@Test @RunWithCustomExecutor public void should_log_error() throws Exception { VitamThreadUtils.getVitamSession().setTenantId(TENANT_ID); ArgumentCaptor<LogbookOperationParameters> captor = ArgumentCaptor.forClass(LogbookOperationParameters.class); BackupLogbookManager manager = new BackupLogbookManager(logbookOperationsClientFactory); ObjectNode evdetData = JsonHandler.createObjectNode(); evdetData.put(BackupLogbookManager.ERROR_MESSAGE, "errorMessage"); manager.logError(newOperationLogbookGUID(0), "STP_TEST", "errorMessage"); verify(logbookOperationsClient).update(captor.capture()); LogbookOperationParameters parameter = captor.getValue(); assertThat(parameter.getParameterValue(eventType)).isEqualTo("STP_TEST"); assertThat(parameter.getParameterValue(eventTypeProcess)).isEqualTo("MASTERDATA"); assertThat(parameter.getParameterValue(outcome)).isEqualTo("KO"); assertThat(parameter.getParameterValue(eventDetailData)).isEqualTo(SanityChecker.sanitizeJson(evdetData)); }
public void logError(GUID logbookOperationMasterId, String eventType, String errorsDetails) throws VitamException { LOGGER.error("There validation errors on the input file {}", errorsDetails); final GUID eipId = GUIDFactory.newOperationLogbookGUID(ParameterHelper.getTenantParameter()); final LogbookOperationParameters logbookParameters = LogbookParameterHelper .newLogbookOperationParameters(eipId, eventType, logbookOperationMasterId, LogbookTypeProcess.MASTERDATA, StatusCode.KO, getCodeOp(eventType, StatusCode.KO), logbookOperationMasterId); logbookMessageError(errorsDetails, logbookParameters); LogbookOperationsClient logbookClient = logbookClientFactory.getClient(); logbookClient.update(logbookParameters); }
BackupLogbookManager { public void logError(GUID logbookOperationMasterId, String eventType, String errorsDetails) throws VitamException { LOGGER.error("There validation errors on the input file {}", errorsDetails); final GUID eipId = GUIDFactory.newOperationLogbookGUID(ParameterHelper.getTenantParameter()); final LogbookOperationParameters logbookParameters = LogbookParameterHelper .newLogbookOperationParameters(eipId, eventType, logbookOperationMasterId, LogbookTypeProcess.MASTERDATA, StatusCode.KO, getCodeOp(eventType, StatusCode.KO), logbookOperationMasterId); logbookMessageError(errorsDetails, logbookParameters); LogbookOperationsClient logbookClient = logbookClientFactory.getClient(); logbookClient.update(logbookParameters); } }
BackupLogbookManager { public void logError(GUID logbookOperationMasterId, String eventType, String errorsDetails) throws VitamException { LOGGER.error("There validation errors on the input file {}", errorsDetails); final GUID eipId = GUIDFactory.newOperationLogbookGUID(ParameterHelper.getTenantParameter()); final LogbookOperationParameters logbookParameters = LogbookParameterHelper .newLogbookOperationParameters(eipId, eventType, logbookOperationMasterId, LogbookTypeProcess.MASTERDATA, StatusCode.KO, getCodeOp(eventType, StatusCode.KO), logbookOperationMasterId); logbookMessageError(errorsDetails, logbookParameters); LogbookOperationsClient logbookClient = logbookClientFactory.getClient(); logbookClient.update(logbookParameters); } BackupLogbookManager(); @VisibleForTesting  BackupLogbookManager(LogbookOperationsClientFactory logbookClientFactory); }
BackupLogbookManager { public void logError(GUID logbookOperationMasterId, String eventType, String errorsDetails) throws VitamException { LOGGER.error("There validation errors on the input file {}", errorsDetails); final GUID eipId = GUIDFactory.newOperationLogbookGUID(ParameterHelper.getTenantParameter()); final LogbookOperationParameters logbookParameters = LogbookParameterHelper .newLogbookOperationParameters(eipId, eventType, logbookOperationMasterId, LogbookTypeProcess.MASTERDATA, StatusCode.KO, getCodeOp(eventType, StatusCode.KO), logbookOperationMasterId); logbookMessageError(errorsDetails, logbookParameters); LogbookOperationsClient logbookClient = logbookClientFactory.getClient(); logbookClient.update(logbookParameters); } BackupLogbookManager(); @VisibleForTesting  BackupLogbookManager(LogbookOperationsClientFactory logbookClientFactory); void logEventSuccess(GUID logbookOperationMasterId, String eventType, String digestStr, String fileName, String objectIdentifier); void logError(GUID logbookOperationMasterId, String eventType, String errorsDetails); }
BackupLogbookManager { public void logError(GUID logbookOperationMasterId, String eventType, String errorsDetails) throws VitamException { LOGGER.error("There validation errors on the input file {}", errorsDetails); final GUID eipId = GUIDFactory.newOperationLogbookGUID(ParameterHelper.getTenantParameter()); final LogbookOperationParameters logbookParameters = LogbookParameterHelper .newLogbookOperationParameters(eipId, eventType, logbookOperationMasterId, LogbookTypeProcess.MASTERDATA, StatusCode.KO, getCodeOp(eventType, StatusCode.KO), logbookOperationMasterId); logbookMessageError(errorsDetails, logbookParameters); LogbookOperationsClient logbookClient = logbookClientFactory.getClient(); logbookClient.update(logbookParameters); } BackupLogbookManager(); @VisibleForTesting  BackupLogbookManager(LogbookOperationsClientFactory logbookClientFactory); void logEventSuccess(GUID logbookOperationMasterId, String eventType, String digestStr, String fileName, String objectIdentifier); void logError(GUID logbookOperationMasterId, String eventType, String errorsDetails); static final VitamLogger LOGGER; static final String ERROR_MESSAGE; static final String FILE_NAME; static final String DIGEST; static final String DIGESTTYPE; }