Search in sources :

Example 1 with TcpReceiver

use of com.nokia.dempsy.messagetransport.tcp.TcpReceiver in project Dempsy by Dempsy.

the class TestDempsy method testTcpTransportExecutorConfigurationThroughApplication.

@Test
public void testTcpTransportExecutorConfigurationThroughApplication() throws Throwable {
    ClassPathXmlApplicationContext actx = null;
    DefaultDempsyExecutor executor = null;
    try {
        actx = new ClassPathXmlApplicationContext("testDempsy/Dempsy-IndividualClusterStart.xml", "testDempsy/Transport-TcpNoBatchingActx.xml", "testDempsy/ClusterInfo-LocalActx.xml", "testDempsy/Serializer-KryoActx.xml", "testDempsy/SimpleMultistageApplicationWithExecutorActx.xml");
        actx.registerShutdownHook();
        Dempsy dempsy = (Dempsy) actx.getBean("dempsy");
        for (Dempsy.Application.Cluster cluster : dempsy.applications.get(0).appClusters) {
            // get the receiver from the node
            TcpReceiver r = (TcpReceiver) cluster.getNodes().get(0).receiver;
            executor = (DefaultDempsyExecutor) TcpReceiverAccess.getExecutor(r);
            assertEquals(123456, executor.getMaxNumberOfQueuedLimitedTasks());
            assertTrue(executor.isRunning());
        }
    } finally {
        try {
            actx.stop();
        } catch (Throwable th) {
        }
        try {
            actx.destroy();
        } catch (Throwable th) {
        }
    }
    assertNotNull(executor);
    assertTrue(!executor.isRunning());
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) TcpReceiver(com.nokia.dempsy.messagetransport.tcp.TcpReceiver) DefaultDempsyExecutor(com.nokia.dempsy.executor.DefaultDempsyExecutor) Test(org.junit.Test)

Aggregations

DefaultDempsyExecutor (com.nokia.dempsy.executor.DefaultDempsyExecutor)1 TcpReceiver (com.nokia.dempsy.messagetransport.tcp.TcpReceiver)1 Test (org.junit.Test)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1