@Test public void givenUnauthorizedInitWorkFlowThenThrowVitamClientInternalException() { when(mock.post()).thenReturn(Response.status(Status.UNAUTHORIZED).build()); WorkFlow workflow = WorkFlow.of(WROKFLOW_ID, WROKFLOW_IDENTIFIER, INGEST); ThrowingCallable throwingCallable = () -> client.initWorkflow(workflow); assertThatThrownBy(throwingCallable) .isInstanceOf(VitamClientException.class); }
@Override public void initWorkflow(WorkFlow workFlow) throws VitamException { ParametersChecker.checkParameter("Params cannot be null", workFlow); VitamRequestBuilder request = post() .withPath(INGEST_URL) .withHeader(GlobalDataRest.X_CONTEXT_ID, workFlow.getId()) .withHeader(GlobalDataRest.X_TYPE_PROCESS, workFlow.getTypeProc()) .withHeader(GlobalDataRest.X_ACTION, ProcessAction.INIT) .withHeader(GlobalDataRest.X_ACTION_INIT, ProcessAction.INIT) .withOctetAccept(); try (Response response = make(request)) { check(response); } catch (IngestInternalClientServerException | IngestInternalClientNotFoundException e) { throw new VitamClientException(e); } }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public void initWorkflow(WorkFlow workFlow) throws VitamException { ParametersChecker.checkParameter("Params cannot be null", workFlow); VitamRequestBuilder request = post() .withPath(INGEST_URL) .withHeader(GlobalDataRest.X_CONTEXT_ID, workFlow.getId()) .withHeader(GlobalDataRest.X_TYPE_PROCESS, workFlow.getTypeProc()) .withHeader(GlobalDataRest.X_ACTION, ProcessAction.INIT) .withHeader(GlobalDataRest.X_ACTION_INIT, ProcessAction.INIT) .withOctetAccept(); try (Response response = make(request)) { check(response); } catch (IngestInternalClientServerException | IngestInternalClientNotFoundException e) { throw new VitamClientException(e); } } }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public void initWorkflow(WorkFlow workFlow) throws VitamException { ParametersChecker.checkParameter("Params cannot be null", workFlow); VitamRequestBuilder request = post() .withPath(INGEST_URL) .withHeader(GlobalDataRest.X_CONTEXT_ID, workFlow.getId()) .withHeader(GlobalDataRest.X_TYPE_PROCESS, workFlow.getTypeProc()) .withHeader(GlobalDataRest.X_ACTION, ProcessAction.INIT) .withHeader(GlobalDataRest.X_ACTION_INIT, ProcessAction.INIT) .withOctetAccept(); try (Response response = make(request)) { check(response); } catch (IngestInternalClientServerException | IngestInternalClientNotFoundException e) { throw new VitamClientException(e); } } IngestInternalClientRest(IngestInternalClientFactory factory); }
IngestInternalClientRest extends DefaultClient implements IngestInternalClient { @Override public void initWorkflow(WorkFlow workFlow) throws VitamException { ParametersChecker.checkParameter("Params cannot be null", workFlow); VitamRequestBuilder request = post() .withPath(INGEST_URL) .withHeader(GlobalDataRest.X_CONTEXT_ID, workFlow.getId()) .withHeader(GlobalDataRest.X_TYPE_PROCESS, workFlow.getTypeProc()) .withHeader(GlobalDataRest.X_ACTION, ProcessAction.INIT) .withHeader(GlobalDataRest.X_ACTION_INIT, ProcessAction.INIT) .withOctetAccept(); try (Response response = make(request)) { check(response); } catch (IngestInternalClientServerException | IngestInternalClientNotFoundException e) { throw new VitamClientException(e); } } 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 void initWorkflow(WorkFlow workFlow) throws VitamException { ParametersChecker.checkParameter("Params cannot be null", workFlow); VitamRequestBuilder request = post() .withPath(INGEST_URL) .withHeader(GlobalDataRest.X_CONTEXT_ID, workFlow.getId()) .withHeader(GlobalDataRest.X_TYPE_PROCESS, workFlow.getTypeProc()) .withHeader(GlobalDataRest.X_ACTION, ProcessAction.INIT) .withHeader(GlobalDataRest.X_ACTION_INIT, ProcessAction.INIT) .withOctetAccept(); try (Response response = make(request)) { check(response); } catch (IngestInternalClientServerException | IngestInternalClientNotFoundException e) { throw new VitamClientException(e); } } 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);  }