use of com.yahoo.document.DocumentType in project vespa by vespa-engine.
the class ScriptManagerTestCase method requireThatScriptsAreAppliedToSubType.
@Test
public void requireThatScriptsAreAppliedToSubType() throws ParseException {
DocumentTypeManager typeMgr = new DocumentTypeManager();
typeMgr.configure("file:src/test/cfg/documentmanager_inherit.cfg");
DocumentType docType = typeMgr.getDocumentType("newssummary");
assertNotNull(docType);
IlscriptsConfig.Builder config = new IlscriptsConfig.Builder();
config.ilscript(new IlscriptsConfig.Ilscript.Builder().doctype("newssummary").content("index"));
ScriptManager scriptMgr = new ScriptManager(typeMgr, new IlscriptsConfig(config), null);
assertNotNull(scriptMgr.getScript(typeMgr.getDocumentType("newsarticle")));
assertNull(scriptMgr.getScript(new DocumentType("unknown")));
}
use of com.yahoo.document.DocumentType in project vespa by vespa-engine.
the class ScriptManagerTestCase method requireThatEmptyConfigurationDoesNotThrow.
@Test
public void requireThatEmptyConfigurationDoesNotThrow() {
DocumentTypeManager typeMgr = new DocumentTypeManager();
typeMgr.configure("file:src/test/cfg/documentmanager_inherit.cfg");
ScriptManager scriptMgr = new ScriptManager(typeMgr, new IlscriptsConfig(new IlscriptsConfig.Builder()), null);
assertNull(scriptMgr.getScript(new DocumentType("unknown")));
}
use of com.yahoo.document.DocumentType in project vespa by vespa-engine.
the class FieldSetRepo method parseFieldCollection.
FieldSet parseFieldCollection(DocumentTypeManager docMan, String docType, String fieldNames) {
DocumentType type = docMan.getDocumentType(docType);
if (type == null) {
throw new IllegalArgumentException("Unknown document type " + docType);
}
StringTokenizer tokenizer = new StringTokenizer(fieldNames, ",");
FieldCollection collection = new FieldCollection(type);
for (; tokenizer.hasMoreTokens(); ) {
String token = tokenizer.nextToken();
Field f = type.getField(token);
if (f == null) {
throw new IllegalArgumentException("No such field " + token);
}
collection.add(f);
}
return collection;
}
use of com.yahoo.document.DocumentType in project vespa by vespa-engine.
the class IndexingProcessorTestCase method requireThatIndexerForwardsDocumentsOfUnknownType.
@Test
public void requireThatIndexerForwardsDocumentsOfUnknownType() {
Document input = new Document(new DocumentType("unknown"), "doc:scheme:");
DocumentOperation output = process(new DocumentPut(input));
assertTrue(output instanceof DocumentPut);
assertSame(input, ((DocumentPut) output).getDocument());
}
use of com.yahoo.document.DocumentType in project vespa by vespa-engine.
the class IndexingProcessorTestCase method requireThatIndexerForwardsUpdatesOfUnknownType.
@Test
public void requireThatIndexerForwardsUpdatesOfUnknownType() {
DocumentUpdate input = new DocumentUpdate(new DocumentType("unknown"), "doc:scheme:");
DocumentOperation output = process(input);
assertSame(input, output);
}
Aggregations