@Test public void createTest() { LogbookLifeCyclesClientFactory.changeMode(null); final LogbookLifeCyclesClient client = LogbookLifeCyclesClientFactory.getInstance().getClient(); assertNotNull(client); final LogbookLifeCycleParameters logbookParameters = LogbookParameterHelper.newLogbookLifeCycleUnitParameters(); assertNotNull(logbookParameters); final Set<LogbookParameterName> mandatory = logbookParameters.getMandatoriesParameters(); assertNotNull(mandatory); boolean catchException = false; try { mandatory.add(LogbookParameterName.objectIdentifier); } catch (final UnsupportedOperationException uoe) { catchException = true; } assertTrue(catchException); fillLogbookParamaters(logbookParameters); catchException = false; try { client.create(logbookParameters); } catch (final LogbookClientException lce) { catchException = true; } assertFalse(catchException); }
@Override public void create(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientAlreadyExistsException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker .checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); logInformation(CREATE, parameters); }
LogbookLifeCyclesClientMock extends AbstractMockClient implements LogbookLifeCyclesClient { @Override public void create(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientAlreadyExistsException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker .checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); logInformation(CREATE, parameters); } }
LogbookLifeCyclesClientMock extends AbstractMockClient implements LogbookLifeCyclesClient { @Override public void create(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientAlreadyExistsException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker .checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); logInformation(CREATE, parameters); }  }
LogbookLifeCyclesClientMock extends AbstractMockClient implements LogbookLifeCyclesClient { @Override public void create(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientAlreadyExistsException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker .checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); logInformation(CREATE, parameters); }  @Override void create(LogbookLifeCycleParameters parameters); @Override void update(LogbookLifeCycleParameters parameters); @Override void update(LogbookLifeCycleParameters parameters, LifeCycleStatusCode lifeCycleStatusCode); @Deprecated @Override 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 JsonNode getRawUnitLifeCycleById(String id); @Override List<JsonNode> getRawUnitLifeCycleByIds(List<String> ids); @Override JsonNode getRawObjectGroupLifeCycleById(String id); @Override List<JsonNode> getRawObjectGroupLifeCycleByIds(List<String> ids); @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); @SuppressWarnings({"unchecked", "rawtypes"}) @Override RequestResponse objectGroupLifeCyclesByOperationIterator(String operationId,
        LifeCycleStatusCode lifeCycleStatus, JsonNode query); @SuppressWarnings({"unchecked", "rawtypes"}) @Override RequestResponse unitLifeCyclesByOperationIterator(String operationId,
        LifeCycleStatusCode lifeCycleStatus, JsonNode query); @Override void bulkCreateUnit(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkUpdateUnit(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkCreateObjectGroup(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 JsonNode selectObjectGroupLifeCycle(JsonNode queryDsl); @Override void bulkObjectGroup(String eventIdProc, List<LogbookLifeCycleObjectGroupModel> logbookLifeCycleModels); @Override void bulkUnit(String eventIdProc, List<LogbookLifeCycleUnitModel> logbookLifeCycleModels); @Override void createRawbulkObjectgrouplifecycles(List<JsonNode> logbookLifeCycleRaws); @Override void createRawbulkUnitlifecycles(List<JsonNode> logbookLifeCycleRaws); @Override void deleteLifecycleUnitsBulk(Collection<String> listIds); @Override void deleteLifecycleObjectGroupBulk(Collection<String> listIds); @Override void bulkLifeCycleTemporary(String operationId, DistributionType type, List<LogbookLifeCycleParametersBulk> logbookLifeCycleParametersBulk); @Override void bulkLifeCycle(String operationId, DistributionType type, List<LogbookLifeCycleParametersBulk> logbookLifeCycleParametersBulk); }
LogbookLifeCyclesClientMock extends AbstractMockClient implements LogbookLifeCyclesClient { @Override public void create(LogbookLifeCycleParameters parameters) throws LogbookClientBadRequestException, LogbookClientAlreadyExistsException, LogbookClientServerException { parameters.putParameterValue(LogbookParameterName.agentIdentifier, SERVER_IDENTITY.getJsonIdentity()); parameters.putParameterValue(LogbookParameterName.eventDateTime, LocalDateUtil.now().toString()); ParametersChecker .checkNullOrEmptyParameters(parameters.getMapParameters(), parameters.getMandatoriesParameters()); logInformation(CREATE, parameters); }  @Override void create(LogbookLifeCycleParameters parameters); @Override void update(LogbookLifeCycleParameters parameters); @Override void update(LogbookLifeCycleParameters parameters, LifeCycleStatusCode lifeCycleStatusCode); @Deprecated @Override 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 JsonNode getRawUnitLifeCycleById(String id); @Override List<JsonNode> getRawUnitLifeCycleByIds(List<String> ids); @Override JsonNode getRawObjectGroupLifeCycleById(String id); @Override List<JsonNode> getRawObjectGroupLifeCycleByIds(List<String> ids); @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); @SuppressWarnings({"unchecked", "rawtypes"}) @Override RequestResponse objectGroupLifeCyclesByOperationIterator(String operationId,
        LifeCycleStatusCode lifeCycleStatus, JsonNode query); @SuppressWarnings({"unchecked", "rawtypes"}) @Override RequestResponse unitLifeCyclesByOperationIterator(String operationId,
        LifeCycleStatusCode lifeCycleStatus, JsonNode query); @Override void bulkCreateUnit(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkUpdateUnit(String eventIdProc, Iterable<LogbookLifeCycleParameters> queue); @Override void bulkCreateObjectGroup(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 JsonNode selectObjectGroupLifeCycle(JsonNode queryDsl); @Override void bulkObjectGroup(String eventIdProc, List<LogbookLifeCycleObjectGroupModel> logbookLifeCycleModels); @Override void bulkUnit(String eventIdProc, List<LogbookLifeCycleUnitModel> logbookLifeCycleModels); @Override void createRawbulkObjectgrouplifecycles(List<JsonNode> logbookLifeCycleRaws); @Override void createRawbulkUnitlifecycles(List<JsonNode> logbookLifeCycleRaws); @Override void deleteLifecycleUnitsBulk(Collection<String> listIds); @Override void deleteLifecycleObjectGroupBulk(Collection<String> listIds); @Override void bulkLifeCycleTemporary(String operationId, DistributionType type, List<LogbookLifeCycleParametersBulk> logbookLifeCycleParametersBulk); @Override void bulkLifeCycle(String operationId, DistributionType type, List<LogbookLifeCycleParametersBulk> logbookLifeCycleParametersBulk);  }