use of com.yahoo.feedapi.MessagePropertyProcessor in project vespa by vespa-engine.
the class GetSearcherTestCase method testResultWithNullDocument.
@Test
public void testResultWithNullDocument() throws Exception {
DocumentSessionFactory factory = new DocumentSessionFactory(docType, null, true);
factory.setNullReply(true);
GetSearcher searcher = new GetSearcher(new FeedContext(new MessagePropertyProcessor(defFeedCfg, defLoadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric()));
Chain<Searcher> searchChain = new Chain<>(searcher);
Result result = new Execution(searchChain, Execution.Context.createContextStub()).search(newQuery("?id[0]=userdoc:kittens:55:bad_document_id"));
// Document not found does not produce any hit at all, error or otherwise
assertNull(result.hits().getErrorHit());
assertRendered("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<result>\n" + "</result>\n", result);
}
use of com.yahoo.feedapi.MessagePropertyProcessor in project vespa by vespa-engine.
the class GetSearcherTestCase method testBadPriorityValue.
@Test
public void testBadPriorityValue() throws Exception {
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);
Result result = new Execution(searchChain, Execution.Context.createContextStub()).search(newQuery("?id=userdoc:kittens:1:2&priority=onkel_jubalon"));
assertNotNull(result.hits().getErrorHit());
assertRendered("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<result>\n" + "<errors>\n" + "<error type=\"searcher\" code=\"3\" message=\"Illegal query: " + "java.lang.IllegalArgumentException: No enum const" + (Util.isJava7Compatible() ? "ant " : " class ") + "com.yahoo.documentapi.messagebus.protocol.DocumentProtocol" + (Util.isJava7Compatible() ? "." : "$") + "Priority.onkel_jubalon\"/>\n" + "</errors>\n" + "</result>\n", result);
}
use of com.yahoo.feedapi.MessagePropertyProcessor 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.feedapi.MessagePropertyProcessor 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.feedapi.MessagePropertyProcessor 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()));
}
Aggregations