use of org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata in project sling by apache.
the class ConfigurationDataImplTest method setUp.
@Before
public void setUp() {
configurationManagementSettings = context.registerInjectActivateService(new ConfigurationManagementSettingsImpl());
configurationPersistenceStrategy = context.registerInjectActivateService(new DefaultConfigurationPersistenceStrategy());
configResource = context.create().resource("/conf/test", "prop1", "value1", "prop4", true);
configMetadata = new ConfigurationMetadata("testName", ImmutableList.<PropertyMetadata<?>>of(new PropertyMetadata<>("prop1", "defValue"), new PropertyMetadata<>("prop2", String.class), new PropertyMetadata<>("prop3", 5), new PropertyMetadata<>("propIntArray", new Integer[] { 1, 2, 3 })), false);
}
use of org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata in project sling by apache.
the class AnnotationClassParserTest method testBuildConfigurationMetadata_AllTypes.
@Test
public void testBuildConfigurationMetadata_AllTypes() {
ConfigurationMetadata metadata = buildConfigurationMetadata(AllTypesConfig.class);
assertEquals(AllTypesConfig.class.getName(), metadata.getName());
assertNull(metadata.getLabel());
assertNull(metadata.getDescription());
assertTrue(metadata.getProperties().isEmpty());
assertEquals(20, metadata.getPropertyMetadata().size());
}
use of org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata in project sling by apache.
the class ConfigurationMetadataProviderMultiplexerImplTest method registerConfigurationMetadataProvider.
private void registerConfigurationMetadataProvider(String... names) {
final Map<String, ConfigurationMetadata> metadata = new HashMap<>();
for (String name : names) {
metadata.put(name, new ConfigurationMetadata(name, ImmutableList.<PropertyMetadata<?>>of(), false));
}
context.registerService(ConfigurationMetadataProvider.class, new ConfigurationMetadataProvider() {
@Override
public SortedSet<String> getConfigurationNames() {
return new TreeSet<>(metadata.keySet());
}
@Override
public ConfigurationMetadata getConfigurationMetadata(String configName) {
return metadata.get(configName);
}
});
}
use of org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata in project sling by apache.
the class ConfigurationManagerImplNoDefaultTest method setUp.
@Before
public void setUp() {
context.registerService(ConfigurationMetadataProvider.class, configurationMetadataProvider);
ConfigurationTestUtils.registerConfigurationResolverWithoutDefaultImpl(context);
underTest = context.registerInjectActivateService(new ConfigurationManagerImpl());
contextResourceNoConfig = context.create().resource("/content/testNoConfig", PROPERTY_CONFIG_REF, "/conf/testNoConfig");
configMetadata = new ConfigurationMetadata(CONFIG_NAME, ImmutableList.<PropertyMetadata<?>>of(new PropertyMetadata<>("prop1", "defValue"), new PropertyMetadata<>("prop2", String.class), new PropertyMetadata<>("prop3", 5)), false);
when(configurationMetadataProvider.getConfigurationMetadata(CONFIG_NAME)).thenReturn(configMetadata);
configMetadata = new ConfigurationMetadata(CONFIG_COL_NAME, ImmutableList.<PropertyMetadata<?>>of(new PropertyMetadata<>("prop1", "defValue"), new PropertyMetadata<>("prop2", String.class), new PropertyMetadata<>("prop3", 5)), true);
when(configurationMetadataProvider.getConfigurationMetadata(CONFIG_COL_NAME)).thenReturn(configMetadata);
}
use of org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata in project sling by apache.
the class ConfigurationManagerImplTest method testGetConfigurationMetadata_Nested_SubLevel2.
@Test
public void testGetConfigurationMetadata_Nested_SubLevel2() {
ConfigurationMetadata configMetadataSubLevel2 = underTest.getConfigurationMetadata(getConfigResolvePath(getConfigResolvePath(CONFIG_NESTED_NAME) + "/propSub") + "/propSubLevel2");
assertNotNull(configMetadataSubLevel2);
assertEquals("propSubLevel2", configMetadataSubLevel2.getName());
}
Aggregations