sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bertrand Delacretaz (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SLING-2091) Sling JUnit sample integration tests fail when deployed and executed on CQ 5.4
Date Tue, 21 Jun 2011 09:38:47 GMT

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

Bertrand Delacretaz updated SLING-2091:
---------------------------------------

    Affects Version/s: org.apache.sling.testing.tools 1.0.4
                       JUnit Scriptable Tests Provider 1.0.6
                       JUnit Remote Tests Runners 1.0.6
        Fix Version/s: org.apache.sling.testing.tools 1.0.6
                       JUnit Scriptable Tests Provider 1.0.8
                       JUnit Remote Tests Runners 1.0.8

> Sling JUnit sample integration tests fail when deployed and executed on CQ 5.4
> ------------------------------------------------------------------------------
>
>                 Key: SLING-2091
>                 URL: https://issues.apache.org/jira/browse/SLING-2091
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: JUnit Remote Tests Runners 1.0.6, JUnit Scriptable Tests Provider
1.0.6, org.apache.sling.testing.tools 1.0.4
>         Environment: Windows 7 64bit, Maven 3.0.3, Adobe CQ 5.4
>            Reporter: Mark Adamcin
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>             Fix For: JUnit Remote Tests Runners 1.0.8, JUnit Scriptable Tests Provider
1.0.8, org.apache.sling.testing.tools 1.0.6
>
>         Attachments: madamcin_sling_junit_cq54.patch, sample-integration-tests-1.0-SNAPSHOT.pom
>
>
> After deploying the sling junit runtime bundles, sling testing tools, and sample server-side
tests to a local CQ 5.4 instance, several sample integration tests fail when trying to run
`mvn install` for the integration tests bundle.
> Bundles deployed to instance using JCR Install:
> /apps/bundles/install/org.apache.sling.testing.tools-1.0.5-SNAPSHOT.jar
> /apps/bundles/install/org.apache.sling.junit.core-1.0.7-SNAPSHOT.jar
> /apps/bundles/install/org.apache.sling.junit.scriptable-1.0.7-SNAPSHOT.jar
> /apps/bundles/install/org.apache.sling.junit.remote-1.0.7-SNAPSHOT.jar
> /apps/bundles/install/org.apache.sling.testing.samples.sampletests-1.0.7-SNAPSHOT.jar
> /apps/bundles/install/org.apache.sling.testing.samples.failingtests-1.0.7-SNAPSHOT.jar
> I copied and modified the org.apache.sling.testing.samples.integrationtests module to
run the tests against a running local CQ 5.4 instance listening on port 4502.
> Upon the first execution, the following tests failed:
> ##########
> Failed tests: 
>   testScriptableTest[0](org.apache.sling.testing.samples.integrationtests.serverside.scriptable.ScriptableTestsTest):
MKCOL request to http://localhost:6502/apps/testing: expecting status 201 expected:<201>
but was:<405>
>   testScriptableTest[1](org.apache.sling.testing.samples.integrationtests.serverside.scriptable.ScriptableTestsTest):
MKCOL request to http://localhost:6502/apps/testing: expecting status 201 expected:<201>
but was:<405>
>   initializationError(org.apache.sling.testing.samples.integrationtests.serverside.sling.SlingServerSideSingleMethodTest):
RetryLoop failed, condition is false after 30 seconds: Expecting /test/sling/1306687266726.junit
to return HTTP status 200
>   initializationError(org.apache.sling.testing.samples.integrationtests.serverside.sling.SlingServerSideTest):
/test/sling/1306687266726.junit check failed previously, cannot run tests
> ##########
> The first couple failures are related to the ScriptableTestsTest use of a SlingClient.mkdirs()
method to create the /apps/testing/ScriptableTests path. The <405> response indicates
that the client attempted to create a folder that already exists, even though it should be
checking for existence first when mkdir calls SlingClient.exists(). 
> The problem is that, unlike the MKCOL request in the mkdir() method, the SlingClient.exists()
method does not pass the ADMIN credentials along with the GET request it creates, which results
in a failure to read the nodes. I made progress in the tests by adding a ".withCredentials(username,
password)" to the request builder call in SlingClient.java on line 206.
> The next execution resulted in the following failed tests:
> ##########
> Failed tests: 
>   testScriptableTest[0](org.apache.sling.testing.samples.integrationtests.serverside.scriptable.ScriptableTestsTest):
Expected 0 failing tests but got 1: [verifyContent[0](org.apache.sling.junit.scriptable.TestAllPaths):
Expecting HTTP status 200 for path /apps/testing/ScriptableTests/testnode.test.txt expected:<200>
but was:<500>]
>   initializationError(org.apache.sling.testing.samples.integrationtests.serverside.sling.SlingServerSideSingleMethodTest):
RetryLoop failed, condition is false after 30 seconds: Expecting /test/sling/1306688554150.junit
to return HTTP status 200
>   initializationError(org.apache.sling.testing.samples.integrationtests.serverside.sling.SlingServerSideTest):
/test/sling/1306688554150.junit check failed previously, cannot run tests
> ##########
> The first failure, "testScriptableTest" referred to a 500 response, and the cause for
this was a NullPointerException:
> 29.05.2011 10:02:33.985 *ERROR* [127.0.0.1 [1306688553968] POST /system/sling/junit/org.apache.sling.junit.scriptable.ScriptableTestsProvider.json
HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable
java.lang.NullPointerException
> 	at org.apache.sling.engine.impl.parameters.ParameterSupport.getContainerParameters(ParameterSupport.java:154)
> 	at org.apache.sling.engine.impl.parameters.ParameterSupport.getRequestParameterMapInternal(ParameterSupport.java:119)
> 	at org.apache.sling.engine.impl.parameters.ParameterSupport.getParameter(ParameterSupport.java:85)
> 	at org.apache.sling.engine.impl.SlingHttpServletRequestImpl.getParameter(SlingHttpServletRequestImpl.java:143)
> 	at org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter.doFilter(BackgroundServletStarterFilter.java:105)
> 	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
> 	at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processRequest(SlingRequestProcessorImpl.java:161)
> 	at org.apache.sling.junit.scriptable.TestAllPaths.verifyContent(TestAllPaths.java:62)
> 	...
> This can be traced to the BackgroundServletStarterFilter attempting to get a parameter
from the org.apache.sling.junit.scriptable.HttpRequest object that was passed to the request
processor by the TestAllPaths.verifyContent() method. The HttpRequest.getParameterMap() method
currently returns a null pointer and the ParameterSupport class does not check for. A quick
workaround was to add a Map<String, String> member to the HttpRequest class and to return
it in the getParameterMap() method.
> The next execution result in the following failed tests:
> ##########
> Failed tests: 
>   initializationError(org.apache.sling.testing.samples.integrationtests.serverside.sling.SlingServerSideSingleMethodTest):
RetryLoop failed, condition is false after 30 seconds: Expecting /test/sling/1306689608120.junit
to return HTTP status 200
>   initializationError(org.apache.sling.testing.samples.integrationtests.serverside.sling.SlingServerSideTest):
/test/sling/1306689608120.junit check failed previously, cannot run tests
> ##########
> The above failure resulted from missing admin credentials in the org.apache.sling.testing.tools.http.RetryingContentChecker's
RetryLoop.Condition. I added a ".withCredentials(SlingTestBase.ADMIN, SlingTestBase.ADMIN)"
call to the request builder, which seems to fix that problem.
> The next execution resulted in the following reported errors:
> ##########
> Tests in error: 
>   org.apache.sling.testing.samples.integrationtests.serverside.sling.SlingServerSideSingleMethodTest:
POST request to http://localhost:6502/test/sling/1306690571924.junit/org.apache.sling.testing.samples.sampletests.JUnit4Test/testRequiresBefore.json:
expecting status 200 expected:<200> but was:<500>
>   org.apache.sling.testing.samples.integrationtests.serverside.sling.SlingServerSideTest:
POST request to http://localhost:6502/test/sling/1306690571924.junit/org.apache.sling.testing.samples.sampletests.json:
expecting status 200 expected:<200> but was:<500>
> ##########
> The above errors were again the result of a lack of permission to execute a test's HTTP
Request. Here are the associated entries in crx-quickstart/logs/error.log:
> 29.05.2011 10:36:11.977 *ERROR* [127.0.0.1 [1306690571975] POST /test/sling/1306690571924.junit/org.apache.sling.testing.samples.sampletests.JUnit4Test/testRequiresBefore.json
HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Access Denied cannot
read item cafebabe-cafe-babe-cafe-babecafebabe 
> 29.05.2011 10:36:12.036 *ERROR* [127.0.0.1 [1306690572033] POST /test/sling/1306690571924.junit/org.apache.sling.testing.samples.sampletests.json
HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Access Denied cannot
read item cafebabe-cafe-babe-cafe-babecafebabe 
> In this case, the request originates from the org.apache.sling.junit.remote.httpclient.RemoteTestHttpClient.runTests()
method. Again, I added a ".withCredentials(SlingTestBase.ADMIN, SlingTestBase.ADMIN)" call
to the request builder, and this resolved the errors.
> After making that change and running the tests again, no other errors were reported:
> ##########
> Results :
> Tests run: 22, Failures: 0, Errors: 0, Skipped: 0
> ##########

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message