use of com.yahoo.vespa.model.VespaModel 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));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class SingleNodeProvisionerTest method require_allocate_clustermembership_works.
@Test
public void require_allocate_clustermembership_works() throws IOException, SAXException {
String servicesXml = "<services version='1.0'>" + " <admin version='3.0'>" + " <nodes count='1' />" + " </admin>" + " <jdisc version='1.0'>" + " <search />" + " <nodes count='1' />" + " </jdisc>" + "</services>";
ApplicationPackage app = new MockApplicationPackage.Builder().withServices(servicesXml).build();
VespaModel model = new VespaModel(app);
assertThat(model.getHosts().size(), is(1));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ClusterControllerConfig method getConfig.
@Override
public void getConfig(FleetcontrollerConfig.Builder builder) {
AbstractConfigProducerRoot root = getRoot();
if (root instanceof VespaModel) {
String zooKeeperAddress = root.getAdmin().getZooKeepersConfigProvider().getZooKeepersConnectionSpec();
builder.zookeeper_server(zooKeeperAddress);
} else {
builder.zookeeper_server("");
}
builder.index(0);
builder.cluster_name(clusterName);
builder.fleet_controller_count(getChildren().size());
if (initProgressTime != null) {
builder.init_progress_time((int) initProgressTime.getMilliSeconds());
}
if (transitionTime != null) {
builder.storage_transition_time((int) transitionTime.getMilliSeconds());
}
if (maxPrematureCrashes != null) {
builder.max_premature_crashes(maxPrematureCrashes.intValue());
}
if (stableStateTimePeriod != null) {
builder.stable_state_time_period((int) stableStateTimePeriod.getMilliSeconds());
}
if (minDistributorUpRatio != null) {
builder.min_distributor_up_ratio(minDistributorUpRatio);
}
if (minStorageUpRatio != null) {
builder.min_storage_up_ratio(minStorageUpRatio);
}
if (minSplitBits != null) {
builder.ideal_distribution_bits(minSplitBits);
}
if (minNodeRatioPerGroup != null) {
builder.min_node_ratio_per_group(minNodeRatioPerGroup);
}
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testUsingNodesCountAttributesAndGettingTooFewNodes.
@Test
public void testUsingNodesCountAttributesAndGettingTooFewNodes() {
String services = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + " <admin version='3.0'>" + // Ignored
" <nodes count='3'/>" + " </admin>" + " <content version='1.0' id='bar'>" + " <redundancy reply-after='8'>12</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='24'/>" + " <engine><proton><searchable-copies>5</searchable-copies></proton></engine>" + " <dispatch><num-dispatch-groups>7</num-dispatch-groups></dispatch>" + " </content>" + "</services>";
int numberOfHosts = 4;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, false);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
ContentCluster cluster = model.getContentClusters().get("bar");
assertEquals(4, cluster.redundancy().effectiveInitialRedundancy());
assertEquals(4, cluster.redundancy().effectiveFinalRedundancy());
assertEquals(4, cluster.redundancy().effectiveReadyCopies());
assertEquals(4, cluster.getSearch().getIndexed().getDispatchSpec().getGroups().size());
assertFalse(cluster.getRootGroup().getPartitions().isPresent());
assertEquals(4, cluster.getRootGroup().getNodes().size());
assertEquals(0, cluster.getRootGroup().getSubgroups().size());
assertThat(cluster.getRootGroup().getNodes().size(), is(4));
assertThat(cluster.getRootGroup().getNodes().get(0).getDistributionKey(), is(0));
assertThat(cluster.getRootGroup().getNodes().get(0).getConfigId(), is("bar/storage/0"));
assertThat(cluster.getRootGroup().getNodes().get(1).getDistributionKey(), is(1));
assertThat(cluster.getRootGroup().getNodes().get(1).getConfigId(), is("bar/storage/1"));
assertThat(cluster.getRootGroup().getNodes().get(2).getDistributionKey(), is(2));
assertThat(cluster.getRootGroup().getNodes().get(2).getConfigId(), is("bar/storage/2"));
assertThat(cluster.getRootGroup().getNodes().get(3).getDistributionKey(), is(3));
assertThat(cluster.getRootGroup().getNodes().get(3).getConfigId(), is("bar/storage/3"));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testThatStandaloneSyntaxWorksOnHostedVespa.
@Test
public void testThatStandaloneSyntaxWorksOnHostedVespa() {
String services = "<?xml version='1.0' encoding='utf-8' ?>" + "<jdisc id='foo' version='1.0'>" + " <http>" + " <server id='server1' port='" + getDefaults().vespaWebServicePort() + "' />" + " </http>" + "</jdisc>";
VespaModelTester tester = new VespaModelTester();
tester.addHosts(1);
VespaModel model = tester.createModel(services, true);
assertThat(model.getHosts().size(), is(1));
assertThat(model.getContainerClusters().size(), is(1));
}
Aggregations