You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2016/12/07 15:17:54 UTC

svn commit: r1773096 - /sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/management/impl/ConfigurationManagerImplTest.java

Author: sseifert
Date: Wed Dec  7 15:17:54 2016
New Revision: 1773096

URL: http://svn.apache.org/viewvc?rev=1773096&view=rev
Log:
cosmetic: make unit tests consistent and use sling:configs directly in paths

Modified:
    sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/management/impl/ConfigurationManagerImplTest.java

Modified: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/management/impl/ConfigurationManagerImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/management/impl/ConfigurationManagerImplTest.java?rev=1773096&r1=1773095&r2=1773096&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/management/impl/ConfigurationManagerImplTest.java (original)
+++ sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/management/impl/ConfigurationManagerImplTest.java Wed Dec  7 15:17:54 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.sling.caconfig.management.impl;
 
-import static org.apache.sling.caconfig.impl.ConfigurationNameConstants.CONFIGS_BUCKET_NAME;
 import static org.apache.sling.caconfig.impl.def.ConfigurationDefNameConstants.PROPERTY_CONFIG_PROPERTY_INHERIT;
 import static org.apache.sling.caconfig.resource.impl.def.ConfigurationResourceNameConstants.PROPERTY_CONFIG_COLLECTION_INHERIT;
 import static org.apache.sling.caconfig.resource.impl.def.ConfigurationResourceNameConstants.PROPERTY_CONFIG_REF;
@@ -96,47 +95,47 @@ public class ConfigurationManagerImplTes
         contextResourceNoConfig = context.create().resource("/content/testNoConfig",
                 PROPERTY_CONFIG_REF, "/conf/testNoConfig");
         
-        context.create().resource(getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NAME),
+        context.create().resource(getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_NAME),
                 "prop1", "value1",
                 "prop4", true);
-        context.create().resource(getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/1"),
+        context.create().resource(getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_COL_NAME + "/1"),
                 "prop1", "value1");
-        context.create().resource(getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/2"),
+        context.create().resource(getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_COL_NAME + "/2"),
                 "prop4", true);
         
         // test fixture with resource collection inheritance on level 2
-        context.create().resource("/conf/test/level2/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME,
+        context.create().resource("/conf/test/level2/sling:configs/" + CONFIG_COL_NAME,
                 PROPERTY_CONFIG_COLLECTION_INHERIT, true);
-        context.create().resource(getConfigPropsPath("/conf/test/level2/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/1"),
+        context.create().resource(getConfigPropsPath("/conf/test/level2/sling:configs/" + CONFIG_COL_NAME + "/1"),
                 "prop1", "value1_level2");
         
         // test fixture with property inheritance and resource collection inheritance on level 3
-        context.create().resource(getConfigPropsPath("/conf/test/level2/level3/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NAME),
+        context.create().resource(getConfigPropsPath("/conf/test/level2/level3/sling:configs/" + CONFIG_NAME),
                 "prop4", false,
                 "prop5", "value5_level3",
                 PROPERTY_CONFIG_PROPERTY_INHERIT, true);
-        context.create().resource("/conf/test/level2/level3/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME,
+        context.create().resource("/conf/test/level2/level3/sling:configs/" + CONFIG_COL_NAME,
                 PROPERTY_CONFIG_COLLECTION_INHERIT, true);
-        context.create().resource(getConfigPropsPath("/conf/test/level2/level3/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/1"),
+        context.create().resource(getConfigPropsPath("/conf/test/level2/level3/sling:configs/" + CONFIG_COL_NAME + "/1"),
                 "prop4", false,
                 "prop5", "value5_level3",
                 PROPERTY_CONFIG_PROPERTY_INHERIT, true);
 
         // test fixture nested configuration
-        context.create().resource(getConfigPropsPath("/conf/test/level2/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NESTED_NAME),
+        context.create().resource(getConfigPropsPath("/conf/test/level2/sling:configs/" + CONFIG_NESTED_NAME),
                 "prop1", "value1",
                 "prop4", true);
-        context.create().resource(getConfigPropsPath(getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NESTED_NAME) + "/propSub"),
+        context.create().resource(getConfigPropsPath(getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_NESTED_NAME) + "/propSub"),
                 "prop1", "propSubValue1",
                 "prop4", true);
-        context.create().resource(getConfigPropsPath(getConfigPropsPath(getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NESTED_NAME) + "/propSub") + "/propSubLevel2"),
+        context.create().resource(getConfigPropsPath(getConfigPropsPath(getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_NESTED_NAME) + "/propSub") + "/propSubLevel2"),
                 "prop1", "propSubLevel2Value1",
                 "prop4", true);
-        context.create().resource(getConfigPropsPath(getConfigPropsPath("/conf/test/level2/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NESTED_NAME) + "/propSubList/item1"),
+        context.create().resource(getConfigPropsPath(getConfigPropsPath("/conf/test/level2/sling:configs/" + CONFIG_NESTED_NAME) + "/propSubList/item1"),
                 "prop1", "propSubListValue1.1");
-        context.create().resource(getConfigPropsPath(getConfigPropsPath("/conf/test/level2/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NESTED_NAME) + "/propSubList/item2"),
+        context.create().resource(getConfigPropsPath(getConfigPropsPath("/conf/test/level2/sling:configs/" + CONFIG_NESTED_NAME) + "/propSubList/item2"),
                 "prop1", "propSubListValue1.2");
-        context.create().resource(getConfigPropsPath(getConfigPropsPath(getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NESTED_NAME) + "/propSubList/item1") + "/propSub"),
+        context.create().resource(getConfigPropsPath(getConfigPropsPath(getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_NESTED_NAME) + "/propSubList/item1") + "/propSub"),
                 "prop1", "propSubList1_proSubValue1",
                 "prop4", true);
         
@@ -225,7 +224,7 @@ public class ConfigurationManagerImplTes
         assertEquals("value1", configData.getEffectiveValues().get("prop1", String.class));
         assertEquals((Integer)5, configData.getEffectiveValues().get("prop3", 0));
 
-        String configPath = getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NAME);
+        String configPath = getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_NAME);
         assertEquals(configPath, configData.getValueInfo("prop1").getConfigSourcePath());
         assertTrue(configData.getValueInfo("prop1").isInherited());
         assertFalse(configData.getValueInfo("prop3").isInherited());
@@ -252,8 +251,8 @@ public class ConfigurationManagerImplTes
         assertFalse(configData.getEffectiveValues().get("prop4", Boolean.class));
         assertEquals("value5_level3", configData.getEffectiveValues().get("prop5", String.class));
 
-        String configPath = getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NAME);
-        String configPathLevel3 = getConfigPropsPath("/conf/test/level2/level3/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NAME);
+        String configPath = getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_NAME);
+        String configPathLevel3 = getConfigPropsPath("/conf/test/level2/level3/sling:configs/" + CONFIG_NAME);
         assertTrue(configData.getValueInfo("prop1").isInherited());
         assertEquals(configPath, configData.getValueInfo("prop1").getConfigSourcePath());
         assertFalse(configData.getValueInfo("prop2").isInherited());
@@ -362,7 +361,7 @@ public class ConfigurationManagerImplTes
         assertEquals("value1_level2", configData1.getEffectiveValues().get("prop1", String.class));
         assertEquals((Integer)5, configData1.getEffectiveValues().get("prop3", 0));
 
-        String configPath1 = getConfigPropsPath("/conf/test/level2/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/1");
+        String configPath1 = getConfigPropsPath("/conf/test/level2/sling:configs/" + CONFIG_COL_NAME + "/1");
         assertFalse(configData1.getValueInfo("prop1").isInherited());
         assertEquals(configPath1, configData1.getValueInfo("prop1").getConfigSourcePath());
         assertFalse(configData1.getValueInfo("prop3").isInherited());
@@ -373,7 +372,7 @@ public class ConfigurationManagerImplTes
         assertNull(configData2.getValues().get("prop1", String.class));
         assertEquals((Integer)5, configData2.getEffectiveValues().get("prop3", 0));
 
-        String configPath2 = getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/2");
+        String configPath2 = getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_COL_NAME + "/2");
         assertTrue(configData2.getValueInfo("prop4").isInherited());
         assertEquals(configPath2, configData2.getValueInfo("prop4").getConfigSourcePath());
         assertFalse(configData2.getValueInfo("prop3").isInherited());
@@ -404,8 +403,8 @@ public class ConfigurationManagerImplTes
         assertFalse(configData1.getEffectiveValues().get("prop4", Boolean.class));
         assertEquals("value5_level3", configData1.getEffectiveValues().get("prop5", String.class));
 
-        String configPathLevel2 = getConfigPropsPath("/conf/test/level2/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/1");
-        String configPathLevel3 = getConfigPropsPath("/conf/test/level2/level3/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/1");
+        String configPathLevel2 = getConfigPropsPath("/conf/test/level2/sling:configs/" + CONFIG_COL_NAME + "/1");
+        String configPathLevel3 = getConfigPropsPath("/conf/test/level2/level3/sling:configs/" + CONFIG_COL_NAME + "/1");
         assertTrue(configData1.getValueInfo("prop1").isInherited());
         assertEquals(configPathLevel2, configData1.getValueInfo("prop1").getConfigSourcePath());
         assertFalse(configData1.getValueInfo("prop2").isInherited());
@@ -422,7 +421,7 @@ public class ConfigurationManagerImplTes
         assertNull(configData2.getValues().get("prop1", String.class));
         assertEquals((Integer)5, configData2.getEffectiveValues().get("prop3", 0));
 
-        String configPath2 = getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/2");
+        String configPath2 = getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_COL_NAME + "/2");
         assertTrue(configData2.getValueInfo("prop4").isInherited());
         assertEquals(configPath2, configData2.getValueInfo("prop4").getConfigSourcePath());
         assertFalse(configData2.getValueInfo("prop3").isInherited());
@@ -507,7 +506,7 @@ public class ConfigurationManagerImplTes
                 new ConfigurationPersistData(ImmutableMap.<String, Object>of("prop1", "value1")));
         context.resourceResolver().commit();
 
-        String configPath = getConfigPropsPath("/conf/testNoConfig/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NAME);
+        String configPath = getConfigPropsPath("/conf/testNoConfig/sling:configs/" + CONFIG_NAME);
         ValueMap props = context.resourceResolver().getResource(configPath).getValueMap();
         assertEquals("value1", props.get("prop1"));
     }
@@ -521,11 +520,11 @@ public class ConfigurationManagerImplTes
         ));
         context.resourceResolver().commit();
 
-        String configPath0 = getConfigPropsPath("/conf/testNoConfig/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/0");
+        String configPath0 = getConfigPropsPath("/conf/testNoConfig/sling:configs/" + CONFIG_COL_NAME + "/0");
         ValueMap props0 = context.resourceResolver().getResource(configPath0).getValueMap();
         assertEquals("value1", props0.get("prop1"));
 
-        String configPath1 = getConfigPropsPath("/conf/testNoConfig/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_COL_NAME + "/1");
+        String configPath1 = getConfigPropsPath("/conf/testNoConfig/sling:configs/" + CONFIG_COL_NAME + "/1");
         ValueMap props1 = context.resourceResolver().getResource(configPath1).getValueMap();
         assertEquals((Integer)5, props1.get("prop2"));
     }
@@ -707,7 +706,7 @@ public class ConfigurationManagerImplTes
     public void testGetConfigurationMetadata_Nested_SubList_Sub() throws Exception {
         // delete resource already existing in test fixture to test with non-existing resource but existing collection item as parent
         context.resourceResolver().delete(context.resourceResolver().getResource(
-                getConfigPropsPath(getConfigPropsPath(getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NESTED_NAME)
+                getConfigPropsPath(getConfigPropsPath(getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_NESTED_NAME)
                         + "/propSubList/item1") + "/propSub")));
 
         ConfigurationMetadata subListDataItem1Sub = underTest.getConfigurationMetadata(getConfigPropsPath(getConfigPropsPath(CONFIG_NESTED_NAME)
@@ -720,7 +719,7 @@ public class ConfigurationManagerImplTes
     public void testGetConfigurationMetadata_Nested_SubList_SubLevel2() throws Exception {
         // delete resource already existing in test fixture to test with non-existing resource but existing collection item as parent
         context.resourceResolver().delete(context.resourceResolver().getResource(
-                getConfigPropsPath(getConfigPropsPath(getConfigPropsPath("/conf/test/" + CONFIGS_BUCKET_NAME + "/" + CONFIG_NESTED_NAME)
+                getConfigPropsPath(getConfigPropsPath(getConfigPropsPath("/conf/test/sling:configs/" + CONFIG_NESTED_NAME)
                         + "/propSubList/item1") + "/propSub")));
 
         ConfigurationMetadata subListDataItem1SubLevel2 = underTest.getConfigurationMetadata(getConfigPropsPath(getConfigPropsPath(getConfigPropsPath(CONFIG_NESTED_NAME)