You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2014/08/22 14:11:16 UTC

svn commit: r1619772 - /sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java

Author: cziegeler
Date: Fri Aug 22 12:11:16 2014
New Revision: 1619772

URL: http://svn.apache.org/r1619772
Log:
SLING-2816 : ConfigPrioritiesTest does not behave as expected

Modified:
    sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java

Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java?rev=1619772&r1=1619771&r2=1619772&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java Fri Aug 22 12:11:16 2014
@@ -39,12 +39,13 @@ public class ConfigPrioritiesTest extend
     public Option[] config() {
         return defaultConfiguration();
     }
-    
+
     @Before
     public void setUp() {
         setupInstaller();
     }
 
+    @Override
     @After
     public void tearDown() {
         super.tearDown();
@@ -70,14 +71,14 @@ public class ConfigPrioritiesTest extend
     @Test
     public void testOverrideConfig() throws Exception {
         final String pid = getClass().getSimpleName() + "." + System.currentTimeMillis();
-        
+
         final Dictionary<String, Object> data = new Hashtable<String, Object>();
         data.put("foo", "a");
-        final InstallableResource a = getInstallableResource(pid, data, InstallableResource.DEFAULT_PRIORITY - 1)[0];
+        final InstallableResource a = getInstallableResource("a/" + pid, data, InstallableResource.DEFAULT_PRIORITY - 1)[0];
         data.put("foo", "b");
-        final InstallableResource b = getInstallableResource(pid, data, InstallableResource.DEFAULT_PRIORITY)[0];
+        final InstallableResource b = getInstallableResource("b/" + pid, data, InstallableResource.DEFAULT_PRIORITY)[0];
         data.put("foo", "c");
-        final InstallableResource c = getInstallableResource(pid, data, InstallableResource.DEFAULT_PRIORITY + 1)[0];
+        final InstallableResource c = getInstallableResource("c/" + pid, data, InstallableResource.DEFAULT_PRIORITY + 1)[0];
 
         // c has more priority than b which has more than a
         installer.updateResources(URL_SCHEME, new InstallableResource[] {b}, null);
@@ -85,23 +86,20 @@ public class ConfigPrioritiesTest extend
         installer.updateResources(URL_SCHEME, new InstallableResource[] {c}, null);
         assertConfigValue(pid, "foo", "c", TIMEOUT);
         installer.updateResources(URL_SCHEME, new InstallableResource[] {a}, null);
-        
-        // TODO should be "c" here - looks like the installer does not
-        // take priorities into account
-        assertConfigValue(pid, "foo", "a", TIMEOUT);
-        
-        // TODO: after removing c value should go back to b, looks like
-        // installer removes the config instead 
+
+        // highest prio should be active (c)
+        assertConfigValue(pid, "foo", "c", TIMEOUT);
+
+        // removing c, second highest prio should be active (b)
         installer.updateResources(URL_SCHEME, null, new String[] {c.getId()});
-        // assertConfigValue(pid, "foo", "b", TIMEOUT);
+        assertConfigValue(pid, "foo", "b", TIMEOUT);
+
+        // removing b, a should be active
+        installer.updateResources(URL_SCHEME, null, new String[] {b.getId()});
+        assertConfigValue(pid, "foo", "a", TIMEOUT);
+
+        // and config should be gone only after removing everything
+        installer.updateResources(URL_SCHEME, null, new String[] {a.getId()});
         waitForConfiguration("After removing all resources", pid, TIMEOUT, false);
-        
-        // TODO after removing b value should go back to a
-        // installer.updateResources(URL_SCHEME, null, new String[] {b.getId()});
-        // assertConfigValue(pid, "foo", "a", TIMEOUT);
-        
-        // TODO and config should be gone only after removing everything
-        // installer.updateResources(URL_SCHEME, null, new String[] {a.getId()});
-        // waitForConfiguration("After removing all resources", pid, TIMEOUT, false);
     }
 }