Use GXInboundResponse to access to the response returned by the resource methods.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/resource-management/resource-manager@163183 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
58e3ef8a37
commit
db3d6a3cf7
|
@ -4,7 +4,6 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -18,8 +17,8 @@ import org.gcube.common.authorization.client.Constants;
|
||||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.gxrest.response.inbound.GXInboundResponse;
|
||||||
import org.gcube.common.gxrest.response.outbound.ErrorCode;
|
import org.gcube.common.gxrest.response.outbound.ErrorCode;
|
||||||
import org.gcube.common.gxrest.response.outbound.deserialization.ErrorEntityManager;
|
|
||||||
import org.gcube.common.gxrest.response.outbound.deserialization.SerializableErrorEntity;
|
import org.gcube.common.gxrest.response.outbound.deserialization.SerializableErrorEntity;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.informationsystem.impl.entity.ContextImpl;
|
import org.gcube.informationsystem.impl.entity.ContextImpl;
|
||||||
|
@ -162,10 +161,8 @@ public class RMContextTest extends JerseyTest {
|
||||||
} else {
|
} else {
|
||||||
assertEquals("Unexpected returned code. Reason: " + create.getStatusInfo().getReasonPhrase(),
|
assertEquals("Unexpected returned code. Reason: " + create.getStatusInfo().getReasonPhrase(),
|
||||||
Status.NOT_ACCEPTABLE.getStatusCode(), create.getStatus());
|
Status.NOT_ACCEPTABLE.getStatusCode(), create.getStatus());
|
||||||
SerializableErrorEntity entity = create.readEntity(SerializableErrorEntity.class);
|
GXInboundResponse response = new GXInboundResponse(create);
|
||||||
ErrorEntityManager response = new ErrorEntityManager(entity);
|
|
||||||
if (response.hasException()) {
|
if (response.hasException()) {
|
||||||
logger.info("about to load " + entity.getExceptionClass());
|
|
||||||
try {
|
try {
|
||||||
throw response.getException();
|
throw response.getException();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -270,8 +267,7 @@ public class RMContextTest extends JerseyTest {
|
||||||
} else {
|
} else {
|
||||||
assertEquals("Unexpected returned code. Reason: " + delete.getStatusInfo().getReasonPhrase(),
|
assertEquals("Unexpected returned code. Reason: " + delete.getStatusInfo().getReasonPhrase(),
|
||||||
Status.NOT_ACCEPTABLE.getStatusCode(), delete.getStatus());
|
Status.NOT_ACCEPTABLE.getStatusCode(), delete.getStatus());
|
||||||
SerializableErrorEntity entity = delete.readEntity(SerializableErrorEntity.class);
|
GXInboundResponse response = new GXInboundResponse(delete);
|
||||||
ErrorEntityManager response = new ErrorEntityManager(entity);
|
|
||||||
if (response.hasException()) {
|
if (response.hasException()) {
|
||||||
try {
|
try {
|
||||||
throw response.getException();
|
throw response.getException();
|
||||||
|
|
Loading…
Reference in New Issue