use of com.yahoo.messagebus.routing.RoutingTableSpec in project vespa by vespa-engine.
the class BasicNetworkTestCase method setUp.
public void setUp() throws ListenFailedException, UnknownHostException {
RoutingTableSpec table = new RoutingTableSpec(SimpleProtocol.NAME);
table.addHop("pxy", "test/pxy/session", Arrays.asList("test/pxy/session"));
table.addHop("dst", "test/dst/session", Arrays.asList("test/dst/session"));
table.addRoute("test", Arrays.asList("pxy", "dst"));
slobrok = new Slobrok();
src = new TestServer("test/src", table, slobrok, null);
pxy = new TestServer("test/pxy", table, slobrok, null);
dst = new TestServer("test/dst", table, slobrok, null);
}
use of com.yahoo.messagebus.routing.RoutingTableSpec 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.RoutingTableSpec 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.RoutingTableSpec 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());
}
}
use of com.yahoo.messagebus.routing.RoutingTableSpec in project vespa by vespa-engine.
the class DocumentProtocol method createRoutingTable.
/**
* This function extrapolates any routes for the document protocol that it can from the vespa model.
*
* @param plugins All initialized plugins of the vespa model.
* @return Routing table for the document protocol.
*/
private static RoutingTableSpec createRoutingTable(ConfigModelRepo plugins) {
// Build simple hops and routes.
List<ContentCluster> content = Content.getContentClusters(plugins);
Collection<ContainerCluster> containerClusters = ContainerModel.containerClusters(plugins);
RoutingTableSpec table = new RoutingTableSpec(NAME);
addContainerClusterDocprocHops(containerClusters, table);
addContentRouting(content, table);
// Build the indexing hop if it is possible to derive.
addIndexingHop(content, table);
// Build the default route if is is possible to derive.
addDefaultRoute(content, containerClusters, table);
// Return the complete routing table.
simplifyRouteNames(table);
return table;
}
Aggregations