You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by kw...@apache.org on 2021/08/19 12:25:28 UTC
[jackrabbit-oak] 01/01: OAK-9541 add failing test
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch OAK-9541-ItemExistsException-in-Sysview-Import
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit e16153801b668a636d3694bba4cee87b11b07076
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Aug 19 14:25:09 2021 +0200
OAK-9541 add failing test
---
.../apache/jackrabbit/oak/jcr/xml/ImportTest.java | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/xml/ImportTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/xml/ImportTest.java
index 5a0dd4e..acabcb1 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/xml/ImportTest.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/xml/ImportTest.java
@@ -30,6 +30,7 @@ import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.ConstraintViolationException;
+import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.test.AbstractJCRTest;
import static org.junit.Assert.assertNotEquals;
@@ -55,6 +56,10 @@ public class ImportTest extends AbstractJCRTest {
}
private InputStream getImportStream() throws RepositoryException, IOException {
+ return getImportStream(path);
+ }
+
+ private InputStream getImportStream(String path) throws RepositoryException, IOException {
OutputStream out = new ByteArrayOutputStream();
superuser.exportSystemView(path, out, true, false);
return new ByteArrayInputStream(out.toString().getBytes());
@@ -77,6 +82,35 @@ public class ImportTest extends AbstractJCRTest {
}
/**
+ * @see <a href="https://issues.apache.org/jira/browse/OAK-9541">OAK-9541</a>
+ * @throws Exception
+ */
+ public void testOverwriteDifferentUUIDSamePath() throws Exception {
+ // export of node1/node1 (nt:folder in nt:folder, does not allow sns)
+ superuser.removeItem(path);
+ Node node = testRootNode.addNode(nodeName1, JcrConstants.NT_FOLDER);
+ Node subNode = node.addNode(nodeName1, JcrConstants.NT_FOLDER);
+ subNode.addMixin(mixReferenceable);
+ superuser.save();
+ uuid = subNode.getIdentifier();
+ InputStream sysViewInputStream = getImportStream(subNode.getPath());
+
+ // replace uuid of node1/node1
+ superuser.removeItem(subNode.getPath());
+ subNode = node.addNode(nodeName1, JcrConstants.NT_FOLDER);
+ subNode.addMixin(mixReferenceable);
+ assertNotEquals(uuid, subNode.getIdentifier());
+ superuser.save();
+
+ // reimport node1/node1 with old uuid
+ superuser.importXML(node.getPath(), sysViewInputStream, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);
+ superuser.save();
+
+ // original uuid must have been restored
+ assertEquals(uuid, testRootNode.getNode(nodeName1).getNode(nodeName1).getIdentifier());
+ }
+
+ /**
* @see <a href="https://issues.apache.org/jira/browse/OAK-2246">OAK-2246</a>
*/
public void testTransientReplaceUUID() throws Exception {