Julian Reschke created OAK-11637:
------------------------------------
Summary: Test for JackrabbitSession.getExpandedName relies on
broken Oak behaviour
Key: OAK-11637
URL: https://issues.apache.org/jira/browse/OAK-11637
Project: Jackrabbit Oak
Issue Type: Bug
Components: jcr
Reporter: Julian Reschke
In
https://github.com/apache/jackrabbit-oak/blob/64ee526b80212de6c2d3d1082db6d71f804399c8/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/session/JackrabbitSessionTest.java#L84
{code:java}
public void testGetExpandedName() throws RepositoryException {
// empty namespace uri
assertEquals("{}testroot", s.getExpandedName(testRootNode));
Node n = testRootNode.addNode("test:bar");
assertEquals("{http://www.apache.org/jackrabbit/test}bar",
s.getExpandedName(n));
// now remap namespace uri
s.setNamespacePrefix("test", "urn:foo");
assertEquals("{urn:foo}bar", s.getExpandedName(n));
// use special namespace uri
n = testRootNode.addNode("rep:bar");
assertEquals("{internal}bar", s.getExpandedName(n));
}
{code}
...the code assumes that remapping the prefix "test" to "urn:foo" will actually
change the item name's namespace. This may be true in Oak (and I would consider
that a bug).
In Jackrabbit classic, remapping "test" to something else will cause the
repository to create a new prefix mapping, and using that when the item's name
is fetched again (for instance, "test2"). Consequently, the expanded name will
not change - as expected.
I would recommend that in *this* test class, we only test what's consistent
with the JCR spec.
See related: https://issues.apache.org/jira/browse/JCR-5137
--
This message was sent by Atlassian Jira
(v8.20.10#820010)