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

Julien Ramboz edited comment on SLING-6986 at 6/28/17 4:56 PM:
---------------------------------------------------------------

[[email protected]] Thanks for taking this over and improving it. I only 
meant to have a simple improvement, but great to see that you introduced the 
full implementation.
On a side note, according to the doc 
https://sling.apache.org/documentation/the-sling-engine/resources.html#resource-types,
 the primary type should be part of the inheritance chain. The resource 
resolver implementation also validates this. So if I have a resource like:

myResource
- jcr:primaryType="nt:unstructured"
- sling:resourceType="foo/bar"

Then we should have:
- MockResourceResolver.isResourceType(myResource, "nt:unstructured") => true
- MockResourceResolver.isResourceType(myResource, "foo/bar") => true


was (Author: ramboz):
[~seelmann] Thanks for taking this over and improving it. I only meant to have 
a simple improvement, but great to see that you introduced the full 
implementation.
On a side note, according to the doc 
https://sling.apache.org/documentation/the-sling-engine/resources.html#resource-types,
 the primary type should be part of the inheritance chain. The resource 
resolver implementation also validates this. So if I have a resource like:

myResource
- jcr:primaryType="nt:unstructured"
- sling:resourceType="foo/bar"

Then we should have:
- MockResourceResolver.isResourceType(myResource, "nt:unstructured") => true
- MockResourceResolver.isResourceType(myResource, "foo/bar") => true

> The ResourceResolver mock does not test the resource type hierarchy in 
> isResourceType
> -------------------------------------------------------------------------------------
>
>                 Key: SLING-6986
>                 URL: https://issues.apache.org/jira/browse/SLING-6986
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: Testing ResourceResolver Mock 1.1.18
>            Reporter: Julien Ramboz
>            Assignee: Stefan Seifert
>            Priority: Minor
>             Fix For: Testing ResourceResolver Mock 1.1.20
>
>
> The mock resource resolver is only plainly checking the resource type on the 
> resource, and not following the type hierarchy.
> So assuming we have a resource of the form:
> myResource
> - jcr:primaryType="unstructured"
> - sling:resourceType="foo/bar"
> mockResourceResolver.isResourceType(myResource, "foo/bar") => true
> mockResourceResolver.isResourceType(myResource, "nt:unstructured") => false
> Without implementing the whole type hierarchy, we could at least improve this 
> by checking:
> - the "sling:resourceType"
> - the "sling:resourceSuperType"
> - the "jcr:primaryType"



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to