Search in sources :

Example 36 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class StorageClusterTest method requireThatNestedGroupsRequireDistribution.

@Test
public void requireThatNestedGroupsRequireDistribution() throws Exception {
    String xml = "<cluster id=\"storage\">\n" + "<documents/>\n" + "  <group>\n" + "    <group distribution-key=\"0\" name=\"bar\">\n" + "      <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + "    </group>\n" + "    <group distribution-key=\"0\" name=\"baz\">\n" + "      <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + "    </group>\n" + "  </group>\n" + "</cluster>";
    try {
        ContentClusterUtils.createCluster(xml, new MockRoot());
        fail("Did not get exception with missing distribution element");
    } catch (RuntimeException e) {
        assertEquals("'distribution' attribute is required with multiple subgroups", e.getMessage());
    }
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) Test(org.junit.Test)

Example 37 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class ContentClusterUtils method createCluster.

public static ContentCluster createCluster(String clusterXml, List<String> searchDefinitions) throws Exception {
    MockRoot root = createMockRoot(searchDefinitions);
    ContentCluster cluster = createCluster(clusterXml, root);
    root.freezeModelTopology();
    cluster.validate();
    return cluster;
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 38 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class ContentClusterUtils method createMockRoot.

private static MockRoot createMockRoot(HostProvisioner provisioner, List<String> searchDefinitions, DeployState.Builder deployStateBuilder) {
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withSearchDefinitions(searchDefinitions).build();
    deployStateBuilder.applicationPackage(applicationPackage).modelHostProvisioner(provisioner).build(true);
    return new MockRoot("", deployStateBuilder.build(true));
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage)

Example 39 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class GenericServicesModelTest method test_generic_services_model.

@Test
public void test_generic_services_model() {
    MockRoot root = new MockRoot();
    GenericServicesModel model = new GenericServicesModel(ConfigModelContext.create(null, root, "foo"));
    assertThat(model.serviceClusters().size(), is(0));
    model.addCluster(new ServiceCluster(root, "mycluster", "/bin/foo"));
    assertThat(model.serviceClusters().size(), is(1));
    assertThat(model.serviceClusters().get(0).getName(), is("mycluster"));
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ServiceCluster(com.yahoo.vespa.model.generic.service.ServiceCluster) Test(org.junit.Test)

Example 40 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class MultilevelDispatchTest method createSearchNodes.

private List<SearchNode> createSearchNodes(int numNodes) {
    List<SearchNode> searchNodes = new ArrayList<>();
    MockRoot root = new MockRoot("");
    for (int i = 0; i < numNodes; ++i) {
        searchNodes.add(SearchNode.create(root, "mynode" + i, i, new NodeSpec(0, i), "mycluster", null, false, Optional.empty()));
    }
    return searchNodes;
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ArrayList(java.util.ArrayList)

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