@Test(expected = LogbookClientServerException.class) public void rollbacktExecutionObjectGroup_ThenThrow_LogbookClientServerException() throws Exception { when(mock.delete()).thenReturn(Response.status(Response.Status.INTERNAL_SERVER_ERROR).build()); final LogbookLifeCycleObjectGroupParameters log = getCompleteLifeCycleObjectGroupParameters(); client.rollback(log); }
@Override public void rollback(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientNotFoundException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker.checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); String eip = parameters.getParameterValue(LogbookParameterName.eventIdentifierProcess); String oid = parameters.getParameterValue(LogbookParameterName.objectIdentifier); try (Response response = make(delete().withPath(getServiceUrl(parameters, eip, oid)).withJsonAccept())) { check(response); } catch (LogbookClientAlreadyExistsException | VitamClientInternalException | PreconditionFailedClientException e) { throw new LogbookClientNotFoundException(LOGBOOK_NOT_FOUND.getMessage(), e); } }
LogbookLifeCyclesClientRest extends DefaultClient implements LogbookLifeCyclesClient { @Override public void rollback(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientNotFoundException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker.checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); String eip = parameters.getParameterValue(LogbookParameterName.eventIdentifierProcess); String oid = parameters.getParameterValue(LogbookParameterName.objectIdentifier); try (Response response = make(delete().withPath(getServiceUrl(parameters, eip, oid)).withJsonAccept())) { check(response); } catch (LogbookClientAlreadyExistsException | VitamClientInternalException | PreconditionFailedClientException e) { throw new LogbookClientNotFoundException(LOGBOOK_NOT_FOUND.getMessage(), e); } } }
LogbookLifeCyclesClientRest extends DefaultClient implements LogbookLifeCyclesClient { @Override public void rollback(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientNotFoundException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker.checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); String eip = parameters.getParameterValue(LogbookParameterName.eventIdentifierProcess); String oid = parameters.getParameterValue(LogbookParameterName.objectIdentifier); try (Response response = make(delete().withPath(getServiceUrl(parameters, eip, oid)).withJsonAccept())) { check(response); } catch (LogbookClientAlreadyExistsException | VitamClientInternalException | PreconditionFailedClientException e) { throw new LogbookClientNotFoundException(LOGBOOK_NOT_FOUND.getMessage(), e); } } LogbookLifeCyclesClientRest(LogbookLifeCyclesClientFactory factory); }
LogbookLifeCyclesClientRest extends DefaultClient implements LogbookLifeCyclesClient { @Override public void rollback(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientNotFoundException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker.checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); String eip = parameters.getParameterValue(LogbookParameterName.eventIdentifierProcess); String oid = parameters.getParameterValue(LogbookParameterName.objectIdentifier); try (Response response = make(delete().withPath(getServiceUrl(parameters, eip, oid)).withJsonAccept())) { check(response); } catch (LogbookClientAlreadyExistsException | VitamClientInternalException | PreconditionFailedClientException e) { throw new LogbookClientNotFoundException(LOGBOOK_NOT_FOUND.getMessage(), e); } } LogbookLifeCyclesClientRest(LogbookLifeCyclesClientFactory factory); @Override void create(LogbookLifeCycleParameters parameters); @Override void update(LogbookLifeCycleParameters parameters); @Override void update(LogbookLifeCycleParameters parameters, LifeCycleStatusCode lifeCycleStatusCode); @Override @Deprecated void commit(LogbookLifeCycleParameters parameters); @Override void rollback(LogbookLifeCycleParameters parameters); @Override JsonNode selectUnitLifeCycleById(String id, JsonNode queryDsl); @Override JsonNode selectUnitLifeCycleById(String id, JsonNode queryDsl, LifeCycleStatusCode lifeCycleStatus); @Override JsonNode selectUnitLifeCycle(JsonNode queryDsl); @Override List<JsonNode> getRawUnitLifecyclesByLastPersistedDate(LocalDateTime startDate, LocalDateTime endDate,
        int limit); @Override List<JsonNode> getRawObjectGroupLifecyclesByLastPersistedDate(LocalDateTime startDate,
        LocalDateTime endDate, int limit); @Override JsonNode selectObjectGroupLifeCycleById(String id, JsonNode queryDsl); @Override JsonNode selectObjectGroupLifeCycleById(String id, JsonNode queryDsl, LifeCycleStatusCode lifeCycleStatus); @Override JsonNode selectObjectGroupLifeCycle(JsonNode queryDsl); @Override RequestResponse objectGroupLifeCyclesByOperationIterator(String operationId,
        LifeCycleStatusCode lifeCycleStatus, JsonNode query); @Override RequestResponse unitLifeCyclesByOperationIterator(String operationId,
        LifeCycleStatusCode lifeCycleStatus, JsonNode query); @Override void bulkCreateUnit(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkCreateObjectGroup(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkUpdateUnit(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkUpdateObjectGroup(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void commitUnit(String operationId, String unitId); @Override void commitObjectGroup(String operationId, String objectGroupId); @Override void rollBackUnitsByOperation(String operationId); @Override void rollBackObjectGroupsByOperation(String operationId); @Override LifeCycleStatusCode getUnitLifeCycleStatus(String unitId); @Override LifeCycleStatusCode getObjectGroupLifeCycleStatus(String objectGroupId); @Override void bulkObjectGroup(String eventIdProc, List<LogbookLifeCycleObjectGroupModel> logbookLifeCycleModels); @Override void bulkUnit(String eventIdProc, List<LogbookLifeCycleUnitModel> logbookLifeCycleModels); @Override JsonNode getRawUnitLifeCycleById(String id); @Override List<JsonNode> getRawUnitLifeCycleByIds(List<String> ids); @Override JsonNode getRawObjectGroupLifeCycleById(String id); @Override List<JsonNode> getRawObjectGroupLifeCycleByIds(List<String> ids); @Override void createRawbulkObjectgrouplifecycles(List<JsonNode> logbookLifeCycleRaws); @Override void createRawbulkUnitlifecycles(List<JsonNode> logbookLifeCycleRaws); @Override void bulkLifeCycleTemporary(String operationId, DistributionType type, List<LogbookLifeCycleParametersBulk> logbookLifeCycleParametersBulk); @Override void bulkLifeCycle(String operationId, DistributionType type, List<LogbookLifeCycleParametersBulk> logbookLifeCycleParametersBulk); @Override void deleteLifecycleUnitsBulk(Collection<String> unitsIds); @Override void deleteLifecycleObjectGroupBulk(Collection<String> objectGroupIds); }
LogbookLifeCyclesClientRest extends DefaultClient implements LogbookLifeCyclesClient { @Override public void rollback(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientNotFoundException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker.checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); String eip = parameters.getParameterValue(LogbookParameterName.eventIdentifierProcess); String oid = parameters.getParameterValue(LogbookParameterName.objectIdentifier); try (Response response = make(delete().withPath(getServiceUrl(parameters, eip, oid)).withJsonAccept())) { check(response); } catch (LogbookClientAlreadyExistsException | VitamClientInternalException | PreconditionFailedClientException e) { throw new LogbookClientNotFoundException(LOGBOOK_NOT_FOUND.getMessage(), e); } } LogbookLifeCyclesClientRest(LogbookLifeCyclesClientFactory factory); @Override void create(LogbookLifeCycleParameters parameters); @Override void update(LogbookLifeCycleParameters parameters); @Override void update(LogbookLifeCycleParameters parameters, LifeCycleStatusCode lifeCycleStatusCode); @Override @Deprecated void commit(LogbookLifeCycleParameters parameters); @Override void rollback(LogbookLifeCycleParameters parameters); @Override JsonNode selectUnitLifeCycleById(String id, JsonNode queryDsl); @Override JsonNode selectUnitLifeCycleById(String id, JsonNode queryDsl, LifeCycleStatusCode lifeCycleStatus); @Override JsonNode selectUnitLifeCycle(JsonNode queryDsl); @Override List<JsonNode> getRawUnitLifecyclesByLastPersistedDate(LocalDateTime startDate, LocalDateTime endDate,
        int limit); @Override List<JsonNode> getRawObjectGroupLifecyclesByLastPersistedDate(LocalDateTime startDate,
        LocalDateTime endDate, int limit); @Override JsonNode selectObjectGroupLifeCycleById(String id, JsonNode queryDsl); @Override JsonNode selectObjectGroupLifeCycleById(String id, JsonNode queryDsl, LifeCycleStatusCode lifeCycleStatus); @Override JsonNode selectObjectGroupLifeCycle(JsonNode queryDsl); @Override RequestResponse objectGroupLifeCyclesByOperationIterator(String operationId,
        LifeCycleStatusCode lifeCycleStatus, JsonNode query); @Override RequestResponse unitLifeCyclesByOperationIterator(String operationId,
        LifeCycleStatusCode lifeCycleStatus, JsonNode query); @Override void bulkCreateUnit(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkCreateObjectGroup(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkUpdateUnit(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkUpdateObjectGroup(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void commitUnit(String operationId, String unitId); @Override void commitObjectGroup(String operationId, String objectGroupId); @Override void rollBackUnitsByOperation(String operationId); @Override void rollBackObjectGroupsByOperation(String operationId); @Override LifeCycleStatusCode getUnitLifeCycleStatus(String unitId); @Override LifeCycleStatusCode getObjectGroupLifeCycleStatus(String objectGroupId); @Override void bulkObjectGroup(String eventIdProc, List<LogbookLifeCycleObjectGroupModel> logbookLifeCycleModels); @Override void bulkUnit(String eventIdProc, List<LogbookLifeCycleUnitModel> logbookLifeCycleModels); @Override JsonNode getRawUnitLifeCycleById(String id); @Override List<JsonNode> getRawUnitLifeCycleByIds(List<String> ids); @Override JsonNode getRawObjectGroupLifeCycleById(String id); @Override List<JsonNode> getRawObjectGroupLifeCycleByIds(List<String> ids); @Override void createRawbulkObjectgrouplifecycles(List<JsonNode> logbookLifeCycleRaws); @Override void createRawbulkUnitlifecycles(List<JsonNode> logbookLifeCycleRaws); @Override void bulkLifeCycleTemporary(String operationId, DistributionType type, List<LogbookLifeCycleParametersBulk> logbookLifeCycleParametersBulk); @Override void bulkLifeCycle(String operationId, DistributionType type, List<LogbookLifeCycleParametersBulk> logbookLifeCycleParametersBulk); @Override void deleteLifecycleUnitsBulk(Collection<String> unitsIds); @Override void deleteLifecycleObjectGroupBulk(Collection<String> objectGroupIds);  }