Search in sources :

Example 21 with ContainerAddress

use of net.dempsy.router.RoutingStrategy.ContainerAddress in project Dempsy by Dempsy.

the class TestManagedRoutingStrategy method testInboundSimpleHappyPathRegister.

@Test
public void testInboundSimpleHappyPathRegister() throws Exception {
    final int numShardsToExpect = Integer.parseInt(Utils.DEFAULT_TOTAL_SHARDS);
    final Manager<RoutingStrategy.Inbound> manager = new Manager<>(RoutingStrategy.Inbound.class);
    try (final RoutingStrategy.Inbound ib = manager.getAssociatedInstance(ManagedInbound.class.getPackage().getName())) {
        final ClusterId clusterId = new ClusterId("test", "test");
        final Utils<ContainerAddress> msutils = new Utils<>(infra, clusterId.clusterName, new ContainerAddress(new DummyNodeAddress("testInboundSimpleHappyPathRegister"), 0));
        assertNotNull(ib);
        assertTrue(ManagedInbound.class.isAssignableFrom(ib.getClass()));
        ib.setContainerDetails(clusterId, new ContainerAddress(new DummyNodeAddress("testInboundSimpleHappyPathRegister"), 0), (l, m) -> {
        });
        ib.start(infra);
        assertTrue(waitForShards(session, msutils, numShardsToExpect));
    }
}
Also used : ClusterId(net.dempsy.config.ClusterId) Utils(net.dempsy.router.shardutils.Utils) RoutingStrategy(net.dempsy.router.RoutingStrategy) RoutingStrategyManager(net.dempsy.router.RoutingStrategyManager) Manager(net.dempsy.Manager) ContainerAddress(net.dempsy.router.RoutingStrategy.ContainerAddress) Test(org.junit.Test)

Aggregations

ContainerAddress (net.dempsy.router.RoutingStrategy.ContainerAddress)21 ClusterId (net.dempsy.config.ClusterId)16 RoutingStrategy (net.dempsy.router.RoutingStrategy)15 Test (org.junit.Test)15 NodeAddress (net.dempsy.transport.NodeAddress)13 ClusterInfoSession (net.dempsy.cluster.ClusterInfoSession)10 RoutingStrategyManager (net.dempsy.router.RoutingStrategyManager)8 Utils (net.dempsy.router.shardutils.Utils)8 List (java.util.List)7 Manager (net.dempsy.Manager)7 ClusterInfoSessionFactory (net.dempsy.cluster.ClusterInfoSessionFactory)7 TestInfrastructure (net.dempsy.util.TestInfrastructure)7 ConditionPoll.poll (net.dempsy.utils.test.ConditionPoll.poll)7 Assert.assertEquals (org.junit.Assert.assertEquals)7 Assert.assertTrue (org.junit.Assert.assertTrue)7 Logger (org.slf4j.Logger)7 LoggerFactory (org.slf4j.LoggerFactory)7 HashMap (java.util.HashMap)6 Map (java.util.Map)6 Consumer (java.util.function.Consumer)6