use of com.yahoo.vespa.model.container.Container in project vespa by vespa-engine.
the class StandaloneContainerActivatorTest method requireThatPortsCanBeFoundNoHttp.
@Test
public void requireThatPortsCanBeFoundNoHttp() throws IOException, ParserConfigurationException, SAXException {
final Path applicationDir = Files.createTempDirectory("application");
try {
writeApplicationPackage(getJdiscXml("<http/>"), applicationDir);
StandaloneContainerActivator activator = new StandaloneContainerActivator();
Container container = StandaloneContainerActivator.getContainer(newAppDirBinding(applicationDir));
List<Integer> ports = getPorts(activator, container);
assertThat(ports, empty());
} finally {
IOUtils.recursiveDeleteDir(applicationDir.toFile());
}
}
use of com.yahoo.vespa.model.container.Container in project vespa by vespa-engine.
the class ModelProvisioningTest method testCombinedClusterWithJvmArgs.
@Test
public void testCombinedClusterWithJvmArgs() {
String xmlWithNodes = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + " <container version='1.0' id='container1'>" + " <document-processing/>" + " <nodes of='content1' jvmargs='testarg'/>" + " </container>" + " <content version='1.0' id='content1'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester();
tester.addHosts(2);
VespaModel model = tester.createModel(xmlWithNodes, true);
assertEquals("Nodes in content1", 2, model.getContentClusters().get("content1").getRootGroup().getNodes().size());
assertEquals("Nodes in container1", 2, model.getContainerClusters().get("container1").getContainers().size());
for (Container container : model.getContainerClusters().get("container1").getContainers()) assertTrue(container.getJvmArgs().contains("testarg"));
}
use of com.yahoo.vespa.model.container.Container in project vespa by vespa-engine.
the class IndexedSearchCluster method addTldsWithSameIdsAsContainers.
/**
* Make sure to allocate tld with same id as container (i.e if container cluster name is 'foo', with containers
* with index 0,1,2 the tlds created will get names ../foo.0.tld.0, ../foo.1.tld.1, ../foo.2.tld.2, so that tld config id is
* stable no matter what changes are done to the number of containers in a container cluster
* @param tldParent the indexed search cluster the tlds to add should be connected to
* @param containerCluster the container cluster that should use the tlds created for searching the indexed search cluster above
*/
public void addTldsWithSameIdsAsContainers(AbstractConfigProducer tldParent, ContainerCluster containerCluster) {
for (Container container : containerCluster.getContainers()) {
String containerSubId = container.getSubId();
if (!containerSubId.contains(".")) {
throw new RuntimeException("Expected container sub id to be of the form string.number");
}
int containerIndex = Integer.parseInt(containerSubId.split("\\.")[1]);
String containerClusterName = containerCluster.getName();
log.log(LogLevel.DEBUG, "Adding tld with index " + containerIndex + " for content cluster " + this.getClusterName() + ", container cluster " + containerClusterName + " (container id " + containerSubId + ") on host " + container.getHostResource().getHostname());
rootDispatch.addDispatcher(createTld(tldParent, container.getHostResource(), containerClusterName, containerIndex));
}
}
use of com.yahoo.vespa.model.container.Container in project vespa by vespa-engine.
the class ContainerModelBuilder method addStandaloneNode.
private void addStandaloneNode(ContainerCluster cluster) {
Container container = new Container(cluster, "standalone", cluster.getContainers().size());
cluster.addContainers(Collections.singleton(container));
}
use of com.yahoo.vespa.model.container.Container in project vespa by vespa-engine.
the class ClusterControllerCluster method getConfig.
@Override
public void getConfig(ZookeeperServerConfig.Builder builder) {
builder.clientPort(ZK_CLIENT_PORT);
for (Container c : containerCluster.getContainers()) {
ClusterControllerContainer container = (ClusterControllerContainer) c;
ZookeeperServerConfig.Server.Builder serverBuilder = new ZookeeperServerConfig.Server.Builder();
serverBuilder.hostname(container.getHostName());
serverBuilder.id(container.getIndex());
builder.server(serverBuilder);
}
}
Aggregations