Search in sources :

Example 21 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class ContentBuilderTest method handleStreamingOnlyWithoutPersistence.

@Test
public void handleStreamingOnlyWithoutPersistence() throws Exception {
    final String musicClusterId = "music-cluster-id";
    ContentCluster cluster = createContent("<content version='1.0' id='" + musicClusterId + "'>" + "    <redundancy>3</redundancy>" + "    <documents>" + "       <document type='music' mode='streaming'/>" + "    </documents>" + "    <engine>" + "      <vds/>" + "    </engine>" + "    <group>" + "      <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + "    </group>" + "</content>");
    ContentSearchCluster s;
    s = cluster.getSearch();
    assertFalse(s.hasIndexedCluster());
    assertEquals(1, s.getClusters().size());
    assertNull(s.getIndexed());
    AbstractSearchCluster sc = s.getClusters().get(musicClusterId + ".music");
    assertEquals(musicClusterId + ".music", sc.getClusterName());
    assertEquals(musicClusterId, ((StreamingSearchCluster) sc).getStorageRouteSpec());
    assertTrue(cluster.getPersistence() instanceof VDSEngine.Factory);
    assertEquals(1, cluster.getStorageNodes().getChildren().size());
    assertEquals(musicClusterId, cluster.getConfigId());
    // assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId());
    // Due to reuse.
    assertEquals(musicClusterId + "/storage/0", cluster.getRootGroup().getNodes().get(0).getConfigId());
    assertEquals(1, cluster.getRoot().getHostSystem().getHosts().size());
    HostResource h = cluster.getRoot().getHostSystem().getHost("mockhost");
    String[] expectedServices = { "logd", "configproxy", "config-sentinel", "configserver", "logserver", "slobrok", "container-clustercontroller", "storagenode", "distributor" };
    assertServices(h, expectedServices);
    assertEquals(musicClusterId + "/storage/0", h.getService("storagenode").getConfigId());
/* Not yet
        assertNotNull(h.getService("qrserver"));
        assertNotNull(h.getService("topleveldisptach"));
        assertNotNull(h.getService("docproc"));
        */
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) HostResource(com.yahoo.vespa.model.HostResource) VDSEngine(com.yahoo.vespa.model.content.engines.VDSEngine) Matchers.containsString(org.hamcrest.Matchers.containsString) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 22 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class ContainerClusterTest method addClusterController.

private static void addClusterController(ContainerCluster cluster, String hostName) {
    Container container = new ClusterControllerContainer(cluster, 1, false);
    container.setHostResource(new HostResource(new Host(null, hostName)));
    container.initService();
    cluster.addContainer(container);
}
Also used : ClusterControllerContainer(com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer) HostResource(com.yahoo.vespa.model.HostResource) ClusterControllerContainer(com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer) Host(com.yahoo.vespa.model.Host)

Example 23 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class SearchNodeTest method requireThatPreShutdownCommandIsEmptyWhenNotActivated.

@Test
public void requireThatPreShutdownCommandIsEmptyWhenNotActivated() {
    MockRoot root = new MockRoot("");
    SearchNode node = createSearchNode(root, "mynode", 3, new NodeSpec(7, 5), false);
    node.setHostResource(new HostResource(new Host(node, "mynbode")));
    node.initService();
    assertFalse(node.getPreShutdownCommand().isPresent());
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) MockRoot(com.yahoo.config.model.test.MockRoot) NodeSpec(com.yahoo.vespa.model.search.NodeSpec) Host(com.yahoo.vespa.model.Host) SearchNode(com.yahoo.vespa.model.search.SearchNode) Test(org.junit.Test)

Example 24 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class SearchNodeTest method requireThatPreShutdownCommandUsesPrepareRestartWhenActivated.

@Test
public void requireThatPreShutdownCommandUsesPrepareRestartWhenActivated() {
    MockRoot root = new MockRoot("");
    SearchNode node = createSearchNode(root, "mynode2", 4, new NodeSpec(7, 5), true);
    node.setHostResource(new HostResource(new Host(node, "mynbode2")));
    node.initService();
    assertTrue(node.getPreShutdownCommand().isPresent());
    Assert.assertThat(node.getPreShutdownCommand().get(), CoreMatchers.containsString("vespa-proton-cmd " + node.getRpcPort() + " prepareRestart"));
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) MockRoot(com.yahoo.config.model.test.MockRoot) NodeSpec(com.yahoo.vespa.model.search.NodeSpec) Host(com.yahoo.vespa.model.Host) SearchNode(com.yahoo.vespa.model.search.SearchNode) Test(org.junit.Test)

Example 25 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class ModelAmendingTestCase method testModelAmending.

@Test
public void testModelAmending() throws IOException, SAXException {
    ConfigModelRegistry amendingModelRepo = MapConfigModelRegistry.createFromList(new AdminModelAmenderBuilder(), new ContainerModelAmenderBuilder(), new ContentModelAmenderBuilder());
    String services = "<services version='1.0'>" + "    <admin version='4.0'/>" + "    <jdisc id='test1' version='1.0'>" + "        <search/>" + "        <nodes count='2'/>" + "    </jdisc>" + "    <jdisc id='test2' version='1.0'>" + "        <http><server id='server1' port='19110'/></http>" + "        <document-api/>" + "        <nodes count='2'/>" + "    </jdisc>" + "    <content id='test3' version='1.0'>" + "        <redundancy>1</redundancy>" + "        <documents>" + "            <document mode='index' type='type1'/>" + "        </documents>" + "        <nodes count='2'/>" + "    </content>" + "    <content id='test4' version='1.0'>" + "        <redundancy>1</redundancy>" + "        <documents>" + "            <document mode='index' type='type1'/>" + "        </documents>" + "        <nodes count='3'/>" + "    </content>" + "</services>";
    VespaModelTester tester = new VespaModelTester(amendingModelRepo);
    tester.addHosts(10);
    VespaModel model = tester.createModel(services);
    // Check that all hosts are amended
    for (HostResource host : model.getAdmin().getHostSystem().getHosts()) {
        assertFalse(host + " is amended", host.getHost().getChildrenByTypeRecursive(AmendedService.class).isEmpty());
    }
    // Check that jdisc clusters are amended
    assertEquals(2, model.getContainerClusters().size());
    assertNotNull(model.getContainerClusters().get("test1").getComponentsMap().get(new ComponentId("com.yahoo.MyAmendedComponent")));
    assertNotNull(model.getContainerClusters().get("test2").getComponentsMap().get(new ComponentId("com.yahoo.MyAmendedComponent")));
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ConfigModelRegistry(com.yahoo.config.model.ConfigModelRegistry) MapConfigModelRegistry(com.yahoo.config.model.MapConfigModelRegistry) VespaModel(com.yahoo.vespa.model.VespaModel) ComponentId(com.yahoo.component.ComponentId) Test(org.junit.Test)

Aggregations

HostResource (com.yahoo.vespa.model.HostResource)25 Test (org.junit.Test)10 ClusterMembership (com.yahoo.config.provision.ClusterMembership)6 Host (com.yahoo.vespa.model.Host)6 VespaModel (com.yahoo.vespa.model.VespaModel)6 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)5 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)4 ArrayList (java.util.ArrayList)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 MockRoot (com.yahoo.config.model.test.MockRoot)3 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Element (org.w3c.dom.Element)3 HostSystem (com.yahoo.vespa.model.HostSystem)2 ClusterControllerContainer (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer)2 NodesSpecification (com.yahoo.vespa.model.builder.xml.dom.NodesSpecification)2 Container (com.yahoo.vespa.model.container.Container)2 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)2 NodeSpec (com.yahoo.vespa.model.search.NodeSpec)2 SearchNode (com.yahoo.vespa.model.search.SearchNode)2