You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by jo...@apache.org on 2025/12/15 17:17:55 UTC

(jackrabbit-filevault) 01/01: JCRVLT-830 add failing test-case

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

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

commit a229001fb73ea6cf8594e7e7a0abb701ca1b8136
Author: Joerg Hoh <jh...@adobe.com>
AuthorDate: Mon Dec 15 18:17:34 2025 +0100

    JCRVLT-830 add failing test-case
---
 .../integration/AggregationJCRVLT830IT.java        |  95 +++++++++++++++++++
 .../META-INF/MANIFEST.MF                           |   6 ++
 .../META-INF/vault/config.xml                      | 101 +++++++++++++++++++++
 .../META-INF/vault/filter.xml                      |  20 ++++
 .../META-INF/vault/nodetypes.cnd                   |  18 ++++
 .../META-INF/vault/properties.xml                  |  14 +++
 .../jcr_root/.content.xml                          |   6 ++
 .../jcr_root/content/.content.xml                  |  17 ++++
 .../jcr_root/content/dam/.content.xml              |   4 +
 .../jcr_root/content/dam/qcom/.content.xml         |   4 +
 .../dam/qcom/content-fragments/.content.xml        |   6 ++
 .../qcom/content-fragments/en/test1/.content.xml   |   5 +
 .../en/test1/_jcr_content/.content.xml             |   4 +
 13 files changed, 300 insertions(+)

diff --git a/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/AggregationJCRVLT830IT.java b/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/AggregationJCRVLT830IT.java
new file mode 100644
index 00000000..f653762f
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/AggregationJCRVLT830IT.java
@@ -0,0 +1,95 @@
+/*
+ * 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.ByteArrayInputStream;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.jcr.Node;
+import javax.jcr.nodetype.NodeTypeManager;
+import org.apache.jackrabbit.commons.cnd.CndImporter;
+import org.apache.jackrabbit.vault.fs.api.ImportMode;
+import org.apache.jackrabbit.vault.fs.io.Archive;
+import org.apache.jackrabbit.vault.fs.io.ImportOptions;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AggregationJCRVLT830IT extends IntegrationTestBase {
+    
+    
+    private static final List<String[]> PATH = Arrays.asList(
+            new String[] {"content","sling:Folder"},
+            new String[] {"dam","sling:Folder"},
+            new String[] {"qcom","sling:Folder"},
+            new String[] {"content-fragments","sling:Folder"},
+            new String[] {"en","sling:Folder"},
+            new String[] {"test1","sling:OrderedFolder"},
+            new String[] {"jcr:content","nt:unstructured"}
+            );
+    
+    private static final String ADDITIONAL_PATH = "/content/dam/qcom/content-fragments/en/test1";
+    
+    private static final String NODETYPES = "<'cq'='http://www.day.com/jcr/cq/1.0'>\n"
+            + "<'sling'='http://sling.apache.org/jcr/sling/1.0'>\n"
+            + "<'nt'='http://www.jcp.org/jcr/nt/1.0'>\n"
+            + "<'rep'='internal'>\n"
+            + "\n"
+            + "[sling:OrderedFolder] > sling:Folder\n"
+            + "  orderable\n"
+            + "  + * (nt:base) = sling:OrderedFolder version\n"
+            + "\n"
+            + "[sling:Folder] > nt:folder\n"
+            + "  - * (undefined) multiple\n"
+            + "  - * (undefined)\n"
+            + "  + * (nt:base) = sling:Folder version\n"
+            + "\n"
+            + "[rep:RepoAccessControllable]\n"
+            + "  mixin\n"
+            + "  + rep:repoPolicy (rep:Policy) protected ignore";
+
+    @Before
+    public void setup() throws Exception {
+        // create the necessary nodetypes
+        CndImporter.registerNodeTypes(new InputStreamReader(new ByteArrayInputStream(NODETYPES.getBytes())), admin);
+        
+        // create the necessary repository structure
+        Node node = admin.getRootNode();
+        for (int i=0; i < PATH.size();i++) {
+            String[] elem = PATH.get(i);
+            node = node.addNode(elem[0],elem[1]);
+        }
+        Node additional = admin.getNode(ADDITIONAL_PATH);
+        additional.addNode("abc");
+        additional.getSession().save();
+    }
+    
+    
+    @Test
+    public void installPackage() throws Exception {
+        Archive archive  = getFileArchive("/test-packages/AggregationJCRVLT830IT.zip");
+        ImportOptions opts = getDefaultOptions();
+        opts.setImportMode(ImportMode.REPLACE);
+        packMgr.extract(archive, opts, true);
+        
+        assertNodeExists(ADDITIONAL_PATH);
+        assertNodeExists(ADDITIONAL_PATH + "/abc");
+        
+    }
+
+}
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/MANIFEST.MF b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..b7928217
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Content-Package-Id: sling/distribution:filevault_1763695579150_3109300f-
+ d8ac-4dae-ba37-59ef714790b6:0.0.1
+Content-Package-Roots: /content/dam/qcom/content-fragments/en/test1
+Content-Package-Type: content
+
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/config.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/config.xml
new file mode 100644
index 00000000..7ac37d58
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/config.xml
@@ -0,0 +1,101 @@
+<!--
+  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.
+  -->
+<vaultfs version="1.1">
+
+    <!-- generic configuration properties -->
+    <properties>
+        <!-- configure binary-less serialization -->
+        <useBinaryReferences>true</useBinaryReferences>
+    </properties>
+
+    <!--
+        Defines the content aggregation. The order of the defined aggregates
+        is important for finding the correct aggregator.
+    -->
+    <aggregates>
+        <!--
+            Defines an aggregate that handles nt:file and nt:resource nodes.
+        -->
+        <!-- we disable the file aggregate for binary less serialization -->
+        <!--<aggregate type="file" title="File Aggregate"/>-->
+
+        <!--
+            Defines an aggregate that handles file/folder like nodes. It matches
+            all nt:hierarchyNode nodes that have or define a jcr:content
+            child node and excludes child nodes that are nt:hierarchyNodes.
+        -->
+        <aggregate type="filefolder" title="File/Folder Aggregate"/>
+
+        <!--
+            Defines an aggregate that handles nt:nodeType nodes and serializes
+            them into .cnd notation.
+        -->
+        <aggregate type="nodetype" title="Node Type Aggregate" />
+
+        <!--
+            Defines an aggregate that defines full coverage for certain node
+            types that cannot be covered by the default aggregator.
+        -->
+        <aggregate type="full" title="Full Coverage Aggregate">
+            <matches>
+                <include nodeType="rep:AccessControl" respectSupertype="true" />
+                <include nodeType="rep:Policy" respectSupertype="true" />
+                <include nodeType="cq:Widget" respectSupertype="true" />
+                <include nodeType="cq:EditConfig" respectSupertype="true" />
+                <include nodeType="cq:WorkflowModel" respectSupertype="true" />
+                <include nodeType="vlt:FullCoverage" respectSupertype="true" />
+                <include nodeType="mix:language" respectSupertype="true" />
+                <include nodeType="sling:OsgiConfig" respectSupertype="true" />
+            </matches>
+        </aggregate>
+
+        <!--
+            Defines an aggregate that handles nt:folder like nodes.
+        -->
+        <aggregate type="generic" title="Folder Aggregate">
+            <matches>
+                <include nodeType="nt:folder" respectSupertype="true" />
+            </matches>
+            <contains>
+                <exclude isNode="true" />
+            </contains>
+        </aggregate>
+
+        <!--
+            Defines the default aggregate
+        -->
+        <aggregate type="generic" title="Default Aggregator" isDefault="true">
+            <matches>
+                <!-- all -->
+            </matches>
+            <contains>
+                <exclude nodeType="nt:hierarchyNode" respectSupertype="true" />
+            </contains>
+        </aggregate>
+
+    </aggregates>
+
+    <!--
+      defines the input handlers
+    -->
+    <handlers>
+        <handler type="folder"/>
+        <handler type="file"/>
+        <handler type="nodetype"/>
+        <handler type="generic"/>
+    </handlers>
+</vaultfs>
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/filter.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/filter.xml
new file mode 100644
index 00000000..5e5a4c87
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/filter.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workspaceFilter version="1.0">
+    <filter root="/content/dam/qcom/content-fragments/en/test1">
+        <include pattern="/\Qcontent/dam/qcom/content-fragments/en/test1\E"/>
+        <include pattern="\Q/content/dam/qcom/content-fragments/en/test1/jcr:content\E"/>
+        <include pattern="\Q/content/dam/qcom/content-fragments/en/test1/jcr:content\E/.*"/>
+        <exclude pattern=".*rep:policy"/>
+        <exclude pattern=".*rep:repoPolicy"/>
+        <exclude pattern="^.*/cq:lastReplicated.*" matchProperties="true"/>
+        <exclude pattern="^.*/cq:lastReplicatedBy.*" matchProperties="true"/>
+        <exclude pattern="^.*/cq:lastReplicationAction.*" matchProperties="true"/>
+        <exclude pattern="^.*/cq:isDelivered.*" matchProperties="true"/>
+        <exclude pattern="^.*/jcr:isCheckedOut.*" matchProperties="true"/>
+        <exclude pattern="^.*/jcr:baseVersion.*" matchProperties="true"/>
+        <exclude pattern="^.*/jcr:predecessors.*" matchProperties="true"/>
+        <exclude pattern="^.*/jcr:versionHistory.*" matchProperties="true"/>
+        <exclude pattern="^.*/jcr:activity.*" matchProperties="true"/>
+        <exclude pattern="^.*/jcr:configuration.*" matchProperties="true"/>
+    </filter>
+</workspaceFilter>
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/nodetypes.cnd b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/nodetypes.cnd
new file mode 100644
index 00000000..b139ad94
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/nodetypes.cnd
@@ -0,0 +1,18 @@
+<'cq'='http://www.day.com/jcr/cq/1.0'>
+<'sling'='http://sling.apache.org/jcr/sling/1.0'>
+<'nt'='http://www.jcp.org/jcr/nt/1.0'>
+<'rep'='internal'>
+
+[sling:OrderedFolder] > sling:Folder
+  orderable
+  + * (nt:base) = sling:OrderedFolder version
+
+[sling:Folder] > nt:folder
+  - * (undefined) multiple
+  - * (undefined)
+  + * (nt:base) = sling:Folder version
+
+[rep:RepoAccessControllable]
+  mixin
+  + rep:repoPolicy (rep:Policy) protected ignore
+
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/properties.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/properties.xml
new file mode 100644
index 00000000..d42487df
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/META-INF/vault/properties.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<properties>
+<comment>FileVault Package Properties</comment>
+<entry key="packageFormatVersion">2</entry>
+<entry key="createdBy">joerghoh</entry>
+<entry key="created">2025-11-21T03:26:19.198Z</entry>
+<entry key="name">JCRVLT-830</entry>
+<entry key="generator">org.apache.jackrabbit.vault:4.1.4</entry>
+<entry key="useBinaryReferences">true</entry>
+<entry key="version">0.0.1</entry>
+<entry key="packageType">content</entry>
+<entry key="group">filevault/test</entry>
+</properties>
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/.content.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/.content.xml
new file mode 100644
index 00000000..fb94eac6
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/.content.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
+    jcr:mixinTypes="[rep:AccessControllable,rep:RepoAccessControllable]"
+    jcr:primaryType="rep:root"
+    sling:resourceType="sling:redirect"
+    sling:target="/index.html"/>
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/.content.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/.content.xml
new file mode 100644
index 00000000..f2eca8af
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/.content.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
+    jcr:mixinTypes="[rep:AccessControllable]"
+    jcr:primaryType="sling:OrderedFolder">
+    <cq:graphql/>
+    <rep:policy/>
+    <dam/>
+    <campaigns/>
+    <projects/>
+    <experience-fragments/>
+    <outbound-marketing/>
+    <cq:tags/>
+    <usergenerated/>
+    <cq:i18n/>
+    <launches/>
+</jcr:root>
+
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/.content.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/.content.xml
new file mode 100644
index 00000000..1581aa34
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/.content.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
+    jcr:mixinTypes="[rep:AccessControllable]"
+    jcr:primaryType="sling:Folder"/>
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/.content.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/.content.xml
new file mode 100644
index 00000000..1581aa34
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/.content.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
+    jcr:mixinTypes="[rep:AccessControllable]"
+    jcr:primaryType="sling:Folder"/>
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/.content.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/.content.xml
new file mode 100644
index 00000000..a9091606
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/.content.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
+    jcr:primaryType="sling:Folder">
+    <en
+        jcr:primaryType="sling:Folder"/>
+</jcr:root>
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/en/test1/.content.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/en/test1/.content.xml
new file mode 100644
index 00000000..e0f5c237
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/en/test1/.content.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
+    jcr:primaryType="sling:OrderedFolder">
+    <jcr:content/>
+</jcr:root>
diff --git a/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/en/test1/_jcr_content/.content.xml b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/en/test1/_jcr_content/.content.xml
new file mode 100644
index 00000000..99f3b8c8
--- /dev/null
+++ b/vault-core-it/vault-core-integration-tests/src/main/resources/test-packages/AggregationJCRVLT830IT.zip/jcr_root/content/dam/qcom/content-fragments/en/test1/_jcr_content/.content.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
+    jcr:primaryType="nt:unstructured"
+    />