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/07/13 11:18:40 UTC

[jackrabbit-filevault] branch JCRVLT-644 created (now 251b865c)

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

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


      at 251b865c JCRVLT-644: simple test case for broken content.xml

This branch includes the following new commits:

     new 251b865c JCRVLT-644: simple test case for broken content.xml

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[jackrabbit-filevault] 01/01: JCRVLT-644: simple test case for broken content.xml

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 251b865cb7fff58d1e6716398a8e970d31f840ff
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Wed Jul 13 12:18:22 2022 +0100

    JCRVLT-644: simple test case for broken content.xml
---
 .../vault/packaging/integration/XMLWFIT.java       | 50 ++++++++++++++++++++++
 .../META-INF/vault/filter.xml                      |  4 ++
 .../META-INF/vault/nodetypes.cnd                   |  9 ++++
 .../META-INF/vault/properties.xml                  | 18 ++++++++
 .../xml-nwf-truncated.zip/jcr_root/.content.xml    | 16 +++++++
 .../jcr_root/testroot/.content.xml                 |  4 ++
 .../jcr_root/testroot/_cq_content.xml              | 20 +++++++++
 7 files changed, 121 insertions(+)

diff --git a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/XMLWFIT.java b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/XMLWFIT.java
new file mode 100755
index 00000000..11fc2244
--- /dev/null
+++ b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/XMLWFIT.java
@@ -0,0 +1,50 @@
+/*
+ * 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 javax.jcr.RepositoryException;
+
+import org.junit.Test;
+
+/**
+ * Test if order of ACE is preserved upon import
+ */
+public class XMLWFIT extends IntegrationTestBase {
+
+    @Override
+    public void tearDown() throws Exception {
+        try {
+            if (admin.nodeExists("/testroot")) {
+                admin.getNode("/testroot").remove();
+                admin.save();
+            }
+        } finally {
+            super.tearDown();
+        }
+    }
+
+    @Test
+    public void testHandlingTruncatedContentXML() throws Exception {
+        assertNodeMissing("/testroot");
+        try {
+            extractVaultPackage("/test-packages/xml-nwf-truncated.zip");
+        } catch (RepositoryException expected) {
+            // expected
+        }
+        assertNodeMissing("/testroot");
+    }
+}
diff --git a/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/META-INF/vault/filter.xml b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/META-INF/vault/filter.xml
new file mode 100644
index 00000000..bbbd616d
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/META-INF/vault/filter.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workspaceFilter version="1.0">
+    <filter root="/testroot"/>
+</workspaceFilter>
diff --git a/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/META-INF/vault/nodetypes.cnd b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/META-INF/vault/nodetypes.cnd
new file mode 100644
index 00000000..3771ba50
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/META-INF/vault/nodetypes.cnd
@@ -0,0 +1,9 @@
+<'sling'='http://sling.apache.org/jcr/sling/1.0'>
+<'nt'='http://www.jcp.org/jcr/nt/1.0'>
+<'cq'='http://www.day.com/jcr/cq/1.0'>
+
+[sling:Folder] > nt:folder
+  - * (undefined)
+  - * (undefined) multiple
+  + * (nt:base) = sling:Folder version
+
diff --git a/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/META-INF/vault/properties.xml b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/META-INF/vault/properties.xml
new file mode 100644
index 00000000..c606e192
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.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">import-modes-test</entry>
+<entry key="lastModified">2011-11-15T09:45:14.664+01:00</entry>
+<entry key="lastModifiedBy">admin</entry>
+<entry key="created">2011-11-15T09:45:14.685+01:00</entry>
+<entry key="buildCount">1</entry>
+<entry key="version"/>
+<entry key="dependencies"/>
+<entry key="packageFormatVersion">2</entry>
+<entry key="description"/>
+<entry key="lastWrapped">2011-11-15T09:45:14.664+01:00</entry>
+<entry key="group"/>
+<entry key="lastWrappedBy">admin</entry>
+</properties>
diff --git a/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/.content.xml b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/.content.xml
new file mode 100644
index 00000000..1bdc10cb
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/.content.xml
@@ -0,0 +1,16 @@
+<?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="rep:root"
+    sling:resourceType="sling:redirect"
+    sling:target="/index.html">
+    <rep:policy/>
+    <jcr:system/>
+    <var/>
+    <libs/>
+    <etc/>
+    <apps/>
+    <content/>
+    <tmp/>
+    <home/>
+    <testroot/>
diff --git a/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/testroot/.content.xml b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/testroot/.content.xml
new file mode 100644
index 00000000..c5cf582a
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/testroot/.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" xmlns:my="http://jackrabbit.apache.org/filevault/testing"
+    jcr:primaryType="sling:Folder">
+</jcr:root>
diff --git a/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/testroot/_cq_content.xml b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/testroot/_cq_content.xml
new file mode 100644
index 00000000..531bf71b
--- /dev/null
+++ b/vault-core/src/test/resources/test-packages/xml-nwf-truncated.zip/jcr_root/testroot/_cq_content.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+  -->
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"
+    jcr:primaryType="nt:unstructured">
+</jcr:root>