use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class StartupCommandChangeValidatorTest method createRootWithChildren.
private static MockRoot createRootWithChildren(AbstractConfigProducer<?>... children) {
MockRoot root = new MockRoot();
Arrays.asList(children).forEach(root::addChild);
root.freezeModelTopology();
return root;
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class StartupCommandChangeValidatorTest method requireEmptyResultForDifferentServices.
@Test
public void requireEmptyResultForDifferentServices() {
MockRoot oldRoot = createRootWithChildren(new ServiceStub("evilservice", "./hax.sh"));
MockRoot newRoot = createRootWithChildren(new ServiceStub("goodservice", "./hax.sh"));
List<ConfigChangeAction> changes = getStartupCommandChanges(oldRoot, newRoot);
assertTrue(changes.isEmpty());
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ConfigValueChangeValidatorTest method requireThatValidatorDetectsConfigChangeFromParentProducer.
@Test
public void requireThatValidatorDetectsConfigChangeFromParentProducer() {
MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p", 1).withChildren(new ServiceWithAnnotation("s1", 0), new ServiceWithAnnotation("s2", 0)));
MockRoot newRoot = createRootWithChildren(new SimpleConfigProducer("p", 2).withChildren(new ServiceWithAnnotation("s1", 0), new ServiceWithAnnotation("s2", 0)));
List<ConfigChangeAction> changes = getConfigChanges(oldRoot, newRoot);
assertEquals(2, changes.size());
assertComponentsEquals(changes, "p/s1", 0);
assertComponentsEquals(changes, "p/s2", 1);
assertEmptyLog();
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ConfigValueChangeValidatorTest method requireThatValidatorDetectsConfigChangeFromService.
@Test
public void requireThatValidatorDetectsConfigChangeFromService() {
MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p", 0).withChildren(new ServiceWithAnnotation("s1", 1), new ServiceWithAnnotation("s2", 2)));
MockRoot newRoot = createRootWithChildren(new SimpleConfigProducer("p", 0).withChildren(new ServiceWithAnnotation("s1", 3), new ServiceWithAnnotation("s2", 4)));
List<ConfigChangeAction> changes = getConfigChanges(oldRoot, newRoot);
assertEquals(2, changes.size());
assertComponentsEquals(changes, "p/s1", 0);
assertComponentsEquals(changes, "p/s2", 1);
assertEquals("anotherrestart.anothervalue has changed from 1 to 3", changes.get(0).getMessage());
assertEquals("anotherrestart.anothervalue has changed from 2 to 4", changes.get(1).getMessage());
assertEmptyLog();
}
use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.
the class ConfigValueChangeValidatorTest method requireThatConfigHasRestartMethods.
@Test(expected = IllegalStateException.class)
public void requireThatConfigHasRestartMethods() {
MockRoot root = createRootWithChildren(new ConfigWithMissingMethodsAnnotatedService(""));
getConfigChanges(root, root);
}
Aggregations