use of com.yahoo.documentmodel.NewDocumentType in project vespa by vespa-engine.
the class GlobalDistributionValidatorTest method throws_exception_on_unknown_document.
@Test
public void throws_exception_on_unknown_document() {
NewDocumentType unknown = new NewDocumentType(new NewDocumentType.Name("unknown"));
NewDocumentType child = createDocumentType("child", unknown);
Fixture fixture = new Fixture().addNonGlobalDocument(child);
Redundancy redundancy = createRedundancyWithGlobalDistribution();
exceptionRule.expect(IllegalArgumentException.class);
exceptionRule.expectMessage("The following document types are referenced from other documents, but are not listed in services.xml: 'unknown'");
validate(fixture, redundancy);
}
use of com.yahoo.documentmodel.NewDocumentType in project vespa by vespa-engine.
the class GlobalDistributionValidatorTest method throws_exception_if_referenced_document_not_global.
@Test
public void throws_exception_if_referenced_document_not_global() {
NewDocumentType parent = createDocumentType("parent");
Fixture fixture = new Fixture().addNonGlobalDocument(parent).addNonGlobalDocument(createDocumentType("child", parent));
Redundancy redundancy = createRedundancyWithoutGlobalDistribution();
exceptionRule.expect(IllegalArgumentException.class);
exceptionRule.expectMessage("The following document types are referenced from other documents, but are not globally distributed: 'parent'");
validate(fixture, redundancy);
}
use of com.yahoo.documentmodel.NewDocumentType in project vespa by vespa-engine.
the class IndexedTest method requireMultipleDocumentTypes.
@Test
public void requireMultipleDocumentTypes() {
VespaModelCreatorWithMockPkg creator = getIndexedVespaModelCreator();
VespaModel model = creator.create();
DeployState deployState = creator.deployState;
IndexedSearchCluster cluster = model.getContentClusters().get("test").getSearch().getIndexed();
assertEquals(3, cluster.getDocumentDbs().size());
NewDocumentType type1 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type1");
NewDocumentType type2 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type2");
NewDocumentType type3 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type3");
assertNotNull(type1);
assertNotNull(type2);
assertNotNull(type3);
}
use of com.yahoo.documentmodel.NewDocumentType in project vespa by vespa-engine.
the class StorageClusterTest method requireThatUserDoesNotSpecifyBothGroupAndNodes.
@Test
public void requireThatUserDoesNotSpecifyBothGroupAndNodes() throws Exception {
String xml = "<cluster id=\"storage\">\n" + "<documents/>\n" + "<engine>\n" + " <fail-partition-on-error>true</fail-partition-on-error>\n" + " <revert-time>34m</revert-time>\n" + " <recovery-time>5d</recovery-time>\n" + "</engine>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " </group>\n" + " <nodes>\n" + " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + " </nodes>\n" + "</cluster>";
try {
final MockRoot root = new MockRoot();
root.getDeployState().getDocumentModel().getDocumentManager().add(new NewDocumentType(new NewDocumentType.Name("music")));
ContentClusterUtils.createCluster(xml, root);
fail("Did not fail when having both group and nodes");
} catch (RuntimeException e) {
e.printStackTrace();
assertEquals("Both group and nodes exists, only one of these tags is legal", e.getMessage());
}
}
use of com.yahoo.documentmodel.NewDocumentType in project vespa by vespa-engine.
the class DocumentGenMojo method execute.
void execute(File sdDir, File outputDir, String packageName) throws MojoFailureException {
if ("".equals(packageName))
throw new IllegalArgumentException("You may not use empty package for generated types.");
searches = new HashMap<String, Search>();
docTypes = new HashMap<String, String>();
structTypes = new HashMap<String, String>();
annotationTypes = new HashMap<String, String>();
outputDir.mkdirs();
SearchBuilder builder = buildSearches(sdDir);
boolean annotationsExported = false;
for (NewDocumentType docType : builder.getModel().getDocumentManager().getTypes()) {
if (docType != VespaDocumentType.INSTANCE) {
exportDocumentSources(outputDir, docType, packageName);
for (AnnotationType annotationType : docType.getAllAnnotations()) {
if (provided(annotationType.getName()) != null)
continue;
annotationsExported = true;
exportAnnotationSources(outputDir, annotationType, docType, packageName);
}
}
}
exportPackageInfo(outputDir, packageName);
if (annotationsExported)
exportPackageInfo(outputDir, packageName + ".annotation");
exportDocFactory(outputDir, builder.getSearchList(), packageName);
if (project != null)
project.addCompileSourceRoot(outputDirectory.toString());
}
Aggregations