use of com.yahoo.config.model.NullConfigModelRegistry in project vespa by vespa-engine.
the class ContainerModelBuilderTest method singlenode_servicespec_is_used_with_hosted_vespa.
@Test
public void singlenode_servicespec_is_used_with_hosted_vespa() throws IOException, SAXException {
String servicesXml = "<jdisc id='default' version='1.0' />";
ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
VespaModel model = new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().modelHostProvisioner(new InMemoryProvisioner(true, "host1.yahoo.com", "host2.yahoo.com")).applicationPackage(applicationPackage).properties(new DeployProperties.Builder().multitenant(true).hostedVespa(true).build()).build(true));
assertEquals(1, model.getHostSystem().getHosts().size());
}
use of com.yahoo.config.model.NullConfigModelRegistry in project vespa by vespa-engine.
the class VespaModelFactoryTest method testThatFactoryModelValidationFailsWithIllegalArgumentException.
// Uses an application package that throws IllegalArgumentException when validating
@Test(expected = IllegalArgumentException.class)
public void testThatFactoryModelValidationFailsWithIllegalArgumentException() {
VespaModelFactory modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
modelFactory.createAndValidateModel(new MockModelContext(createApplicationPackageThatFailsWhenValidating()), false);
}
use of com.yahoo.config.model.NullConfigModelRegistry in project vespa by vespa-engine.
the class VespaModelFactoryTest method testThatFactoryModelValidationFails.
// Uses a MockApplicationPackage that throws throws UnsupportedOperationException (rethrown as RuntimeException) when validating
@Test(expected = RuntimeException.class)
public void testThatFactoryModelValidationFails() {
VespaModelFactory modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
modelFactory.createAndValidateModel(testModelContext, false);
}
use of com.yahoo.config.model.NullConfigModelRegistry 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.NullConfigModelRegistry in project vespa by vespa-engine.
the class VespaModelTestCase method testDeployLogger.
@Test
public void testDeployLogger() throws IOException, SAXException {
final String services = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<services version=\"1.0\">" + "<config name=\"unknsownfoo\">" + "<logserver><host>foo</host></logserver>" + "</config>" + "<admin version=\"2.0\">" + " <adminserver hostalias=\"node0\" />" + "</admin>" + "</services>";
MyLogger logger = new MyLogger();
final DeployState.Builder builder = new DeployState.Builder();
builder.modelHostProvisioner(new HostsXmlProvisioner(new StringReader(simpleHosts)));
ApplicationPackage app = new MockApplicationPackage.Builder().withHosts(simpleHosts).withServices(services).build();
DeployState deployState = builder.deployLogger(logger).applicationPackage(app).build(true);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
Validation.validate(model, true, deployState);
assertFalse(logger.msgs.isEmpty());
}
Aggregations