resource-manager/webapp/src/main/java/org/gcube/resourcemanagement/manager/webapp/rs/RMTestForGXRest.java

55 lines
1.4 KiB
Java

package org.gcube.resourcemanagement.manager.webapp.rs;
import static org.gcube.resourcemanagement.manager.io.rs.RMContextPath.GXREST_ROOT;
import static org.gcube.resourcemanagement.manager.io.rs.RMContextPath.UUID_PARAM;
import javax.ws.rs.DELETE;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
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;
/**
* Tests for gxrest
*
* @author Manuele Simi (ISTI CNR)
*
*/
@Path(GXREST_ROOT)
public class RMTestForGXRest {
/** e.g. DELETE
* /resource-manager/gxrest/UUID?rrURL=http://registry:port//resource-
* registry
*/
@DELETE
@Path("{" + UUID_PARAM + "}")
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public Response delete(@PathParam(UUID_PARAM) String uuid) {
methodThree();
return null;
}
private void methodOne() {
methodTwo();
}
private void methodTwo() {
//something fails here
GXOutboundErrorResponse.throwExceptionWithTrace(new RMContextDoesNotExistException("Error in methodTwo"),3);
}
private void methodThree() {
//something fails here
GXOutboundErrorResponse.throwException(new RMContextDoesNotExistException("Error in methodTwo"));
}
}