@Test public void givenOKWhenDefinitionsWorkflowThenReturnMap() throws Exception { List<WorkFlow> desired = new ArrayList<>(); desired.add(new WorkFlow().setId("TEST").setComment("TEST comment")); RequestResponseOK<WorkFlow> expected = new RequestResponseOK<>(); expected.addAllResults(desired); expected.setHits(1, 0, 1, 1); expected.setHttpCode(Status.OK.getStatusCode()); when(mock.get()).thenReturn(Response.status(Status.OK).entity(expected).build()); RequestResponse<WorkFlow> requestResponse = client.getWorkflowDefinitions(); assertEquals(expected.getHttpCode(), requestResponse.getHttpCode()); }
@Override public RequestResponse<WorkFlow> getWorkflowDefinitions() throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI) .withJsonAccept() ); check(response); return RequestResponse.parseFromResponse(response, WorkFlow.class); } catch (InvalidParseOperationException | NotAcceptableClientException | WorkspaceClientServerException e) { throw new VitamClientException(e); } catch (VitamClientInternalException | IngestInternalClientServerException | IngestInternalClientNotFoundException | IngestInternalClientConflictException e) { throw new VitamClientInternalException(e); } finally { if (response != null) { response.close(); } } }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public RequestResponse<WorkFlow> getWorkflowDefinitions() throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI) .withJsonAccept() ); check(response); return RequestResponse.parseFromResponse(response, WorkFlow.class); } catch (InvalidParseOperationException | NotAcceptableClientException | WorkspaceClientServerException e) { throw new VitamClientException(e); } catch (VitamClientInternalException | IngestInternalClientServerException | IngestInternalClientNotFoundException | IngestInternalClientConflictException e) { throw new VitamClientInternalException(e); } finally { if (response != null) { response.close(); } } } }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public RequestResponse<WorkFlow> getWorkflowDefinitions() throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI) .withJsonAccept() ); check(response); return RequestResponse.parseFromResponse(response, WorkFlow.class); } catch (InvalidParseOperationException | NotAcceptableClientException | WorkspaceClientServerException e) { throw new VitamClientException(e); } catch (VitamClientInternalException | IngestInternalClientServerException | IngestInternalClientNotFoundException | IngestInternalClientConflictException e) { throw new VitamClientInternalException(e); } finally { if (response != null) { response.close(); } } } IngestInternalClientRest(IngestInternalClientFactory factory); }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public RequestResponse<WorkFlow> getWorkflowDefinitions() throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI) .withJsonAccept() ); check(response); return RequestResponse.parseFromResponse(response, WorkFlow.class); } catch (InvalidParseOperationException | NotAcceptableClientException | WorkspaceClientServerException e) { throw new VitamClientException(e); } catch (VitamClientInternalException | IngestInternalClientServerException | IngestInternalClientNotFoundException | IngestInternalClientConflictException e) { throw new VitamClientInternalException(e); } finally { if (response != null) { response.close(); } } } IngestInternalClientRest(IngestInternalClientFactory factory); @Override void uploadInitialLogbook(Iterable<LogbookOperationParameters> logbookParametersList); @Override void upload(InputStream inputStream, MediaType archiveMimeType, WorkFlow workflow, String actionAfterInit); @Override void initWorkflow(WorkFlow workFlow); @Override void uploadFinalLogbook(Iterable<LogbookOperationParameters> logbookParametersList); @Override Response downloadObjectAsync(String objectId, IngestCollection type); @Override void storeATR(GUID guid, InputStream input); @Override RequestResponse<ItemStatus> updateOperationActionProcess(String actionId, String operationId); @Override ItemStatus getOperationProcessStatus(String id); @Override RequestResponse<ItemStatus> getOperationProcessExecutionDetails(String id); @Override RequestResponse<ItemStatus> cancelOperationProcessExecution(String id); @Override RequestResponse<ProcessDetail> listOperationsDetails(ProcessQuery query); @Override RequestResponse<WorkFlow> getWorkflowDefinitions(); @Override Optional<WorkFlow> getWorkflowDetails(String workflowIdentifier); }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public RequestResponse<WorkFlow> getWorkflowDefinitions() throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI) .withJsonAccept() ); check(response); return RequestResponse.parseFromResponse(response, WorkFlow.class); } catch (InvalidParseOperationException | NotAcceptableClientException | WorkspaceClientServerException e) { throw new VitamClientException(e); } catch (VitamClientInternalException | IngestInternalClientServerException | IngestInternalClientNotFoundException | IngestInternalClientConflictException e) { throw new VitamClientInternalException(e); } finally { if (response != null) { response.close(); } } } IngestInternalClientRest(IngestInternalClientFactory factory); @Override void uploadInitialLogbook(Iterable<LogbookOperationParameters> logbookParametersList); @Override void upload(InputStream inputStream, MediaType archiveMimeType, WorkFlow workflow, String actionAfterInit); @Override void initWorkflow(WorkFlow workFlow); @Override void uploadFinalLogbook(Iterable<LogbookOperationParameters> logbookParametersList); @Override Response downloadObjectAsync(String objectId, IngestCollection type); @Override void storeATR(GUID guid, InputStream input); @Override RequestResponse<ItemStatus> updateOperationActionProcess(String actionId, String operationId); @Override ItemStatus getOperationProcessStatus(String id); @Override RequestResponse<ItemStatus> getOperationProcessExecutionDetails(String id); @Override RequestResponse<ItemStatus> cancelOperationProcessExecution(String id); @Override RequestResponse<ProcessDetail> listOperationsDetails(ProcessQuery query); @Override RequestResponse<WorkFlow> getWorkflowDefinitions(); @Override Optional<WorkFlow> getWorkflowDetails(String workflowIdentifier);  }