jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1575052 - in /jackrabbit/commons/filevault/trunk/vault-core/src: main/java/org/apache/jackrabbit/vault/fs/impl/io/ test/java/org/apache/jackrabbit/vault/packaging/integration/ test/resources/org/apache/jackrabbit/vault/packaging/integratio...
Date Thu, 06 Mar 2014 21:38:29 GMT
Author: tripod
Date: Thu Mar  6 21:38:28 2014
New Revision: 1575052

URL: http://svn.apache.org/r1575052
Log:
JCRVLT-41 ImportMode=UPDATE deletes existing nodes

Added:
    jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestImportMode.java
    jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_merge.zip
    jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_replace.zip
    jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_update.zip
Modified:
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewSAXImporter.java

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewSAXImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewSAXImporter.java?rev=1575052&r1=1575051&r2=1575052&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewSAXImporter.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewSAXImporter.java
Thu Mar  6 21:38:28 2014
@@ -1096,8 +1096,10 @@ public class DocViewSAXImporter extends 
                                 aclManagement.clearACL(node);
                             }
                         } else {
-                            importInfo.onDeleted(path);
-                            child.remove();
+                            if (wspFilter.getImportMode(path) == ImportMode.REPLACE) {
+                                importInfo.onDeleted(path);
+                                child.remove();
+                            }
                         }
                     } else if (aclHandling == AccessControlHandling.CLEAR
                             && aclManagement.isACLNode(child)

Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestImportMode.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestImportMode.java?rev=1575052&view=auto
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestImportMode.java
(added)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestImportMode.java
Thu Mar  6 21:38:28 2014
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.vault.packaging.integration;
+
+import java.io.IOException;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.vault.packaging.JcrPackage;
+import org.apache.jackrabbit.vault.packaging.PackageException;
+import org.junit.Test;
+
+/**
+ * <code>TestPackageInstall</code>...
+ */
+public class TestImportMode extends IntegrationTestBase {
+
+    /**
+     * Installs a package with the filter: "/tmp/foo", mode="replace"
+     */
+    @Test
+    public void testReplace() throws RepositoryException, IOException, PackageException {
+        Node tmp = admin.getRootNode().addNode("tmp");
+        Node foo = tmp.addNode("foo");
+        Node old = foo.addNode("old");
+        admin.save();
+        assertNodeExists("/tmp/foo/old");
+        assertNodeMissing("/tmp/foo/bar");
+
+        JcrPackage pack = packMgr.upload(getStream("testpackages/tmp_mode_replace.zip"),
false);
+        pack.extract(getDefaultOptions());
+
+        assertNodeMissing("/tmp/foo/old");
+        assertNodeExists("/tmp/foo/bar");
+        assertProperty("/tmp/foo/bar/testProperty", "new");
+    }
+
+    /**
+     * Installs a package with the filter: "/tmp/foo", mode="merge"
+     */
+    @Test
+    public void testMerge() throws RepositoryException, IOException, PackageException {
+        Node tmp = admin.getRootNode().addNode("tmp");
+        Node foo = tmp.addNode("foo");
+        Node old = foo.addNode("old");
+        Node bar = foo.addNode("bar");
+        bar.setProperty("testProperty", "old");
+        admin.save();
+        assertNodeExists("/tmp/foo/old");
+        assertNodeMissing("/tmp/foo/new");
+
+        JcrPackage pack = packMgr.upload(getStream("testpackages/tmp_mode_merge.zip"), false);
+        pack.extract(getDefaultOptions());
+
+        assertNodeExists("/tmp/foo/old");
+        assertNodeExists("/tmp/foo/bar");
+        assertNodeExists("/tmp/foo/new");
+        assertProperty("/tmp/foo/bar/testProperty", "old");
+    }
+
+    /**
+     * Installs a package with the filter: "/tmp/foo", mode="update"
+     */
+    @Test
+    public void testUpdate() throws RepositoryException, IOException, PackageException {
+        Node tmp = admin.getRootNode().addNode("tmp");
+        Node foo = tmp.addNode("foo");
+        Node old = foo.addNode("old");
+        Node bar = foo.addNode("bar");
+        bar.setProperty("testProperty", "old");
+        admin.save();
+        assertNodeExists("/tmp/foo/old");
+        assertNodeMissing("/tmp/foo/new");
+
+        JcrPackage pack = packMgr.upload(getStream("testpackages/tmp_mode_update.zip"), false);
+        pack.extract(getDefaultOptions());
+
+        assertNodeExists("/tmp/foo/old");
+        assertNodeExists("/tmp/foo/bar");
+        assertNodeExists("/tmp/foo/new");
+        assertProperty("/tmp/foo/bar/testProperty", "new");
+    }
+
+}
\ No newline at end of file

Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_merge.zip
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_merge.zip?rev=1575052&view=auto
==============================================================================
Files jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_merge.zip
(added) and jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_merge.zip
Thu Mar  6 21:38:28 2014 differ

Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_replace.zip
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_replace.zip?rev=1575052&view=auto
==============================================================================
Files jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_replace.zip
(added) and jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_replace.zip
Thu Mar  6 21:38:28 2014 differ

Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_update.zip
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_update.zip?rev=1575052&view=auto
==============================================================================
Files jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_update.zip
(added) and jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_mode_update.zip
Thu Mar  6 21:38:28 2014 differ



Mime
View raw message