Commit 2c01bb60 authored by Sheng Wang's avatar Sheng Wang
Browse files

add more logs in EntityUtil

parent 0d8b41e8
Pipeline #24421 failed with stages
in 17 minutes and 27 seconds
......@@ -31,6 +31,10 @@ public class EntityUtil {
Map<String, String> headers = HeaderUtils.getHeaders(TenantUtils.getTenantName(), token);
ClientResponse response = TestUtils.send(getEntityUrl(), path, "PUT", headers, body, "");
System.out.println(String.format("response status: %d %s", response.getStatus(), response.getStatusInfo().getReasonPhrase()));
if(response.getStatus() != HttpStatus.SC_CREATED) {
String message = getMessage(response);
System.out.println(message);
}
Assert.assertEquals(HttpStatus.SC_CREATED, response.getStatus());
Thread.sleep(100);
System.out.println(String.format("created entity: %s", id));
......@@ -60,6 +64,10 @@ public class EntityUtil {
Map<String, String> headers = HeaderUtils.getHeaders(TenantUtils.getTenantName(), token);
ClientResponse response = TestUtils.send(getEntityUrl(), path, "DELETE", headers, "", "");
System.out.println(String.format("response status: %d %s", response.getStatus(), response.getStatusInfo().getReasonPhrase()));
if(response.getStatus() != HttpStatus.SC_NO_CONTENT) {
String message = getMessage(response);
System.out.println(message);
}
Assert.assertEquals(HttpStatus.SC_NO_CONTENT, response.getStatus());
System.out.println(String.format("deleted entity: %s", id));
return response;
......@@ -70,6 +78,10 @@ public class EntityUtil {
Map<String, String> headers = HeaderUtils.getHeaders(TenantUtils.getTenantName(), token);
ClientResponse response = TestUtils.send(getEntityUrl(), path, "DELETE", headers, "", "");
System.out.println(String.format("response status: %d %s", response.getStatus(), response.getStatusInfo().getReasonPhrase()));
if(response.getStatus() != HttpStatus.SC_NO_CONTENT) {
String message = getMessage(response);
System.out.println(message);
}
Assert.assertEquals(HttpStatus.SC_NO_CONTENT, response.getStatus());
System.out.println(String.format("purged entity: %s", id));
return response;
......@@ -90,6 +102,10 @@ public class EntityUtil {
Map<String, String> headers = HeaderUtils.getHeaders(TenantUtils.getTenantName(), token);
ClientResponse response = TestUtils.send(getEntityUrl(), path, "DELETE", headers, "", "");
System.out.println(String.format("response status: %d %s", response.getStatus(), response.getStatusInfo().getReasonPhrase()));
if(response.getStatus() != HttpStatus.SC_NO_CONTENT) {
String message = getMessage(response);
System.out.println(message);
}
Assert.assertEquals(HttpStatus.SC_NO_CONTENT, response.getStatus());
System.out.println(String.format("deleted entity version: %s:%d", id, version));
return response;
......@@ -100,6 +116,10 @@ public class EntityUtil {
Map<String, String> headers = HeaderUtils.getHeaders(TenantUtils.getTenantName(), token);
ClientResponse response = TestUtils.send(getEntityUrl(), path, "DELETE", headers, "", "");
System.out.println(String.format("response status: %d %s", response.getStatus(), response.getStatusInfo().getReasonPhrase()));
if(response.getStatus() != HttpStatus.SC_NO_CONTENT) {
String message = getMessage(response);
System.out.println(message);
}
Assert.assertEquals(HttpStatus.SC_NO_CONTENT, response.getStatus());
System.out.println(String.format("purged entity version: %s:%d", id, version));
return response;
......@@ -225,8 +245,19 @@ public class EntityUtil {
return entity.version;
}
public static String getMessage(ClientResponse response)
{
Gson gson = new Gson();
MessageMock mock = gson.fromJson(response.getEntity(String.class), EntityUtil.MessageMock.class);
return mock.message;
}
public class EnitityMock {
public String id;
public long version;
}
public class MessageMock {
public String message;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment