Search in sources :

Example 1 with MockRoot

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());
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) Test(org.junit.Test)

Example 2 with MockRoot

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);
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) Zone(com.yahoo.config.provision.Zone) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster)

Example 3 with MockRoot

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);
    }
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot)

Example 4 with MockRoot

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;
}
Also used : SearchChains(com.yahoo.vespa.model.container.search.searchchain.SearchChains) DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) ContainerSearch(com.yahoo.vespa.model.container.search.ContainerSearch)

Example 5 with MockRoot

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());
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Aggregations

MockRoot (com.yahoo.config.model.test.MockRoot)43 Test (org.junit.Test)29 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)7 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)7 DeployState (com.yahoo.config.model.deploy.DeployState)6 Host (com.yahoo.vespa.model.Host)4 HostResource (com.yahoo.vespa.model.HostResource)4 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)3 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)3 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)3 Zone (com.yahoo.config.provision.Zone)3 NodeSpec (com.yahoo.vespa.model.search.NodeSpec)3 SearchNode (com.yahoo.vespa.model.search.SearchNode)3 Before (org.junit.Before)3 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)2 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)2 StorServerConfig (com.yahoo.vespa.config.content.core.StorServerConfig)2 ContainerSearch (com.yahoo.vespa.model.container.search.ContainerSearch)2 SearchChains (com.yahoo.vespa.model.container.search.searchchain.SearchChains)2