@Test public void givenNotFoundWhenGetWorkFlowDetailThenReturnOptionalEmpty() throws Exception { when(mock.get()).thenReturn(Response.status(Status.NOT_FOUND).build()); Optional<WorkFlow> requestReponse = client.getWorkflowDetails("FAKE_WORKFLOW"); assertEquals(Boolean.FALSE, requestReponse.isPresent()); }
@Override public Optional<WorkFlow> getWorkflowDetails(String workflowIdentifier) throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI + "/" + workflowIdentifier) .withJsonAccept() ); check(response); return Optional.of(response.readEntity(WorkFlow.class)); } catch (InvalidParseOperationException | NotAcceptableClientException | IngestInternalClientServerException | WorkspaceClientServerException e) { throw new VitamClientException("Internal Error Server : " + response.readEntity(String.class)); } catch (IngestInternalClientNotFoundException e) { return Optional.empty(); } finally { if (response != null) { response.close(); } } }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public Optional<WorkFlow> getWorkflowDetails(String workflowIdentifier) throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI + "/" + workflowIdentifier) .withJsonAccept() ); check(response); return Optional.of(response.readEntity(WorkFlow.class)); } catch (InvalidParseOperationException | NotAcceptableClientException | IngestInternalClientServerException | WorkspaceClientServerException e) { throw new VitamClientException("Internal Error Server : " + response.readEntity(String.class)); } catch (IngestInternalClientNotFoundException e) { return Optional.empty(); } finally { if (response != null) { response.close(); } } } }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public Optional<WorkFlow> getWorkflowDetails(String workflowIdentifier) throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI + "/" + workflowIdentifier) .withJsonAccept() ); check(response); return Optional.of(response.readEntity(WorkFlow.class)); } catch (InvalidParseOperationException | NotAcceptableClientException | IngestInternalClientServerException | WorkspaceClientServerException e) { throw new VitamClientException("Internal Error Server : " + response.readEntity(String.class)); } catch (IngestInternalClientNotFoundException e) { return Optional.empty(); } finally { if (response != null) { response.close(); } } } IngestInternalClientRest(IngestInternalClientFactory factory); }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public Optional<WorkFlow> getWorkflowDetails(String workflowIdentifier) throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI + "/" + workflowIdentifier) .withJsonAccept() ); check(response); return Optional.of(response.readEntity(WorkFlow.class)); } catch (InvalidParseOperationException | NotAcceptableClientException | IngestInternalClientServerException | WorkspaceClientServerException e) { throw new VitamClientException("Internal Error Server : " + response.readEntity(String.class)); } catch (IngestInternalClientNotFoundException e) { return Optional.empty(); } 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 Optional<WorkFlow> getWorkflowDetails(String workflowIdentifier) throws VitamClientException { Response response = null; try { response = make(get() .withPath(WORKFLOWS_URI + "/" + workflowIdentifier) .withJsonAccept() ); check(response); return Optional.of(response.readEntity(WorkFlow.class)); } catch (InvalidParseOperationException | NotAcceptableClientException | IngestInternalClientServerException | WorkspaceClientServerException e) { throw new VitamClientException("Internal Error Server : " + response.readEntity(String.class)); } catch (IngestInternalClientNotFoundException e) { return Optional.empty(); } 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);  }