use of org.apache.ignite.internal.configuration.FirstConfiguration.KEY in project ignite-3 by apache.
the class ConfigurationChangerTest method testModifiedFromAnotherStorageWithIncompatibleChanges.
/**
* Test that subsequent change of configuration is failed if changes are incompatible.
*/
@Test
public void testModifiedFromAnotherStorageWithIncompatibleChanges() throws Exception {
ConfigurationChanger changer1 = createChanger(KEY);
changer1.start();
Validator<MaybeInvalid, Object> validator = new Validator<>() {
/**
* {@inheritDoc}
*/
@Override
public void validate(MaybeInvalid annotation, ValidationContext<Object> ctx) {
ctx.addIssue(new ValidationIssue("foo"));
}
};
ConfigurationChanger changer2 = new TestConfigurationChanger(cgen, List.of(KEY), Map.of(MaybeInvalid.class, Set.of(validator)), storage, List.of(), List.of());
changer2.start();
changer1.change(source(KEY, (FirstChange parent) -> parent.changeChild(change -> change.changeIntCfg(1).changeStrCfg("1")).changeElements(change -> change.create("a", element -> element.changeStrCfg("1"))))).get(1, SECONDS);
assertThrows(ExecutionException.class, () -> changer2.change(source(KEY, (FirstChange parent) -> parent.changeChild(change -> change.changeIntCfg(2).changeStrCfg("2")).changeElements(change -> change.create("a", element -> element.changeStrCfg("2")).create("b", element -> element.changeStrCfg("2"))))).get(1, SECONDS));
FirstView newRoot = (FirstView) changer2.getRootNode(KEY);
assertEquals(1, newRoot.child().intCfg());
assertEquals("1", newRoot.child().strCfg());
assertEquals("1", newRoot.elements().get("a").strCfg());
}
Aggregations