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 2022/01/18 15:38:25 UTC
[jackrabbit-filevault] 01/01: add 3.5.0 variant of ReferenceableIdentifiersImportIT
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch testidconflict350
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git
commit f08961ab2b9e54c034d88a91bf969ad202bcd9cc
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Tue Jan 18 16:36:06 2022 +0100
add 3.5.0 variant of ReferenceableIdentifiersImportIT
---
.../ReferenceableIdentifiersImportIT.java | 68 ++++++++++++++++
.../META-INF/vault/config.xml | 93 ++++++++++++++++++++++
.../META-INF/vault/definition/.content.xml | 25 ++++++
.../META-INF/vault/filter.xml | 4 +
.../META-INF/vault/nodetypes.cnd | 17 ++++
.../META-INF/vault/properties.xml | 18 +++++
.../referenceable-dup.zip/jcr_root/.content.xml | 6 ++
.../jcr_root/tmp/.content.xml | 4 +
.../jcr_root/tmp/duplicate.xml | 12 +++
.../jcr_root/tmp/referenceable.xml | 12 +++
10 files changed, 259 insertions(+)
diff --git a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/ReferenceableIdentifiersImportIT.java b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/ReferenceableIdentifiersImportIT.java
new file mode 100644
index 0000000..da3be3a
--- /dev/null
+++ b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/ReferenceableIdentifiersImportIT.java
@@ -0,0 +1,68 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.vault.fs.io.ImportOptions;
+import org.apache.jackrabbit.vault.packaging.PackageException;
+import org.junit.Test;
+
+public class ReferenceableIdentifiersImportIT extends IntegrationTestBase {
+
+ private static final String UUID_REFERENCEABLE = "352c89a4-304f-4b87-9bed-e09275597df1";
+
+ @Test
+ public void testImportDupDefault() throws RepositoryException, IOException, PackageException {
+ testImportDup();
+ Node referenceableNode = getNodeOrNull("/tmp/referenceable");
+ Node duplicateNode = getNodeOrNull("/tmp/duplicate");
+ if (duplicateNode == null && referenceableNode != null) {
+ assertTrue(referenceableNode.isNodeType(JcrConstants.MIX_REFERENCEABLE));
+ assertEquals(referenceableNode.getIdentifier(), UUID_REFERENCEABLE);
+ } else if (duplicateNode != null && referenceableNode == null) {
+ assertTrue(duplicateNode.isNodeType(JcrConstants.MIX_REFERENCEABLE));
+ assertEquals(duplicateNode.getIdentifier(), UUID_REFERENCEABLE);
+ } else {
+ fail("both nodes imported");
+ }
+ }
+
+ private Node getNodeOrNull(String path) throws RepositoryException {
+ try {
+ return admin.getNode(path);
+ } catch (PathNotFoundException ex) {
+ return null;
+ }
+ }
+
+ private void testImportDup() throws IOException, RepositoryException, PackageException {
+ ImportOptions options = getDefaultOptions();
+ options.setStrict(true);
+ extractVaultPackage("/test-packages/referenceable-dup.zip", options);
+ }
+}
\ No newline at end of file
diff --git a/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/config.xml b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/config.xml
new file mode 100644
index 0000000..b525f1c
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/config.xml
@@ -0,0 +1,93 @@
+<!--
+ 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">
+ <!--
+ 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.
+ -->
+ <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/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/definition/.content.xml b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/definition/.content.xml
new file mode 100644
index 0000000..c57b6a8
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/definition/.content.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:vlt="http://www.day.com/jcr/vault/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ jcr:created="{Date}2015-12-16T16:59:10.779+01:00"
+ jcr:createdBy="admin"
+ jcr:description=""
+ jcr:lastModified="{Date}2015-12-16T16:59:10.779+01:00"
+ jcr:lastModifiedBy="admin"
+ jcr:primaryType="vlt:PackageDefinition"
+ buildCount="5"
+ builtWith="Adobe Experience Manager-6.1.0.20150507"
+ group="my_packages"
+ lastUnwrapped="{Date}2015-12-16T16:59:10.779+01:00"
+ lastUnwrappedBy="admin"
+ lastWrapped="{Date}2015-12-16T16:59:10.779+01:00"
+ lastWrappedBy="admin"
+ name="test_referenceable"
+ version="">
+ <filter jcr:primaryType="nt:unstructured">
+ <f0
+ jcr:primaryType="nt:unstructured"
+ mode="replace"
+ root="/tmp/referenceable"
+ rules="[]"/>
+ </filter>
+</jcr:root>
diff --git a/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/filter.xml b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/filter.xml
new file mode 100644
index 0000000..1f2812b
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/filter.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workspaceFilter version="1.0">
+ <filter root="/tmp"/>
+</workspaceFilter>
diff --git a/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/nodetypes.cnd b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/nodetypes.cnd
new file mode 100644
index 0000000..c348e28
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/nodetypes.cnd
@@ -0,0 +1,17 @@
+<'vlt'='http://www.day.com/jcr/vault/1.0'>
+<'sling'='http://sling.apache.org/jcr/sling/1.0'>
+<'nt'='http://www.jcp.org/jcr/nt/1.0'>
+<'rep'='internal'>
+
+[vlt:FullCoverage]
+ mixin
+
+[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/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/properties.xml b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/properties.xml
new file mode 100644
index 0000000..2494f50
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/META-INF/vault/properties.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<properties>
+<comment>FileVault Package Properties</comment>
+<entry key="createdBy">admin</entry>
+<entry key="name">test_referenceable</entry>
+<entry key="lastModified">2015-12-16T16:59:10.779+01:00</entry>
+<entry key="lastModifiedBy">admin</entry>
+<entry key="created">2015-12-16T16:59:10.795+01:00</entry>
+<entry key="buildCount">5</entry>
+<entry key="version"/>
+<entry key="dependencies"/>
+<entry key="packageFormatVersion">2</entry>
+<entry key="description"/>
+<entry key="lastWrapped">2015-12-16T16:59:10.779+01:00</entry>
+<entry key="group">my_packages</entry>
+<entry key="lastWrappedBy">admin</entry>
+</properties>
diff --git a/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/.content.xml b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/.content.xml
new file mode 100644
index 0000000..8ea9f2a
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/.content.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
+ jcr:mixinTypes="[rep:AccessControllable,rep:RepoAccessControllable]"
+ jcr:primaryType="rep:root"
+ sling:resourceType="sling:redirect"
+ sling:target="/index.html"/>
diff --git a/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/.content.xml b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/.content.xml
new file mode 100644
index 0000000..54084a8
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/.content.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
+ jcr:mixinTypes="[rep:AccessControllable]"
+ jcr:primaryType="sling:Folder"/>
diff --git a/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/duplicate.xml b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/duplicate.xml
new file mode 100644
index 0000000..2d1995c
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/duplicate.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:vlt="http://www.day.com/jcr/vault/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ jcr:mixinTypes="[mix:referenceable,vlt:FullCoverage]"
+ jcr:primaryType="sling:Folder"
+ jcr:uuid="352c89a4-304f-4b87-9bed-e09275597df1"
+ someproperty="somevalue">
+ <child
+ jcr:mixinTypes="[mix:referenceable]"
+ jcr:primaryType="nt:unstructured"
+ jcr:uuid="a201bd6b-25b9-4255-b7db-6fc4c3ddb32d"
+ someproperty="somevalue"/>
+</jcr:root>
diff --git a/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/referenceable.xml b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/referenceable.xml
new file mode 100644
index 0000000..2d1995c
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/referenceable-dup.zip/jcr_root/tmp/referenceable.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:vlt="http://www.day.com/jcr/vault/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ jcr:mixinTypes="[mix:referenceable,vlt:FullCoverage]"
+ jcr:primaryType="sling:Folder"
+ jcr:uuid="352c89a4-304f-4b87-9bed-e09275597df1"
+ someproperty="somevalue">
+ <child
+ jcr:mixinTypes="[mix:referenceable]"
+ jcr:primaryType="nt:unstructured"
+ jcr:uuid="a201bd6b-25b9-4255-b7db-6fc4c3ddb32d"
+ someproperty="somevalue"/>
+</jcr:root>