use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.
the class ConfigModelRepo method getPermanentServices.
private Collection<Element> getPermanentServices(DeployState deployState) throws IOException, SAXException {
List<Element> permanentServices = new ArrayList<>();
Optional<ApplicationPackage> applicationPackage = deployState.getPermanentApplicationPackage();
if (applicationPackage.isPresent()) {
ApplicationFile file = applicationPackage.get().getFile(Path.fromString(ApplicationPackage.PERMANENT_SERVICES));
if (file.exists()) {
try (Reader reader = file.createReader()) {
Element permanentServicesRoot = getServicesFromReader(reader);
permanentServices.addAll(getServiceElements(permanentServicesRoot));
}
}
}
return permanentServices;
}
use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.
the class DeployStateTest method testBuilder.
@Test
public void testBuilder() {
DeployState.Builder builder = new DeployState.Builder();
ApplicationPackage app = MockApplicationPackage.createEmpty();
builder.permanentApplicationPackage(Optional.of(app));
DeployState state = builder.build(true);
assertThat(state.getPermanentApplicationPackage().get(), is(app));
}
use of com.yahoo.config.application.api.ApplicationPackage 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.config.application.api.ApplicationPackage in project vespa by vespa-engine.
the class ValidationTester method deploy.
/**
* Deploys an application
*
* @param previousModel the previous model, or null if no previous
* @param services the services file content
* @param validationOverrides the validation overrides file content, or null if none
* @return the new model and any change actions
*/
public Pair<VespaModel, List<ConfigChangeAction>> deploy(VespaModel previousModel, String services, String validationOverrides) {
Instant now = LocalDate.parse("2000-01-01", DateTimeFormatter.ISO_DATE).atStartOfDay().atZone(ZoneOffset.UTC).toInstant();
ApplicationPackage newApp = new MockApplicationPackage.Builder().withServices(services).withSearchDefinition(MockApplicationPackage.MUSIC_SEARCHDEFINITION).withValidationOverrides(validationOverrides).build();
VespaModelCreatorWithMockPkg newModelCreator = new VespaModelCreatorWithMockPkg(newApp);
DeployState.Builder deployStateBuilder = new DeployState.Builder().applicationPackage(newApp).properties(new DeployProperties.Builder().hostedVespa(true).build()).modelHostProvisioner(new InMemoryProvisioner(nodeCount)).now(now);
if (previousModel != null)
deployStateBuilder.previousModel(previousModel);
VespaModel newModel = newModelCreator.create(deployStateBuilder);
return new Pair<>(newModel, newModelCreator.configChangeActions);
}
use of com.yahoo.config.application.api.ApplicationPackage in project vespa by vespa-engine.
the class ContainerModelBuilderTest method qrconfig_is_produced.
@Test
public void qrconfig_is_produced() throws IOException, SAXException {
String servicesXml = "<services>" + "<admin version='3.0'>" + " <nodes count='1'/>" + "</admin>" + "<jdisc id ='default' version='1.0'>" + " <nodes>" + " <node hostalias='node1' />" + " </nodes>" + "</jdisc>" + "</services>";
ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
VespaModel model = new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().applicationPackage(applicationPackage).properties(new DeployProperties.Builder().build()).build(true));
// Using the same way of getting hostname as filedistribution model
String hostname = HostName.getLocalhost();
QrConfig config = model.getConfig(QrConfig.class, "default/container.0");
assertEquals("default.container.0", config.discriminator());
assertEquals(19102, config.rpc().port());
assertEquals("vespa/service/default/container.0", config.rpc().slobrokId());
assertEquals(true, config.rpc().enabled());
assertEquals("", config.rpc().host());
assertEquals(false, config.restartOnDeploy());
assertEquals(false, config.coveragereports());
assertEquals("filedistribution/" + hostname, config.filedistributor().configid());
}
Aggregations