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 2010/09/15 10:06:09 UTC

svn commit: r997219 - /sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java

Author: cziegeler
Date: Wed Sep 15 08:06:08 2010
New Revision: 997219

URL: http://svn.apache.org/viewvc?rev=997219&view=rev
Log:
Add another test case for remove/add of a bundle in a single cycle -> should result in an update

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

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java?rev=997219&r1=997218&r2=997219&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java Wed Sep 15 08:06:08 2010
@@ -171,4 +171,38 @@ public class BundleInstallUpgradeDowngra
             assertBundle("After reinstalling", symbolicName, "1.1", Bundle.ACTIVE);
         }
     }
+
+    /**
+     * This test first installs the test bundle in version 1.0 and then removes this version while
+     * at the same time adding version 1.1 of the bundle.
+     * This test should ensure that this results in a bundle update and not in a bundle remove/install!
+     */
+    @Test
+    public void testUpdateAndRemove() throws Exception {
+        final String symbolicName = "osgi-installer-testbundle";
+        assertNull("Test bundle must be absent before installing", findBundle(symbolicName));
+
+        // install version 1.0
+        {
+            final Object listener = this.startObservingBundleEvents();
+            installer.updateResources(URL_SCHEME, getInstallableResource(
+                    getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")), null);
+            this.waitForBundleEvents(symbolicName + " should be installed with version 1.0", listener,
+                    new BundleEvent(symbolicName, "1.0", org.osgi.framework.BundleEvent.INSTALLED),
+                    new BundleEvent(symbolicName, "1.0", org.osgi.framework.BundleEvent.STARTED));
+            assertBundle("After installing", symbolicName, "1.0", Bundle.ACTIVE);
+        }
+        // install version 1.1 and remove 1.0 in one go
+        {
+            final Object listener = this.startObservingBundleEvents();
+            installer.updateResources(URL_SCHEME,
+                    getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")),
+                    getNonInstallableResourceUrl(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")));
+            this.waitForBundleEvents(symbolicName + " should be updated", listener,
+                    new BundleEvent(symbolicName, null, org.osgi.framework.BundleEvent.UPDATED),
+                    new BundleEvent(symbolicName, "1.1", org.osgi.framework.BundleEvent.STARTED));
+            assertBundle("After installing", symbolicName, "1.1", Bundle.ACTIVE);
+        }
+
+    }
 }
\ No newline at end of file