Search in sources :

Example 1 with NIOLooper

use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.

the class ConnectTest method before.

@Before
public void before() throws Exception {
    UnitTestHelper.addSystemConfigToSingleton();
    nioLooper = new NIOLooper();
    slaveLooper = new SlaveLooper();
    inStreamQueue = new Communicator<HeronTuples.HeronTupleSet>(nioLooper, slaveLooper);
    inStreamQueue.init(Constants.QUEUE_BUFFER_SIZE, Constants.QUEUE_BUFFER_SIZE, 0.5);
    outStreamQueue = new Communicator<HeronTuples.HeronTupleSet>(slaveLooper, nioLooper);
    outStreamQueue.init(Constants.QUEUE_BUFFER_SIZE, Constants.QUEUE_BUFFER_SIZE, 0.5);
    inControlQueue = new Communicator<InstanceControlMsg>(nioLooper, slaveLooper);
    gatewayMetrics = new GatewayMetrics();
    threadsPool = Executors.newSingleThreadExecutor();
    // Get an available port
    serverPort = SysUtils.getFreePort();
}
Also used : InstanceControlMsg(com.twitter.heron.instance.InstanceControlMsg) SlaveLooper(com.twitter.heron.common.basics.SlaveLooper) NIOLooper(com.twitter.heron.common.basics.NIOLooper) GatewayMetrics(com.twitter.heron.metrics.GatewayMetrics) Before(org.junit.Before)

Example 2 with NIOLooper

use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.

the class HandleReadTest method before.

@Before
public void before() throws Exception {
    UnitTestHelper.addSystemConfigToSingleton();
    nioLooper = new NIOLooper();
    slaveLooper = new SlaveLooper();
    inStreamQueue = new Communicator<HeronTuples.HeronTupleSet>(nioLooper, slaveLooper);
    inStreamQueue.init(Constants.QUEUE_BUFFER_SIZE, Constants.QUEUE_BUFFER_SIZE, 0.5);
    outStreamQueue = new Communicator<HeronTuples.HeronTupleSet>(slaveLooper, nioLooper);
    outStreamQueue.init(Constants.QUEUE_BUFFER_SIZE, Constants.QUEUE_BUFFER_SIZE, 0.5);
    inControlQueue = new Communicator<InstanceControlMsg>(nioLooper, slaveLooper);
    gatewayMetrics = new GatewayMetrics();
    threadsPool = Executors.newSingleThreadExecutor();
    // Get an available port
    serverPort = SysUtils.getFreePort();
}
Also used : InstanceControlMsg(com.twitter.heron.instance.InstanceControlMsg) SlaveLooper(com.twitter.heron.common.basics.SlaveLooper) NIOLooper(com.twitter.heron.common.basics.NIOLooper) GatewayMetrics(com.twitter.heron.metrics.GatewayMetrics) Before(org.junit.Before)

Example 3 with NIOLooper

use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.

the class HeronServerTest method before.

@Before
public void before() throws Exception {
    // Get an available port
    serverPort = SysUtils.getFreePort();
    serverLooper = new NIOLooper();
    heronServer = new SimpleHeronServer(serverLooper, SERVER_HOST, serverPort);
    clientLooper = new NIOLooper();
    heronClient = new SimpleHeronClient(clientLooper, SERVER_HOST, serverPort);
    threadsPool = Executors.newFixedThreadPool(2);
}
Also used : NIOLooper(com.twitter.heron.common.basics.NIOLooper) Before(org.junit.Before)

Example 4 with NIOLooper

use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.

the class HandleTMasterLocationTest method before.

@Before
public void before() throws Exception {
    // Get an available port
    serverPort = SysUtils.getFreePort();
    threadsPool = Executors.newFixedThreadPool(2);
    HeronSocketOptions serverSocketOptions = new HeronSocketOptions(100 * 1024 * 1024, 100, 100 * 1024 * 1024, 100, 5 * 1024 * 1024, 5 * 1024 * 1024);
    serverLooper = new NIOLooper();
    // Spy it for unit test
    metricsManagerServer = Mockito.spy(new MetricsManagerServer(serverLooper, SERVER_HOST, serverPort, serverSocketOptions, new MultiCountMetric()));
}
Also used : NIOLooper(com.twitter.heron.common.basics.NIOLooper) HeronSocketOptions(com.twitter.heron.common.network.HeronSocketOptions) MultiCountMetric(com.twitter.heron.api.metric.MultiCountMetric) Before(org.junit.Before)

Example 5 with NIOLooper

use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.

the class HandleTMasterLocationTest method runClient.

private void runClient() {
    Runnable runClient = new Runnable() {

        private NIOLooper looper;

        @Override
        public void run() {
            try {
                looper = new NIOLooper();
                simpleLocationPublisher = new SimpleTMasterLocationPublisher(looper, SERVER_HOST, serverPort);
                simpleLocationPublisher.start();
                looper.loop();
            } catch (IOException e) {
                throw new RuntimeException("Some error instantiating client");
            } finally {
                simpleLocationPublisher.stop();
                if (looper != null) {
                    looper.exitLoop();
                }
            }
        }
    };
    threadsPool.execute(runClient);
}
Also used : NIOLooper(com.twitter.heron.common.basics.NIOLooper) IOException(java.io.IOException)

Aggregations

NIOLooper (com.twitter.heron.common.basics.NIOLooper)11 Before (org.junit.Before)6 IOException (java.io.IOException)4 SlaveLooper (com.twitter.heron.common.basics.SlaveLooper)3 InstanceControlMsg (com.twitter.heron.instance.InstanceControlMsg)3 GatewayMetrics (com.twitter.heron.metrics.GatewayMetrics)3 MultiCountMetric (com.twitter.heron.api.metric.MultiCountMetric)2 HeronSocketOptions (com.twitter.heron.common.network.HeronSocketOptions)2 SystemConfig (com.twitter.heron.common.config.SystemConfig)1 MetricsSinksConfig (com.twitter.heron.metricsmgr.MetricsSinksConfig)1 TopologyMaster (com.twitter.heron.proto.tmaster.TopologyMaster)1 Test (org.junit.Test)1