Search in sources :

Example 1 with LoadTypeConfig

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

Example 2 with LoadTypeConfig

use of com.yahoo.vespa.config.content.LoadTypeConfig in project vespa by vespa-engine.

the class VespaFeedHandlerTestCase method testLoadTypes.

@Test
public void testLoadTypes() throws Exception {
    List<LoadTypeConfig.Type.Builder> typeBuilder = new ArrayList<>();
    typeBuilder.add(new LoadTypeConfig.Type.Builder().id(1234).name("foo").priority("VERY_LOW"));
    typeBuilder.add(new LoadTypeConfig.Type.Builder().id(4567).name("bar").priority("NORMAL_3"));
    setup(null, new LoadTypeConfig(new LoadTypeConfig.Builder().type(typeBuilder)), true, null);
    {
        Result res = testRequest(HttpRequest.createTestRequest("remove?id=doc:test:removeme&loadtype=foo", com.yahoo.jdisc.http.HttpRequest.Method.PUT));
        assertEquals(1, res.messages.size());
        Message m = res.messages.get(0);
        assertEquals(DocumentProtocol.MESSAGE_REMOVEDOCUMENT, m.getType());
        DocumentId d = ((RemoveDocumentMessage) m).getDocumentId();
        assertEquals("doc:test:removeme", d.toString());
        assertEquals(new LoadType(1234, "foo", DocumentProtocol.Priority.VERY_LOW), ((DocumentMessage) m).getLoadType());
        assertEquals(DocumentProtocol.Priority.VERY_LOW, ((DocumentMessage) m).getPriority());
    }
}
Also used : ArrayList(java.util.ArrayList) LoadType(com.yahoo.documentapi.messagebus.loadtypes.LoadType) LoadTypeConfig(com.yahoo.vespa.config.content.LoadTypeConfig) Test(org.junit.Test)

Example 3 with LoadTypeConfig

use of com.yahoo.vespa.config.content.LoadTypeConfig 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 4 with LoadTypeConfig

use of com.yahoo.vespa.config.content.LoadTypeConfig in project vespa by vespa-engine.

the class Arguments method parse.

void parse(String[] argList) throws HelpShownException {
    List<String> args = new LinkedList<String>();
    args.addAll(Arrays.asList(argList));
    while (!args.isEmpty()) {
        String arg = args.remove(0);
        if (arg.equals("-h") || arg.equals("--help")) {
            help();
            throw new HelpShownException();
        } else if ("--abortondataerror".equals(arg)) {
            feederConfigBuilder.abortondocumenterror(getBoolean(getParam(args, arg)));
        } else if ("--abortonsenderror".equals(arg)) {
            feederConfigBuilder.abortonsenderror(getBoolean(getParam(args, arg)));
        } else if ("--file".equals(arg)) {
            files.add(getParam(args, arg));
        } else if ("--maxpending".equals(arg)) {
            feederConfigBuilder.maxpendingdocs(Integer.parseInt(getParam(args, arg)));
        } else if ("--maxpendingsize".equals(arg)) {
            feederConfigBuilder.maxpendingbytes(Integer.parseInt(getParam(args, arg)));
        } else if ("--mode".equals(arg)) {
            mode = getParam(args, arg);
        } else if ("--noretry".equals(arg)) {
            feederConfigBuilder.retryenabled(false);
        } else if ("--retrydelay".equals(arg)) {
            feederConfigBuilder.retrydelay(Integer.parseInt(getParam(args, arg)));
        } else if ("--route".equals(arg)) {
            feederConfigBuilder.route(getParam(args, arg));
        } else if ("--timeout".equals(arg)) {
            feederConfigBuilder.timeout(Double.parseDouble(getParam(args, arg)));
        } else if ("--trace".equals(arg)) {
            feederConfigBuilder.tracelevel(Integer.parseInt(getParam(args, arg)));
        } else if ("--validate".equals(arg)) {
            validateOnly = true;
        } else if ("--dumpDocuments".equals(arg)) {
            dumpDocumentsFile = getParam(args, arg);
        } else if ("--maxfeedrate".equals(arg)) {
            feederConfigBuilder.maxfeedrate(Double.parseDouble(getParam(args, arg)));
        } else if ("--create-if-non-existent".equals(arg)) {
            feederConfigBuilder.createifnonexistent(true);
        } else if ("-v".equals(arg) || "--verbose".equals(arg)) {
            verbose = true;
        } else if ("--priority".equals(arg)) {
            priority = getParam(args, arg);
        } else {
            files.add(arg);
        }
    }
    propertyProcessor = new MessagePropertyProcessor(getFeederConfig(), new LoadTypeConfig(new LoadTypeConfig.Builder()));
}
Also used : MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) LinkedList(java.util.LinkedList) LoadTypeConfig(com.yahoo.vespa.config.content.LoadTypeConfig)

Aggregations

LoadTypeConfig (com.yahoo.vespa.config.content.LoadTypeConfig)4 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)3 ClusterListConfig (com.yahoo.cloud.config.ClusterListConfig)2 FeedContext (com.yahoo.feedapi.FeedContext)2 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)2 ClusterList (com.yahoo.vespaclient.ClusterList)2 FeederConfig (com.yahoo.vespaclient.config.FeederConfig)2 Test (org.junit.Test)2 LoadType (com.yahoo.documentapi.messagebus.loadtypes.LoadType)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1