jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1585608 - in /jackrabbit/commons/filevault/trunk/vault-core/src: main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
Date Mon, 07 Apr 2014 22:19:07 GMT
Author: tripod
Date: Mon Apr  7 22:19:07 2014
New Revision: 1585608

URL: http://svn.apache.org/r1585608
Log:
JCRVLT-45 Uninstallation of package fails if snapshot of sub-package is missing

Modified:
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
    jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java?rev=1585608&r1=1585607&r2=1585608&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
Mon Apr  7 22:19:07 2014
@@ -590,7 +590,7 @@ public class JcrPackageImpl implements J
             opts.getListener().onMessage(ProgressTrackerListener.Mode.TEXT, "Uninstalling
package from snapshot " + snap.getDefinition().getId(), "");
         }
         Session s = getNode().getSession();
-        // check for recursive unininstall
+        // check for recursive uninstall
         if (!opts.isNonRecursive()) {
             Node defNode = snap.getDefNode();
             LinkedList<PackageId> subPackages = new LinkedList<PackageId>();
@@ -606,7 +606,11 @@ public class JcrPackageImpl implements J
                 for (PackageId id: subPackages) {
                     JcrPackage pack = packMgr.open(id);
                     if (pack != null) {
-                        pack.uninstall(opts);
+                        if (pack.getSnapshot() == null) {
+                            log.warn("Unable to uninstall sub package {}. Snapshot missing.",
id);
+                        } else {
+                            pack.uninstall(opts);
+                        }
                     }
                 }
 

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java?rev=1585608&r1=1585607&r2=1585608&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
Mon Apr  7 22:19:07 2014
@@ -207,5 +207,35 @@ public class TestSubPackages extends Int
 
     }
 
+    /**
+     * Uninstalls a package that contains sub packages where a snapshot of a sub package
was deleted
+     */
+    @Test
+    public void testUninstallMissingSnapshot() throws RepositoryException, IOException, PackageException
{
+        JcrPackage pack = packMgr.upload(getStream("testpackages/subtest.zip"), false);
+        assertNotNull(pack);
+
+        // install
+        ImportOptions opts = getDefaultOptions();
+        opts.setNonRecursive(false);
+        pack.install(opts);
+
+        assertNodeExists("/tmp/a");
+        assertNodeExists("/tmp/b");
+
+        admin.getNode("/etc/packages/my_packages/.snapshot/sub_a.zip").remove();
+        admin.save();
+
+        // uninstall
+        opts.setNonRecursive(false);
+        pack.uninstall(opts);
+
+        assertNodeMissing("/etc/packages/my_packages/sub_a.zip");
+        assertNodeMissing("/etc/packages/my_packages/sub_b.zip");
+        assertNodeExists("/tmp/a");
+        assertNodeMissing("/tmp/b");
+
+    }
+
 
 }
\ No newline at end of file



Mime
View raw message