Search in sources :

Example 96 with VespaModel

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());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 97 with VespaModel

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());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 98 with VespaModel

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)));
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) Matchers.containsString(org.hamcrest.Matchers.containsString) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Example 99 with VespaModel

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());
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) AbstractConfigProducerRoot(com.yahoo.config.model.producer.AbstractConfigProducerRoot) VespaModel(com.yahoo.vespa.model.VespaModel) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) Matchers.containsString(org.hamcrest.Matchers.containsString) VipStatusConfig(com.yahoo.container.core.VipStatusConfig) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Example 100 with VespaModel

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"));
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Component(com.yahoo.vespa.model.container.component.Component) ComponentId(com.yahoo.component.ComponentId) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Aggregations

VespaModel (com.yahoo.vespa.model.VespaModel)153 Test (org.junit.Test)135 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)35 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)26 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)21 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)18 DeployState (com.yahoo.config.model.deploy.DeployState)18 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)15 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)14 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)13 Matchers.containsString (org.hamcrest.Matchers.containsString)12 File (java.io.File)8 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)6 ValidationTester (com.yahoo.vespa.model.application.validation.ValidationTester)6 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)6 LogdConfig (com.yahoo.cloud.config.log.LogdConfig)5 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)5 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)5 HostResource (com.yahoo.vespa.model.HostResource)5