Search in sources :

Example 6 with RoutingTableSpec

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);
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) TestServer(com.yahoo.messagebus.network.rpc.test.TestServer)

Example 7 with RoutingTableSpec

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());
    }
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) RoutingTable(com.yahoo.messagebus.routing.RoutingTable) RouteSpec(com.yahoo.messagebus.routing.RouteSpec) Route(com.yahoo.messagebus.routing.Route) Test(org.junit.Test)

Example 8 with RoutingTableSpec

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);
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) RoutingTable(com.yahoo.messagebus.routing.RoutingTable) RouteSpec(com.yahoo.messagebus.routing.RouteSpec)

Example 9 with RoutingTableSpec

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());
    }
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) RoutingTable(com.yahoo.messagebus.routing.RoutingTable) RouteSpec(com.yahoo.messagebus.routing.RouteSpec) Route(com.yahoo.messagebus.routing.Route) Test(org.junit.Test)

Example 10 with RoutingTableSpec

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;
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Aggregations

RoutingTableSpec (com.yahoo.messagebus.routing.RoutingTableSpec)11 RouteSpec (com.yahoo.messagebus.routing.RouteSpec)6 Slobrok (com.yahoo.jrt.slobrok.server.Slobrok)4 TestServer (com.yahoo.messagebus.network.rpc.test.TestServer)4 Test (org.junit.Test)4 RoutingTable (com.yahoo.messagebus.routing.RoutingTable)3 Route (com.yahoo.messagebus.routing.Route)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 DocumentProtocol (com.yahoo.vespa.model.routing.DocumentProtocol)2 Routing (com.yahoo.vespa.model.routing.Routing)2 DocumentrouteselectorpolicyConfig (com.yahoo.documentapi.messagebus.protocol.DocumentrouteselectorpolicyConfig)1 MessagebusConfig (com.yahoo.messagebus.MessagebusConfig)1 HopSpec (com.yahoo.messagebus.routing.HopSpec)1 RoutingSpec (com.yahoo.messagebus.routing.RoutingSpec)1 Receptor (com.yahoo.messagebus.test.Receptor)1 SimpleMessage (com.yahoo.messagebus.test.SimpleMessage)1 HostResource (com.yahoo.vespa.model.HostResource)1 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1