use of org.apache.sling.caconfig.management.ConfigurationData in project sling by apache.
the class ConfigurationDataImplTest method testIgnoreProperties.
@Test
public void testIgnoreProperties() {
Resource resource = context.create().resource("/conf/testIgnoreProps", "prop1", "value1", "prop4", true, "jcr:primaryType", "myType");
ConfigurationData underTest = new ConfigurationDataImpl(null, resource, resource, null, contextResource, "test", configurationManager, configurationManagementSettings, configurationOverrideMultiplexer, configurationPersistenceStrategy, false, null);
assertEquals(ImmutableSet.of("prop1", "prop4"), underTest.getPropertyNames());
assertNull(underTest.getValues().get("jcr:primaryType"));
assertNull(underTest.getEffectiveValues().get("jcr:primaryType"));
}
use of org.apache.sling.caconfig.management.ConfigurationData in project sling by apache.
the class ConfigurationManagerImplNoDefaultTest method testGet_NoConfigResource.
@Test
public void testGet_NoConfigResource() {
ConfigurationData configData = underTest.getConfiguration(contextResourceNoConfig, CONFIG_NAME);
assertNotNull(configData);
assertEquals(ImmutableSet.of("prop1", "prop2", "prop3"), configData.getPropertyNames());
assertNull(configData.getValues().get("prop1", String.class));
assertEquals((Integer) 5, configData.getEffectiveValues().get("prop3", 0));
assertFalse(configData.getValueInfo("prop1").isInherited());
assertFalse(configData.getValueInfo("prop3").isInherited());
}
use of org.apache.sling.caconfig.management.ConfigurationData in project sling by apache.
the class ConfigurationManagerImplNoDefaultTest method testNewCollectionItem.
@Test
public void testNewCollectionItem() {
ConfigurationData newItem = underTest.newCollectionItem(contextResourceNoConfig, CONFIG_COL_NAME);
assertNotNull(newItem);
assertEquals((Integer) 5, newItem.getEffectiveValues().get("prop3", 0));
}
use of org.apache.sling.caconfig.management.ConfigurationData in project sling by apache.
the class ConfigurationManagerImplTest method testGetConfiguration.
@Test
public void testGetConfiguration() {
ConfigurationData configData = underTest.getConfiguration(contextResource, CONFIG_NAME);
assertNotNull(configData);
assertFalse(configData.isInherited());
assertEquals(ImmutableSet.of("prop1", "prop2", "prop3", "prop4"), configData.getPropertyNames());
assertEquals("value1", configData.getValues().get("prop1", String.class));
assertEquals((Integer) 5, configData.getEffectiveValues().get("prop3", 0));
assertFalse(configData.getValueInfo("prop1").isInherited());
assertFalse(configData.getValueInfo("prop3").isInherited());
assertFalse(configData.getValues().get(ConfigurationDefNameConstants.PROPERTY_CONFIG_PROPERTY_INHERIT, false));
}
use of org.apache.sling.caconfig.management.ConfigurationData in project sling by apache.
the class ConfigurationManagerImplTest method testPersistConfigurationCollection_Nested.
@Test
public void testPersistConfigurationCollection_Nested() throws Exception {
underTest.persistConfigurationCollection(contextResourceLevel2, getConfigResolvePath(CONFIG_NESTED_NAME) + "/propSubList", new ConfigurationCollectionPersistData(ImmutableList.of(new ConfigurationPersistData(ImmutableMap.<String, Object>of("prop1", "value1_persist")).collectionItemName("item1"), new ConfigurationPersistData(ImmutableMap.<String, Object>of("prop1", "value2_persist")).collectionItemName("item2"), new ConfigurationPersistData(ImmutableMap.<String, Object>of("prop1", "value3_persist")).collectionItemName("item3"))));
context.resourceResolver().commit();
ConfigurationData configData = underTest.getConfiguration(contextResourceLevel2, CONFIG_NESTED_NAME);
ConfigurationData[] subListData = configData.getValues().get("propSubList", ConfigurationData[].class);
assertEquals(3, subListData.length);
assertEquals("value1_persist", subListData[0].getValues().get("prop1", String.class));
assertEquals("value2_persist", subListData[1].getValues().get("prop1", String.class));
assertEquals("value3_persist", subListData[2].getValues().get("prop1", String.class));
}
Aggregations