Search in sources :

Example 1 with LocalTestServer

use of org.apache.http.localserver.LocalTestServer in project graphdb by neo4j-attic.

the class PingerTest method setUp.

@Before
public void setUp() throws Exception {
    handler = new PingerHandler();
    server = new LocalTestServer(null, null);
    server.register("/*", handler);
    server.start();
    hostname = server.getServiceHostName();
    serverUrl = "http://" + hostname + ":" + server.getServicePort();
    System.out.println("LocalTestServer available at " + serverUrl);
}
Also used : LocalTestServer(org.apache.http.localserver.LocalTestServer) Before(org.junit.Before)

Example 2 with LocalTestServer

use of org.apache.http.localserver.LocalTestServer in project graphdb by neo4j-attic.

the class UdcExtensionImplTest method shouldRecordSuccessesWhenThereIsAServer.

@Test
public void shouldRecordSuccessesWhenThereIsAServer() throws Exception {
    // first, set up the test server
    LocalTestServer server = new LocalTestServer(null, null);
    PingerHandler handler = new PingerHandler();
    server.register("/*", handler);
    server.start();
    final String hostname = server.getServiceHostName();
    final String serverAddress = hostname + ":" + server.getServicePort();
    Map<String, String> config = new HashMap<String, String>();
    config.put(UdcExtensionImpl.FIRST_DELAY_CONFIG_KEY, "100");
    config.put(UdcExtensionImpl.UDC_HOST_ADDRESS_KEY, serverAddress);
    EmbeddedGraphDatabase graphdb = createTempDatabase(config);
    assertGotSuccessWithRetry(IS_GREATER_THAN_ZERO);
    assertGotFailureWithRetry(IS_ZERO);
    destroy(graphdb);
}
Also used : EmbeddedGraphDatabase(org.neo4j.kernel.EmbeddedGraphDatabase) HashMap(java.util.HashMap) LocalTestServer(org.apache.http.localserver.LocalTestServer) Test(org.junit.Test)

Example 3 with LocalTestServer

use of org.apache.http.localserver.LocalTestServer in project cdap-ingest by caskdata.

the class RestTest method setUp.

@Before
public void setUp() throws Exception {
    localTestServer = new LocalTestServer(null, null);
    localTestServer.register("*/config", configHandler);
    localTestServer.register("*/truncate", truncateHandler);
    localTestServer.register("*/info", infoHandler);
    localTestServer.register("*", streamsHandler);
    localTestServer.start();
    testServerHost = localTestServer.getServiceAddress().getHostName();
    testServerPort = localTestServer.getServiceAddress().getPort();
}
Also used : LocalTestServer(org.apache.http.localserver.LocalTestServer) Before(org.junit.Before)

Example 4 with LocalTestServer

use of org.apache.http.localserver.LocalTestServer in project graphdb by neo4j-attic.

the class UdcExtensionImplTest method shouldBeAbleToSpecifySourceWithConfig.

@Test
public void shouldBeAbleToSpecifySourceWithConfig() throws Exception {
    // first, set up the test server
    LocalTestServer server = new LocalTestServer(null, null);
    PingerHandler handler = new PingerHandler();
    server.register("/*", handler);
    server.start();
    final String hostname = server.getServiceHostName();
    final String serverAddress = hostname + ":" + server.getServicePort();
    Map<String, String> config = new HashMap<String, String>();
    config.put(UdcExtensionImpl.FIRST_DELAY_CONFIG_KEY, "100");
    config.put(UdcExtensionImpl.UDC_HOST_ADDRESS_KEY, serverAddress);
    config.put(UdcExtensionImpl.UDC_SOURCE_KEY, "test");
    EmbeddedGraphDatabase graphdb = createTempDatabase(config);
    assertGotSuccessWithRetry(IS_GREATER_THAN_ZERO);
    assertEquals("test", handler.getQueryMap().get("source"));
    destroy(graphdb);
}
Also used : EmbeddedGraphDatabase(org.neo4j.kernel.EmbeddedGraphDatabase) HashMap(java.util.HashMap) LocalTestServer(org.apache.http.localserver.LocalTestServer) Test(org.junit.Test)

Aggregations

LocalTestServer (org.apache.http.localserver.LocalTestServer)4 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 Test (org.junit.Test)2 EmbeddedGraphDatabase (org.neo4j.kernel.EmbeddedGraphDatabase)2