use of com.yahoo.config.model.NullConfigModelRegistry in project vespa by vespa-engine.
the class AccessControlValidatorTest method cluster_with_mbus_handler_passes_validation_without_write_protection.
@Test
public void cluster_with_mbus_handler_passes_validation_without_write_protection() throws IOException, SAXException {
String servicesXml = joinLines("<services version='1.0'>", " <container id='default' version='1.0'>", " <handler id='foo'>", " <binding>mbus://*/foo</binding>", " </handler>", " </container>", "</services>");
DeployState deployState = deployState(servicesXml);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
new AccessControlValidator().validate(model, deployState);
}
use of com.yahoo.config.model.NullConfigModelRegistry in project vespa by vespa-engine.
the class VespaModelTestCase method testNoMultitenantHostExported.
@Test
public void testNoMultitenantHostExported() throws IOException, SAXException {
ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices("<services version='1.0'><admin version='3.0'><nodes count='1' /></admin></services>").build();
DeployState deployState = new DeployState.Builder().applicationPackage(applicationPackage).modelHostProvisioner(new InMemoryProvisioner(true, "host1.yahoo.com")).properties(new DeployProperties.Builder().configServerSpecs(Arrays.asList(new Configserver.Spec("cfghost", 1234, 1235, 1236))).multitenant(true).build()).build(true);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
AllocatedHosts info = model.allocatedHosts();
assertEquals("Admin version 3 is ignored, and there are no other hosts to borrow for admin services", 0, info.getHosts().size());
}
use of com.yahoo.config.model.NullConfigModelRegistry in project vespa by vespa-engine.
the class VespaModelTestCase method testPermanentServices.
@Test
public void testPermanentServices() throws IOException, SAXException {
ApplicationPackage app = MockApplicationPackage.createEmpty();
DeployState.Builder builder = new DeployState.Builder().applicationPackage(app);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), builder.build(true));
assertThat(model.getContainerClusters().size(), is(0));
model = new VespaModel(new NullConfigModelRegistry(), builder.permanentApplicationPackage(Optional.of(FilesApplicationPackage.fromFile(new File(TESTDIR, "app_permanent")))).build(true));
assertThat(model.getContainerClusters().size(), is(1));
}
use of com.yahoo.config.model.NullConfigModelRegistry in project vespa by vespa-engine.
the class SessionActiveHandlerTest method setup.
@Before
public void setup() throws Exception {
remoteSessionRepo = new RemoteSessionRepo(tenant);
applicationRepo = new MemoryTenantApplications();
curator = new MockCurator();
configCurator = ConfigCurator.create(curator);
localRepo = new LocalSessionRepo(Clock.systemUTC());
pathPrefix = "/application/v2/tenant/" + tenant + "/session/";
hostProvisioner = new MockProvisioner();
modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
componentRegistry = new TestComponentRegistry.Builder().curator(curator).configCurator(configCurator).modelFactoryRegistry(new ModelFactoryRegistry(Collections.singletonList(modelFactory))).build();
}
use of com.yahoo.config.model.NullConfigModelRegistry in project vespa by vespa-engine.
the class RemoteSessionTest method require_that_applications_are_loaded.
@Test
public void require_that_applications_are_loaded() throws IOException, SAXException {
RemoteSession session = createSession(3, Arrays.asList(new MockModelFactory(), new VespaModelFactory(new NullConfigModelRegistry())), Clock.systemUTC());
session.loadPrepared();
ApplicationSet applicationSet = session.ensureApplicationLoaded();
assertNotNull(applicationSet);
assertThat(applicationSet.getApplicationGeneration(), is(3l));
assertThat(applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).getId().application().value(), is("foo"));
assertNotNull(applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).getModel());
session.deactivate();
applicationSet = session.ensureApplicationLoaded();
assertNotNull(applicationSet);
assertThat(applicationSet.getApplicationGeneration(), is(3l));
assertThat(applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).getId().application().value(), is("foo"));
assertNotNull(applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()).getModel());
}
Aggregations