You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2020/08/13 12:40:00 UTC

[jira] [Commented] (SLING-9659) Namespace http://sling.apache.org/ registered as prefix sling instead of http://sling.apache.org/jcr/sling/1.0

    [ https://issues.apache.org/jira/browse/SLING-9659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17176970#comment-17176970 ] 

Konrad Windszus commented on SLING-9659:
----------------------------------------

[~hanspeterstoerr] Can you debug by setting a breakpoint in https://github.com/apache/sling-org-apache-sling-testing-sling-mock/blob/53b029af8ddc25e51a7feff61568ebf350d613b4/core/src/main/java/org/apache/sling/testing/mock/sling/ResourceResolverFactoryInitializer.java#L191 by which classpath artifact the wrong URL is being provided?
This is defining the correct Namespace prefix and URL: https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/master/src/main/resources/SLING-INF/nodetypes/folder.cnd#L20

> Namespace http://sling.apache.org/ registered as prefix sling instead of http://sling.apache.org/jcr/sling/1.0
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-9659
>                 URL: https://issues.apache.org/jira/browse/SLING-9659
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: Testing Sling Mock Oak 2.1.10-1.16.0
>            Reporter: Hans-Peter Stoerr
>            Priority: Minor
>         Attachments: slingmocktest.zip
>
>
> When using org.apache.sling.testing.mock.sling.junit.SlingContext with ResourceResolverType.JCR_OAK , the URL [http://sling.apache.org/] is somehow registered as namespace "sling" instead of the usual [http://sling.apache.org/jcr/sling/1.0] . This has the effect that [http://sling.apache.org/jcr/sling/1.0] gets the prefix sling0 , and this can lead to problems when importing content during tests. This does not appear in 2.1.8-1.16.0, so I assume it's a problem of Sling Mock Oak. It can be a problem of the included dependencies, too, of course.
> I'll attach a zip of a example project that reproduces the error. The crucial lines of the failing test are:
> {code:java}
>         JackrabbitSession session = (JackrabbitSession) context.resourceResolver().adaptTo(Session.class);
>         String slinguri = session.getNamespaceURI("sling");
>         Assert.assertEquals("http://sling.apache.org/jcr/sling/1.0", slinguri);
>         // is actually http://sling.apache.org/{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)