use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class VisitorSearcherTestCase method testNoClusterParamWhenSeveralClusters.
@Test(expected = IllegalArgumentException.class)
public void testNoClusterParamWhenSeveralClusters() throws Exception {
DocumentSessionFactory factory = new DocumentSessionFactory(docType);
ClusterListConfig.Storage.Builder storageCluster1 = new ClusterListConfig.Storage.Builder().configid("storage/cluster.foo").name("foo");
ClusterListConfig.Storage.Builder storageCluster2 = new ClusterListConfig.Storage.Builder().configid("storage/cluster.bar").name("bar");
ClusterListConfig clusterListCfg = new ClusterListConfig(new ClusterListConfig.Builder().storage(Arrays.asList(storageCluster1, storageCluster2)));
ClusterList clusterList = new ClusterList(clusterListCfg);
VisitSearcher searcher = new VisitSearcher(new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder().timeout(100).route("whatever").retryenabled(true)), new LoadTypeConfig(new LoadTypeConfig.Builder())), factory, docMan, clusterList, new NullFeedMetric()));
searcher.getVisitorParameters(newQuery("visit?visit.selection=id.user=1234"), null);
}
use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class VespaFeedHandlerTestCase method setup.
public void setup(com.yahoo.messagebus.Error e, LoadTypeConfig loadTypeCfg, boolean autoReply, DummySessionFactory.ReplyFactory autoReplyFactory) throws Exception {
DocumentTypeManager docMan = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(docMan, "file:" + xmlFilesPath + "documentmanager.cfg");
if (autoReply) {
if (autoReplyFactory != null) {
factory = DummySessionFactory.createWithAutoReplyFactory(autoReplyFactory);
} else {
factory = DummySessionFactory.createWithErrorAutoReply(e);
}
} else {
factory = DummySessionFactory.createDefault();
}
context = new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder()), loadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric());
Executor threadPool = Executors.newCachedThreadPool();
feedHandler = new VespaFeedHandler(context, threadPool);
removeHandler = new VespaFeedHandlerRemove(context, threadPool);
statusHandler = new VespaFeedHandlerStatus(context, false, false, threadPool);
removeLocationHandler = new VespaFeedHandlerRemoveLocation(context, threadPool);
CallStack dpCallstack = new CallStack("bar");
dpCallstack.addLast(new TestDocProc());
dpCallstack.addLast(new TestLaterDocProc());
DocprocService myservice = new DocprocService("bar");
myservice.setCallStack(dpCallstack);
myservice.setInService(true);
ComponentRegistry<DocprocService> registry = new ComponentRegistry<DocprocService>();
registry.register(new ComponentId(myservice.getName()), myservice);
DocumentProcessingHandler handler = new DocumentProcessingHandler(registry, new ComponentRegistry<>(), new ComponentRegistry<>(), new DocumentProcessingHandlerParameters());
Container container = Container.get();
ComponentRegistry<RequestHandler> requestHandlerComponentRegistry = new ComponentRegistry<>();
requestHandlerComponentRegistry.register(new ComponentId(DocumentProcessingHandler.class.getName()), handler);
container.setRequestHandlerRegistry(requestHandlerComponentRegistry);
}
use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class VdsVisitTestCase method testBadClusterName.
@Test
public void testBadClusterName() throws Exception {
List<ClusterDef> clusterDefs = new ArrayList<>();
clusterDefs.add(new ClusterDef("storage", "content/cluster.foo/storage"));
ClusterList clusterList = new ClusterList(clusterDefs);
try {
VdsVisit.resolveClusterRoute(clusterList, "borkbork");
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().contains("Your vespa cluster contains the content clusters storage, not borkbork."));
}
}
use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class VdsVisitTestCase method testExplicitClusterOptionWithMultipleClusters.
@Test
public void testExplicitClusterOptionWithMultipleClusters() {
List<ClusterDef> clusterDefs = new ArrayList<>();
clusterDefs.add(new ClusterDef("storage", "content/cluster.foo/storage"));
clusterDefs.add(new ClusterDef("storage2", "content/cluster.bar/storage"));
ClusterList clusterList = new ClusterList(clusterDefs);
String route = VdsVisit.resolveClusterRoute(clusterList, "storage2");
assertEquals("[Storage:cluster=storage2;clusterconfigid=content/cluster.bar/storage]", route);
}
use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class DocumentRetrieverTest method testSendSingleMessage.
@Test
public void testSendSingleMessage() throws DocumentRetrieverException {
ClientParameters params = createParameters().setDocumentIds(asIterator(DOC_ID_1)).setPriority(DocumentProtocol.Priority.HIGH_1).setNoRetry(true).setLoadTypeName("loadtype").build();
when(mockedSession.syncSend(any())).thenReturn(createDocumentReply(DOC_ID_1));
LoadTypeSet loadTypeSet = new LoadTypeSet();
loadTypeSet.addLoadType(1, "loadtype", DocumentProtocol.Priority.HIGH_1);
DocumentRetriever documentRetriever = new DocumentRetriever(new ClusterList(), mockedFactory, loadTypeSet, params);
documentRetriever.retrieveDocuments();
verify(mockedSession, times(1)).syncSend(argThat(new ArgumentMatcher<GetDocumentMessage>() {
@Override
public boolean matches(Object o) {
GetDocumentMessage msg = (GetDocumentMessage) o;
return msg.getPriority().equals(DocumentProtocol.Priority.HIGH_1) && !msg.getRetryEnabled() && msg.getLoadType().equals(new LoadType(1, "loadtype", DocumentProtocol.Priority.HIGH_1));
}
}));
assertContainsDocument(DOC_ID_1);
}
Aggregations