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/04/17 12:51:09 UTC

[jackrabbit-filevault] branch JCRVLT-697 updated: JCRVLT-697: add test coverage

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch JCRVLT-697
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git


The following commit(s) were added to refs/heads/JCRVLT-697 by this push:
     new bbda6558 JCRVLT-697: add test coverage
bbda6558 is described below

commit bbda6558ca65efaa2a6a9a0dfb5604868597ada1
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Mon Apr 17 13:50:55 2023 +0100

    JCRVLT-697: add test coverage
---
 .../packaging/integration/NodeStashingIT.java      | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

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 4ab759ba..e56a7db1 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
@@ -22,11 +22,15 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
 import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.vault.fs.api.ImportMode;
+import org.apache.jackrabbit.vault.fs.api.ProgressTrackerListener;
+import org.apache.jackrabbit.vault.fs.api.ProgressTrackerListener.Mode;
 import org.apache.jackrabbit.vault.fs.io.ImportOptions;
 import org.apache.jackrabbit.vault.packaging.PackageException;
 import org.junit.Test;
@@ -65,6 +69,9 @@ public class NodeStashingIT extends IntegrationTestBase {
 
         // update same path but without mixin allowing child nodes and different
         // UUID so that node stashing kicks in
+        Collector col = new Collector();
+        options.setListener(col);
+
         extractVaultPackage("/test-packages/stashing/update.zip", options);
 
         // child node should be retained
@@ -79,5 +86,21 @@ public class NodeStashingIT extends IntegrationTestBase {
 
         // make sure mixin type was restored
         assertTrue(node2.isNodeType("{" + TESTNS + "}hasMandatoryChildNode"));
+
+        String expected = "saving approx 3 nodes...";
+        assertTrue("Expected message '" + expected + "' not seen in: " + col.actions, col.actions.contains(expected));
+    }
+
+    private static class Collector implements ProgressTrackerListener {
+        private final List<String> actions = new LinkedList<>();
+
+        public void onMessage(Mode mode, String action, String path) {
+            if (Mode.PATHS == mode) {
+                actions.add(action);
+            }
+        }
+
+        public void onError(Mode mode, String path, Exception e) {
+        }
     }
 }
\ No newline at end of file