use of org.apache.ignite.internal.configuration.asm.ConfigurationAsmGenerator in project ignite-3 by apache.
the class ConstructableTreeNodeTest method beforeAll.
/**
* Before all.
*/
@BeforeAll
public static void beforeAll() {
cgen = new ConfigurationAsmGenerator();
cgen.compileRootSchema(TraversableTreeNodeTest.ParentConfigurationSchema.class, Map.of(), Map.of());
}
use of org.apache.ignite.internal.configuration.asm.ConfigurationAsmGenerator in project ignite-3 by apache.
the class ConfigurationUtilTest method beforeAll.
/**
* Before all.
*/
@BeforeAll
public static void beforeAll() {
cgen = new ConfigurationAsmGenerator();
cgen.compileRootSchema(ParentConfigurationSchema.class, Map.of(), Map.of());
cgen.compileRootSchema(PolymorphicRootConfigurationSchema.class, Map.of(), Map.of(PolymorphicConfigurationSchema.class, Set.of(FirstPolymorphicInstanceConfigurationSchema.class, SecondPolymorphicInstanceConfigurationSchema.class)));
}
use of org.apache.ignite.internal.configuration.asm.ConfigurationAsmGenerator in project ignite-3 by apache.
the class ConfigurationUtilTest method testSuperRootWithInternalConfig.
@Test
void testSuperRootWithInternalConfig() {
ConfigurationAsmGenerator generator = new ConfigurationAsmGenerator();
Class<?> schemaClass = InternalWithoutSuperclassConfigurationSchema.class;
RootKey<?, ?> schemaKey = InternalWithoutSuperclassConfiguration.KEY;
generator.compileRootSchema(schemaClass, Map.of(), Map.of());
SuperRoot superRoot = new SuperRoot(s -> new RootInnerNode(schemaKey, generator.instantiateNode(schemaClass)));
assertThrows(NoSuchElementException.class, () -> superRoot.construct(schemaKey.key(), null, false));
superRoot.construct(schemaKey.key(), null, true);
superRoot.addRoot(schemaKey, generator.instantiateNode(schemaClass));
assertThrows(KeyNotFoundException.class, () -> find(List.of(schemaKey.key()), superRoot, false));
assertNotNull(find(List.of(schemaKey.key()), superRoot, true));
Map<String, Object> config = (Map<String, Object>) superRoot.accept(schemaKey.key(), new ConverterToMapVisitor(false));
assertTrue(config.isEmpty());
config = (Map<String, Object>) superRoot.accept(schemaKey.key(), new ConverterToMapVisitor(true));
assertEquals(1, config.size());
assertNotNull(config.get(schemaKey.key()));
}
use of org.apache.ignite.internal.configuration.asm.ConfigurationAsmGenerator in project ignite-3 by apache.
the class ConfigurationUtilTest method testFindInternalConfigs.
@Test
void testFindInternalConfigs() {
Map<Class<?>, Set<Class<?>>> internalExtensions = internalSchemaExtensions(List.of(InternalFirstRootConfigurationSchema.class, InternalSecondRootConfigurationSchema.class, InternalFirstConfigurationSchema.class, InternalSecondConfigurationSchema.class));
ConfigurationAsmGenerator generator = new ConfigurationAsmGenerator();
generator.compileRootSchema(InternalRootConfigurationSchema.class, internalExtensions, Map.of());
InnerNode innerNode = generator.instantiateNode(InternalRootConfigurationSchema.class);
addDefaults(innerNode);
// Check that no internal configuration will be found.
assertThrows(KeyNotFoundException.class, () -> find(List.of("str2"), innerNode, false));
assertThrows(KeyNotFoundException.class, () -> find(List.of("str3"), innerNode, false));
assertThrows(KeyNotFoundException.class, () -> find(List.of("subCfg1"), innerNode, false));
assertThrows(KeyNotFoundException.class, () -> find(List.of("subCfg", "str01"), innerNode, false));
assertThrows(KeyNotFoundException.class, () -> find(List.of("subCfg", "str02"), innerNode, false));
// Check that internal configuration will be found.
assertNull(find(List.of("str2"), innerNode, true));
assertEquals("foo", find(List.of("str3"), innerNode, true));
assertNotNull(find(List.of("subCfg1"), innerNode, true));
assertEquals("foo", find(List.of("subCfg", "str01"), innerNode, true));
assertEquals("foo", find(List.of("subCfg", "str02"), innerNode, true));
}
Aggregations