@SuppressWarnings("unchecked") @Test public void shouldReturnGoodStatusWhenForcePause() throws Exception { doNothing().when(processManagement).forcePause(any()); ProcessPause pause = new ProcessPause(null, 0, null); given() .contentType(ContentType.JSON) .headers(GlobalDataRest.X_TENANT_ID, TENANT_ID) .body(pause).when() .post(FORCE_PAUSE_URI) .then().assertThat() .statusCode(Status.OK.getStatusCode()); doThrow(new ProcessingException("be null")).when(processManagement).forcePause(any()); pause.setTenant(null); given() .contentType(ContentType.JSON) .headers(GlobalDataRest.X_TENANT_ID, TENANT_ID) .body(pause).when() .post(FORCE_PAUSE_URI) .then().assertThat() .statusCode(Status.BAD_REQUEST.getStatusCode()) .body(containsString("be null")); doNothing().when(processManagement).forcePause(any()); pause.setType("INGEST"); given() .contentType(ContentType.JSON) .headers(GlobalDataRest.X_TENANT_ID, TENANT_ID) .body(pause).when() .post(FORCE_PAUSE_URI) .then().assertThat() .statusCode(Status.OK.getStatusCode()); doThrow(new ProcessingException("is not a valid process type")).when(processManagement).forcePause(any()); pause.setType("BAD_INGEST"); given() .contentType(ContentType.JSON) .headers(GlobalDataRest.X_TENANT_ID, TENANT_ID) .body(pause).when() .post(FORCE_PAUSE_URI) .then().assertThat() .statusCode(Status.BAD_REQUEST.getStatusCode()) .body(containsString("is not a valid process type")); ; }
@Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response forcePause(ProcessPause info) { try { processManagement.forcePause(info); RequestResponseOK<ProcessPause> response = new RequestResponseOK<>(); response.addResult(info) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (ProcessingException e) { LOGGER.error(e); return this.buildResponse(Status.BAD_REQUEST, getErrorEntity(Status.BAD_REQUEST, "Error while set force pause", e.getMessage())); } }
ProcessManagementResource extends ApplicationStatusResource { @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response forcePause(ProcessPause info) { try { processManagement.forcePause(info); RequestResponseOK<ProcessPause> response = new RequestResponseOK<>(); response.addResult(info) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (ProcessingException e) { LOGGER.error(e); return this.buildResponse(Status.BAD_REQUEST, getErrorEntity(Status.BAD_REQUEST, "Error while set force pause", e.getMessage())); } } }
ProcessManagementResource extends ApplicationStatusResource { @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response forcePause(ProcessPause info) { try { processManagement.forcePause(info); RequestResponseOK<ProcessPause> response = new RequestResponseOK<>(); response.addResult(info) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (ProcessingException e) { LOGGER.error(e); return this.buildResponse(Status.BAD_REQUEST, getErrorEntity(Status.BAD_REQUEST, "Error while set force pause", e.getMessage())); } } ProcessManagementResource(ServerConfiguration configuration, ProcessDistributor processDistributor);   ProcessManagementResource(ProcessManagement pManagement, ServerConfiguration configuration); }
ProcessManagementResource extends ApplicationStatusResource { @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response forcePause(ProcessPause info) { try { processManagement.forcePause(info); RequestResponseOK<ProcessPause> response = new RequestResponseOK<>(); response.addResult(info) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (ProcessingException e) { LOGGER.error(e); return this.buildResponse(Status.BAD_REQUEST, getErrorEntity(Status.BAD_REQUEST, "Error while set force pause", e.getMessage())); } } ProcessManagementResource(ServerConfiguration configuration, ProcessDistributor processDistributor);   ProcessManagementResource(ProcessManagement pManagement, ServerConfiguration configuration); ProcessLifeCycle getProcessLifeCycle(); @Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) Response getWorkflowDefinitions(); @Path("workflows/{workfowId}") @GET @Produces(MediaType.APPLICATION_JSON) Response getWorkflowDetails(@PathParam("workfowId") String workfowId); @Path("operations/{id}") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response executeWorkFlow(@Context HttpHeaders headers, @PathParam("id") String id, ProcessingEntry process); @Path("operations/{id}") @GET @Produces(MediaType.APPLICATION_JSON) Response getOperationProcessExecutionDetails(@PathParam("id") String id); @Path("operations/{id}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateWorkFlowStatus(@Context HttpHeaders headers, @PathParam("id") String id); @Path("operations/{id}") @DELETE @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response cancelOperationProcessExecution(@PathParam("id") String id); @Path("operations/{id}") @HEAD @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response getWorkFlowState(@PathParam("id") String id); @GET @Path("/operations") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response findProcessWorkflow(ProcessQuery query); @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response forcePause(ProcessPause info); @Path("/removeforcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response removeForcePause(ProcessPause info); }
ProcessManagementResource extends ApplicationStatusResource { @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response forcePause(ProcessPause info) { try { processManagement.forcePause(info); RequestResponseOK<ProcessPause> response = new RequestResponseOK<>(); response.addResult(info) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (ProcessingException e) { LOGGER.error(e); return this.buildResponse(Status.BAD_REQUEST, getErrorEntity(Status.BAD_REQUEST, "Error while set force pause", e.getMessage())); } } ProcessManagementResource(ServerConfiguration configuration, ProcessDistributor processDistributor);   ProcessManagementResource(ProcessManagement pManagement, ServerConfiguration configuration); ProcessLifeCycle getProcessLifeCycle(); @Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) Response getWorkflowDefinitions(); @Path("workflows/{workfowId}") @GET @Produces(MediaType.APPLICATION_JSON) Response getWorkflowDetails(@PathParam("workfowId") String workfowId); @Path("operations/{id}") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response executeWorkFlow(@Context HttpHeaders headers, @PathParam("id") String id, ProcessingEntry process); @Path("operations/{id}") @GET @Produces(MediaType.APPLICATION_JSON) Response getOperationProcessExecutionDetails(@PathParam("id") String id); @Path("operations/{id}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateWorkFlowStatus(@Context HttpHeaders headers, @PathParam("id") String id); @Path("operations/{id}") @DELETE @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response cancelOperationProcessExecution(@PathParam("id") String id); @Path("operations/{id}") @HEAD @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response getWorkFlowState(@PathParam("id") String id); @GET @Path("/operations") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response findProcessWorkflow(ProcessQuery query); @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response forcePause(ProcessPause info); @Path("/removeforcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response removeForcePause(ProcessPause info);  }