Search in sources :

Example 1 with Protocol

use of com.yahoo.vespa.model.routing.Protocol in project vespa by vespa-engine.

the class IndexingAndDocprocRoutingTest method assertFeedingRouteIndexed.

private void assertFeedingRouteIndexed(VespaModel model, String searchClusterName, String indexingHopName) {
    Routing routing = model.getRouting();
    List<Protocol> protocols = routing.getProtocols();
    DocumentProtocol documentProtocol = null;
    for (Protocol protocol : protocols) {
        if (protocol instanceof DocumentProtocol) {
            documentProtocol = (DocumentProtocol) protocol;
        }
    }
    assertNotNull(documentProtocol);
    RoutingTable table = new RoutingTable(documentProtocol.getRoutingTableSpec());
    Route indexingRoute = table.getRoute("searchcluster-index");
    assertThat(indexingRoute.getNumHops(), is(2));
    assertThat(indexingRoute.getHop(0).toString(), is(indexingHopName));
    assertThat(indexingRoute.getHop(1).toString(), is("[Content:cluster=" + searchClusterName + "]"));
}
Also used : Routing(com.yahoo.vespa.model.routing.Routing) DocumentProtocol(com.yahoo.vespa.model.routing.DocumentProtocol) Protocol(com.yahoo.vespa.model.routing.Protocol) DocumentProtocol(com.yahoo.vespa.model.routing.DocumentProtocol)

Example 2 with Protocol

use of com.yahoo.vespa.model.routing.Protocol in project vespa by vespa-engine.

the class IndexingAndDocprocRoutingTest method assertFeedingRoute.

private void assertFeedingRoute(VespaModel model, String searchClusterName, String indexingHopName) {
    Routing routing = model.getRouting();
    List<Protocol> protocols = routing.getProtocols();
    DocumentProtocol documentProtocol = null;
    for (Protocol protocol : protocols) {
        if (protocol instanceof DocumentProtocol) {
            documentProtocol = (DocumentProtocol) protocol;
        }
    }
    assertNotNull(documentProtocol);
    RoutingTable table = new RoutingTable(documentProtocol.getRoutingTableSpec());
    HopBlueprint indexingHop = table.getHop("indexing");
    assertThat(indexingHop, not(nullValue()));
    assertThat(indexingHop.getNumDirectives(), is(1));
    assertThat(indexingHop.getDirective(0), instanceOf(PolicyDirective.class));
    assertThat(indexingHop.getDirective(0).toString(), is("[DocumentRouteSelector]"));
    // assertThat(indexingHop.getNumRecipients(), is(1));
    // assertThat(indexingHop.getRecipient(0).getServiceName(), is(searchClusterName));
    Route route = table.getRoute(searchClusterName);
    assertNotNull(route);
    assertThat(route.getNumHops(), is(1));
    Hop messageTypeHop = route.getHop(0);
    assertThat(messageTypeHop.getNumDirectives(), is(1));
    assertThat(messageTypeHop.getDirective(0), instanceOf(PolicyDirective.class));
    assertThat(messageTypeHop.getDirective(0).toString(), is("[MessageType:" + searchClusterName + "]"));
    PolicyDirective messageTypeDirective = (PolicyDirective) messageTypeHop.getDirective(0);
    assertThat(messageTypeDirective.getName(), is("MessageType"));
    assertThat(messageTypeDirective.getParam(), is(searchClusterName));
    String indexingRouteName = DocumentProtocol.getIndexedRouteName(model.getContentClusters().get(searchClusterName).getConfigId());
    Route indexingRoute = table.getRoute(indexingRouteName);
    assertThat(indexingRoute.getNumHops(), is(2));
    assertThat(indexingRoute.getHop(0).getServiceName(), is(indexingHopName));
    assertThat(indexingRoute.getHop(1), not(nullValue()));
}
Also used : Routing(com.yahoo.vespa.model.routing.Routing) DocumentProtocol(com.yahoo.vespa.model.routing.DocumentProtocol) Protocol(com.yahoo.vespa.model.routing.Protocol) DocumentProtocol(com.yahoo.vespa.model.routing.DocumentProtocol)

Aggregations

DocumentProtocol (com.yahoo.vespa.model.routing.DocumentProtocol)2 Protocol (com.yahoo.vespa.model.routing.Protocol)2 Routing (com.yahoo.vespa.model.routing.Routing)2