Search in sources :

Example 1 with HeronServerTester

use of com.twitter.heron.common.testhelpers.HeronServerTester in project incubator-heron by apache.

the class CheckpointManagerServerTest method runTest.

private void runTest(TestRequestHandler.RequestType requestType, HeronServerTester.TestResponseHandler responseHandler) throws IOException, InterruptedException {
    serverTester = new HeronServerTester(checkpointManagerServer, new TestRequestHandler(requestType), responseHandler, RESPONSE_RECEIVED_TIMEOUT);
    serverTester.start();
}
Also used : HeronServerTester(com.twitter.heron.common.testhelpers.HeronServerTester)

Example 2 with HeronServerTester

use of com.twitter.heron.common.testhelpers.HeronServerTester in project incubator-heron by apache.

the class HeronServerTest method before.

@Before
public void before() throws IOException {
    // Get an available port
    int serverPort = SysUtils.getFreePort();
    serverOnConnectSignal = new CountDownLatch(1);
    serverOnMessageSignal = new CountDownLatch(TOTAL_MESSAGES);
    serverOnRequestSignal = new CountDownLatch(1);
    clientOnConnectSignal = new CountDownLatch(1);
    clientOnResponseSignal = new CountDownLatch(1);
    heronServer = new SimpleHeronServer(new NIOLooper(), HeronServerTester.SERVER_HOST, serverPort, serverOnConnectSignal, serverOnMessageSignal, serverOnRequestSignal);
    heronClient = new SimpleHeronClient(new NIOLooper(), HeronServerTester.SERVER_HOST, serverPort, clientOnConnectSignal, clientOnResponseSignal);
    heronServerTester = new HeronServerTester(heronServer, heronClient);
}
Also used : NIOLooper(com.twitter.heron.common.basics.NIOLooper) CountDownLatch(java.util.concurrent.CountDownLatch) HeronServerTester(com.twitter.heron.common.testhelpers.HeronServerTester) Before(org.junit.Before)

Example 3 with HeronServerTester

use of com.twitter.heron.common.testhelpers.HeronServerTester in project incubator-heron by apache.

the class EchoTest method before.

@Before
public void before() throws IOException {
    int serverPort = SysUtils.getFreePort();
    serverRequestsReceivedLatch = new CountDownLatch(MAX_REQUESTS);
    server = new EchoServer(new NIOLooper(), serverPort, MAX_REQUESTS, serverRequestsReceivedLatch);
    client = new EchoClient(new NIOLooper(), serverPort, MAX_REQUESTS);
    heronServerTester = new HeronServerTester(server, client);
    heronServerTester.start();
}
Also used : NIOLooper(com.twitter.heron.common.basics.NIOLooper) CountDownLatch(java.util.concurrent.CountDownLatch) HeronServerTester(com.twitter.heron.common.testhelpers.HeronServerTester) Before(org.junit.Before)

Example 4 with HeronServerTester

use of com.twitter.heron.common.testhelpers.HeronServerTester in project incubator-heron by apache.

the class HandleTMasterLocationTest method before.

@Before
public void before() throws IOException {
    // MetricsManagerServer increments this counter every time a location refresh message is
    // received, so we can await this counter getting to 4 before proceeding with the test
    serverMetrics = new LatchedMultiCountMetric("tmaster-location-received", 4L);
    // Spy it for unit test
    metricsManagerServer = spy(new MetricsManagerServer(new NIOLooper(), HeronServerTester.SERVER_HOST, SysUtils.getFreePort(), HeronServerTester.TEST_SOCKET_OPTIONS, serverMetrics));
    heronServerTester = new HeronServerTester(metricsManagerServer, new TestRequestHandler(), new HeronServerTester.SuccessResponseHandler(Metrics.MetricPublisherRegisterResponse.class, new TestResponseHandler()), RESPONSE_RECEIVED_TIMEOUT);
    heronServerTester.start();
}
Also used : Metrics(com.twitter.heron.proto.system.Metrics) NIOLooper(com.twitter.heron.common.basics.NIOLooper) HeronServerTester(com.twitter.heron.common.testhelpers.HeronServerTester) Before(org.junit.Before)

Example 5 with HeronServerTester

use of com.twitter.heron.common.testhelpers.HeronServerTester in project incubator-heron by apache.

the class MetricsManagerServerTest method before.

@Before
public void before() throws IOException {
    metricsManagerServer = new MetricsManagerServer(new NIOLooper(), HeronServerTester.SERVER_HOST, SysUtils.getFreePort(), HeronServerTester.TEST_SOCKET_OPTIONS, new MultiCountMetric());
    serverTester = new HeronServerTester(metricsManagerServer, new MetricsManagerClientRequestHandler(), new HeronServerTester.SuccessResponseHandler(Metrics.MetricPublisherRegisterResponse.class, new MetricsManagerClientResponseHandler(MESSAGE_SIZE)), RESPONSE_RECEIVED_TIMEOUT);
}
Also used : Metrics(com.twitter.heron.proto.system.Metrics) NIOLooper(com.twitter.heron.common.basics.NIOLooper) MultiCountMetric(com.twitter.heron.api.metric.MultiCountMetric) HeronServerTester(com.twitter.heron.common.testhelpers.HeronServerTester) Before(org.junit.Before)

Aggregations

HeronServerTester (com.twitter.heron.common.testhelpers.HeronServerTester)5 NIOLooper (com.twitter.heron.common.basics.NIOLooper)4 Before (org.junit.Before)4 Metrics (com.twitter.heron.proto.system.Metrics)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 MultiCountMetric (com.twitter.heron.api.metric.MultiCountMetric)1