@Test public void checkLifecycleTraceabilityWorkflowStatus() throws Exception { VitamThreadUtils.getVitamSession().setTenantId(0); when(mock.get()) .thenReturn(Response.status(Status.OK).entity( new RequestResponseOK<LifecycleTraceabilityStatus>().addResult( new LifecycleTraceabilityStatus(true, "MY_STATUS", true) )).build()); LifecycleTraceabilityStatus lifecycleTraceabilityStatus = client.checkLifecycleTraceabilityWorkflowStatus("id"); assertTrue(lifecycleTraceabilityStatus.isCompleted()); assertEquals(lifecycleTraceabilityStatus.getOutcome(), "MY_STATUS"); assertTrue(lifecycleTraceabilityStatus.isMaxEntriesReached()); }
@Override public LifecycleTraceabilityStatus checkLifecycleTraceabilityWorkflowStatus(String operationId) throws LogbookClientServerException, InvalidParseOperationException { try (Response response = make(get().withPath("/lifecycles/traceability/check/" + operationId).withHeader(X_TENANT_ID, getTenantParameter()).withJsonAccept())) { check(response); JsonNode jsonNode = response.readEntity(JsonNode.class); RequestResponseOK<LifecycleTraceabilityStatus> requestResponse = RequestResponseOK.getFromJsonNode(jsonNode, LifecycleTraceabilityStatus.class); return requestResponse.getFirstResult(); } catch (VitamClientInternalException | LogbookClientNotFoundException | LogbookClientAlreadyExistsException | LogbookClientBadRequestException e) { throw new LogbookClientServerException(ErrorMessage.INTERNAL_SERVER_ERROR.getMessage(), e); } }
LogbookOperationsClientRest extends DefaultClient implements LogbookOperationsClient { @Override public LifecycleTraceabilityStatus checkLifecycleTraceabilityWorkflowStatus(String operationId) throws LogbookClientServerException, InvalidParseOperationException { try (Response response = make(get().withPath("/lifecycles/traceability/check/" + operationId).withHeader(X_TENANT_ID, getTenantParameter()).withJsonAccept())) { check(response); JsonNode jsonNode = response.readEntity(JsonNode.class); RequestResponseOK<LifecycleTraceabilityStatus> requestResponse = RequestResponseOK.getFromJsonNode(jsonNode, LifecycleTraceabilityStatus.class); return requestResponse.getFirstResult(); } catch (VitamClientInternalException | LogbookClientNotFoundException | LogbookClientAlreadyExistsException | LogbookClientBadRequestException e) { throw new LogbookClientServerException(ErrorMessage.INTERNAL_SERVER_ERROR.getMessage(), e); } } }
LogbookOperationsClientRest extends DefaultClient implements LogbookOperationsClient { @Override public LifecycleTraceabilityStatus checkLifecycleTraceabilityWorkflowStatus(String operationId) throws LogbookClientServerException, InvalidParseOperationException { try (Response response = make(get().withPath("/lifecycles/traceability/check/" + operationId).withHeader(X_TENANT_ID, getTenantParameter()).withJsonAccept())) { check(response); JsonNode jsonNode = response.readEntity(JsonNode.class); RequestResponseOK<LifecycleTraceabilityStatus> requestResponse = RequestResponseOK.getFromJsonNode(jsonNode, LifecycleTraceabilityStatus.class); return requestResponse.getFirstResult(); } catch (VitamClientInternalException | LogbookClientNotFoundException | LogbookClientAlreadyExistsException | LogbookClientBadRequestException e) { throw new LogbookClientServerException(ErrorMessage.INTERNAL_SERVER_ERROR.getMessage(), e); } } LogbookOperationsClientRest(LogbookOperationsClientFactory factory); }
LogbookOperationsClientRest extends DefaultClient implements LogbookOperationsClient { @Override public LifecycleTraceabilityStatus checkLifecycleTraceabilityWorkflowStatus(String operationId) throws LogbookClientServerException, InvalidParseOperationException { try (Response response = make(get().withPath("/lifecycles/traceability/check/" + operationId).withHeader(X_TENANT_ID, getTenantParameter()).withJsonAccept())) { check(response); JsonNode jsonNode = response.readEntity(JsonNode.class); RequestResponseOK<LifecycleTraceabilityStatus> requestResponse = RequestResponseOK.getFromJsonNode(jsonNode, LifecycleTraceabilityStatus.class); return requestResponse.getFirstResult(); } catch (VitamClientInternalException | LogbookClientNotFoundException | LogbookClientAlreadyExistsException | LogbookClientBadRequestException e) { throw new LogbookClientServerException(ErrorMessage.INTERNAL_SERVER_ERROR.getMessage(), e); } } LogbookOperationsClientRest(LogbookOperationsClientFactory factory); @Override void create(LogbookOperationParameters parameters); @Override void update(LogbookOperationParameters parameters); @Override JsonNode selectOperation(JsonNode select); @Override JsonNode selectOperationSliced(JsonNode select); @Override JsonNode selectOperationById(String processId); @Override void createDelegate(LogbookOperationParameters parameters); @Override void updateDelegate(LogbookOperationParameters parameters); @Override void bulkCreate(String eventIdProc, Iterable<LogbookOperationParameters> queue); @Override void commitCreateDelegate(String eventIdProc); @Override void bulkUpdate(String eventIdProc, Iterable<LogbookOperationParameters> queue); @Override void commitUpdateDelegate(String eventIdProc); @Override RequestResponseOK traceability(); @Override RequestResponseOK traceabilityLfcUnit(); @Override RequestResponseOK traceabilityLfcObjectGroup(); @Override LifecycleTraceabilityStatus checkLifecycleTraceabilityWorkflowStatus(String operationId); @Override JsonNode reindex(IndexParameters indexParam); @Override JsonNode switchIndexes(SwitchIndexParameters switchIndexParam); @Override void traceabilityAudit(int tenant, AuditLogbookOptions options); @Override LogbookCheckResult checkLogbookCoherence(); @Override void close(); }
LogbookOperationsClientRest extends DefaultClient implements LogbookOperationsClient { @Override public LifecycleTraceabilityStatus checkLifecycleTraceabilityWorkflowStatus(String operationId) throws LogbookClientServerException, InvalidParseOperationException { try (Response response = make(get().withPath("/lifecycles/traceability/check/" + operationId).withHeader(X_TENANT_ID, getTenantParameter()).withJsonAccept())) { check(response); JsonNode jsonNode = response.readEntity(JsonNode.class); RequestResponseOK<LifecycleTraceabilityStatus> requestResponse = RequestResponseOK.getFromJsonNode(jsonNode, LifecycleTraceabilityStatus.class); return requestResponse.getFirstResult(); } catch (VitamClientInternalException | LogbookClientNotFoundException | LogbookClientAlreadyExistsException | LogbookClientBadRequestException e) { throw new LogbookClientServerException(ErrorMessage.INTERNAL_SERVER_ERROR.getMessage(), e); } } LogbookOperationsClientRest(LogbookOperationsClientFactory factory); @Override void create(LogbookOperationParameters parameters); @Override void update(LogbookOperationParameters parameters); @Override JsonNode selectOperation(JsonNode select); @Override JsonNode selectOperationSliced(JsonNode select); @Override JsonNode selectOperationById(String processId); @Override void createDelegate(LogbookOperationParameters parameters); @Override void updateDelegate(LogbookOperationParameters parameters); @Override void bulkCreate(String eventIdProc, Iterable<LogbookOperationParameters> queue); @Override void commitCreateDelegate(String eventIdProc); @Override void bulkUpdate(String eventIdProc, Iterable<LogbookOperationParameters> queue); @Override void commitUpdateDelegate(String eventIdProc); @Override RequestResponseOK traceability(); @Override RequestResponseOK traceabilityLfcUnit(); @Override RequestResponseOK traceabilityLfcObjectGroup(); @Override LifecycleTraceabilityStatus checkLifecycleTraceabilityWorkflowStatus(String operationId); @Override JsonNode reindex(IndexParameters indexParam); @Override JsonNode switchIndexes(SwitchIndexParameters switchIndexParam); @Override void traceabilityAudit(int tenant, AuditLogbookOptions options); @Override LogbookCheckResult checkLogbookCoherence(); @Override void close();  }