incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r695441 - in /incubator/sling/trunk/extensions/jcrinstall: pom.xml src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/ResourceDetectionTest.java
Date Mon, 15 Sep 2008 11:57:23 GMT
Author: bdelacretaz
Date: Mon Sep 15 04:57:23 2008
New Revision: 695441

URL: http://svn.apache.org/viewvc?rev=695441&view=rev
Log:
SLING-655 - failing to UNinstall a resource must not prevent other resources from being processed

Modified:
    incubator/sling/trunk/extensions/jcrinstall/pom.xml
    incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java
    incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/ResourceDetectionTest.java

Modified: incubator/sling/trunk/extensions/jcrinstall/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/pom.xml?rev=695441&r1=695440&r2=695441&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/pom.xml (original)
+++ incubator/sling/trunk/extensions/jcrinstall/pom.xml Mon Sep 15 04:57:23 2008
@@ -28,7 +28,7 @@
   </parent>
 
   <artifactId>org.apache.sling.jcr.jcrinstall</artifactId>
-  <version>2.0.3-incubator-SNAPSHOT</version>
+  <version>2.0.3-incubator-R695435</version>
   <packaging>bundle</packaging>
 
   <name>Sling - JCR OSGi Installer</name>

Modified: incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java?rev=695441&r1=695440&r2=695441&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java
Mon Sep 15 04:57:23 2008
@@ -174,7 +174,12 @@
             if(uri.startsWith(path)) {
                 if(!session.itemExists(uri)) {
                     log.info("Resource {} has been deleted, uninstalling", uri);
-                    controller.uninstall(uri);
+            		// a single failure must not block the whole thing (SLING-655)
+                    try {
+                    	controller.uninstall(uri);
+                    } catch(JcrInstallException jie) {
+                    	log.warn("Failed to uninstall " + uri, jie);
+                    }
                 }
             }
         }

Modified: incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/ResourceDetectionTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/ResourceDetectionTest.java?rev=695441&r1=695440&r2=695441&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/ResourceDetectionTest.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/ResourceDetectionTest.java
Mon Sep 15 04:57:23 2008
@@ -22,6 +22,8 @@
 import java.io.InputStream;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 import javax.jcr.Session;
 
@@ -235,6 +237,35 @@
         mockery.assertIsSatisfied();
     }
     
+    public void testInitialDeletionsWithException() throws Exception {
+        contentHelper.setupContent();
+        
+        final SortedSet<String> installedUri = new TreeSet<String>();
+        installedUri.add("/libs/foo/bar/install/dummy.cfg");
+        installedUri.add("/libs/foo/bar/install/dummy.dp");
+        installedUri.add("/libs/foo/bar/install/dummy.jar");
+        
+        final OsgiController c = mockery.mock(OsgiController.class);
+        final RepositoryObserver ro = new MockRepositoryObserver(repo, c);
+        
+        mockery.checking(new Expectations() {{
+            allowing(c).getInstalledUris(); will(returnValue(installedUri));
+            allowing(c).getLastModified(with(any(String.class))); will(returnValue(-1L));

+            one(c).uninstall("/libs/foo/bar/install/dummy.cfg");
+            inSequence(sequence);
+            one(c).uninstall("/libs/foo/bar/install/dummy.dp");
+            inSequence(sequence);
+            will(throwException(new JcrInstallException("Fake BundleException for testing")));
+            one(c).uninstall("/libs/foo/bar/install/dummy.jar");
+            inSequence(sequence);
+        }});
+        
+        // Activating with installed resources that are not in
+        // the repository must cause them to be uninstalled
+        ro.activate(null);
+        mockery.assertIsSatisfied();
+    }
+    
     public void testMultipleResourcesWithException() throws Exception {
         contentHelper.setupContent();
         



Mime
View raw message