[jira] [Commented] (SLING-5770) Allow to configure resource resolver mapping
[ https://issues.apache.org/jira/browse/SLING-5770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322556#comment-15322556 ] Konrad Windszus commented on SLING-5770: Actually that won't work because if I do that in my test classes setup method, it is actually too late (because then the resource resolver factory has been created already with the wrong settings in {{SlingContext}}). > Allow to configure resource resolver mapping > > > Key: SLING-5770 > URL: https://issues.apache.org/jira/browse/SLING-5770 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Konrad Windszus > > Currently the {{ResourceResolverFactoryActivator}} being registered in > https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/ResourceResolverFactoryInitializer.java#L123 > is not configured at all. > Since resource resolver mapping is a topic which is often implemented in the > wrong way, it should be possible to setup some mapping for SlingContext to > allow to test in a more realistic way. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-5768) Introduce rep:slingResourceTypes as extension to Oak permission system
[ https://issues.apache.org/jira/browse/SLING-5768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322459#comment-15322459 ] Robert Munteanu commented on SLING-5768: Looks good! I added a couple of comments on the Github PR, but I think it's a great idead. > Introduce rep:slingResourceTypes as extension to Oak permission system > -- > > Key: SLING-5768 > URL: https://issues.apache.org/jira/browse/SLING-5768 > Project: Sling > Issue Type: New Feature > Components: Extensions >Reporter: Georg Henzler > > Oak allows to extend its permissions management by using custom restrictions > \[1], also the standard oak restrictions are based on this and are > implemented in a fairly straight-forward way \[2] (example is for > rep:ntNames). > It would be nice to have sling level restrictions using sling properties in > general. This issue is about introducing a restriction on resource types - > the following should be possible: > {code} > - /content/mynode >- rep:policy (rep:ACL) > - allow (rep:GrantACE) >+ principalName (String) = "myAuthorizable" >+ rep:privileges (Name[]) = "rep:write" >- rep:restrictions (rep:Restrictions) > + rep:slingResourceTypes (String[]) = > [myproj/resourcetype1,myproj/resourcetype2] > {code} > The example would only grant "rep:write" for the resource types > myproj/resourcetype1 and myproj/resourcetype2 in path /content/mynode, other > resources under path /content/mynode would not have "rep:write" permissions. > See github PR for a first simple implementation (adding a bundle > org.apache.sling.sling-oak-restrictions to contributions, not sure if this is > the best spot). > \[1] > https://jackrabbit.apache.org/oak/docs/security/authorization/restriction.html#Pluggability > \[2] > https://github.com/apache/jackrabbit-oak/blob/cea167f5bf70d818d58b1ffcc6bc65b3c0f9a5a4/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/NodeTypePattern.java#L50) > https://github.com/apache/jackrabbit-oak/blob/cea167f5bf70d818d58b1ffcc6bc65b3c0f9a5a4/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImpl.java -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Comment Edited] (SLING-5768) Introduce rep:slingResourceTypes as extension to Oak permission system
[ https://issues.apache.org/jira/browse/SLING-5768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322459#comment-15322459 ] Robert Munteanu edited comment on SLING-5768 at 6/9/16 1:05 PM: Looks good! I added a couple of comments on the Github PR, but I think it's a great idea. was (Author: rombert): Looks good! I added a couple of comments on the Github PR, but I think it's a great idead. > Introduce rep:slingResourceTypes as extension to Oak permission system > -- > > Key: SLING-5768 > URL: https://issues.apache.org/jira/browse/SLING-5768 > Project: Sling > Issue Type: New Feature > Components: Extensions >Reporter: Georg Henzler > > Oak allows to extend its permissions management by using custom restrictions > \[1], also the standard oak restrictions are based on this and are > implemented in a fairly straight-forward way \[2] (example is for > rep:ntNames). > It would be nice to have sling level restrictions using sling properties in > general. This issue is about introducing a restriction on resource types - > the following should be possible: > {code} > - /content/mynode >- rep:policy (rep:ACL) > - allow (rep:GrantACE) >+ principalName (String) = "myAuthorizable" >+ rep:privileges (Name[]) = "rep:write" >- rep:restrictions (rep:Restrictions) > + rep:slingResourceTypes (String[]) = > [myproj/resourcetype1,myproj/resourcetype2] > {code} > The example would only grant "rep:write" for the resource types > myproj/resourcetype1 and myproj/resourcetype2 in path /content/mynode, other > resources under path /content/mynode would not have "rep:write" permissions. > See github PR for a first simple implementation (adding a bundle > org.apache.sling.sling-oak-restrictions to contributions, not sure if this is > the best spot). > \[1] > https://jackrabbit.apache.org/oak/docs/security/authorization/restriction.html#Pluggability > \[2] > https://github.com/apache/jackrabbit-oak/blob/cea167f5bf70d818d58b1ffcc6bc65b3c0f9a5a4/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/NodeTypePattern.java#L50) > https://github.com/apache/jackrabbit-oak/blob/cea167f5bf70d818d58b1ffcc6bc65b3c0f9a5a4/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImpl.java -- This message was sent by Atlassian JIRA (v6.3.4#6332)
Re: svn commit: r1747400 - /sling/trunk/testing/http/clients/src/test/java/org/apache/sling/testing/DelayRequestInterceptorTest.java
Hi Andrei, On Wed, 2016-06-08 at 14:30 +, dul...@apache.org wrote: > -DelayRequestInterceptor interceptor = new > DelayRequestInterceptor(1000); > +DelayRequestInterceptor interceptor = new > DelayRequestInterceptor(700); This type of timeout tweaking might be better served by using a TimeoutsProvider [1] , which has a configurable multiplier. Thanks, Robert [1]: https://github.com/apache/sling/blob/bbe394c21d8fe449dfd01b0f1c3e4 f102dbbfda7/testing/tools/src/main/java/org/apache/sling/testing/tools/ sling/TimeoutsProvider.java
[jira] [Comment Edited] (SLING-5770) Allow to configure resource resolver mapping
[ https://issues.apache.org/jira/browse/SLING-5770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322375#comment-15322375 ] Konrad Windszus edited comment on SLING-5770 at 6/9/16 11:34 AM: - Great, I didn't know about that. For that purpose it would be very good though if the {{o.a.s.testing.mock.osgi.MapUtil}} would be public. Otherwise my test cannot leverage propertiesMergeWithOsgiMetadata and I have to come up with all default property values as well, even if I only intend to overwrite the mapping. Also from a performance perspective it would be good if I would be able to provide the configuration upfront (instead of doing a reconfiguration). was (Author: kwin): Great, I didn't know about that. For that purpose it would be very good though if the {{o.a.s.testing.mock.osgi.MapUtil}} would be public. Otherwise my test cannot leverage propertiesMergeWithOsgiMetadata and I have to come up with all default property values as well, even if I only intend to overwrite the mapping. > Allow to configure resource resolver mapping > > > Key: SLING-5770 > URL: https://issues.apache.org/jira/browse/SLING-5770 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Konrad Windszus > > Currently the {{ResourceResolverFactoryActivator}} being registered in > https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/ResourceResolverFactoryInitializer.java#L123 > is not configured at all. > Since resource resolver mapping is a topic which is often implemented in the > wrong way, it should be possible to setup some mapping for SlingContext to > allow to test in a more realistic way. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-5770) Allow to configure resource resolver mapping
[ https://issues.apache.org/jira/browse/SLING-5770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322375#comment-15322375 ] Konrad Windszus commented on SLING-5770: Great, I didn't know about that. For that purpose it would be very good though if the {{o.a.s.testing.mock.osgi.MapUtil}} would be public. Otherwise my test cannot leverage propertiesMergeWithOsgiMetadata and I have to come up with all default property values as well, even if I only intend to overwrite the mapping. > Allow to configure resource resolver mapping > > > Key: SLING-5770 > URL: https://issues.apache.org/jira/browse/SLING-5770 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Konrad Windszus > > Currently the {{ResourceResolverFactoryActivator}} being registered in > https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/ResourceResolverFactoryInitializer.java#L123 > is not configured at all. > Since resource resolver mapping is a topic which is often implemented in the > wrong way, it should be possible to setup some mapping for SlingContext to > allow to test in a more realistic way. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (SLING-5772) Wrong Java Doc in Adaption.class for usage sample
[ https://issues.apache.org/jira/browse/SLING-5772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Antonio Sanso resolved SLING-5772. -- Resolution: Fixed fixed in http://svn.apache.org/viewvc?view=revision&revision=1747529 > Wrong Java Doc in Adaption.class for usage sample > - > > Key: SLING-5772 > URL: https://issues.apache.org/jira/browse/SLING-5772 > Project: Sling > Issue Type: Bug > Components: Extensions >Reporter: Antonio Sanso >Assignee: Antonio Sanso >Priority: Trivial > > The {{Adaption.class}} has a wrong javadoc > {code} > * A usage sample is > * > * > @Reference(referenceInterface=Adaptation.class,target="(&(adaptable=com.myco.MyClass)(adaptable=org.apache.sling.api.Resource), > name = "ignore", strategy = ReferenceStrategy.LOOKUP)") > * > */ > {code} > should rather be > {code} > * A usage sample is > A usage sample is > * > * > @Reference(referenceInterface=Adaption.class,target="(&(adaptables=com.myco.MyClass)(adapters=org.apache.sling.api.Resource))", > name = "ignore", strategy = ReferenceStrategy.LOOKUP) > * > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (SLING-5772) Wrong Java Doc in Adaption.class for usage sample
Antonio Sanso created SLING-5772: Summary: Wrong Java Doc in Adaption.class for usage sample Key: SLING-5772 URL: https://issues.apache.org/jira/browse/SLING-5772 Project: Sling Issue Type: Bug Components: Extensions Reporter: Antonio Sanso Assignee: Antonio Sanso Priority: Trivial The {{Adaption.class}} has a wrong javadoc {code} * A usage sample is * * @Reference(referenceInterface=Adaptation.class,target="(&(adaptable=com.myco.MyClass)(adaptable=org.apache.sling.api.Resource), name = "ignore", strategy = ReferenceStrategy.LOOKUP)") * */ {code} should rather be {code} * A usage sample is A usage sample is * * @Reference(referenceInterface=Adaption.class,target="(&(adaptables=com.myco.MyClass)(adapters=org.apache.sling.api.Resource))", name = "ignore", strategy = ReferenceStrategy.LOOKUP) * {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (SLING-5771) Wrong Java Doc in Adaption.class for usage sample
Antonio Sanso created SLING-5771: Summary: Wrong Java Doc in Adaption.class for usage sample Key: SLING-5771 URL: https://issues.apache.org/jira/browse/SLING-5771 Project: Sling Issue Type: Bug Components: Extensions Reporter: Antonio Sanso Assignee: Antonio Sanso Priority: Trivial The {{Adaption.class}} has a wrong javadoc {code} * A usage sample is * * @Reference(referenceInterface=Adaptation.class,target="(&(adaptable=com.myco.MyClass)(adaptable=org.apache.sling.api.Resource), name = "ignore", strategy = ReferenceStrategy.LOOKUP)") * */ {code} should rather be {code} * A usage sample is A usage sample is * * @Reference(referenceInterface=Adaption.class,target="(&(adaptables=com.myco.MyClass)(adapters=org.apache.sling.api.Resource))", name = "ignore", strategy = ReferenceStrategy.LOOKUP) * {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-5770) Allow to configure resource resolver mapping
[ https://issues.apache.org/jira/browse/SLING-5770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322293#comment-15322293 ] Stefan Seifert commented on SLING-5770: --- this is already possible using ConfigAdmin - example: https://github.com/wcm-io/wcm-io-testing/blob/develop/aem-mock/src/main/java/io/wcm/testing/mock/aem/context/AemContextImpl.java#L83 > Allow to configure resource resolver mapping > > > Key: SLING-5770 > URL: https://issues.apache.org/jira/browse/SLING-5770 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Konrad Windszus > > Currently the {{ResourceResolverFactoryActivator}} being registered in > https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/ResourceResolverFactoryInitializer.java#L123 > is not configured at all. > Since resource resolver mapping is a topic which is often implemented in the > wrong way, it should be possible to setup some mapping for SlingContext to > allow to test in a more realistic way. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (SLING-5770) Allow to configure resource mapping
Konrad Windszus created SLING-5770: -- Summary: Allow to configure resource mapping Key: SLING-5770 URL: https://issues.apache.org/jira/browse/SLING-5770 Project: Sling Issue Type: Improvement Components: Testing Affects Versions: Testing Sling Mock 1.6.2 Reporter: Konrad Windszus Currently the {{ResourceResolverFactoryActivator}} being registered in https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/ResourceResolverFactoryInitializer.java#L123 is not configured at all. Since resource resolver mapping is a topic which is often implemented in the wrong way, it should be possible to setup some mapping for SlingContext to allow to test in a more realistic way. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (SLING-5770) Allow to configure resource resolver mapping
[ https://issues.apache.org/jira/browse/SLING-5770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Konrad Windszus updated SLING-5770: --- Summary: Allow to configure resource resolver mapping (was: Allow to configure resource mapping) > Allow to configure resource resolver mapping > > > Key: SLING-5770 > URL: https://issues.apache.org/jira/browse/SLING-5770 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Konrad Windszus > > Currently the {{ResourceResolverFactoryActivator}} being registered in > https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/ResourceResolverFactoryInitializer.java#L123 > is not configured at all. > Since resource resolver mapping is a topic which is often implemented in the > wrong way, it should be possible to setup some mapping for SlingContext to > allow to test in a more realistic way. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (SLING-5769) Expose resource resolver factory from SlingContext
[ https://issues.apache.org/jira/browse/SLING-5769?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Konrad Windszus resolved SLING-5769. Resolution: Won't Fix > Expose resource resolver factory from SlingContext > -- > > Key: SLING-5769 > URL: https://issues.apache.org/jira/browse/SLING-5769 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Konrad Windszus >Assignee: Konrad Windszus > > Currently only one singleton resource resolver is exposed from > {{o.a.s.testing.mock.sling.junit.SlingContext}} (which is automatically > closed at the end of the test). For some cases (see SLING-5719) it is useful > to create additional resource resolvers. For that the underlying resource > resolver factory should be exposed as well from {{SlingContext}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-5769) Expose resource resolver factory from SlingContext
[ https://issues.apache.org/jira/browse/SLING-5769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322188#comment-15322188 ] Konrad Windszus commented on SLING-5769: I just figured out that this really is the same resource resolver factory. Therefore I reverted commit [r1747508|https://svn.apache.org/r1747508] (which added the additional method) with [r1747511|https://svn.apache.org/r1747511]. > Expose resource resolver factory from SlingContext > -- > > Key: SLING-5769 > URL: https://issues.apache.org/jira/browse/SLING-5769 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Konrad Windszus >Assignee: Konrad Windszus > > Currently only one singleton resource resolver is exposed from > {{o.a.s.testing.mock.sling.junit.SlingContext}} (which is automatically > closed at the end of the test). For some cases (see SLING-5719) it is useful > to create additional resource resolvers. For that the underlying resource > resolver factory should be exposed as well from {{SlingContext}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-5769) Expose resource resolver factory from SlingContext
[ https://issues.apache.org/jira/browse/SLING-5769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322164#comment-15322164 ] Stefan Seifert commented on SLING-5769: --- you can get the ResourceResolverFactory just via OSGi / getService(...) on the context. > Expose resource resolver factory from SlingContext > -- > > Key: SLING-5769 > URL: https://issues.apache.org/jira/browse/SLING-5769 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Konrad Windszus >Assignee: Konrad Windszus > > Currently only one singleton resource resolver is exposed from > {{o.a.s.testing.mock.sling.junit.SlingContext}} (which is automatically > closed at the end of the test). For some cases (see SLING-5719) it is useful > to create additional resource resolvers. For that the underlying resource > resolver factory should be exposed as well from {{SlingContext}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (SLING-5719) Missing isLive() test before closing ResourceResolver
[ https://issues.apache.org/jira/browse/SLING-5719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Konrad Windszus resolved SLING-5719. Resolution: Won't Fix > Missing isLive() test before closing ResourceResolver > - > > Key: SLING-5719 > URL: https://issues.apache.org/jira/browse/SLING-5719 > Project: Sling > Issue Type: Bug > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Jens Lauterbach >Priority: Minor > Labels: easyfix > Attachments: resourceResolverIsLive.patch > > > I am currently writing tests that involve the {{SlingContext}} and its > {{ResourceResolver}}: > {code} > @Rule > public final SlingContext context = new > SlingContext(ResourceResolverType.JCR_MOCK); > [... code ...] > @Test > public void testSomething() { > ResourceResolver resolver = this.context.resourceResolver(); > someOtherMethod(resolver); > } > {code} > If the resolver is closed in {{someOtherMethod()}} the test will fail because > after the test runs the {{SlingContextImpl}} mehtod {{tearDown()}} is called > which will {{close()}} the resource resolver if it is not {{null}}. > The problem is that it won't test if the resource resolver {{isLive()}} which > will end in an exception and a failed test: > {quote} > java.lang.IllegalStateException: Resource resolver is already closed. > at > org.apache.sling.resourceresolver.impl.ResourceResolverImpl.checkClosed(ResourceResolverImpl.java:167) > at > org.apache.sling.resourceresolver.impl.ResourceResolverImpl.adaptTo(ResourceResolverImpl.java:718) > at > org.apache.sling.testing.mock.sling.context.SlingContextImpl.tearDown(SlingContextImpl.java:145) > at > org.apache.sling.testing.mock.sling.junit.SlingContext.access$300(SlingContext.java:32) > at > org.apache.sling.testing.mock.sling.junit.SlingContext$1.after(SlingContext.java:120) > at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50) > at org.junit.rules.RunRules.evaluate(RunRules.java:20) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) > at org.junit.runners.ParentRunner.run(ParentRunner.java:309) > at org.junit.runner.JUnitCore.run(JUnitCore.java:160) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) > at > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) > {quote} > Github link to the line in question: > https://github.com/apache/sling/blob/4da6392078b73f0f20d3d66e87743cf4e86f4ecb/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java#L161 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-5719) Missing isLive() test before closing ResourceResolver
[ https://issues.apache.org/jira/browse/SLING-5719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322153#comment-15322153 ] Konrad Windszus commented on SLING-5719: [~jenslauterbach] Since you found a workaround and the exposure of the resource resolver factory is now tracked in SLING-5769 I close this issue as Won't Fix. > Missing isLive() test before closing ResourceResolver > - > > Key: SLING-5719 > URL: https://issues.apache.org/jira/browse/SLING-5719 > Project: Sling > Issue Type: Bug > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Jens Lauterbach >Priority: Minor > Labels: easyfix > Attachments: resourceResolverIsLive.patch > > > I am currently writing tests that involve the {{SlingContext}} and its > {{ResourceResolver}}: > {code} > @Rule > public final SlingContext context = new > SlingContext(ResourceResolverType.JCR_MOCK); > [... code ...] > @Test > public void testSomething() { > ResourceResolver resolver = this.context.resourceResolver(); > someOtherMethod(resolver); > } > {code} > If the resolver is closed in {{someOtherMethod()}} the test will fail because > after the test runs the {{SlingContextImpl}} mehtod {{tearDown()}} is called > which will {{close()}} the resource resolver if it is not {{null}}. > The problem is that it won't test if the resource resolver {{isLive()}} which > will end in an exception and a failed test: > {quote} > java.lang.IllegalStateException: Resource resolver is already closed. > at > org.apache.sling.resourceresolver.impl.ResourceResolverImpl.checkClosed(ResourceResolverImpl.java:167) > at > org.apache.sling.resourceresolver.impl.ResourceResolverImpl.adaptTo(ResourceResolverImpl.java:718) > at > org.apache.sling.testing.mock.sling.context.SlingContextImpl.tearDown(SlingContextImpl.java:145) > at > org.apache.sling.testing.mock.sling.junit.SlingContext.access$300(SlingContext.java:32) > at > org.apache.sling.testing.mock.sling.junit.SlingContext$1.after(SlingContext.java:120) > at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50) > at org.junit.rules.RunRules.evaluate(RunRules.java:20) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) > at org.junit.runners.ParentRunner.run(ParentRunner.java:309) > at org.junit.runner.JUnitCore.run(JUnitCore.java:160) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) > at > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) > {quote} > Github link to the line in question: > https://github.com/apache/sling/blob/4da6392078b73f0f20d3d66e87743cf4e86f4ecb/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java#L161 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-5719) Missing isLive() test before closing ResourceResolver
[ https://issues.apache.org/jira/browse/SLING-5719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322152#comment-15322152 ] Konrad Windszus commented on SLING-5719: I created https://issues.apache.org/jira/browse/SLING-5769 for this enhancement. > Missing isLive() test before closing ResourceResolver > - > > Key: SLING-5719 > URL: https://issues.apache.org/jira/browse/SLING-5719 > Project: Sling > Issue Type: Bug > Components: Testing >Affects Versions: Testing Sling Mock 1.6.2 >Reporter: Jens Lauterbach >Priority: Minor > Labels: easyfix > Attachments: resourceResolverIsLive.patch > > > I am currently writing tests that involve the {{SlingContext}} and its > {{ResourceResolver}}: > {code} > @Rule > public final SlingContext context = new > SlingContext(ResourceResolverType.JCR_MOCK); > [... code ...] > @Test > public void testSomething() { > ResourceResolver resolver = this.context.resourceResolver(); > someOtherMethod(resolver); > } > {code} > If the resolver is closed in {{someOtherMethod()}} the test will fail because > after the test runs the {{SlingContextImpl}} mehtod {{tearDown()}} is called > which will {{close()}} the resource resolver if it is not {{null}}. > The problem is that it won't test if the resource resolver {{isLive()}} which > will end in an exception and a failed test: > {quote} > java.lang.IllegalStateException: Resource resolver is already closed. > at > org.apache.sling.resourceresolver.impl.ResourceResolverImpl.checkClosed(ResourceResolverImpl.java:167) > at > org.apache.sling.resourceresolver.impl.ResourceResolverImpl.adaptTo(ResourceResolverImpl.java:718) > at > org.apache.sling.testing.mock.sling.context.SlingContextImpl.tearDown(SlingContextImpl.java:145) > at > org.apache.sling.testing.mock.sling.junit.SlingContext.access$300(SlingContext.java:32) > at > org.apache.sling.testing.mock.sling.junit.SlingContext$1.after(SlingContext.java:120) > at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50) > at org.junit.rules.RunRules.evaluate(RunRules.java:20) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) > at org.junit.runners.ParentRunner.run(ParentRunner.java:309) > at org.junit.runner.JUnitCore.run(JUnitCore.java:160) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) > at > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) > {quote} > Github link to the line in question: > https://github.com/apache/sling/blob/4da6392078b73f0f20d3d66e87743cf4e86f4ecb/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java#L161 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (SLING-5769) Expose resource resolver factory from SlingContext
Konrad Windszus created SLING-5769: -- Summary: Expose resource resolver factory from SlingContext Key: SLING-5769 URL: https://issues.apache.org/jira/browse/SLING-5769 Project: Sling Issue Type: Improvement Components: Testing Affects Versions: Testing Sling Mock 1.6.2 Reporter: Konrad Windszus Assignee: Konrad Windszus Currently only one singleton resource resolver is exposed from {{o.a.s.testing.mock.sling.junit.SlingContext}} (which is automatically closed at the end of the test). For some cases (see SLING-5719) it is useful to create additional resource resolvers. For that the underlying resource resolver factory should be exposed as well from {{SlingContext}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
RE: Release of Testing ResourceResolverMock
i'm fine with a release! >-Original Message- >From: Konrad Windszus [mailto:konra...@gmx.de] >Sent: Thursday, June 09, 2016 10:18 AM >To: dev@sling.apache.org >Subject: Release of Testing ResourceResolverMock > >I would like to have a release of Testing ResourceResolver Mock 1.1.14 for >fix https://issues.apache.org/jira/browse/SLING-5673. >I am working on some issue related to NonExistingResource's and for that it >would be very handy to have proper testing support. > >Should we wait for any more fixes? Otherwise I will start the release >process soon >Thanks, >Konrad > >
Release of Testing ResourceResolverMock
I would like to have a release of Testing ResourceResolver Mock 1.1.14 for fix https://issues.apache.org/jira/browse/SLING-5673. I am working on some issue related to NonExistingResource's and for that it would be very handy to have proper testing support. Should we wait for any more fixes? Otherwise I will start the release process soon Thanks, Konrad
Re: Please welcome Andrei Dulvac, Sling committer
Welcome! Cheers, Stefan On 09/06/16 08:29, "Konrad Windszus" wrote: >Welcome, > >Konrad > >> On 09 Jun 2016, at 05:51, Chetan Mehrotra >>wrote: >> >> Welcome Andrei >> >> Chetan Mehrotra >> >> On Wed, Jun 8, 2016 at 8:07 PM, Stefan Seifert >> wrote: >> >>> welcome! >>> >>> stefan >>> -Original Message- From: Robert Munteanu [mailto:romb...@apache.org] Sent: Wednesday, June 08, 2016 3:35 PM To: Sling Dev Subject: Please welcome Andrei Dulvac, Sling committer Hi Sling community, Based on his ongoing and valuable contributions to the project, including HAPi and the contribution to the testing modules, the Sling PMC has elected Andrei Dulvac as a Sling committer, and he has accepted the invitation. Please join me in welcoming him! Andrei - if you want to honor the old tradition of new committers briefly introducing themselves to the list, feel free. And maybe take the time to verify your SVN permissions to update http://sling.apache.o rg/project-information/project-team.html :-) Best, Robert >>> >