forked from gCubeSystem/gx-rest
Improve the post test in GXHTTPStringRequest.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/gxREST@178712 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
69bac931ec
commit
7993999be2
|
@ -97,14 +97,13 @@ public class GXHTTPStringRequestTest {
|
|||
if (skipTest)
|
||||
return;
|
||||
request.clear();
|
||||
String context ="{\"@class\":\"Context\",\"header\":{\"@class\":\"Header\",\"uuid\":\"6f86dc81-2f59-486b-8aa9-3ab5486313c4\",\"creator\":null,\"modifiedBy\":\"gxRestTest\",\"creationTime\":null,\"lastUpdateTime\":null},\"name\":\"gxTest\",\"parent\":null,\"children\":[]}";
|
||||
String context ="{\"@class\":\"Context\",\"header\":{\"@class\":\"Header\",\"uuid\":\"b252e6ce-8b9a-4142-9bca-3ab5486313c4\",\"creator\":null,\"modifiedBy\":\"gxRestTest\",\"creationTime\":null,\"lastUpdateTime\":null},\"name\":\"gxTest\",\"parent\":null,\"children\":[]}";
|
||||
Map<String,String> queryParams = new WeakHashMap<>();
|
||||
queryParams.put("rrURL", DEFAULT_RR_URL);
|
||||
try {
|
||||
GXInboundResponse response = request.path("gxrest")
|
||||
.header("Another header", "GXHTTPRequestTest")
|
||||
.queryParams(queryParams).post(context);
|
||||
assertTrue("Unexpected returned code.", response.hasCREATEDCode());
|
||||
if (response.hasException()) {
|
||||
try {
|
||||
throw response.getException();
|
||||
|
@ -114,9 +113,9 @@ public class GXHTTPStringRequestTest {
|
|||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
System.out.println("Returned string " + response.getStreamedContentAsString());
|
||||
}
|
||||
assertTrue("Unexpected returned code.", response.hasCREATEDCode());
|
||||
System.out.println("Returned string " + response.getStreamedContentAsString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail("Failed to send a POST request");
|
||||
|
|
Loading…
Reference in New Issue