on 2021 Oct 25 7:39 AM
Hello,
on Hybris Version 1905.33 the Spock-Test of OCC-Webservices failed (error 404). I generated the OCC extensions (trainingcommercewebservices and trainingcommercewebservicestest) and I tried to write a Spock-Test for my own implemented controller, but the Spock-Test failed in the token generation, especially in this function authorizeTrustedClient(restClient).
Request:
POST
https://localhost:8002/authorizationserver_junit/oauth/token?grant_type=client_credentials&client_id...
Response:
groovyx.net.http.ResponseParseException:
at groovyx.net.http.HTTPBuilder$1.handleResponse(HTTPBuilder.java:495)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:223)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)
at groovyx.net.http.RESTClient.post(RESTClient.java:141)
at com.training.test.groovy.webservicetests.v2.spock.AbstractSpockTest.getOAuth2TokenUsingClientCredentials(AbstractSpockTest.groovy:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.training.test.groovy.webservicetests.v2.spock.AbstractSpockTest.authorizeTrustedClient(AbstractSpockTest.groovy:290)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.training.test.groovy.webservicetests.v2.spock.mytest.MyTrainingTest.A trusted client request : #format(MyTrainingTest.groovy:22)
Caused by: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object
The current character read is '<' with an int value of 60
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
<!doctype html><html lang="fr"><head><title>État HTTP 404 – Non trouvé</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>État HTTP 404 – Non trouvé</h1><hr class="line" /><p><b>Type</b> Rapport d'état</p><p><b>description</b> La ressource demandée n'est pas disponible.</p><hr class="line" /><h3>Apache Tomcat/8.5.69</h3></body></html>
^
at org.apache.groovy.json.internal.JsonParserCharArray.decodeValueInternal(JsonParserCharArray.java:206)
at org.apache.groovy.json.internal.JsonParserCharArray.decodeValue(JsonParserCharArray.java:157)
at org.apache.groovy.json.internal.JsonParserCharArray.decodeFromChars(JsonParserCharArray.java:46)
at org.apache.groovy.json.internal.JsonParserCharArray.parse(JsonParserCharArray.java:384)
at org.apache.groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:133)
at groovy.json.JsonSlurper.parse(JsonSlurper.java:221)
at groovyx.net.http.ParserRegistry.parseJSON(ParserRegistry.java:280)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at groovy.lang.Closure.call(Closure.java:411)
at groovy.lang.Closure.call(Closure.java:427)
at groovyx.net.http.HTTPBuilder.parseResponse(HTTPBuilder.java:560)
at groovyx.net.http.HTTPBuilder$1.handleResponse(HTTPBuilder.java:489)<br>
For information, native Spock-Test do not pass too,I had the same error.
Thanks in advance and best regards,
Rida
Request clarification before answering.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.