use of com.yahoo.vespa.configmodel.producers.DocumentManager in project vespa by vespa-engine.
the class InheritanceTestCase method requireThatStructTypesAreInheritedThroughDiamond.
@Test
public void requireThatStructTypesAreInheritedThroughDiamond() throws IOException, ParseException {
String dir = "src/test/derived/inheritdiamond/";
List<String> files = Arrays.asList("grandparent.sd", "mother.sd", "father.sd", "child.sd");
File outDir = tmpDir.newFolder("out");
for (int startIdx = 0; startIdx < files.size(); ++startIdx) {
SearchBuilder builder = new SearchBuilder();
for (int fileIdx = startIdx; fileIdx < startIdx + files.size(); ++fileIdx) {
String fileName = files.get(fileIdx % files.size());
builder.importFile(dir + fileName);
}
builder.build();
DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder();
DerivedConfiguration.exportDocuments(new DocumentManager().produce(builder.getModel(), b), outDir.getPath());
DocumentmanagerConfig dc = new DocumentmanagerConfig(b);
assertEquals(17, dc.datatype().size());
assertNotNull(structType("child.body", dc));
DocumentmanagerConfig.Datatype.Structtype childHeader = structType("child.header", dc);
assertEquals(childHeader.field(0).name(), "foo");
assertEquals(childHeader.field(1).name(), "bar");
assertEquals(childHeader.field(2).name(), "baz");
assertEquals(childHeader.field(3).name(), "cox");
DocumentmanagerConfig.Datatype.Documenttype child = documentType("child", dc);
assertEquals(child.inherits(0).name(), "document");
assertEquals(child.inherits(1).name(), "father");
assertEquals(child.inherits(2).name(), "mother");
DocumentmanagerConfig.Datatype.Documenttype mother = documentType("mother", dc);
assertEquals(mother.inherits(0).name(), "grandparent");
assertEquals(mother.inherits(1).name(), "document");
}
}
use of com.yahoo.vespa.configmodel.producers.DocumentManager in project vespa by vespa-engine.
the class Deriver method deriveDocuments.
/**
* Derives only document manager.
*
* @param sdFileNames The name of the search definition files to derive from.
* @param toDir The directory to write configuration to.
* @return The list of Search objects, possibly "unproper ones", from sd files containing only document
*/
public static SearchBuilder deriveDocuments(List<String> sdFileNames, String toDir) {
SearchBuilder builder = getUnprocessingSearchBuilder(sdFileNames);
DocumentmanagerConfig.Builder documentManagerCfg = new DocumentManager().produce(builder.getModel(), new DocumentmanagerConfig.Builder());
try {
DerivedConfiguration.exportDocuments(documentManagerCfg, toDir);
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
return builder;
}
use of com.yahoo.vespa.configmodel.producers.DocumentManager in project vespa by vespa-engine.
the class DocumentModelBuilderTestCase method testDocumentManagerSimple.
@Test
public void testDocumentManagerSimple() throws IOException, ParseException {
DocumentModel model = createAndTestModel("src/test/configmodel/types/types.sd");
DocumentmanagerConfig.Builder documentmanagerCfg = new DocumentManager().produce(model, new DocumentmanagerConfig.Builder());
assertConfigFile("src/test/configmodel/types/documentmanager.cfg", new DocumentmanagerConfig(documentmanagerCfg).toString());
}
use of com.yahoo.vespa.configmodel.producers.DocumentManager 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());
}
Aggregations