You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Robert Munteanu (JIRA)" <ji...@apache.org> on 2019/08/08 11:14:00 UTC

[jira] [Assigned] (SLING-8621) TestUtil.cleanup causes in WARNing due to SlingContext Rule

     [ https://issues.apache.org/jira/browse/SLING-8621?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Munteanu reassigned SLING-8621:
--------------------------------------

    Assignee: Robert Munteanu

> TestUtil.cleanup causes in WARNing due to SlingContext Rule
> -----------------------------------------------------------
>
>                 Key: SLING-8621
>                 URL: https://issues.apache.org/jira/browse/SLING-8621
>             Project: Sling
>          Issue Type: Bug
>          Components: Repoinit
>            Reporter: angela
>            Assignee: Robert Munteanu
>            Priority: Minor
>
> there are a bunch of tests with _sling-jcr-repoinit_ that call {{TestUtil.cleanup}} in the after method essentially logging out the admin session created in the constructor of the TestUtil.
> however, the {{TestUtil}} is created from a {{SlingContext}} rule, which will take care of releasing the resource-resolver and associated session itself. therefore the call to {{TestUtil.cleanup}} will result in the following warning:
> {code}
> [main] INFO org.apache.sling.jcr.repoinit.impl.NodetypesVisitor - Registering nodetypes from <RegisterNodetypesTest='uri:RegisterNodetypesTest:863a68ae-5725-45ec-9e29-fa2624d7911a'>
> [RegisterN...
> [main] WARN org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider - Unable to revert pending changes.
> javax.jcr.RepositoryException: This session has been closed.
> 	at org.apache.jackrabbit.oak.jcr.session.SessionImpl.checkAlive(SessionImpl.java:142)
> 	at org.apache.jackrabbit.oak.jcr.session.SessionImpl.refresh(SessionImpl.java:432)
> 	at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.revert(JcrResourceProvider.java:478)
> 	at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.revert(AuthenticatedResourceProvider.java:205)
> 	at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.revert(ResourceResolverControl.java:412)
> 	at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.revert(ResourceResolverImpl.java:1169)
> 	at org.apache.sling.testing.mock.sling.context.SlingContextImpl.tearDown(SlingContextImpl.java:190)
> 	at org.apache.sling.testing.mock.sling.junit.SlingContext.access$200(SlingContext.java:40)
> 	at org.apache.sling.testing.mock.sling.junit.SlingContext$1.after(SlingContext.java:134)
> 	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:325)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
> 	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
> 	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
> {code}
> i run into this whilke working on SLING-8602, where i actually need the cleanup, because i can't make use of the {{SlingContext}} to obtain a session.... but for the existing tests, calling the cleanup should be avoided.
> affected tests are:
> - RegisterNamespacesTest
> - RegisterNodetypesTest
> - RegisterPrivilegeTest
> - ExecutionOrderTest
> - ManyServiceUsersTest



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)