You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2023/02/14 12:20:35 UTC
[jackrabbit-filevault] branch JCRVLT-685 updated: JCRVLT-685: stash-recover properties for ImportMode REPLACE as well (restoring pre JCRVLT-551 behavior)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch JCRVLT-685
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git
The following commit(s) were added to refs/heads/JCRVLT-685 by this push:
new 526977d5 JCRVLT-685: stash-recover properties for ImportMode REPLACE as well (restoring pre JCRVLT-551 behavior)
526977d5 is described below
commit 526977d56f5effce6cdb8a46b0dd5d4c92d30ce6
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Tue Feb 14 13:20:26 2023 +0100
JCRVLT-685: stash-recover properties for ImportMode REPLACE as well (restoring pre JCRVLT-551 behavior)
---
.../jackrabbit/vault/fs/impl/io/NodeStash.java | 21 ++++++++++-----------
.../vault/packaging/integration/NodeStashingIT.java | 13 +++++++++++--
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/NodeStash.java b/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/NodeStash.java
index f0b265fd..7fe00803 100644
--- a/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/NodeStash.java
+++ b/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/NodeStash.java
@@ -187,16 +187,15 @@ public class NodeStash {
}
}
}
- if (importMode != ImportMode.REPLACE) {
- try {
- recoverProperties(importMode==ImportMode.MERGE || importMode == ImportMode.MERGE_PROPERTIES);
- } catch (RepositoryException e) {
- log.warn("Unable to restore properties at {} due to: {}. Properties will remain in temporary location: {}",
- path, e.getMessage(), tmpNode.getPath());
- if (importInfo != null) {
- importInfo.onError(path, e);
- hasErrors = true;
- }
+
+ try {
+ recoverProperties(importMode == ImportMode.MERGE || importMode == ImportMode.MERGE_PROPERTIES);
+ } catch (RepositoryException e) {
+ log.warn("Unable to restore properties at {} due to: {}. Properties will remain in temporary location: {}", path,
+ e.getMessage(), tmpNode.getPath());
+ if (importInfo != null) {
+ importInfo.onError(path, e);
+ hasErrors = true;
}
}
if (!hasErrors) {
@@ -204,7 +203,7 @@ public class NodeStash {
}
}
}
-
+
private void recoverProperties(boolean overwriteNewOnes) throws RepositoryException {
Node destNode = session.getNode(path);
diff --git a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/NodeStashingIT.java b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/NodeStashingIT.java
index f60d1a22..270ca10b 100644
--- a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/NodeStashingIT.java
+++ b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/NodeStashingIT.java
@@ -36,12 +36,21 @@ public class NodeStashingIT extends IntegrationTestBase {
private static final String TESTNS = "https://issues.apache.org/jira/browse/JCRVLT-684";
@Test
- public void testStashMixinMandatoryChildNode() throws RepositoryException, IOException, PackageException {
+ public void testStashMixinMandatoryChildNodeModeReplace() throws RepositoryException, IOException, PackageException {
+ testStashMixinMandatoryChildNode(ImportMode.REPLACE);
+ }
+
+ @Test
+ public void testStashMixinMandatoryChildNodeModeMergeProperties() throws RepositoryException, IOException, PackageException {
+ testStashMixinMandatoryChildNode(ImportMode.MERGE_PROPERTIES);
+ }
+
+ private void testStashMixinMandatoryChildNode(ImportMode mode) throws RepositoryException, IOException, PackageException {
assumeTrue(isOak());
ImportOptions options = getDefaultOptions();
- options.setImportMode(ImportMode.MERGE_PROPERTIES);
+ options.setImportMode(mode);
extractVaultPackage("/test-packages/stashing.zip", options);