use of org.apache.ignite.internal.configuration.storage.TestConfigurationStorage in project ignite-3 by apache.
the class ConfigurationPresentationTest method beforeAll.
/**
* Before all.
*/
@BeforeAll
static void beforeAll() {
Validator<Value, Object> validator = new Validator<>() {
/**
* {@inheritDoc}
*/
@Override
public void validate(Value annotation, ValidationContext<Object> ctx) {
if (Objects.equals("error", ctx.getNewValue())) {
ctx.addIssue(new ValidationIssue("Error word"));
}
}
};
cfgRegistry = new ConfigurationRegistry(List.of(TestRootConfiguration.KEY), Map.of(Value.class, Set.of(validator)), new TestConfigurationStorage(LOCAL), List.of(), List.of());
cfgRegistry.start();
cfgPresentation = new HoconPresentation(cfgRegistry);
cfg = cfgRegistry.getConfiguration(TestRootConfiguration.KEY);
}
use of org.apache.ignite.internal.configuration.storage.TestConfigurationStorage in project ignite-3 by apache.
the class ConfigurationRegistryTest method testValidationInternalConfigurationExtensions.
@Test
void testValidationInternalConfigurationExtensions() {
assertThrows(IllegalArgumentException.class, () -> new ConfigurationRegistry(List.of(SecondRootConfiguration.KEY), Map.of(), new TestConfigurationStorage(LOCAL), List.of(ExtendedFirstRootConfigurationSchema.class), List.of()));
// Check that everything is fine.
ConfigurationRegistry configRegistry = new ConfigurationRegistry(List.of(FirstRootConfiguration.KEY, SecondRootConfiguration.KEY), Map.of(), new TestConfigurationStorage(LOCAL), List.of(ExtendedFirstRootConfigurationSchema.class), List.of());
configRegistry.stop();
}
use of org.apache.ignite.internal.configuration.storage.TestConfigurationStorage in project ignite-3 by apache.
the class ConfigurationAsmGeneratorTest method beforeEach.
@BeforeEach
void beforeEach() {
Collection<Class<?>> internalExtensions = List.of(ExtendedTestRootConfigurationSchema.class, ExtendedSecondTestRootConfigurationSchema.class, ExtendedTestConfigurationSchema.class, ExtendedSecondTestConfigurationSchema.class);
Collection<Class<?>> polymorphicExtensions = List.of(FirstPolymorphicInstanceTestConfigurationSchema.class, SecondPolymorphicInstanceTestConfigurationSchema.class, NonDefaultPolymorphicInstanceTestConfigurationSchema.class, FirstPolymorphicNamedInstanceTestConfigurationSchema.class, SecondPolymorphicNamedInstanceTestConfigurationSchema.class, PolyInst0InjectedNameConfigurationSchema.class, PolyInst1InjectedNameConfigurationSchema.class);
changer = new TestConfigurationChanger(generator, List.of(TestRootConfiguration.KEY, InjectedNameRootConfiguration.KEY), Map.of(), new TestConfigurationStorage(LOCAL), internalExtensions, polymorphicExtensions);
changer.start();
changer.initializeDefaults();
}
use of org.apache.ignite.internal.configuration.storage.TestConfigurationStorage in project ignite-3 by apache.
the class ConfigurationAnyListenerTest method before.
/**
* Before each.
*/
@BeforeEach
public void before() throws Exception {
registry = new ConfigurationRegistry(List.of(RootConfiguration.KEY), Map.of(), new TestConfigurationStorage(LOCAL), List.of(), List.of(FirstPolyAnyConfigurationSchema.class, SecondPolyAnyConfigurationSchema.class));
registry.start();
registry.initializeDefaults();
rootConfig = registry.getConfiguration(RootConfiguration.KEY);
// Add "regular" listeners.
rootConfig.listen(configListener(ctx -> events.add("root")));
rootConfig.child().listen(configListener(ctx -> events.add("root.child")));
rootConfig.child().str().listen(configListener(ctx -> events.add("root.child.str")));
rootConfig.child().child2().listen(configListener(ctx -> events.add("root.child.child2")));
rootConfig.child().child2().intVal().listen(configListener(ctx -> events.add("root.child.child2.i")));
rootConfig.elements().listen(configListener(ctx -> events.add("root.elements")));
rootConfig.elements().listenElements(configNamedListenerOnCreate(ctx -> events.add("root.elements.onCrt")));
rootConfig.elements().listenElements(configNamedListenerOnUpdate(ctx -> events.add("root.elements.onUpd")));
rootConfig.elements().listenElements(configNamedListenerOnRename(ctx -> events.add("root.elements.onRen")));
rootConfig.elements().listenElements(configNamedListenerOnDelete(ctx -> events.add("root.elements.onDel")));
rootConfig.elements().change(c -> c.create("0", doNothingConsumer())).get(1, SECONDS);
FirstSubConfiguration childCfg = this.rootConfig.elements().get("0");
childCfg.listen(configListener(ctx -> events.add("root.elements.0")));
childCfg.str().listen(configListener(ctx -> events.add("root.elements.0.str")));
childCfg.child2().listen(configListener(ctx -> events.add("root.elements.0.child2")));
childCfg.child2().intVal().listen(configListener(ctx -> events.add("root.elements.0.child2.i")));
NamedConfigurationTree<SecondSubConfiguration, SecondSubView, SecondSubChange> elements2 = childCfg.elements2();
elements2.listen(configListener(ctx -> events.add("root.elements.0.elements2")));
elements2.listenElements(configNamedListenerOnCreate(ctx -> events.add("root.elements.0.elements2.onCrt")));
elements2.listenElements(configNamedListenerOnUpdate(ctx -> events.add("root.elements.0.elements2.onUpd")));
elements2.listenElements(configNamedListenerOnRename(ctx -> events.add("root.elements.0.elements2.onRen")));
elements2.listenElements(configNamedListenerOnDelete(ctx -> events.add("root.elements.0.elements2.onDel")));
elements2.change(c -> c.create("0", doNothingConsumer())).get(1, SECONDS);
SecondSubConfiguration child2 = elements2.get("0");
child2.listen(configListener(ctx -> events.add("root.elements.0.elements2.0")));
child2.intVal().listen(configListener(ctx -> events.add("root.elements.0.elements2.0.i")));
// Adding "any" listeners.
FirstSubConfiguration anyChild = rootConfig.elements().any();
anyChild.listen(configListener(ctx -> events.add("root.elements.any")));
anyChild.str().listen(configListener(ctx -> events.add("root.elements.any.str")));
anyChild.child2().listen(configListener(ctx -> events.add("root.elements.any.child2")));
anyChild.child2().intVal().listen(configListener(ctx -> events.add("root.elements.any.child2.i")));
NamedConfigurationTree<SecondSubConfiguration, SecondSubView, SecondSubChange> anyEl2 = anyChild.elements2();
anyEl2.listen(configListener(ctx -> events.add("root.elements.any.elements2")));
anyEl2.listenElements(configNamedListenerOnCreate(ctx -> events.add("root.elements.any.elements2.onCrt")));
anyEl2.listenElements(configNamedListenerOnUpdate(ctx -> events.add("root.elements.any.elements2.onUpd")));
anyEl2.listenElements(configNamedListenerOnRename(ctx -> events.add("root.elements.any.elements2.onRen")));
anyEl2.listenElements(configNamedListenerOnDelete(ctx -> events.add("root.elements.any.elements2.onDel")));
SecondSubConfiguration anyChild2 = anyEl2.any();
anyChild2.listen(configListener(ctx -> events.add("root.elements.any.elements2.any")));
anyChild2.intVal().listen(configListener(ctx -> events.add("root.elements.any.elements2.any.i")));
childCfg.elements2().any().listen(configListener(ctx -> events.add("root.elements.0.elements2.any")));
childCfg.elements2().any().intVal().listen(configListener(ctx -> events.add("root.elements.0.elements2.any.i")));
}
use of org.apache.ignite.internal.configuration.storage.TestConfigurationStorage in project ignite-3 by apache.
the class ItClientHandlerTest method startServer.
private ClientHandlerModule startServer(TestInfo testInfo) {
configurationManager = new ConfigurationManager(List.of(ClientConnectorConfiguration.KEY, NetworkConfiguration.KEY), Map.of(), new TestConfigurationStorage(LOCAL), List.of(), List.of());
configurationManager.start();
var registry = configurationManager.configurationRegistry();
registry.getConfiguration(ClientConnectorConfiguration.KEY).change(local -> local.changePort(10800).changePortRange(10)).join();
bootstrapFactory = new NettyBootstrapFactory(registry.getConfiguration(NetworkConfiguration.KEY), testInfo.getDisplayName());
bootstrapFactory.start();
var module = new ClientHandlerModule(mock(QueryProcessor.class), mock(IgniteTables.class), mock(IgniteTransactions.class), registry, bootstrapFactory);
module.start();
return module;
}
Aggregations