use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ConfigValueChangeValidatorTest method requireThatAnnotationDoesNotHaveEmtpyConfigList.
@Test(expected = IllegalStateException.class)
public void requireThatAnnotationDoesNotHaveEmtpyConfigList() {
MockRoot root = createRootWithChildren(new EmptyConfigListAnnotationService(""));
getConfigChanges(root, root);
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ConfigValueChangeValidatorTest method requireThatConfigsFromAnnotatedSuperClassesAreDetected.
@Test
public void requireThatConfigsFromAnnotatedSuperClassesAreDetected() {
MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p", 1).withChildren(new ChildServiceWithAnnotation("child1", 0), new ChildServiceWithoutAnnotation("child2", 0)));
MockRoot newRoot = createRootWithChildren(new SimpleConfigProducer("p", 2).withChildren(new ChildServiceWithAnnotation("child1", 0), new ChildServiceWithoutAnnotation("child2", 0)));
List<ConfigChangeAction> changes = getConfigChanges(oldRoot, newRoot);
assertEquals(2, changes.size());
assertComponentsEquals(changes, "p/child1", 0);
assertComponentsEquals(changes, "p/child2", 1);
assertEmptyLog();
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ConfigValueChangeValidatorTest method createRootWithChildren.
private static MockRoot createRootWithChildren(AbstractConfigProducer<?>... children) {
MockRoot root = new MockRoot();
Arrays.asList(children).forEach(root::addChild);
root.freezeModelTopology();
return root;
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class MultilevelDispatchTest method createCluster.
private ContentCluster createCluster(String dispatchXml) throws Exception {
String[] hosts = { "mh0", "mh1", "mh2", "mh3", "mh4", "mh5" };
MockRoot root = ContentClusterUtils.createMockRoot(hosts);
ContentCluster cluster = ContentClusterUtils.createCluster(createClusterXml(getGroupXml(), Optional.of(dispatchXml), 1, 1), root);
AbstractConfigProducer<Dispatch> dispatchParent = new SimpleConfigProducer<>(root, "tlds");
HostResource hostResource = new HostResource(new Host(root, "mockhost"));
IndexedSearchCluster index = cluster.getSearch().getIndexed();
index.addTld(dispatchParent, hostResource);
index.setupDispatchGroups();
root.freezeModelTopology();
cluster.validate();
return cluster;
}
use of com.yahoo.config.model.test.MockRoot 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());
}
}
Aggregations