Search in sources :

Example 1 with HeronServerTester

use of org.apache.heron.common.testhelpers.HeronServerTester in project heron by twitter.

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(org.apache.heron.common.basics.NIOLooper) CountDownLatch(java.util.concurrent.CountDownLatch) HeronServerTester(org.apache.heron.common.testhelpers.HeronServerTester) Before(org.junit.Before)

Example 2 with HeronServerTester

use of org.apache.heron.common.testhelpers.HeronServerTester in project heron by twitter.

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(org.apache.heron.common.basics.NIOLooper) CountDownLatch(java.util.concurrent.CountDownLatch) HeronServerTester(org.apache.heron.common.testhelpers.HeronServerTester) Before(org.junit.Before)

Example 3 with HeronServerTester

use of org.apache.heron.common.testhelpers.HeronServerTester in project heron by twitter.

the class HandleTManagerLocationTest 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("tmanager-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(org.apache.heron.proto.system.Metrics) NIOLooper(org.apache.heron.common.basics.NIOLooper) HeronServerTester(org.apache.heron.common.testhelpers.HeronServerTester) Before(org.junit.Before)

Example 4 with HeronServerTester

use of org.apache.heron.common.testhelpers.HeronServerTester in project heron by twitter.

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(org.apache.heron.proto.system.Metrics) NIOLooper(org.apache.heron.common.basics.NIOLooper) MultiCountMetric(org.apache.heron.api.metric.MultiCountMetric) HeronServerTester(org.apache.heron.common.testhelpers.HeronServerTester) Before(org.junit.Before)

Example 5 with HeronServerTester

use of org.apache.heron.common.testhelpers.HeronServerTester in project heron by twitter.

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(org.apache.heron.common.testhelpers.HeronServerTester)

Aggregations

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