use of com.nokia.dempsy.router.RoutingStrategy.Inbound in project Dempsy by Dempsy.
the class TestRouterClusterManagement method init.
@Before
public void init() throws Throwable {
onodes = System.setProperty("min_nodes_for_cluster", "1");
oslots = System.setProperty("total_slots_for_cluster", "20");
final ClusterId clusterId = new ClusterId("test", "test-slot");
Destination destination = new Destination() {
};
ApplicationDefinition app = new ApplicationDefinition(clusterId.getApplicationName());
DecentralizedRoutingStrategy strategy = new DecentralizedRoutingStrategy(1, 1);
app.setRoutingStrategy(strategy);
app.setSerializer(new JavaSerializer<Object>());
ClusterDefinition cd = new ClusterDefinition(clusterId.getMpClusterName());
cd.setMessageProcessorPrototype(new GoodTestMp());
app.add(cd);
app.initialize();
LocalClusterSessionFactory mpfactory = new LocalClusterSessionFactory();
ClusterInfoSession session = mpfactory.createSession();
TestUtils.createClusterLevel(clusterId, session);
// fake the inbound side setup
inbound = strategy.createInbound(session, clusterId, new Dempsy() {
public List<Class<?>> gm(ClusterDefinition clusterDef) {
return super.getAcceptedMessages(clusterDef);
}
}.gm(cd), destination, new RoutingStrategy.Inbound.KeyspaceResponsibilityChangeListener() {
@Override
public void keyspaceResponsibilityChanged(Inbound inbound, boolean less, boolean more) {
}
});
routerFactory = new Router(app);
routerFactory.setClusterSession(session);
routerFactory.setCurrentCluster(clusterId);
routerFactory.initialize();
}
Aggregations