use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class AccessControlValidatorTest method write_protection_is_not_required_for_non_default_application_type.
@Test
public void write_protection_is_not_required_for_non_default_application_type() throws IOException, SAXException {
String servicesXml = joinLines("<services version='1.0' application-type='hosted-infrastructure'>", " <container id='default' version='1.0'>", httpHandlerXml, " </container>", "</services>");
DeployState deployState = deployState(servicesXml);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
new AccessControlValidator().validate(model, deployState);
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class ContainerClusterTest method createContainerCluster.
private ContainerCluster createContainerCluster(boolean isHosted, boolean isCombinedCluster, Optional<Integer> memoryPercentage, Optional<ContainerClusterVerifier> extraComponents) {
DeployState state = new DeployState.Builder().properties(new DeployProperties.Builder().hostedVespa(isHosted).build()).build(true);
MockRoot root = new MockRoot("foo", state);
ContainerCluster cluster = extraComponents.isPresent() ? new ContainerCluster(root, "container0", "container1", extraComponents.get()) : new ContainerCluster(root, "container0", "container1");
if (isCombinedCluster)
cluster.setHostClusterId("test-content-cluster");
cluster.setMemoryPercentage(memoryPercentage);
cluster.setSearch(new ContainerSearch(cluster, new SearchChains(cluster, "search-chain"), new ContainerSearch.Options()));
return cluster;
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class ContainerModelBuilderTest method http_aliases_are_only_honored_in_prod_environment.
@Test
public void http_aliases_are_only_honored_in_prod_environment() throws SAXException, IOException {
Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0'>", " <aliases>", " <service-alias>service1</service-alias>", " <endpoint-alias>foo1.bar1.com</endpoint-alias>", " </aliases>", " <nodes>", " <node hostalias='host1' />", " </nodes>", "</jdisc>");
DeployState deployState = new DeployState.Builder().zone(new Zone(Environment.dev, RegionName.from("us-east-1"))).build(true);
createModel(root, deployState, clusterElem);
assertEquals(0, getContainerCluster("default").serviceAliases().size());
assertEquals(0, getContainerCluster("default").endpointAliases().size());
assertNull(getContainerCluster("default").getContainers().get(0).getServicePropertyString("servicealiases"));
assertNull(getContainerCluster("default").getContainers().get(0).getServicePropertyString("endpointaliases"));
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class DeploymentFileValidatorTest method testDeploymentWithNonExistentGlobalId.
@Test
public void testDeploymentWithNonExistentGlobalId() throws IOException, SAXException {
final String simpleHosts = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<hosts> " + "<host name=\"localhost\">" + "<alias>node0</alias>" + "</host>" + "</hosts>";
final String services = "<services version='1.0'>" + " <admin version='2.0'>" + " <adminserver hostalias='node0' />" + " </admin>" + " <jdisc id='default' version='1.0'>" + " <search/>" + " <nodes>" + " <node hostalias='node0'/>" + " </nodes>" + " </jdisc>" + "</services>";
final String deploymentSpec = "<?xml version='1.0' encoding='UTF-8'?>" + "<deployment version='1.0'>" + " <test />" + " <prod global-service-id='non-existing'>" + " <region active='true'>us-east</region>" + " </prod>" + "</deployment>";
ApplicationPackage app = new MockApplicationPackage.Builder().withHosts(simpleHosts).withServices(services).withDeploymentSpec(deploymentSpec).build();
DeployState.Builder builder = new DeployState.Builder().applicationPackage(app);
try {
final DeployState deployState = builder.build(true);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
new DeploymentFileValidator().validate(model, deployState);
fail("Did not get expected exception");
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), containsString("specified in deployment.xml does not match any container cluster id"));
}
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class IndexedTest method requireMultipleDocumentTypes.
@Test
public void requireMultipleDocumentTypes() {
VespaModelCreatorWithMockPkg creator = getIndexedVespaModelCreator();
VespaModel model = creator.create();
DeployState deployState = creator.deployState;
IndexedSearchCluster cluster = model.getContentClusters().get("test").getSearch().getIndexed();
assertEquals(3, cluster.getDocumentDbs().size());
NewDocumentType type1 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type1");
NewDocumentType type2 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type2");
NewDocumentType type3 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type3");
assertNotNull(type1);
assertNotNull(type2);
assertNotNull(type3);
}
Aggregations