Java Code Examples for nl.basjes.parse.useragent.UserAgentAnalyzer#dropTests()

The following examples show how to use nl.basjes.parse.useragent.UserAgentAnalyzer#dropTests() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestBuilder.java    From yauaa with Apache License 2.0 6 votes vote down vote up
@Test
public void testPreheatNoTests() {
    UserAgentAnalyzer userAgentAnalyzer =
        UserAgentAnalyzer
            .newBuilder()
            .keepTests()
            .hideMatcherLoadStats()
            .withField("AgentName")
            .build();

    assertTrue(userAgentAnalyzer.getNumberOfTestCases() > 100);
    assertEquals(0, userAgentAnalyzer.preHeat(0));
    assertEquals(0, userAgentAnalyzer.preHeat(-1));
    assertEquals(0, userAgentAnalyzer.preHeat(1000000000L));

    userAgentAnalyzer.dropTests();
    assertEquals(0, userAgentAnalyzer.getNumberOfTestCases());
    assertEquals(0, userAgentAnalyzer.preHeat());
}
 
Example 2
Source File: TestMemoryFootprint.java    From yauaa with Apache License 2.0 5 votes vote down vote up
@Disabled
@Test
public void profileMemoryFootprint() { //NOSONAR: Do not complain about ignored performance test
    printCurrentMemoryProfile("Before ");

    UserAgentAnalyzer uaa = UserAgentAnalyzer
        .newBuilder()
        .hideMatcherLoadStats()
        .withoutCache()
        .keepTests()
        .build();
    printCurrentMemoryProfile("Loaded ");

    uaa.initializeMatchers();
    printCurrentMemoryProfile("Init   ");

    Runtime.getRuntime().gc();
    printCurrentMemoryProfile("Post GC");

    uaa.setCacheSize(1000);
    uaa.preHeat();
    Runtime.getRuntime().gc();
    printCurrentMemoryProfile("Cache 1K");

    uaa.setCacheSize(10000);
    uaa.preHeat();
    Runtime.getRuntime().gc();
    printCurrentMemoryProfile("Cache 10K");

    uaa.dropTests();
    Runtime.getRuntime().gc();
    printCurrentMemoryProfile("NoTest ");

}