use of com.yahoo.messagebus.routing.RoutingTable in project vespa by vespa-engine.
the class MessageBusVisitorSession method createForMessageBus.
public static MessageBusVisitorSession createForMessageBus(final MessageBus mbus, final ScheduledExecutorService scheduledExecutorService, final VisitorParameters params) throws ParseException {
final AsyncTaskExecutor executor = new ThreadAsyncTaskExecutor(scheduledExecutorService);
final MessageBusSenderFactory senderFactory = new MessageBusSenderFactory(mbus);
final MessageBusReceiverFactory receiverFactory = new MessageBusReceiverFactory(mbus);
final RoutingTable table = mbus.getRoutingTable(DocumentProtocol.NAME);
return new MessageBusVisitorSession(params, executor, senderFactory, receiverFactory, table);
}
use of com.yahoo.messagebus.routing.RoutingTable in project vespa by vespa-engine.
the class MessageBusVisitorSessionTestCase method testRoutingTableHasNoStorageClusters.
@Test
public void testRoutingTableHasNoStorageClusters() {
VisitorParameters visitorParameters = createVisitorParameters("");
visitorParameters.setRoute(new Route());
RoutingTableSpec spec = new RoutingTableSpec(DocumentProtocol.NAME);
spec.addRoute(new RouteSpec("storage/lobster.foo"));
RoutingTable table = new RoutingTable(spec);
try {
createDefaultMock(visitorParameters, table);
fail("No exception thrown on zero storage clusters");
} catch (IllegalArgumentException e) {
assertEquals("No storage cluster found in your application.", e.getMessage());
}
}
use of com.yahoo.messagebus.routing.RoutingTable in project vespa by vespa-engine.
the class MessageBusVisitorSessionTestCase method createDummyRoutingTable.
RoutingTable createDummyRoutingTable() {
RoutingTableSpec spec = new RoutingTableSpec(DocumentProtocol.NAME);
spec.addRoute(new RouteSpec("storage/badger.bar"));
RouteSpec storageCluster = new RouteSpec("storage/cluster.foo");
storageCluster.addHop("bunnies");
spec.addRoute(storageCluster);
spec.addRoute(new RouteSpec("storage/otters.baz"));
return new RoutingTable(spec);
}
use of com.yahoo.messagebus.routing.RoutingTable in project vespa by vespa-engine.
the class MessageBusVisitorSessionTestCase method testDefaultClusterRouteResolutionNoHops.
/**
* Test that we try to get a route to the storage cluster automatically if
* the provided route has no hops.
*/
@Test
public void testDefaultClusterRouteResolutionNoHops() {
VisitorParameters visitorParameters = createVisitorParameters("");
visitorParameters.setRoute(new Route());
RoutingTable table = createDummyRoutingTable();
createDefaultMock(visitorParameters, table);
assertEquals("storage/cluster.foo", visitorParameters.getRoute().toString());
}
use of com.yahoo.messagebus.routing.RoutingTable in project vespa by vespa-engine.
the class MessageBusVisitorSessionTestCase method testRoutingTableHasMultipleStorageClusters.
@Test
public void testRoutingTableHasMultipleStorageClusters() {
VisitorParameters visitorParameters = createVisitorParameters("");
visitorParameters.setRoute(new Route());
RoutingTableSpec spec = new RoutingTableSpec(DocumentProtocol.NAME);
spec.addRoute(new RouteSpec("storage/cluster.foo"));
spec.addRoute(new RouteSpec("storage/cluster.bar"));
RoutingTable table = new RoutingTable(spec);
try {
createDefaultMock(visitorParameters, table);
fail("No exception thrown on multiple storage clusters");
} catch (IllegalArgumentException e) {
assertEquals("There are multiple storage clusters in your application, " + "please specify which one to visit.", e.getMessage());
}
}
Aggregations