use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ModelGraphTest method require_that_collections_can_be_empty.
@Test
public void require_that_collections_can_be_empty() {
ModelGraph graph = new ModelGraphBuilder().addBuilder(new GraphMock.BC()).addBuilder(new GraphMock.BA()).build();
List<ModelNode> nodes = graph.topologicalSort();
MockRoot root = new MockRoot();
GraphMock.A a = (GraphMock.A) nodes.get(0).createModel(ConfigModelContext.create(null, root, "first"));
GraphMock.C c = (GraphMock.C) nodes.get(1).createModel(ConfigModelContext.create(null, root, "second"));
assertThat(c.a, is(a));
assertTrue(c.b.isEmpty());
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class RoutingBuilderTest method getContainer.
private Container getContainer(ApplicationPackage applicationPackage, String region, Element clusterElem) throws IOException, SAXException {
DeployState deployState = new DeployState.Builder().applicationPackage(applicationPackage).zone(new Zone(Environment.prod, RegionName.from(region))).build(true);
root = new MockRoot("root", deployState);
createModel(root, deployState, clusterElem);
ContainerCluster cluster = getContainerCluster("default");
return cluster.getContainers().get(0);
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class DistributorTest method parseCluster.
ContentCluster parseCluster(String xml) {
try {
List<String> searchDefs = ApplicationPackageUtils.generateSearchDefinitions("music", "movies", "bunnies");
MockRoot root = ContentClusterUtils.createMockRoot(searchDefs);
return ContentClusterUtils.createCluster(xml, root);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ContainerClusterTest method createContainerCluster.
private ContainerCluster createContainerCluster(boolean isHosted, boolean isCombinedCluster, Optional<Integer> memoryPercentage, Optional<ContainerClusterVerifier> extraComponents) {
DeployState state = new DeployState.Builder().properties(new DeployProperties.Builder().hostedVespa(isHosted).build()).build(true);
MockRoot root = new MockRoot("foo", state);
ContainerCluster cluster = extraComponents.isPresent() ? new ContainerCluster(root, "container0", "container1", extraComponents.get()) : new ContainerCluster(root, "container0", "container1");
if (isCombinedCluster)
cluster.setHostClusterId("test-content-cluster");
cluster.setMemoryPercentage(memoryPercentage);
cluster.setSearch(new ContainerSearch(cluster, new SearchChains(cluster, "search-chain"), new ContainerSearch.Options()));
return cluster;
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class StartupCommandChangeValidatorTest method requireEmptyResultForEqualStartupCommand.
@Test
public void requireEmptyResultForEqualStartupCommand() {
MockRoot oldRoot = createRootWithChildren(new ServiceStub("evilservice", "./hax.sh"));
MockRoot newRoot = createRootWithChildren(new ServiceStub("evilservice", "./hax.sh"));
List<ConfigChangeAction> changes = getStartupCommandChanges(oldRoot, newRoot);
assertTrue(changes.isEmpty());
}
Aggregations