use of com.yahoo.vespa.model.container.Container in project vespa by vespa-engine.
the class RoutingBuilderTest method setsRotationActiveAccordingToDeploymentSpec.
@Test
public void setsRotationActiveAccordingToDeploymentSpec() throws IOException, SAXException {
Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0'><search /></jdisc>");
String deploymentSpec = "<deployment>\n" + " <prod> \n" + " <region active='true'>us-north-1</region>\n" + " <parallel>\n" + " <region active='false'>us-north-2</region>\n" + " <region active='true'>us-north-3</region>\n" + " </parallel>\n" + " <region active='false'>us-north-4</region>\n" + " </prod>\n" + "</deployment>";
ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withDeploymentSpec(deploymentSpec).build();
// root = new MockRoot("root", applicationPackage);
for (String region : Arrays.asList("us-north-1", "us-north-3")) {
Container container = getContainer(applicationPackage, region, clusterElem);
assertEquals("Region " + region + " is active", "true", container.getServicePropertyString("activeRotation"));
}
for (String region : Arrays.asList("us-north-2", "us-north-4")) {
Container container = getContainer(applicationPackage, region, clusterElem);
assertEquals("Region " + region + " is inactive", "false", container.getServicePropertyString("activeRotation"));
}
Container container = getContainer(applicationPackage, "unknown", clusterElem);
assertEquals("Unknown region is inactive", "false", container.getServicePropertyString("activeRotation"));
}
Aggregations