use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testNoNodeTagMeans1Node.
@Test
public void testNoNodeTagMeans1Node() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <jdisc id='foo' version='1.0'>" + " <search/>" + " <document-api/>" + " </jdisc>" + " <content version='1.0' id='bar'>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester();
tester.addHosts(1);
VespaModel model = tester.createModel(services, true);
assertEquals(1, model.getRoot().getHostSystem().getHosts().size());
assertEquals(1, model.getAdmin().getSlobroks().size());
assertEquals(1, model.getContainerClusters().get("foo").getContainers().size());
assertEquals(1, model.getContentClusters().get("bar").getRootGroup().countNodes());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testClusterControllersCanSupplementWithAllContainerClusters.
@Test
public void testClusterControllersCanSupplementWithAllContainerClusters() throws ParseException {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='4.0'/>" + " <container version='1.0' id='foo1'>" + " <nodes count='2'/>" + " </container>" + " <container version='1.0' id='foo2'>" + " <nodes count='1'/>" + " </container>" + " <content version='1.0' id='bar'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <controllers><nodes dedicated='false' count='5'/></controllers>" + " <nodes count='2'/>" + " </content>" + "</services>";
int numberOfHosts = 5;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, true);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
ContentCluster cluster = model.getContentClusters().get("bar");
ContainerCluster clusterControllers = cluster.getClusterControllers();
// TODO: Expected 5 with this feature reactivated
assertEquals(1, clusterControllers.getContainers().size());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ContainerModelBuilderTest method fail_if_http_port_is_not_4080_in_hosted_vespa.
@Test
public void fail_if_http_port_is_not_4080_in_hosted_vespa() throws Exception {
String servicesXml = "<services>" + "<admin version='3.0'>" + " <nodes count='1'/>" + "</admin>" + "<jdisc version='1.0'>" + " <http>" + " <server port='9000' id='foo' />" + " </http>" + nodesXml + "</jdisc>" + "</services>";
ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
// Need to create VespaModel to make deploy properties have effect
final MyLogger logger = new MyLogger();
new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().applicationPackage(applicationPackage).deployLogger(logger).properties(new DeployProperties.Builder().hostedVespa(true).build()).build(true));
assertFalse(logger.msgs.isEmpty());
assertThat(logger.msgs.get(0).getSecond(), containsString(String.format("You cannot set port to anything else than %d", Container.BASEPORT)));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ContainerModelBuilderTest method vip_status_handler_uses_file_for_hosted_vespa.
@Test
public void vip_status_handler_uses_file_for_hosted_vespa() throws Exception {
String servicesXml = "<services>" + "<jdisc version='1.0'>" + nodesXml + "</jdisc>" + "</services>";
ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
VespaModel model = new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().applicationPackage(applicationPackage).properties(new DeployProperties.Builder().hostedVespa(true).build()).build(true));
AbstractConfigProducerRoot modelRoot = model.getRoot();
VipStatusConfig vipStatusConfig = modelRoot.getConfig(VipStatusConfig.class, "jdisc/component/status.html-status-handler");
assertTrue(vipStatusConfig.accessdisk());
assertEquals(ContainerModelBuilder.HOSTED_VESPA_STATUS_FILE, vipStatusConfig.statusfile());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ContainerModelBuilderTest method component_includes_are_added.
@Test
public void component_includes_are_added() {
VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg("src/test/cfg/application/include_dirs");
VespaModel model = creator.create(true);
ContainerCluster cluster = model.getContainerClusters().get("default");
Map<ComponentId, Component<?, ?>> componentsMap = cluster.getComponentsMap();
Component<?, ?> example = componentsMap.get(ComponentId.fromString("test.Exampledocproc"));
assertThat(example.getComponentId().getName(), is("test.Exampledocproc"));
}
Aggregations