WorkflowResource { @GET @ApiOperation(value = "Get instantiated workflow in workspace", response = WorkflowDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkflowDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("{workflowId}") @Produces(MediaType.APPLICATION_JSON) public WorkflowDTO getWorkflowInstance( @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId, @ApiParam(required = true, value = "Workflow id") @PathParam("workflowId") int workflowId) throws EntityNotFoundException, UserNotActiveException, AccessRightException, WorkspaceNotEnabledException { Workflow workflow = workflowService.getWorkflow(workspaceId, workflowId); return mapper.map(workflow, WorkflowDTO.class); } WorkflowResource(); @PostConstruct void init(); @GET @ApiOperation(value = "Get instantiated workflow in workspace", response = WorkflowDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkflowDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("{workflowId}") @Produces(MediaType.APPLICATION_JSON) WorkflowDTO getWorkflowInstance(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId,
            @ApiParam(required = true, value = "Workflow id") @PathParam("workflowId") int workflowId); @GET @ApiOperation(value = "Get workflow's aborted workflow list", response = WorkflowDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkflowDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("{workflowId}/aborted") @Produces(MediaType.APPLICATION_JSON) Response getWorkflowAbortedWorkflowList(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId,
            @ApiParam(required = true, value = "Workflow id") @PathParam("workflowId") int workflowId);  }
@Test public void getWorkflowInstanceTest() throws ApplicationException { int workflowId = 42; Workflow workflow = new Workflow(); workflow.setId(workflowId); Mockito.when(workflowService.getWorkflow(Matchers.anyString(), Matchers.anyInt())).thenReturn(workflow); WorkflowDTO workflowDTO = workflowResource.getWorkflowInstance("wks", workflowId); Assert.assertNotNull(workflowDTO); Assert.assertEquals(workflowId, workflowDTO.getId()); }