use of com.yahoo.messagebus.network.rpc.RPCNetwork in project vespa by vespa-engine.
the class MessageBusTestCase method testRoutingPolicyCache.
@Test
public void testRoutingPolicyCache() throws ListenFailedException, UnknownHostException {
Slobrok slobrok = new Slobrok();
String config = "slobrok[1]\nslobrok[0].connectionspec \"" + new Spec("localhost", slobrok.port()).toString() + "\"\n";
SimpleProtocol protocol = new SimpleProtocol();
protocol.addPolicyFactory("Custom", new CustomPolicyFactory());
MessageBus bus = new MessageBus(new RPCNetwork(new RPCNetworkParams().setSlobrokConfigId("raw:" + config)), new MessageBusParams().addProtocol(protocol));
RoutingPolicy all = bus.getRoutingPolicy(SimpleProtocol.NAME, "Custom", null);
assertNotNull(all);
RoutingPolicy ref = bus.getRoutingPolicy(SimpleProtocol.NAME, "Custom", null);
assertNotNull(ref);
assertSame(all, ref);
RoutingPolicy allArg = bus.getRoutingPolicy(SimpleProtocol.NAME, "Custom", "Arg");
assertNotNull(allArg);
assertNotSame(all, allArg);
RoutingPolicy refArg = bus.getRoutingPolicy(SimpleProtocol.NAME, "Custom", "Arg");
assertNotNull(refArg);
assertSame(allArg, refArg);
}
Aggregations