Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java?rev=983998&r1=983997&r2=983998&view=diff ============================================================================== --- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java (original) +++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java Tue Aug 10 13:37:59 2010 @@ -26,7 +26,7 @@ import java.util.LinkedList; import java.util.List; import org.apache.sling.osgi.installer.InstallableResource; -import org.apache.sling.osgi.installer.OsgiInstaller; +import org.apache.sling.osgi.installer.OsgiInstallerStatistics; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -84,26 +84,26 @@ public class ConfigInstallTest extends O resetCounters(); installer.addResource(r); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); Configuration cfg = waitForConfiguration("After installing", cfgPid, TIMEOUT, true); assertEquals("Config value must match", "bar", cfg.getProperties().get("foo")); resetCounters(); installer.removeResource(r.getUrl()); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); waitForConfiguration("After removing", cfgPid, TIMEOUT, false); // Reinstalling with same digest must work resetCounters(); installer.addResource(r); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); cfg = waitForConfiguration("After reinstalling", cfgPid, TIMEOUT, true); assertEquals("Config value must match", "bar", cfg.getProperties().get("foo")); resetCounters(); installer.removeResource(r.getUrl()); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); waitForConfiguration("After removing for the second time", cfgPid, TIMEOUT, false); } @@ -133,11 +133,11 @@ public class ConfigInstallTest extends O resetCounters(); final InstallableResource r = getInstallableResource(cfgPid, cfgData); installer.addResource(r); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); sleep(1000L); configAdmin.start(); waitForConfigAdmin(true); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); waitForConfiguration("Config must be installed once ConfigurationAdmin restarts", cfgPid, TIMEOUT, true); @@ -145,12 +145,12 @@ public class ConfigInstallTest extends O waitForConfigAdmin(false); resetCounters(); installer.removeResource(r.getUrl()); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); sleep(1000L); resetCounters(); configAdmin.start(); waitForConfigAdmin(true); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); waitForConfiguration("Config must be removed once ConfigurationAdmin restarts", cfgPid, TIMEOUT, false); } @@ -170,11 +170,11 @@ public class ConfigInstallTest extends O Condition cond = new Condition() { public boolean isTrue() { return events.size() == 1; }}; waitForCondition("Expected two ConfigurationEvents since beginning of test", TIMEOUT, cond); - long nOps = installer.getCounters()[OsgiInstaller.OSGI_TASKS_COUNTER]; + long nOps = statistics.getCounters()[OsgiInstallerStatistics.OSGI_TASKS_COUNTER]; installer.addResource(getInstallableResource(cfgPid, cfgData)); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertEquals("Registering a Configuration that's already installed must not generate OSGi tasks", - nOps, installer.getCounters()[OsgiInstaller.OSGI_TASKS_COUNTER]); + nOps, statistics.getCounters()[OsgiInstallerStatistics.OSGI_TASKS_COUNTER]); assertEquals("Expected one ConfigurationEvent after (ignored) install via OsgiInstaller", 1, events.size()); // Reinstalling with a change must be executed
Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ContextBundleUpdateTest.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ContextBundleUpdateTest.java?rev=983998&r1=983997&r2=983998&view=diff ============================================================================== --- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ContextBundleUpdateTest.java (original) +++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ContextBundleUpdateTest.java Tue Aug 10 13:37:59 2010 @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNul import java.io.FileInputStream; import java.io.InputStream; -import org.apache.sling.osgi.installer.OsgiInstaller; +import org.apache.sling.osgi.installer.OsgiInstallerStatistics; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -40,29 +40,29 @@ public class ContextBundleUpdateTest ext public static Option[] configuration() { return defaultConfiguration(); } - + @Before public void setUp() { setupInstaller(); } - + @After public void tearDown() { super.tearDown(); } - + @Test public void testContextUpdate() throws Exception { - + // Install V1.0 via installer final String symbolicName = "osgi-installer-testbundle"; assertNull("Test bundle must be absent before installing", findBundle(symbolicName)); resetCounters(); installer.addResource(getInstallableResource( getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar"), "digest0")); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); final Bundle b = assertBundle("After initial install", symbolicName, "1.0", Bundle.ACTIVE); - + // Update to 1.1, directly via bundle context final InputStream is = new FileInputStream(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")); try { @@ -71,13 +71,13 @@ public class ContextBundleUpdateTest ext is.close(); } assertBundle("After direct update", symbolicName, "1.1", Bundle.ACTIVE); - + // Install another bundle (to trigger installer queue activity), wait // for installer to be idle and check version resetCounters(); installer.addResource(getInstallableResource( getTestBundle(BUNDLE_BASE_NAME + "-snap.jar"), "digest1")); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertBundle("-snap bundle install", "osgi-installer-snapshot-test", null, Bundle.ACTIVE); assertBundle("After installing another bundle", symbolicName, "1.1", Bundle.ACTIVE); } Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/InvalidBundlesTest.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/InvalidBundlesTest.java?rev=983998&r1=983997&r2=983998&view=diff ============================================================================== --- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/InvalidBundlesTest.java (original) +++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/InvalidBundlesTest.java Tue Aug 10 13:37:59 2010 @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.Collection; import org.apache.sling.osgi.installer.InstallableResource; -import org.apache.sling.osgi.installer.OsgiInstaller; +import org.apache.sling.osgi.installer.OsgiInstallerStatistics; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -38,17 +38,17 @@ public class InvalidBundlesTest extends public static Option[] configuration() { return defaultConfiguration(); } - + @Before public void setUp() { setupInstaller(); } - + @After public void tearDown() { super.tearDown(); } - + @Test public void testRegisterInvalidBundles() throws Exception { final Collection<InstallableResource> data = new ArrayList<InstallableResource>(); @@ -60,15 +60,15 @@ public class InvalidBundlesTest extends getTestBundle("test-classes/invalid-jar.jar"))); data.add(getInstallableResource( getTestBundle(BUNDLE_BASE_NAME + "-testB-1.0.jar"))); - + resetCounters(); installer.registerResources(data, URL_SCHEME); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); - + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + final String info = "All valid bundles must be installed"; assertBundle(info, "osgi-installer-testbundle", "1.1", Bundle.ACTIVE); assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE); - + assertNoOsgiTasks("At the end of test"); } @@ -76,21 +76,21 @@ public class InvalidBundlesTest extends public void testIndividualInvalidBundles() throws Exception { final String symbolicName = "osgi-installer-testbundle"; int testIndex = 0; - + assertNull("Test bundle must not be present before test", findBundle(symbolicName)); - + // Install first test bundle and check version { assertNull("Test bundle must be absent before installing", findBundle(symbolicName)); resetCounters(); installer.addResource(getInstallableResource( getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar"))); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertBundle("After installing", symbolicName, "1.1", Bundle.ACTIVE); } - + assertNoOsgiTasks("After test " + testIndex++); - + // Non-bundle must be ignored { resetCounters(); @@ -110,12 +110,12 @@ public class InvalidBundlesTest extends assertNoOsgiTasks("After test " + testIndex++); - // Make sure controller is not blocked, by testing an upgrade + // Make sure controller is not blocked, by testing an upgrade { resetCounters(); installer.addResource(getInstallableResource( getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar"))); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertBundle("After updating to 1.2", symbolicName, "1.2", Bundle.ACTIVE); } Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java?rev=983998&r1=983997&r2=983998&view=diff ============================================================================== --- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java (original) +++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java Tue Aug 10 13:37:59 2010 @@ -39,7 +39,7 @@ public class MockInstallableResource imp private final String uri; private final InputStream is; private final String digest; - private final InstallableResource.Type type; + private final String type; private final int priority; private final Dictionary<String, Object> d; @@ -51,19 +51,19 @@ public class MockInstallableResource imp this.uri = uri; this.is = new ByteArrayInputStream(data.getBytes()); this.digest = getNextDigest(digest); - this.type = InstallableResource.Type.BUNDLE; + this.type = InstallableResource.TYPE_BUNDLE; this.priority = InstallableResourceFactory.DEFAULT_PRIORITY; this.d = null; } - public MockInstallableResource(String uri, InputStream is, String digest, InstallableResource.Type type, Integer priority) { + public MockInstallableResource(String uri, InputStream is, String digest, String type, Integer priority) { this.uri = uri; this.is = is; this.digest = digest; if ( type != null ) { this.type = type; } else { - this.type = InstallableResource.Type.BUNDLE; + this.type = InstallableResource.TYPE_BUNDLE; } if ( priority != null ) { this.priority = priority; @@ -73,13 +73,13 @@ public class MockInstallableResource imp this.d = null; } - public MockInstallableResource(String uri, Dictionary<String, Object> d, String digest, InstallableResource.Type type, Integer priority) { + public MockInstallableResource(String uri, Dictionary<String, Object> d, String digest,String type, Integer priority) { this.uri = uri; this.is = null; if ( type != null ) { this.type = type; } else { - this.type = InstallableResource.Type.CONFIG; + this.type = InstallableResource.TYPE_CONFIG; } if ( priority != null ) { this.priority = priority; @@ -119,7 +119,7 @@ public class MockInstallableResource imp return this.priority; } - public Type getType() { + public String getType() { return this.type; } Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java?rev=983998&r1=983997&r2=983998&view=diff ============================================================================== --- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java (original) +++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java Tue Aug 10 13:37:59 2010 @@ -37,6 +37,7 @@ import java.util.Dictionary; import org.apache.sling.osgi.installer.InstallableResource; import org.apache.sling.osgi.installer.InstallableResourceFactory; import org.apache.sling.osgi.installer.OsgiInstaller; +import org.apache.sling.osgi.installer.OsgiInstallerStatistics; import org.ops4j.pax.exam.Inject; import org.ops4j.pax.exam.Option; import org.osgi.framework.Bundle; @@ -59,6 +60,8 @@ class OsgiInstallerTestBase implements F private int packageRefreshEventsCount; private ServiceTracker configAdminTracker; protected OsgiInstaller installer; + protected OsgiInstallerStatistics statistics; + private long [] counters; public static final long WAIT_FOR_ACTION_TIMEOUT_MSEC = 5000; public static final String BUNDLE_BASE_NAME = "org.apache.sling.osgi.installer.it-" + POM_VERSION; @@ -86,6 +89,7 @@ class OsgiInstallerTestBase implements F public void setupInstaller() { installer = getService(OsgiInstaller.class); + statistics = getService(OsgiInstallerStatistics.class); resetCounters(); } @@ -316,9 +320,9 @@ class OsgiInstallerTestBase implements F } protected void resetCounters() { - final long [] src = installer.getCounters(); + final long [] src = statistics.getCounters(); counters = new long[src.length]; - System.arraycopy(installer.getCounters(), 0, counters, 0, src.length); + System.arraycopy(statistics.getCounters(), 0, counters, 0, src.length); } protected void sleep(long msec) { @@ -344,24 +348,24 @@ class OsgiInstallerTestBase implements F info += ": "; } - final boolean waitForCycles = counterType == OsgiInstaller.INSTALLER_CYCLES_COUNTER; + final boolean waitForCycles = counterType == OsgiInstallerStatistics.INSTALLER_CYCLES_COUNTER; long targetValue = howMany < 0 ? -howMany : counters[counterType] + howMany; if(waitForCycles) { // if waiting for installer cycles, get initial value from // that counter - we know we want to wait from now on, not from an // earlier resetCounters() call - targetValue = installer.getCounters()[counterType] + howMany; + targetValue = statistics.getCounters()[counterType] + howMany; } final long timeout = timeoutMsec > 0 ? timeoutMsec : WAIT_FOR_ACTION_TIMEOUT_MSEC; final long endTime = System.currentTimeMillis() + timeout; long lastValue = 0; while(System.currentTimeMillis() < endTime) { - lastValue = installer.getCounters()[counterType]; + lastValue = statistics.getCounters()[counterType]; if(lastValue >= targetValue) { return; - } else if(waitForCycles && installer.getCounters()[OsgiInstaller.WORKER_THREAD_IS_IDLE_COUNTER] == 1) { + } else if(waitForCycles && statistics.getCounters()[OsgiInstallerStatistics.WORKER_THREAD_IS_IDLE_COUNTER] == 1) { // Waiting for controller cycles, but worker thread became idle -> ok return; } @@ -374,14 +378,14 @@ class OsgiInstallerTestBase implements F /** Verify that no OSGi actions are executed in next two installer cycles */ protected void assertNoOsgiTasks(String info) { - final long actionsCounter = installer.getCounters()[OsgiInstaller.OSGI_TASKS_COUNTER]; - waitForInstallerAction(OsgiInstaller.INSTALLER_CYCLES_COUNTER, 2); + final long actionsCounter = statistics.getCounters()[OsgiInstallerStatistics.OSGI_TASKS_COUNTER]; + waitForInstallerAction(OsgiInstallerStatistics.INSTALLER_CYCLES_COUNTER, 2); assertEquals(info + ": OSGi tasks counter should not have changed", - actionsCounter, installer.getCounters()[OsgiInstaller.OSGI_TASKS_COUNTER]); + actionsCounter, statistics.getCounters()[OsgiInstallerStatistics.OSGI_TASKS_COUNTER]); } public void assertCounter(int index, long value) { - assertEquals("Expected value matches for counter " + index, value, installer.getCounters()[index]); + assertEquals("Expected value matches for counter " + index, value, statistics.getCounters()[index]); } protected void log(int level, String msg) { Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java?rev=983998&r1=983997&r2=983998&view=diff ============================================================================== --- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java (original) +++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java Tue Aug 10 13:37:59 2010 @@ -26,7 +26,7 @@ import java.util.LinkedList; import java.util.List; import org.apache.sling.osgi.installer.InstallableResource; -import org.apache.sling.osgi.installer.OsgiInstaller; +import org.apache.sling.osgi.installer.OsgiInstallerStatistics; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -69,7 +69,7 @@ public class RegisterResourcesTest exten installer.registerResources(r, URL_SCHEME); // Wait for worker thread to wake up and become idle once - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); final String info = "After initial registration"; assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE); @@ -88,7 +88,7 @@ public class RegisterResourcesTest exten r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar"))); installer.registerResources(r, URL_SCHEME); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); final String info = "After initial registration"; assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE); @@ -100,7 +100,7 @@ public class RegisterResourcesTest exten // Add test 1.2 in between, to make sure it disappears in next registerResources call resetCounters(); installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar"))); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertBundle("After adding testbundle V1.2", "osgi-installer-testbundle", "1.2", Bundle.ACTIVE); } @@ -111,7 +111,7 @@ public class RegisterResourcesTest exten "anotherscheme:testA.jar", new FileInputStream(getTestBundle(BUNDLE_BASE_NAME + "-testA-1.0.jar")), "digest1", null, null)); - waitForInstallerAction(OsgiInstaller.OSGI_TASKS_COUNTER, 2); + waitForInstallerAction(OsgiInstallerStatistics.OSGI_TASKS_COUNTER, 2); assertBundle("testA bundle added", "osgi-installer-testA", "1.0", Bundle.ACTIVE); } @@ -124,7 +124,7 @@ public class RegisterResourcesTest exten r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-snap.jar"), "digest1")); installer.registerResources(r, URL_SCHEME); - waitForInstallerAction(OsgiInstaller.INSTALLER_CYCLES_COUNTER, 2); + waitForInstallerAction(OsgiInstallerStatistics.INSTALLER_CYCLES_COUNTER, 2); assertBundle("Snapshot bundle must be started", "osgi-installer-snapshot-test", "1.0.0.SNAPSHOT", Bundle.ACTIVE); @@ -143,7 +143,7 @@ public class RegisterResourcesTest exten installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testB-1.0.jar"))); installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar"))); - waitForInstallerAction(OsgiInstaller.INSTALLER_CYCLES_COUNTER, 2); + waitForInstallerAction(OsgiInstallerStatistics.INSTALLER_CYCLES_COUNTER, 2); final String info = "After re-adding missing bundles"; assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE); @@ -169,7 +169,7 @@ public class RegisterResourcesTest exten r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar"))); installer.registerResources(r, URL_SCHEME); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); final String info = "After initial registration"; assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE); @@ -180,7 +180,7 @@ public class RegisterResourcesTest exten { resetCounters(); installer.registerResources(new LinkedList<InstallableResource>(), URL_SCHEME); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertNull("After registration with no resources, testB bundle must be gone", findBundle("osgi-installer-testB")); assertNull("After registration with no resources, testB bundle must be gone", findBundle("osgi-installer-needsB")); assertNull("After registration with no resources, testB bundle must be gone", findBundle("osgi-installer-testbundle")); Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RemovedResourceDetectionTest.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RemovedResourceDetectionTest.java?rev=983998&r1=983997&r2=983998&view=diff ============================================================================== --- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RemovedResourceDetectionTest.java (original) +++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RemovedResourceDetectionTest.java Tue Aug 10 13:37:59 2010 @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.sling.osgi.installer.InstallableResource; -import org.apache.sling.osgi.installer.OsgiInstaller; +import org.apache.sling.osgi.installer.OsgiInstallerStatistics; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -36,43 +36,43 @@ import org.osgi.framework.Bundle; */ @RunWith(JUnit4TestRunner.class) public class RemovedResourceDetectionTest extends OsgiInstallerTestBase { - + @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() { return defaultConfiguration(); } - + @Before public void setUp() { setupInstaller(); } - + @After public void tearDown() { super.tearDown(); } - + @Test public void testRemoveResourceAndRestart() throws Exception { - + final String symbolicNameA = "osgi-installer-testbundle"; final String symbolicNameB = "osgi-installer-testB"; - + // Install two bundles and verify assertNull(symbolicNameA + " must be absent before installing", findBundle(symbolicNameA)); resetCounters(); installer.addResource(getInstallableResource( getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar"))); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertBundle("After initial install", symbolicNameA, "1.1", Bundle.ACTIVE); - + assertNull(symbolicNameB + " must be absent before installing", findBundle(symbolicNameB)); resetCounters(); installer.addResource(getInstallableResource( getTestBundle(BUNDLE_BASE_NAME + "-testB-1.0.jar"))); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertBundle("After initial install", symbolicNameB, "1.0", Bundle.ACTIVE); - + // Restart installer, register only second bundle and verify that first one is gone restartInstaller(); resetCounters(); @@ -80,7 +80,7 @@ public class RemovedResourceDetectionTes data.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testB-1.0.jar"))); installer.registerResources(data, URL_SCHEME); sleep(500); - waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); + waitForInstallerAction(OsgiInstallerStatistics.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1); assertBundle("After installer restart", symbolicNameB, "1.0", Bundle.ACTIVE); assertNull("Bundle not in second list should be removed", findBundle(symbolicNameA)); } Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/WorkerThreadIdleTest.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/WorkerThreadIdleTest.java?rev=983998&r1=983997&r2=983998&view=diff ============================================================================== --- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/WorkerThreadIdleTest.java (original) +++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/WorkerThreadIdleTest.java Tue Aug 10 13:37:59 2010 @@ -18,7 +18,7 @@ package org.apache.sling.osgi.installer. import static org.junit.Assert.assertNull; -import org.apache.sling.osgi.installer.OsgiInstaller; +import org.apache.sling.osgi.installer.OsgiInstallerStatistics; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -29,36 +29,36 @@ import org.osgi.framework.Bundle; @RunWith(JUnit4TestRunner.class) public class WorkerThreadIdleTest extends OsgiInstallerTestBase { - + @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() { return defaultConfiguration(); } - + @Before public void setUp() { setupInstaller(); } - + @After public void tearDown() { super.tearDown(); } - + @Test public void testWorkerThreadBecomesIdle() throws Exception { waitForInstallerAction("Worker thread should become idle soon after controller starts", - OsgiInstaller.WORKER_THREAD_IS_IDLE_COUNTER, -1); - + OsgiInstallerStatistics.WORKER_THREAD_IS_IDLE_COUNTER, -1); + final String symbolicName = "osgi-installer-testbundle"; assertNull("Test bundle must be absent before installing", findBundle(symbolicName)); resetCounters(); installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar"))); // wait for two tasks: install and start - waitForInstallerAction(OsgiInstaller.OSGI_TASKS_COUNTER, 2); + waitForInstallerAction(OsgiInstallerStatistics.OSGI_TASKS_COUNTER, 2); assertBundle("After installing", symbolicName, "1.1", Bundle.ACTIVE); - + waitForInstallerAction("Worker thread should become idle after installing bundle", - OsgiInstaller.WORKER_THREAD_IS_IDLE_COUNTER, -1); + OsgiInstallerStatistics.WORKER_THREAD_IS_IDLE_COUNTER, -1); } } \ No newline at end of file
