コード例 #1
0
  @Test
  public void shouldBeAbleToDetermineUserAgents() throws Exception {
    CollectUserAgentFilter.addUserAgent("test/1.0");
    CollectUserAgentFilter.addUserAgent("foo/bar");
    setupServer();
    GraphDatabaseService graphdb = createDatabase(config);
    assertGotSuccessWithRetry(IS_GREATER_THAN_ZERO);
    String userAgents = handler.getQueryMap().get(USER_AGENTS);
    assertEquals(true, userAgents.contains("test/1.0"));
    assertEquals(true, userAgents.contains("foo/bar"));

    destroy(graphdb);
  }
コード例 #2
0
  @Test
  public void shouldUpdateTheUserAgentsPerPing() throws Exception {
    CollectUserAgentFilter.addUserAgent("test/1.0");
    setupServer();
    config.put(UdcSettings.interval.name(), "1000");
    GraphDatabaseService graphdb = createDatabase(config);
    assertGotSuccessWithRetry(IS_GREATER_THAN_ZERO);
    String userAgents = handler.getQueryMap().get(USER_AGENTS);
    assertEquals(true, userAgents.contains("test/1.0"));

    CollectUserAgentFilter.addUserAgent("foo/bar");

    Thread.sleep(1000);
    assertGotSuccessWithRetry(IS_GREATER_THAN_ZERO);

    userAgents = handler.getQueryMap().get(USER_AGENTS);
    assertEquals(true, userAgents.contains("foo/bar"));

    destroy(graphdb);
  }