use of com.yahoo.collections.Pair in project vespa by vespa-engine.
the class SchemaMappingAndAccessesTest method testProxyAndSecureSecureFailing.
public void testProxyAndSecureSecureFailing() {
DocumentProcessor procInsecure = new TestDPInsecure();
Map<Pair<String, String>, String> fieldMap = new HashMap<>();
fieldMap.put(new Pair<>("album", "titleMapped"), "title");
procInsecure.setFieldMap(fieldMap);
DocumentPut put = new DocumentPut(getDoc());
Document doc = new Call(procInsecure).configDoc(procInsecure, put).getDocument();
try {
procInsecure.process(Processing.of(new DocumentPut(doc)));
fail("Insecure docproc went through");
} catch (Exception e) {
assertTrue(e.getMessage().matches(".*allowed.*"));
}
// assertEquals(doc.get("title"), "MyTitle");
}
use of com.yahoo.collections.Pair in project vespa by vespa-engine.
the class SchemaMappingAndAccessesTest method testSchemaMapNoDocType.
public void testSchemaMapNoDocType() {
SchemaMap map = new SchemaMap(null);
map.addMapping("mychain", "com.yahoo.MyDocProc", null, "inDoc1", "inProc1");
map.addMapping("mychain", "com.yahoo.MyDocProc", null, "inDoc2", "inProc2");
Map<Pair<String, String>, String> cMap = map.chainMap("mychain", "com.yahoo.MyDocProc");
DocumentProcessor proc = new TestDocumentProcessor1();
proc.setFieldMap(cMap);
Map<String, String> dMap = proc.getDocMap("mydoctype");
assertEquals("inDoc1", dMap.get("inProc1"));
assertEquals("inDoc2", dMap.get("inProc2"));
}
use of com.yahoo.collections.Pair in project vespa by vespa-engine.
the class DocumentProcessingHandlerForkTestCase method getCallStacks.
@Override
protected List<Pair<String, CallStack>> getCallStacks() {
ArrayList<Pair<String, CallStack>> stacks = new ArrayList<>(5);
stacks.add(new Pair<>(TOMANYALLINSAMEBUCKET, new CallStack().addLast(new OneToManyDocumentsAllInSameBucketProcessor())));
stacks.add(new Pair<>(TOMANYSOMEINSAMEBUCKET, new CallStack().addLast(new OneToManyDocumentsSomeInSameBucketProcessor())));
stacks.add(new Pair<>(TOMANY, new CallStack().addLast(new OneToManyDocumentsProcessor())));
stacks.add(new Pair<>(TOONE, new CallStack().addLast(new OneToOneDocumentsProcessor())));
stacks.add(new Pair<>(TOZERO, new CallStack().addLast(new OneToZeroDocumentsProcessor())));
return stacks;
}
use of com.yahoo.collections.Pair in project vespa by vespa-engine.
the class DocumentProcessingHandlerTransformingMessagesTestCase method getCallStacks.
@Override
public List<Pair<String, CallStack>> getCallStacks() {
CallStack stack = new CallStack();
stack.addLast(new TransformingDocumentProcessor());
ArrayList<Pair<String, CallStack>> stacks = new ArrayList<>(1);
stacks.add(new Pair<>(FOOBAR, stack));
return stacks;
}
use of com.yahoo.collections.Pair in project vespa by vespa-engine.
the class DocumentProcessingHandlerBasicTestCase method getCallStacks.
@Override
public List<Pair<String, CallStack>> getCallStacks() {
CallStack stack = new CallStack();
stack.addLast(new TestDocumentProcessor());
ArrayList<Pair<String, CallStack>> stacks = new ArrayList<>(1);
stacks.add(new Pair<>("foobar", stack));
return stacks;
}
Aggregations