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);
}
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);
}
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();
}
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);
}
Aggregations