SLING-7496 Factory config deleted with ConfigAdmin immediately after creation 1/head
authorDavid Bosschaert <bosschae@adobe.com>
Mon, 19 Feb 2018 16:11:09 +0000 (16:11 +0000)
committerDavid Bosschaert <bosschae@adobe.com>
Mon, 19 Feb 2018 16:11:09 +0000 (16:11 +0000)
Fix timing issue with test. The test wasn't waiting to reach the initial
INSTALLED state.

src/test/java/org/apache/sling/installer/it/ConfigInstallTest.java

index 9d9a210..f27c16f 100644 (file)
@@ -359,6 +359,8 @@ public class ConfigInstallTest extends OsgiInstallerTestBase implements Configur
                 null, cfgData, null, InstallableResource.TYPE_PROPERTIES, 10);
         installer.updateResources(URL_SCHEME, new InstallableResource[] {rsrc}, null);
 
+        waitForResource(URL_SCHEME + ":/configA/" + cfgFactoryPid + "-" + alias, ResourceState.INSTALLED);
+
         // get factory config
         final Configuration cfg = waitForFactoryConfigValue("After installing", cfgFactoryPid, "foo", "bar");
 
@@ -367,7 +369,7 @@ public class ConfigInstallTest extends OsgiInstallerTestBase implements Configur
         secondData.put("foo", "bla");
         cfg.update(secondData);
 
-        waitForResource(URL_SCHEME + ":/configA/" + cfgFactoryPid + "-" + alias, ResourceState.INSTALLED);
+        waitForResource(URL_SCHEME + ":/configA/" + cfgFactoryPid + "-" + alias, ResourceState.IGNORED);
 
         // get updated factory config
         final Configuration secondCfg = waitForFactoryConfigValue("After updating", cfgFactoryPid, "foo", "bla");
@@ -392,6 +394,8 @@ public class ConfigInstallTest extends OsgiInstallerTestBase implements Configur
                 null, cfgData, null, InstallableResource.TYPE_PROPERTIES, 10);
         installer.updateResources(URL_SCHEME, new InstallableResource[] {rsrc}, null);
 
+        waitForResource(URL_SCHEME + ":/configA/" + cfgFactoryPid + "-" + alias, ResourceState.INSTALLED);
+
         // get factory config
         final Configuration cfg = waitForFactoryConfigValue("After installing", cfgFactoryPid, "foo", "bar");
 
@@ -400,7 +404,7 @@ public class ConfigInstallTest extends OsgiInstallerTestBase implements Configur
         secondData.put("foo", "bla");
         cfg.update(secondData);
 
-        waitForResource(URL_SCHEME + ":/configA/" + cfgFactoryPid + "-" + alias, ResourceState.INSTALLED);
+        waitForResource(URL_SCHEME + ":/configA/" + cfgFactoryPid + "-" + alias, ResourceState.IGNORED);
 
         // get updated factory config
         final Configuration secondCfg = waitForFactoryConfigValue("After updating", cfgFactoryPid, "foo", "bla");