Search in sources :

Example 11 with DocumentmanagerConfig

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());
}
Also used : Pattern(java.util.regex.Pattern) DocumentmanagerConfig(com.yahoo.document.config.DocumentmanagerConfig) VespaModel(com.yahoo.vespa.model.VespaModel) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 12 with DocumentmanagerConfig

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());
}
Also used : DocumentmanagerConfig(com.yahoo.document.config.DocumentmanagerConfig) DocumentManager(com.yahoo.vespa.configmodel.producers.DocumentManager)

Example 13 with DocumentmanagerConfig

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);
        }
    }
}
Also used : DocumentmanagerConfig(com.yahoo.document.config.DocumentmanagerConfig) AnnotationReferenceDataType(com.yahoo.document.annotation.AnnotationReferenceDataType) AnnotationType(com.yahoo.document.annotation.AnnotationType)

Example 14 with DocumentmanagerConfig

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);
}
Also used : DocumentmanagerConfig(com.yahoo.document.config.DocumentmanagerConfig) AnnotationReferenceDataType(com.yahoo.document.annotation.AnnotationReferenceDataType)

Aggregations

DocumentmanagerConfig (com.yahoo.document.config.DocumentmanagerConfig)14 Test (org.junit.Test)7 AnnotationType (com.yahoo.document.annotation.AnnotationType)4 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)3 AnnotationReferenceDataType (com.yahoo.document.annotation.AnnotationReferenceDataType)3 DocumentManager (com.yahoo.vespa.configmodel.producers.DocumentManager)3 Splitter (com.google.common.base.Splitter)1 DocprocConfig (com.yahoo.config.docproc.DocprocConfig)1 SchemamappingConfig (com.yahoo.config.docproc.SchemamappingConfig)1 SplitterJoinerDocumentProcessorConfig (com.yahoo.config.docproc.SplitterJoinerDocumentProcessorConfig)1 ConfigGetter (com.yahoo.config.subscription.ConfigGetter)1 BundlesConfig (com.yahoo.container.BundlesConfig)1 ComponentsConfig (com.yahoo.container.ComponentsConfig)1 ChainsConfig (com.yahoo.container.core.ChainsConfig)1 ContainerMbusConfig (com.yahoo.container.jdisc.ContainerMbusConfig)1 HttpRequest (com.yahoo.container.jdisc.HttpRequest)1 HttpResponse (com.yahoo.container.jdisc.HttpResponse)1 SessionCache (com.yahoo.container.jdisc.messagebus.SessionCache)1 AccessLog (com.yahoo.container.logging.AccessLog)1 Processing (com.yahoo.docproc.Processing)1