diff --git a/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8ChromeTest.java b/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8ChromeTest.java new file mode 100644 index 0000000000..262b261d21 --- /dev/null +++ b/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8ChromeTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 1999-2011 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.bvt.support.http; + +import org.junit.Assert; +import junit.framework.TestCase; + +import com.alibaba.druid.support.http.stat.WebAppStat; + + +public class UserAgentWin8ChromeTest extends TestCase { + + public void test_mac_firefox() throws Exception { + WebAppStat stat = new WebAppStat(""); + stat.computeUserAgent("Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"); + Assert.assertEquals(1, stat.getBrowserChromeCount()); + Assert.assertEquals(0, stat.getBrowserFirefoxCount()); + Assert.assertEquals(0, stat.getBrowserOperaCount()); + Assert.assertEquals(0, stat.getBrowserSafariCount()); + Assert.assertEquals(0, stat.getBrowserIECount()); + Assert.assertEquals(0, stat.getBrowserIE10Count()); + + Assert.assertEquals(0, stat.getDeviceAndroidCount()); + Assert.assertEquals(0, stat.getDeviceIpadCount()); + Assert.assertEquals(0, stat.getDeviceIphoneCount()); + Assert.assertEquals(0, stat.getDeviceWindowsPhoneCount()); + + Assert.assertEquals(0, stat.getOSLinuxCount()); + Assert.assertEquals(0, stat.getOSLinuxUbuntuCount()); + Assert.assertEquals(0, stat.getOSMacOSXCount()); + Assert.assertEquals(1, stat.getOSWindowsCount()); + Assert.assertEquals(1, stat.getOSWindows8Count()); + Assert.assertEquals(0, stat.getOSSymbianCount()); + Assert.assertEquals(0, stat.getOSFreeBSDCount()); + Assert.assertEquals(0, stat.getOSOpenBSDCount()); + } +} diff --git a/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8IETest.java b/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8IETest.java new file mode 100644 index 0000000000..d6c606d24e --- /dev/null +++ b/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8IETest.java @@ -0,0 +1,50 @@ +/* + * Copyright 1999-2011 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.bvt.support.http; + +import org.junit.Assert; +import junit.framework.TestCase; + +import com.alibaba.druid.support.http.stat.WebAppStat; + + +public class UserAgentWin8IETest extends TestCase { + + public void test_mac_firefox() throws Exception { + WebAppStat stat = new WebAppStat(""); + stat.computeUserAgent("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"); + Assert.assertEquals(0, stat.getBrowserChromeCount()); + Assert.assertEquals(0, stat.getBrowserFirefoxCount()); + Assert.assertEquals(0, stat.getBrowserOperaCount()); + Assert.assertEquals(0, stat.getBrowserSafariCount()); + Assert.assertEquals(1, stat.getBrowserIECount()); + Assert.assertEquals(1, stat.getBrowserIE10Count()); + + Assert.assertEquals(0, stat.getDeviceAndroidCount()); + Assert.assertEquals(0, stat.getDeviceIpadCount()); + Assert.assertEquals(0, stat.getDeviceIphoneCount()); + Assert.assertEquals(0, stat.getDeviceWindowsPhoneCount()); + + Assert.assertEquals(0, stat.getOSLinuxCount()); + Assert.assertEquals(0, stat.getOSLinuxUbuntuCount()); + Assert.assertEquals(0, stat.getOSMacOSXCount()); + Assert.assertEquals(1, stat.getOSWindowsCount()); + Assert.assertEquals(1, stat.getOSWindows8Count()); + Assert.assertEquals(0, stat.getOSSymbianCount()); + Assert.assertEquals(0, stat.getOSFreeBSDCount()); + Assert.assertEquals(0, stat.getOSOpenBSDCount()); + } +} diff --git a/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8IETest_2.java b/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8IETest_2.java new file mode 100644 index 0000000000..a3371e458d --- /dev/null +++ b/src/test/java/com/alibaba/druid/bvt/support/http/UserAgentWin8IETest_2.java @@ -0,0 +1,50 @@ +/* + * Copyright 1999-2011 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.bvt.support.http; + +import org.junit.Assert; +import junit.framework.TestCase; + +import com.alibaba.druid.support.http.stat.WebAppStat; + + +public class UserAgentWin8IETest_2 extends TestCase { + + public void test_mac_firefox() throws Exception { + WebAppStat stat = new WebAppStat(""); + stat.computeUserAgent("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)"); + Assert.assertEquals(0, stat.getBrowserChromeCount()); + Assert.assertEquals(0, stat.getBrowserFirefoxCount()); + Assert.assertEquals(0, stat.getBrowserOperaCount()); + Assert.assertEquals(0, stat.getBrowserSafariCount()); + Assert.assertEquals(1, stat.getBrowserIECount()); + Assert.assertEquals(1, stat.getBrowserIE10Count()); + + Assert.assertEquals(0, stat.getDeviceAndroidCount()); + Assert.assertEquals(0, stat.getDeviceIpadCount()); + Assert.assertEquals(0, stat.getDeviceIphoneCount()); + Assert.assertEquals(0, stat.getDeviceWindowsPhoneCount()); + + Assert.assertEquals(0, stat.getOSLinuxCount()); + Assert.assertEquals(0, stat.getOSLinuxUbuntuCount()); + Assert.assertEquals(0, stat.getOSMacOSXCount()); + Assert.assertEquals(1, stat.getOSWindowsCount()); + Assert.assertEquals(1, stat.getOSWindows8Count()); + Assert.assertEquals(0, stat.getOSSymbianCount()); + Assert.assertEquals(0, stat.getOSFreeBSDCount()); + Assert.assertEquals(0, stat.getOSOpenBSDCount()); + } +}