Search in sources :

Example 31 with MockRoot

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;
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) SearchDefinitionBuilder(com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder) ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 32 with MockRoot

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'"));
    }
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) DomSearchChainsBuilder(com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder) Element(org.w3c.dom.Element) ContainerModelBuilderTest(com.yahoo.vespa.model.container.xml.ContainerModelBuilderTest) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 33 with MockRoot

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

Example 34 with MockRoot

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

Example 35 with MockRoot

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();
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) NewDocumentType(com.yahoo.documentmodel.NewDocumentType) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

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