use of com.yahoo.document.config.DocumentmanagerConfig in project vespa by vespa-engine.
the class ApplicationDeployTest method testSdFromDocprocBundle.
@Test
public void testSdFromDocprocBundle() throws IOException, SAXException {
String appDir = "src/test/cfg/application/app_sdbundles";
FilesApplicationPackage app = createAppPkg(appDir);
VespaModel model = new VespaModel(app);
// Check that the resulting documentmanager config contains those types
DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder();
model.getConfig(b, VespaModel.ROOT_CONFIGID);
// String docMan = model.getConfig("documentmanager", "").toString();
DocumentmanagerConfig dc = new DocumentmanagerConfig(b);
String docMan = ConfigInstance.serialize(dc).toString();
int pFlags = Pattern.MULTILINE + Pattern.DOTALL;
Pattern base = Pattern.compile(".*name.*base\\.header.*", pFlags);
Pattern book = Pattern.compile(".*name.*book\\.header.*", pFlags);
Pattern music = Pattern.compile(".*name.*music\\.header.*", pFlags);
Pattern video = Pattern.compile(".*name.*video\\.header.*", pFlags);
Pattern muzak = Pattern.compile(".*name.*muzak\\.header.*", pFlags);
assertTrue(base.matcher(docMan).matches());
assertTrue(book.matcher(docMan).matches());
assertTrue(music.matcher(docMan).matches());
assertTrue(video.matcher(docMan).matches());
assertTrue(muzak.matcher(docMan).matches());
}
use of com.yahoo.document.config.DocumentmanagerConfig in project vespa by vespa-engine.
the class DocumentModelBuilderReferenceTypeTestCase method assertDocumentmanagerCfg.
private void assertDocumentmanagerCfg(DocumentModel model, String documentmanagerCfgFile) throws IOException {
DocumentmanagerConfig.Builder documentmanagerCfg = new DocumentManager().produce(model, new DocumentmanagerConfig.Builder());
assertConfigFile(TEST_FOLDER + documentmanagerCfgFile, new DocumentmanagerConfig(documentmanagerCfg).toString());
}
use of com.yahoo.document.config.DocumentmanagerConfig in project vespa by vespa-engine.
the class DocumentTypeManagerConfigurer method addAnnotationTypePayloads.
private static void addAnnotationTypePayloads(DocumentmanagerConfig config, DocumentTypeManager manager) {
for (DocumentmanagerConfig.Annotationtype annType : config.annotationtype()) {
AnnotationType annotationType = manager.getAnnotationTypeRegistry().getType(annType.id());
DataType payload = manager.getDataType(annType.datatype(), "");
if (!payload.equals(DataType.NONE)) {
annotationType.setDataType(payload);
}
}
}
use of com.yahoo.document.config.DocumentmanagerConfig in project vespa by vespa-engine.
the class DocumentTypeManagerConfigurer method registerStructType.
private static void registerStructType(DocumentmanagerConfig config, DocumentTypeManager manager, int id, DocumentmanagerConfig.Datatype.Structtype struct) {
StructDataType type = new StructDataType(id, struct.name());
if (config.enablecompression()) {
CompressionConfig comp = makeCompressionConfig(struct);
type.setCompressionConfig(comp);
}
for (Object j : struct.field()) {
DocumentmanagerConfig.Datatype.Structtype.Field field = (DocumentmanagerConfig.Datatype.Structtype.Field) j;
DataType fieldType = (field.datatype() == id) ? manager.getDataTypeAndReturnTemporary(field.datatype(), field.detailedtype()) : manager.getDataType(field.datatype(), field.detailedtype());
if (field.id().size() == 1) {
type.addField(new Field(field.name(), field.id().get(0).id(), fieldType, true));
} else {
type.addField(new Field(field.name(), fieldType, true));
}
}
manager.register(type);
}
Aggregations