use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ClusterTest method createWithZone.
private ContentCluster createWithZone(String clusterXml, Zone zone) throws Exception {
DeployState.Builder deployStateBuilder = new DeployState.Builder().zone(zone).properties(new DeployProperties.Builder().hostedVespa(true).build());
List<String> searchDefinitions = SearchDefinitionBuilder.createSearchDefinitions("test");
MockRoot root = ContentClusterUtils.createMockRoot(searchDefinitions, deployStateBuilder);
ContentCluster cluster = ContentClusterUtils.createCluster(clusterXml, root);
root.freezeModelTopology();
cluster.validate();
return cluster;
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class SearchChainsTest2 method fail_upon_unresolved_inheritance.
@Test
public void fail_upon_unresolved_inheritance() {
final Element searchElem = DomBuilderTest.parse("<search>", " <chain id='default' inherits='nonexistent' />", "</search>");
try {
SearchChains chains = new DomSearchChainsBuilder().build(new MockRoot(), searchElem);
chains.validate();
fail("Expected exception when inheriting a nonexistent search chain.");
} catch (Exception e) {
assertThat(e.getMessage(), containsString("Missing chain 'nonexistent'"));
}
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class SourceGroupTest method setUp.
@Before
public void setUp() throws Exception {
root = new MockRoot();
searchChains = new SearchChains(root, "searchchains");
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class StartupCommandChangeValidatorTest method requireThatDifferentStartupCommandIsDetected.
@Test
public void requireThatDifferentStartupCommandIsDetected() {
MockRoot oldRoot = createRootWithChildren(new ServiceStub("evilservice", "rm -rf /"));
MockRoot newRoot = createRootWithChildren(new ServiceStub("evilservice", "rm -rf *"));
List<ConfigChangeAction> changes = getStartupCommandChanges(oldRoot, newRoot);
assertEquals(1, changes.size());
assertEquals("evilservice", changes.get(0).getServices().get(0).getConfigId());
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class StorageClusterTest method parse.
StorageCluster parse(String xml) throws Exception {
MockRoot root = new MockRoot();
root.getDeployState().getDocumentModel().getDocumentManager().add(new NewDocumentType(new NewDocumentType.Name("music")));
root.getDeployState().getDocumentModel().getDocumentManager().add(new NewDocumentType(new NewDocumentType.Name("movies")));
ContentCluster cluster = ContentClusterUtils.createCluster(xml, root);
root.freezeModelTopology();
return cluster.getStorageNodes();
}
Aggregations