use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class VespaModelTestCase method testHostsConfig.
@Test
public void testHostsConfig() {
VespaModel model = getVespaModel(TESTDIR + "app_qrserverandgw");
LogdConfig config = getLogdConfig(model, "");
assertEquals(config.logserver().host(), HostName.getLocalhost());
assertNotNull(config);
config = getLogdConfig(model, "hosts");
assertNotNull(config);
assertEquals(config.logserver().host(), HostName.getLocalhost());
}
use of com.yahoo.vespa.model.VespaModel 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());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class VespaModelTestCase method testConfigLists.
@Test
public void testConfigLists() {
VespaModel model = getVespaModel(TESTDIR + "app_nohosts/");
assertTrue(model.allConfigsProduced().size() > 0);
assertTrue(model.allConfigIds().size() > 0);
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class VespaModelCreatorWithMockPkg method create.
public VespaModel create(boolean validate, DeployState deployState, ConfigModelRegistry configModelRegistry) {
try {
this.deployState = deployState;
VespaModel model = new VespaModel(configModelRegistry, deployState);
Version vespaVersion = new Version(6);
if (validate) {
SchemaValidators validators = new SchemaValidators(vespaVersion);
try {
if (appPkg.getHosts() != null) {
validators.hostsXmlValidator().validate(appPkg.getHosts());
}
if (appPkg.getDeployment().isPresent()) {
validators.deploymentXmlValidator().validate(appPkg.getDeployment().get());
}
validators.servicesXmlValidator().validate(appPkg.getServices());
} catch (Exception e) {
System.err.println(e.getClass());
throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
}
// Validate, but without checking configSources or routing (routing
// is constructed in a special way and cannot always be validated in
// this step for unit tests)
configChangeActions = Validation.validate(model, false, false, deployState);
}
return model;
} catch (Exception e) {
e.printStackTrace();
throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
}
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ApplicationTest method setupHandler.
@Before
public void setupHandler() throws IOException, SAXException {
File testApp = new File("src/test/apps/app");
ServerCache cache = createCacheAndAddContent();
VespaModel model = new VespaModel(FilesApplicationPackage.fromFile(testApp));
final ApplicationId applicationId = new ApplicationId.Builder().tenant("foo").applicationName("foo").build();
handler = new Application(model, cache, 1, Version.fromIntValues(1, 2, 3), new MetricUpdater(Metrics.createTestMetrics(), Metrics.createDimensions(applicationId)), applicationId);
}
Aggregations