Search in sources :

Example 6 with Container

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

the class QrserverAndGatewayPortAllocationTest method testPorts.

@Test
public void testPorts() throws IOException, SAXException {
    String appDir = "src/test/cfg/application/app_qrserverandgw/";
    VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg(appDir);
    VespaModel vespaModel = creator.create();
    List<Container> qrservers = vespaModel.getContainerClusters().get("container").getContainers();
    assertThat(qrservers.size(), is(1));
    assertThat(qrservers.get(0).getSearchPort(), is(Container.BASEPORT));
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) Container(com.yahoo.vespa.model.container.Container) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 7 with Container

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

the class ModelProvisioningTest method checkThatTldAndContainerRunningOnSameHostHaveSameId.

private void checkThatTldAndContainerRunningOnSameHostHaveSameId(Collection<ContainerCluster> containerClusters, Collection<ContentCluster> contentClusters, int startIndexForContainerIds) {
    for (ContentCluster contentCluster : contentClusters) {
        String contentClusterName = contentCluster.getName();
        int i = 0;
        for (ContainerCluster containerCluster : containerClusters) {
            String containerClusterName = containerCluster.getName();
            for (int j = 0; j < 2; j++) {
                Dispatch tld = contentCluster.getSearch().getIndexed().getTLDs().get(2 * i + j);
                Container container = containerCluster.getContainers().get(j);
                int containerConfigIdIndex = j + startIndexForContainerIds;
                assertEquals(container.getHostName(), tld.getHostname());
                assertEquals(contentClusterName + "/search/cluster." + contentClusterName + "/tlds/" + containerClusterName + "." + containerConfigIdIndex + ".tld." + containerConfigIdIndex, tld.getConfigId());
                assertEquals(containerClusterName + "/" + "container." + containerConfigIdIndex, container.getConfigId());
            }
            i++;
        }
    }
}
Also used : Container(com.yahoo.vespa.model.container.Container) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Dispatch(com.yahoo.vespa.model.search.Dispatch) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 8 with Container

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

the class DocprocBuilderTest method testDocprocCluster.

// TODO: re-enable assertions when the appropriate attributes are handled by the builder
@Test
public void testDocprocCluster() {
    assertThat(cluster.getName(), is("banan"));
    assertThat(cluster.getDocproc().isCompressDocuments(), is(true));
    // assertThat(cluster.getContainerDocproc().isPreferLocalNode(), is(true));
    // assertThat(cluster.getContainerDocproc().getNumNodesPerClient(), is(2));
    List<Container> services = cluster.getContainers();
    assertThat(services.size(), is(1));
    Container service = services.get(0);
    assertThat(service, notNullValue());
    Map<String, DocprocChain> chains = new HashMap<>();
    for (DocprocChain chain : cluster.getDocprocChains().allChains().allComponents()) {
        chains.put(chain.getId().stringValue(), chain);
    }
    assertThat(chains.size(), is(1));
    DocprocChain chain = chains.get("chein");
    assertThat(chain.getId().stringValue(), is("chein"));
    assertThat(chain.getInnerComponents().size(), is(1));
    DocumentProcessor processor = chain.getInnerComponents().iterator().next();
    assertThat(processor.getComponentId().stringValue(), is("docproc2"));
}
Also used : Container(com.yahoo.vespa.model.container.Container) HashMap(java.util.HashMap) DocumentProcessor(com.yahoo.vespa.model.container.docproc.DocumentProcessor) DocprocChain(com.yahoo.vespa.model.container.docproc.DocprocChain) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 9 with Container

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

the class StandaloneContainerActivatorTest method requireThatPortsCanBeFoundHttpThreeServers.

@Test
public void requireThatPortsCanBeFoundHttpThreeServers() throws IOException, ParserConfigurationException, SAXException {
    final Path applicationDir = Files.createTempDirectory("application");
    try {
        final String contents = "<http>\n" + "  <server id=\"a\" port=\"123\"/>\n" + "  <server id=\"b\" port=\"456\"/>\n" + "  <server id=\"c\" port=\"789\"/>\n" + "</http>\n";
        writeApplicationPackage(getJdiscXml(contents), applicationDir);
        StandaloneContainerActivator activator = new StandaloneContainerActivator();
        Container container = StandaloneContainerActivator.getContainer(newAppDirBinding(applicationDir));
        List<Integer> ports = getPorts(activator, container);
        assertThat(ports, is(asList(123, 456, 789)));
    } finally {
        IOUtils.recursiveDeleteDir(applicationDir.toFile());
    }
}
Also used : Path(java.nio.file.Path) Container(com.yahoo.vespa.model.container.Container) Test(org.junit.Test)

Example 10 with Container

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

the class StandaloneContainerActivatorTest method requireThatPortsCanBeFoundBasic.

@Test
public void requireThatPortsCanBeFoundBasic() throws IOException, ParserConfigurationException, SAXException {
    final Path applicationDir = Files.createTempDirectory("application");
    try {
        writeApplicationPackage(getJdiscXml(""), applicationDir);
        StandaloneContainerActivator activator = new StandaloneContainerActivator();
        Container container = StandaloneContainerActivator.getContainer(newAppDirBinding(applicationDir));
        List<Integer> ports = getPorts(activator, container);
        assertThat(ports, is(singletonList(Defaults.getDefaults().vespaWebServicePort())));
    } finally {
        IOUtils.recursiveDeleteDir(applicationDir.toFile());
    }
}
Also used : Path(java.nio.file.Path) Container(com.yahoo.vespa.model.container.Container) Test(org.junit.Test)

Aggregations

Container (com.yahoo.vespa.model.container.Container)16 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)4 Element (org.w3c.dom.Element)4 Path (java.nio.file.Path)3 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 HostResource (com.yahoo.vespa.model.HostResource)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)2 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)2 ZookeeperServerConfig (com.yahoo.cloud.config.ZookeeperServerConfig)1 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)1 ClusterMembership (com.yahoo.config.provision.ClusterMembership)1 ClusterControllerCluster (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerCluster)1 ClusterControllerClusterVerifier (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerClusterVerifier)1 ClusterControllerContainer (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer)1 DocprocChain (com.yahoo.vespa.model.container.docproc.DocprocChain)1 DocumentProcessor (com.yahoo.vespa.model.container.docproc.DocumentProcessor)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1