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 + "]"));
}
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()));
}
Aggregations