incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r805489 - in /sling/trunk/installer/osgi: installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallTest.java
Date Tue, 18 Aug 2009 16:47:22 GMT
Author: bdelacretaz
Date: Tue Aug 18 16:47:22 2009
New Revision: 805489

URL: http://svn.apache.org/viewvc?rev=805489&view=rev
Log:
SLING-1078 - 'remove bundle' integration test passes

Modified:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallTest.java

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java?rev=805489&r1=805488&r2=805489&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java
Tue Aug 18 16:47:22 2009
@@ -110,6 +110,12 @@
                     t = createRegisteredResourcesEntry();
                     registeredResources.put(r.getEntityId(), t);
                 }
+                
+                // If an object with same sort key is already present, replace with the
+                // new one which might have different attributes
+                if(t.contains(r)) {
+                    t.remove(r);
+                }
                 t.add(r);
             }
             newResources.clear();

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallTest.java?rev=805489&r1=805488&r2=805489&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallTest.java
(original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallTest.java
Tue Aug 18 16:47:22 2009
@@ -19,6 +19,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertFalse;
 
 import org.apache.sling.osgi.installer.OsgiInstaller;
 import org.junit.After;
@@ -100,26 +101,39 @@
             assertEquals("Bundle ID must not change after ignored downgrade", bundleId, b.getBundleId());
         }
     	
-        /** TODO
     	// Uninstall
     	{
-        	c.scheduleUninstall(uri);
-        	c.waitForInstallerAction();
-        	final Bundle b = findBundle(symbolicName);
-        	assertNull("Test bundle 1.2 must be gone", b);
+            resetCounters();
+            installer.removeResource(getInstallableResource(
+                    getTestBundle("org.apache.sling.osgi.installer.it-" + POM_VERSION + "-testbundle-1.0.jar")));
+            installer.removeResource(getInstallableResource(
+                    getTestBundle("org.apache.sling.osgi.installer.it-" + POM_VERSION + "-testbundle-1.1.jar")));
+            installer.removeResource(getInstallableResource(
+                    getTestBundle("org.apache.sling.osgi.installer.it-" + POM_VERSION + "-testbundle-1.2.jar")));
+            
+            // wait for one task: uninstall
+            waitForInstallerAction(OsgiInstaller.OSGI_TASKS_COUNTER, 1);
+            final Bundle b = findBundle(symbolicName);
+            assertNull("Bundle must be gone", b);
     	}
     	
-    	// Install lower version, must work
-    	{
-        	c.scheduleInstallOrUpdate(uri, new FileInstallableResource(getTestBundle("org.apache.sling.osgi.installer.it-"
+ POM_VERSION + "-testbundle-1.0.jar")));
-        	c.waitForInstallerAction();
-        	final Bundle b = findBundle(symbolicName);
-        	assertNotNull("Test bundle 1.0 must be found after waitForInstallerAction", b);
-        	assertEquals("Installed bundle must be started", Bundle.ACTIVE, b.getState());
-        	assertEquals("Version must be 1.0 after uninstall and downgrade", "1.0", b.getHeaders().get(BUNDLE_VERSION));
-        	assertFalse("Bundle ID must have changed after uninstall and reinstall", bundleId
== b.getBundleId());
-    	}
-    	*/
+    	/** TODO
+    	// Reinstall lower version, must work
+        {
+            resetCounters();
+            installer.addResource(getInstallableResource(
+                    getTestBundle("org.apache.sling.osgi.installer.it-" + POM_VERSION + "-testbundle-1.1.jar")));
+            // wait for two tasks: install and start
+            waitForInstallerAction(OsgiInstaller.OSGI_TASKS_COUNTER, 2);
+            final Bundle b = findBundle(symbolicName);
+            assertNotNull("Reinstalled test bundle 1.1 must be found after waitForInstallerAction",
b);
+            bundleId = b.getBundleId();
+            assertEquals("Reinstalled bundle must be started", Bundle.ACTIVE, b.getState());
+            assertEquals("Reinstalled bundle version must be 1.1", "1.1", b.getHeaders().get(BUNDLE_VERSION));
+            assertFalse("Bundle ID must have changed after uninstall and reinstall", bundleId
== b.getBundleId());
+        }
+        */
+        
     }
 	
 	/** TODO



Mime
View raw message