use of net.dempsy.router.shardutils.Utils in project Dempsy by Dempsy.
the class TestGroupRoutingStrategy method testInboundSimpleHappyPathRegister.
@Test
public void testInboundSimpleHappyPathRegister() throws Exception {
final int numShardsToExpect = Integer.parseInt(Utils.DEFAULT_TOTAL_SHARDS);
final RoutingInboundManager manager = new RoutingInboundManager();
try (final RoutingStrategy.Inbound ib = manager.getAssociatedInstance(ClusterGroupInbound.class.getPackage().getName() + ":testInboundSimpleHappyPathRegister")) {
final Utils<Object> msutils = new Utils<>(infra, "testInboundSimpleHappyPathRegister", new Object());
assertNotNull(ib);
assertTrue(ClusterGroupInbound.Proxy.class.isAssignableFrom(ib.getClass()));
ib.setContainerDetails(new ClusterId("test", "test"), new ContainerAddress(new DummyNodeAddress("testInboundSimpleHappyPathRegister"), 0), (l, m) -> {
});
ib.start(infra);
assertTrue(waitForShards(session, msutils, numShardsToExpect));
}
}
use of net.dempsy.router.shardutils.Utils in project Dempsy by Dempsy.
the class TestGroupRoutingStrategy method testInboundResillience.
@Test
public void testInboundResillience() throws Exception {
final int numShardsToExpect = Integer.parseInt(Utils.DEFAULT_TOTAL_SHARDS);
final String groupName = "testInboundResillience";
final Manager<RoutingStrategy.Inbound> manager = new RoutingInboundManager();
try (final RoutingStrategy.Inbound ib = manager.getAssociatedInstance(ClusterGroupInbound.class.getPackage().getName() + ":" + groupName)) {
final ClusterId clusterId = super.setTestName("testInboundResillience");
final NodeAddress na = new DummyNodeAddress("theOnlyNode");
final ContainerAddress ca = new ContainerAddress(na, 0);
final GroupDetails gd = new GroupDetails(groupName, na);
final Infrastructure infra = makeInfra(session, sched);
final Utils<GroupDetails> msutils = new Utils<>(infra, groupName, gd);
ib.setContainerDetails(clusterId, ca, (l, m) -> {
});
ib.start(infra);
checkForShardDistribution(session, msutils, numShardsToExpect, 1);
disruptor.accept(session);
checkForShardDistribution(session, msutils, numShardsToExpect, 1);
}
}
use of net.dempsy.router.shardutils.Utils 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));
}
}
Aggregations