use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class GetSearcherTestCase method testJsonRendererSetting.
@Test
public void testJsonRendererSetting() throws Exception {
// Needs auto-reply
DocumentSessionFactory factory = new DocumentSessionFactory(docType);
GetSearcher searcher = new GetSearcher(new FeedContext(new MessagePropertyProcessor(defFeedCfg, defLoadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric()));
Chain<Searcher> searchChain = new Chain<>(searcher);
Query query = newQuery("?id=userdoc:kittens:1:2&format=json");
Result result = new Execution(searchChain, Execution.Context.createContextStub()).search(query);
assertFalse(result.getTemplating().getTemplates() instanceof DocumentXMLTemplate);
}
use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class VisitorSearcherTestCase method create.
public VisitSearcher create() throws Exception {
ClusterListConfig.Storage.Builder storageCluster = new ClusterListConfig.Storage.Builder().configid("storage/cluster.foobar").name("foobar");
ClusterListConfig clusterListCfg = new ClusterListConfig(new ClusterListConfig.Builder().storage(storageCluster));
ClusterList clusterList = new ClusterList(clusterListCfg);
return new VisitSearcher(new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder().timeout(458).route("riksveg18").retryenabled(true)), new LoadTypeConfig(new LoadTypeConfig.Builder())), factory, docMan, clusterList, new NullFeedMetric()));
}
use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class VdsVisit method main.
public static void main(String[] args) {
LogSetup.initVespaLogging("vespa-visit");
VdsVisit vdsVisit = new VdsVisit();
Options options = createOptions();
try {
ArgumentParser parser = new ArgumentParser(options);
vdsVisit.params = parser.parse(args);
if (vdsVisit.params == null) {
vdsVisit.printSyntax(options);
System.exit(0);
}
ClusterList clusterList = new ClusterList("client");
vdsVisit.params.getVisitorParameters().setRoute(resolveClusterRoute(clusterList, vdsVisit.params.getCluster()));
} catch (org.apache.commons.cli.ParseException e) {
System.err.println("Failed to parse arguments. Try --help for syntax. " + e.getMessage());
System.exit(1);
} catch (IllegalArgumentException e) {
System.err.println(e.getMessage());
System.exit(1);
}
if (vdsVisit.params.isVerbose()) {
verbosePrintParameters(vdsVisit.params, System.err);
}
try {
vdsVisit.run();
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class VdsVisitTestCase method testAutoSelectClusterRoute.
@Test
public void testAutoSelectClusterRoute() throws Exception {
List<ClusterDef> clusterDefs = new ArrayList<>();
clusterDefs.add(new ClusterDef("storage", "content/cluster.foo/storage"));
ClusterList clusterList = new ClusterList(clusterDefs);
String route = VdsVisit.resolveClusterRoute(clusterList, null);
assertEquals("[Storage:cluster=storage;clusterconfigid=content/cluster.foo/storage]", route);
}
use of com.yahoo.vespaclient.ClusterList in project vespa by vespa-engine.
the class VdsVisitTestCase method testFailIfNoContentClustersAvailable.
@Test
public void testFailIfNoContentClustersAvailable() {
List<ClusterDef> clusterDefs = new ArrayList<>();
ClusterList clusterList = new ClusterList(clusterDefs);
try {
VdsVisit.resolveClusterRoute(clusterList, null);
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().contains("Your Vespa cluster does not have any content clusters"));
}
}
Aggregations