|
|
|
@ -12,6 +12,8 @@ import javax.ws.rs.core.Response;
|
|
|
|
|
import org.gcube.common.gxrest.response.outbound.GXOutboundErrorResponse;
|
|
|
|
|
import org.gcube.resourcemanagement.manager.io.rs.RMContextDoesNotExistException;
|
|
|
|
|
import org.gcube.resourcemanagement.manager.webapp.ResourceInitializer;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests for gxrest
|
|
|
|
@ -22,6 +24,8 @@ import org.gcube.resourcemanagement.manager.webapp.ResourceInitializer;
|
|
|
|
|
@Path(GXREST_ROOT)
|
|
|
|
|
public class RMTestForGXRest {
|
|
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(RMTestForGXRest.class);
|
|
|
|
|
|
|
|
|
|
/** e.g. DELETE
|
|
|
|
|
* /resource-manager/gxrest/UUID?rrURL=http://registry:port//resource-
|
|
|
|
|
* registry
|
|
|
|
@ -30,7 +34,7 @@ public class RMTestForGXRest {
|
|
|
|
|
@Path("{" + UUID_PARAM + "}")
|
|
|
|
|
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
|
|
|
|
public Response delete(@PathParam(UUID_PARAM) String uuid) {
|
|
|
|
|
methodThree();
|
|
|
|
|
methodOne();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -41,14 +45,15 @@ public class RMTestForGXRest {
|
|
|
|
|
private void methodTwo() {
|
|
|
|
|
|
|
|
|
|
//something fails here
|
|
|
|
|
|
|
|
|
|
GXOutboundErrorResponse.throwExceptionWithTrace(new RMContextDoesNotExistException("Error in methodTwo"),3);
|
|
|
|
|
logger.error("method 2 failed");
|
|
|
|
|
GXOutboundErrorResponse.throwExceptionWithTrace(new RMContextDoesNotExistException("Error in methodTwo"),3,Response.Status.BAD_REQUEST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void methodThree() {
|
|
|
|
|
|
|
|
|
|
//something fails here
|
|
|
|
|
|
|
|
|
|
GXOutboundErrorResponse.throwException(new RMContextDoesNotExistException("Error in methodTwo"));
|
|
|
|
|
logger.error("method 3 failed");
|
|
|
|
|
|
|
|
|
|
GXOutboundErrorResponse.throwException(new RMContextDoesNotExistException("Error in methodThree"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|