Search in sources :

Example 26 with ClusterList

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);
}
Also used : Chain(com.yahoo.component.chain.Chain) ClusterList(com.yahoo.vespaclient.ClusterList) Query(com.yahoo.search.Query) Searcher(com.yahoo.search.Searcher) Result(com.yahoo.search.Result) Execution(com.yahoo.search.searchchain.Execution) FeedContext(com.yahoo.feedapi.FeedContext) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) Test(org.junit.Test)

Example 27 with ClusterList

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()));
}
Also used : ClusterList(com.yahoo.vespaclient.ClusterList) FeedContext(com.yahoo.feedapi.FeedContext) ClusterListConfig(com.yahoo.cloud.config.ClusterListConfig) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) LoadTypeConfig(com.yahoo.vespa.config.content.LoadTypeConfig)

Example 28 with ClusterList

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);
    }
}
Also used : Options(org.apache.commons.cli.Options) ClusterList(com.yahoo.vespaclient.ClusterList) ParseException(com.yahoo.document.select.parser.ParseException)

Example 29 with ClusterList

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);
}
Also used : ClusterList(com.yahoo.vespaclient.ClusterList) ClusterDef(com.yahoo.vespaclient.ClusterDef) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 30 with ClusterList

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"));
    }
}
Also used : ClusterList(com.yahoo.vespaclient.ClusterList) ClusterDef(com.yahoo.vespaclient.ClusterDef) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

ClusterList (com.yahoo.vespaclient.ClusterList)34 Test (org.junit.Test)29 FeedContext (com.yahoo.feedapi.FeedContext)25 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)24 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)24 Chain (com.yahoo.component.chain.Chain)21 Searcher (com.yahoo.search.Searcher)20 Execution (com.yahoo.search.searchchain.Execution)20 Result (com.yahoo.search.Result)19 GetDocumentMessage (com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage)8 Message (com.yahoo.messagebus.Message)7 ClusterDef (com.yahoo.vespaclient.ClusterDef)7 FeederConfig (com.yahoo.vespaclient.config.FeederConfig)5 ArrayList (java.util.ArrayList)5 Query (com.yahoo.search.Query)4 ClusterListConfig (com.yahoo.cloud.config.ClusterListConfig)2 GetDocumentReply (com.yahoo.documentapi.messagebus.protocol.GetDocumentReply)2 Hit (com.yahoo.search.result.Hit)2 HitGroup (com.yahoo.search.result.HitGroup)2 LoadTypeConfig (com.yahoo.vespa.config.content.LoadTypeConfig)2