Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repro test for issue OAK-10544; currently fails for Oak but passes for… #330

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Apache Jackrabbit FileVault is a project of the Apache Software Foundation.
<!-- for dependencies used for calculating OSGi import-package version ranges the minimally supported version should be used to be backwards compatible in OSGi containers -->
<oak.min.version>1.22.4</oak.min.version>
<!-- for embedded dependencies the newest version should be used -->
<oak.max.version>1.52.0</oak.max.version>
<oak.max.version>1.62.0</oak.max.version>
<slf4j.version>1.7.25</slf4j.version>
<test.oak>true</test.oak> <!-- passed to integration test as property "oak", set to true to test with Oak, false means test with Jackrabbit 2 -->
<bnd.version>6.4.0</bnd.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assume.assumeTrue;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import java.util.UUID;

import javax.jcr.NamespaceException;
import javax.jcr.NamespaceRegistry;
Expand All @@ -35,6 +37,7 @@
import javax.jcr.SimpleCredentials;

import org.apache.jackrabbit.api.JackrabbitRepository;
import org.apache.jackrabbit.commons.JcrUtils;
import org.apache.jackrabbit.vault.fs.api.PathFilterSet;
import org.apache.jackrabbit.vault.fs.config.DefaultMetaInf;
import org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter;
Expand Down Expand Up @@ -208,6 +211,19 @@ public void testBadNamespaceNames() throws RepositoryException, IOException, Pac
}
}

@Test
public void importRemappedNamespace() throws IOException, PackageException, RepositoryException {
// repro test for OAK-10544
admin.getWorkspace().getNamespaceRegistry().registerNamespace("correct", "bar:");
admin.getWorkspace().getNamespaceRegistry().registerNamespace("ns2", "bad:");
Node test = JcrUtils.getOrCreateByPath("/tmp/remappedprefix", "nt:unstructured", admin);
test.setProperty("ns2:prop", "old");
admin.save();
extractVaultPackageStrict("/test-packages/remappedprefix.zip");
Node test2 = admin.getNode("/tmp/remappedprefix");
assertEquals("new", test2.getProperty("{correct:}prop").getString());
}

/** Simple Oak repository wrapper */
private static final class Instance implements Closeable {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/tmp/remappedprefix"/>
</workspaceFilter>
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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"
jcr:mixinTypes="[rep:AccessControllable,rep:RepoAccessControllable]"
jcr:primaryType="rep:root"/>
Original file line number Diff line number Diff line change
@@ -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="nt:unstructured"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<jcr:root 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" xmlns:ns2="correct:" ns2:prop="new"
jcr:primaryType="nt:unstructured">
</jcr:root>