Search in sources :

Example 1 with DummyInbound

use of net.dempsy.container.mocks.DummyInbound in project Dempsy by Dempsy.

the class TestInstanceManager method setupContainer.

@SuppressWarnings("resource")
public Container setupContainer(final MessageProcessorLifecycle<?> prototype) throws ContainerException {
    dispatcher = new DummyDispatcher();
    statsCollector = new BasicClusterStatsCollector();
    manager = new NonLockingAltContainer().setMessageProcessor(prototype).setClusterId(new ClusterId("test", "test"));
    manager.setDispatcher(dispatcher);
    manager.setInbound(new DummyInbound());
    tm = new DefaultThreadingModel(TestInstanceManager.class.getName());
    tm.start(TestInstanceManager.class.getName());
    manager.start(new TestInfrastructure(tm) {

        BasicNodeStatsCollector nStats = new BasicNodeStatsCollector();

        @Override
        public ClusterStatsCollector getClusterStatsCollector(final ClusterId clusterId) {
            return statsCollector;
        }

        @Override
        public NodeStatsCollector getNodeStatsCollector() {
            return nStats;
        }
    });
    return manager;
}
Also used : DummyInbound(net.dempsy.container.mocks.DummyInbound) BasicNodeStatsCollector(net.dempsy.monitoring.basic.BasicNodeStatsCollector) NodeStatsCollector(net.dempsy.monitoring.NodeStatsCollector) TestInfrastructure(net.dempsy.util.TestInfrastructure) BasicClusterStatsCollector(net.dempsy.monitoring.basic.BasicClusterStatsCollector) ClusterStatsCollector(net.dempsy.monitoring.ClusterStatsCollector) ClusterId(net.dempsy.config.ClusterId) BasicClusterStatsCollector(net.dempsy.monitoring.basic.BasicClusterStatsCollector) DefaultThreadingModel(net.dempsy.threading.DefaultThreadingModel) NonLockingAltContainer(net.dempsy.container.altnonlocking.NonLockingAltContainer) BasicNodeStatsCollector(net.dempsy.monitoring.basic.BasicNodeStatsCollector)

Example 2 with DummyInbound

use of net.dempsy.container.mocks.DummyInbound in project Dempsy by Dempsy.

the class TestContainerLoadHandling method setUp.

@Before
public void setUp() throws Exception {
    final ClusterId cid = new ClusterId("TestContainerLoadHandling", "test" + sequence++);
    dispatcher = new MockDispatcher();
    final BasicClusterStatsCollector sc = new BasicClusterStatsCollector();
    clusterStats = sc;
    nodeStats = new BasicNodeStatsCollector();
    container = tr.track(new Manager<Container>(Container.class).getAssociatedInstance(containerId)).setMessageProcessor(new MessageProcessor<TestMessageProcessor>(new TestMessageProcessor())).setClusterId(cid);
    container.setDispatcher(dispatcher);
    container.setInbound(new DummyInbound());
    container.start(new TestInfrastructure(null, null) {

        @Override
        public ClusterStatsCollector getClusterStatsCollector(final ClusterId clusterId) {
            return sc;
        }

        @Override
        public NodeStatsCollector getNodeStatsCollector() {
            return nodeStats;
        }
    });
    forceOutputException = false;
    stillRunning = true;
}
Also used : BasicNodeStatsCollector(net.dempsy.monitoring.basic.BasicNodeStatsCollector) NodeStatsCollector(net.dempsy.monitoring.NodeStatsCollector) TestInfrastructure(net.dempsy.util.TestInfrastructure) ClusterId(net.dempsy.config.ClusterId) BasicClusterStatsCollector(net.dempsy.monitoring.basic.BasicClusterStatsCollector) DummyInbound(net.dempsy.container.mocks.DummyInbound) NonLockingAltContainer(net.dempsy.container.altnonlocking.NonLockingAltContainer) LockingContainer(net.dempsy.container.locking.LockingContainer) BasicClusterStatsCollector(net.dempsy.monitoring.basic.BasicClusterStatsCollector) ClusterStatsCollector(net.dempsy.monitoring.ClusterStatsCollector) BasicNodeStatsCollector(net.dempsy.monitoring.basic.BasicNodeStatsCollector) Before(org.junit.Before)

Example 3 with DummyInbound

use of net.dempsy.container.mocks.DummyInbound in project Dempsy by Dempsy.

the class TestInstanceManager method setupContainer.

@SuppressWarnings("resource")
public LockingContainer setupContainer(final MessageProcessorLifecycle<?> prototype) throws ContainerException {
    dispatcher = new DummyDispatcher();
    statsCollector = new BasicClusterStatsCollector();
    nodeStats = new BasicNodeStatsCollector();
    container = (LockingContainer) new LockingContainer().setMessageProcessor(prototype).setClusterId(new ClusterId("test", "test"));
    container.setDispatcher(dispatcher);
    container.setInbound(new DummyInbound());
    tm = new DefaultThreadingModel(TestInstanceManager.class.getName());
    tm.start(TestInstanceManager.class.getName());
    container.start(new TestInfrastructure(tm) {

        @Override
        public BasicClusterStatsCollector getClusterStatsCollector(final ClusterId clusterId) {
            return statsCollector;
        }

        @Override
        public NodeStatsCollector getNodeStatsCollector() {
            return nodeStats;
        }
    });
    return container;
}
Also used : DummyInbound(net.dempsy.container.mocks.DummyInbound) BasicNodeStatsCollector(net.dempsy.monitoring.basic.BasicNodeStatsCollector) NodeStatsCollector(net.dempsy.monitoring.NodeStatsCollector) TestInfrastructure(net.dempsy.util.TestInfrastructure) ClusterId(net.dempsy.config.ClusterId) BasicClusterStatsCollector(net.dempsy.monitoring.basic.BasicClusterStatsCollector) DefaultThreadingModel(net.dempsy.threading.DefaultThreadingModel) BasicNodeStatsCollector(net.dempsy.monitoring.basic.BasicNodeStatsCollector)

Aggregations

ClusterId (net.dempsy.config.ClusterId)3 DummyInbound (net.dempsy.container.mocks.DummyInbound)3 NodeStatsCollector (net.dempsy.monitoring.NodeStatsCollector)3 BasicClusterStatsCollector (net.dempsy.monitoring.basic.BasicClusterStatsCollector)3 BasicNodeStatsCollector (net.dempsy.monitoring.basic.BasicNodeStatsCollector)3 TestInfrastructure (net.dempsy.util.TestInfrastructure)3 NonLockingAltContainer (net.dempsy.container.altnonlocking.NonLockingAltContainer)2 ClusterStatsCollector (net.dempsy.monitoring.ClusterStatsCollector)2 DefaultThreadingModel (net.dempsy.threading.DefaultThreadingModel)2 LockingContainer (net.dempsy.container.locking.LockingContainer)1 Before (org.junit.Before)1