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 2015/01/05 15:46:47 UTC
svn commit: r1649537 -
/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java
Author: cziegeler
Date: Mon Jan 5 14:46:46 2015
New Revision: 1649537
URL: http://svn.apache.org/r1649537
Log:
Remove duplicate method
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=1649537&r1=1649536&r2=1649537&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 Mon Jan 5 14:46:46 2015
@@ -16,8 +16,6 @@
*/
package org.apache.sling.installer.it;
-import static org.junit.Assert.fail;
-
import java.util.Dictionary;
import java.util.Hashtable;
@@ -28,7 +26,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
-import org.osgi.service.cm.Configuration;
@RunWith(PaxExam.class)
public class ConfigPrioritiesTest extends OsgiInstallerTestBase {
@@ -51,24 +48,7 @@ public class ConfigPrioritiesTest extend
super.tearDown();
}
- void assertConfigValue(String pid, String key, String value, long timeoutMsec) throws Exception {
- boolean found = false;
- final String info = pid + ": waiting for " + key + "=" + value;
- final long end = System.currentTimeMillis() + timeoutMsec;
- do {
- final Configuration cfg = waitForConfiguration(info, pid, timeoutMsec, true);
- if(value.equals(cfg.getProperties().get(key))) {
- found = true;
- break;
- }
- } while(System.currentTimeMillis() < end);
-
- if(!found) {
- fail("Did not get expected value: " + info);
- }
- }
-
- @Test
+ @Test
public void testOverrideConfig() throws Exception {
final String pid = getClass().getSimpleName() + "." + System.currentTimeMillis();
@@ -82,21 +62,21 @@ public class ConfigPrioritiesTest extend
// c has more priority than b which has more than a
installer.updateResources(URL_SCHEME, new InstallableResource[] {b}, null);
- assertConfigValue(pid, "foo", "b", TIMEOUT);
+ waitForConfigValue(null, pid, TIMEOUT, "foo", "b");
installer.updateResources(URL_SCHEME, new InstallableResource[] {c}, null);
- assertConfigValue(pid, "foo", "c", TIMEOUT);
+ waitForConfigValue(null, pid, TIMEOUT, "foo", "c");
installer.updateResources(URL_SCHEME, new InstallableResource[] {a}, null);
// highest prio should be active (c)
- assertConfigValue(pid, "foo", "c", TIMEOUT);
+ waitForConfigValue(null, pid, TIMEOUT, "foo", "c");
// removing c, second highest prio should be active (b)
installer.updateResources(URL_SCHEME, null, new String[] {c.getId()});
- assertConfigValue(pid, "foo", "b", TIMEOUT);
+ waitForConfigValue(null, pid, TIMEOUT, "foo", "b");
// removing b, a should be active
installer.updateResources(URL_SCHEME, null, new String[] {b.getId()});
- assertConfigValue(pid, "foo", "a", TIMEOUT);
+ waitForConfigValue(null, pid, TIMEOUT, "foo", "a");
// and config should be gone only after removing everything
installer.updateResources(URL_SCHEME, null, new String[] {a.getId()});