Search in sources :

Example 81 with WebAppStat

use of com.alibaba.druid.support.http.stat.WebAppStat in project druid by alibaba.

the class UserAgentTest method test_1.

public void test_1() throws Exception {
    WebAppStat stat = new WebAppStat("");
    stat.computeUserAgent("Ubuntu APT-HTTP/1.3 (0.7.23.1ubuntu2)");
    Assert.assertEquals(0, stat.getBrowserIECount());
    Assert.assertEquals(0, stat.getBrowserChromeCount());
    Assert.assertEquals(0, stat.getBrowserFirefoxCount());
    Assert.assertEquals(0, stat.getBrowserIE10Count());
    Assert.assertEquals(0, stat.getBrowserIE6Count());
    Assert.assertEquals(0, stat.getBrowserIE7Count());
    Assert.assertEquals(0, stat.getBrowserIE8Count());
    Assert.assertEquals(0, stat.getBrowserIE9Count());
    Assert.assertEquals(0, stat.getBrowserOperaCount());
    Assert.assertEquals(0, stat.getBrowserSafariCount());
    Assert.assertEquals(0, stat.getDeviceAndroidCount());
    Assert.assertEquals(0, stat.getDeviceIpadCount());
    Assert.assertEquals(0, stat.getDeviceIphoneCount());
    Assert.assertEquals(0, stat.getDeviceWindowsPhoneCount());
    Assert.assertEquals(1, stat.getOSLinuxCount());
    Assert.assertEquals(0, stat.getOSMacOSXCount());
    Assert.assertEquals(0, stat.getOSWindowsCount());
    Assert.assertEquals(0, stat.getOSSymbianCount());
    Assert.assertEquals(0, stat.getOSFreeBSDCount());
    Assert.assertEquals(0, stat.getOSOpenBSDCount());
}
Also used : WebAppStat(com.alibaba.druid.support.http.stat.WebAppStat)

Example 82 with WebAppStat

use of com.alibaba.druid.support.http.stat.WebAppStat in project druid by alibaba.

the class UserAgentTest method test_agent_other_1.

public void test_agent_other_1() throws Exception {
    WebAppStat stat = new WebAppStat("");
    stat.computeUserAgent("Mitsu/1.2.B (MT560) MMP/1.1");
    Assert.assertEquals(0, stat.getBrowserIECount());
}
Also used : WebAppStat(com.alibaba.druid.support.http.stat.WebAppStat)

Example 83 with WebAppStat

use of com.alibaba.druid.support.http.stat.WebAppStat in project druid by alibaba.

the class UserAgentTest method test_android_15.

public void test_android_15() throws Exception {
    WebAppStat stat = new WebAppStat("");
    stat.computeUserAgent("Mozilla/5.0 (Linux; U; Android 1.5; zh-cn; ME600 Build/CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1");
    Assert.assertEquals(0, stat.getBrowserIECount());
    Assert.assertEquals(0, stat.getBrowserChromeCount());
    Assert.assertEquals(0, stat.getBrowserFirefoxCount());
    Assert.assertEquals(0, stat.getBrowserIE10Count());
    Assert.assertEquals(0, stat.getBrowserIE6Count());
    Assert.assertEquals(0, stat.getBrowserIE7Count());
    Assert.assertEquals(0, stat.getBrowserIE8Count());
    Assert.assertEquals(0, stat.getBrowserIE9Count());
    Assert.assertEquals(0, stat.getBrowserOperaCount());
    Assert.assertEquals(0, stat.getBrowserSafariCount());
    Assert.assertEquals(1, stat.getDeviceAndroidCount());
    Assert.assertEquals(0, stat.getDeviceIpadCount());
    Assert.assertEquals(0, stat.getDeviceIphoneCount());
    Assert.assertEquals(0, stat.getDeviceWindowsPhoneCount());
    Assert.assertEquals(1, stat.getOSLinuxCount());
    Assert.assertEquals(0, stat.getOSLinuxUbuntuCount());
    Assert.assertEquals(0, stat.getOSMacOSXCount());
    Assert.assertEquals(0, stat.getOSWindowsCount());
    Assert.assertEquals(0, stat.getOSSymbianCount());
    Assert.assertEquals(0, stat.getOSFreeBSDCount());
    Assert.assertEquals(0, stat.getOSOpenBSDCount());
    Assert.assertEquals(1, stat.getOSAndroidCount());
    Assert.assertEquals(1, stat.getOSAndroid15Count());
}
Also used : WebAppStat(com.alibaba.druid.support.http.stat.WebAppStat)

Example 84 with WebAppStat

use of com.alibaba.druid.support.http.stat.WebAppStat in project druid by alibaba.

the class UserAgentBotStat method test_unkownBot7.

public void test_unkownBot7() throws Exception {
    WebAppStat stat = new WebAppStat("");
    stat.computeUserAgent("Crawl/0.01 libcrawl/0.3");
    Assert.assertEquals(1, stat.getBotCount());
}
Also used : WebAppStat(com.alibaba.druid.support.http.stat.WebAppStat)

Example 85 with WebAppStat

use of com.alibaba.druid.support.http.stat.WebAppStat in project druid by alibaba.

the class UserAgentBotStat method test_KaloogaBot.

public void test_KaloogaBot() throws Exception {
    WebAppStat stat = new WebAppStat("");
    stat.computeUserAgent("Mozilla/5.0 (compatible; KaloogaBot; http://kalooga.com/crawler)");
    Assert.assertEquals(1, stat.getBotCount());
}
Also used : WebAppStat(com.alibaba.druid.support.http.stat.WebAppStat)

Aggregations

WebAppStat (com.alibaba.druid.support.http.stat.WebAppStat)113 WebStatFilter (com.alibaba.druid.support.http.WebStatFilter)3 MockFilterChain (org.springframework.mock.web.MockFilterChain)3 MockFilterConfig (org.springframework.mock.web.MockFilterConfig)3 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)3 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)3 MockServletContext (org.springframework.mock.web.MockServletContext)3 WebAppStatValue (com.alibaba.druid.support.http.stat.WebAppStatValue)1 WebRequestStat (com.alibaba.druid.support.http.stat.WebRequestStat)1 WebSessionStat (com.alibaba.druid.support.http.stat.WebSessionStat)1 WebURIStat (com.alibaba.druid.support.http.stat.WebURIStat)1 WebURIStatValue (com.alibaba.druid.support.http.stat.WebURIStatValue)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 MockHttpSession (org.springframework.mock.web.MockHttpSession)1