use of com.yahoo.vespa.config.server.model.TestModelFactory in project vespa by vespa-engine.
the class SessionPreparerTest method require_that_prepare_fails_if_older_version_fails.
@Test(expected = InvalidApplicationException.class)
public void require_that_prepare_fails_if_older_version_fails() throws IOException {
ModelFactoryRegistry modelFactoryRegistry = new ModelFactoryRegistry(Arrays.asList(new TestModelFactory(Version.fromIntValues(3, 2, 3)), new FailingModelFactory(Version.fromIntValues(1, 2, 1), new IllegalArgumentException("BOOHOO"))));
preparer = createPreparer(modelFactoryRegistry, HostProvisionerProvider.empty());
preparer.prepare(getContext(getApplicationPackage(testApp)), getLogger(), new PrepareParams.Builder().build(), Optional.empty(), tenantPath, Instant.now());
}
use of com.yahoo.vespa.config.server.model.TestModelFactory in project vespa by vespa-engine.
the class SessionPreparerTest method require_that_prepare_succeeds_if_newer_version_fails.
@Test
public void require_that_prepare_succeeds_if_newer_version_fails() throws IOException {
ModelFactoryRegistry modelFactoryRegistry = new ModelFactoryRegistry(Arrays.asList(new TestModelFactory(Version.fromIntValues(1, 2, 3)), new FailingModelFactory(Version.fromIntValues(3, 2, 1), new IllegalArgumentException("BOOHOO"))));
preparer = createPreparer(modelFactoryRegistry, HostProvisionerProvider.empty());
preparer.prepare(getContext(getApplicationPackage(testApp)), getLogger(), new PrepareParams.Builder().build(), Optional.empty(), tenantPath, Instant.now());
}
use of com.yahoo.vespa.config.server.model.TestModelFactory in project vespa by vespa-engine.
the class SessionPreparerTest method require_that_rotations_are_read_from_zookeeper_and_used.
@Test
public void require_that_rotations_are_read_from_zookeeper_and_used() throws IOException {
final Version vespaVersion = Version.fromIntValues(1, 2, 3);
final TestModelFactory modelFactory = new TestModelFactory(vespaVersion);
preparer = createPreparer(new ModelFactoryRegistry(Arrays.asList(modelFactory)), HostProvisionerProvider.empty());
final String rotations = "foo.msbe.global.vespa.yahooapis.com";
final ApplicationId applicationId = applicationId("test");
new Rotations(curator, tenantPath).writeRotationsToZooKeeper(applicationId, Collections.singleton(new Rotation(rotations)));
final PrepareParams params = new PrepareParams.Builder().applicationId(applicationId).build();
final File app = new File("src/test/resources/deploy/app");
preparer.prepare(getContext(getApplicationPackage(app)), getLogger(), params, Optional.empty(), tenantPath, Instant.now());
// check that the rotation from zookeeper were used
final ModelContext modelContext = modelFactory.getModelContext();
final Set<Rotation> rotationSet = modelContext.properties().rotations();
assertThat(rotationSet, contains(new Rotation(rotations)));
// Check that the persisted value is still the same
assertThat(readRotationsFromZK(applicationId), contains(new Rotation(rotations)));
}
Aggregations