@Test public void testIsAlertEventFalse() throws Exception { logbookParameters.putParameterValue(LogbookParameterName.outcome, "KO"); boolean isAlertEvent = alertLogbookOperationsDecorator.isAlertEvent(logbookParameters); assertFalse(isAlertEvent); }
@VisibleForTesting boolean isAlertEvent(LogbookOperationParameters parameters) { for (LogbookEvent logbookEvent : alertEvents) { if (logbookEvent.getOutDetail() != null) { String outDetail = parameters.getParameterValue(LogbookParameterName.outcomeDetail); if (Strings.isNullOrEmpty(outDetail)) { return false; } if (outDetail.equals(logbookEvent.getOutDetail())) { return true; } } else { String eventType = parameters.getParameterValue(LogbookParameterName.eventType); if (Strings.isNullOrEmpty(eventType)) { return false; } String outcome = parameters.getParameterValue(LogbookParameterName.outcome); if (Strings.isNullOrEmpty(outcome)) { return false; } if (eventType.equals(logbookEvent.getEvType()) && outcome.equals(logbookEvent.getOutcome())) { return true; } } } return false; }
AlertLogbookOperationsDecorator extends LogbookOperationsDecorator { @VisibleForTesting boolean isAlertEvent(LogbookOperationParameters parameters) { for (LogbookEvent logbookEvent : alertEvents) { if (logbookEvent.getOutDetail() != null) { String outDetail = parameters.getParameterValue(LogbookParameterName.outcomeDetail); if (Strings.isNullOrEmpty(outDetail)) { return false; } if (outDetail.equals(logbookEvent.getOutDetail())) { return true; } } else { String eventType = parameters.getParameterValue(LogbookParameterName.eventType); if (Strings.isNullOrEmpty(eventType)) { return false; } String outcome = parameters.getParameterValue(LogbookParameterName.outcome); if (Strings.isNullOrEmpty(outcome)) { return false; } if (eventType.equals(logbookEvent.getEvType()) && outcome.equals(logbookEvent.getOutcome())) { return true; } } } return false; } }
AlertLogbookOperationsDecorator extends LogbookOperationsDecorator { @VisibleForTesting boolean isAlertEvent(LogbookOperationParameters parameters) { for (LogbookEvent logbookEvent : alertEvents) { if (logbookEvent.getOutDetail() != null) { String outDetail = parameters.getParameterValue(LogbookParameterName.outcomeDetail); if (Strings.isNullOrEmpty(outDetail)) { return false; } if (outDetail.equals(logbookEvent.getOutDetail())) { return true; } } else { String eventType = parameters.getParameterValue(LogbookParameterName.eventType); if (Strings.isNullOrEmpty(eventType)) { return false; } String outcome = parameters.getParameterValue(LogbookParameterName.outcome); if (Strings.isNullOrEmpty(outcome)) { return false; } if (eventType.equals(logbookEvent.getEvType()) && outcome.equals(logbookEvent.getOutcome())) { return true; } } } return false; } AlertLogbookOperationsDecorator(LogbookOperations logbookOperations, List<LogbookEvent> alertEvents); @VisibleForTesting  AlertLogbookOperationsDecorator(LogbookOperations logbookOperations, List<LogbookEvent> alertEvents, AlertService alertService); }
AlertLogbookOperationsDecorator extends LogbookOperationsDecorator { @VisibleForTesting boolean isAlertEvent(LogbookOperationParameters parameters) { for (LogbookEvent logbookEvent : alertEvents) { if (logbookEvent.getOutDetail() != null) { String outDetail = parameters.getParameterValue(LogbookParameterName.outcomeDetail); if (Strings.isNullOrEmpty(outDetail)) { return false; } if (outDetail.equals(logbookEvent.getOutDetail())) { return true; } } else { String eventType = parameters.getParameterValue(LogbookParameterName.eventType); if (Strings.isNullOrEmpty(eventType)) { return false; } String outcome = parameters.getParameterValue(LogbookParameterName.outcome); if (Strings.isNullOrEmpty(outcome)) { return false; } if (eventType.equals(logbookEvent.getEvType()) && outcome.equals(logbookEvent.getOutcome())) { return true; } } } return false; } AlertLogbookOperationsDecorator(LogbookOperations logbookOperations, List<LogbookEvent> alertEvents); @VisibleForTesting  AlertLogbookOperationsDecorator(LogbookOperations logbookOperations, List<LogbookEvent> alertEvents, AlertService alertService); @Override void create(LogbookOperationParameters parameters); @Override void update(LogbookOperationParameters parameters); @Override RequestResponse<LogbookOperation> selectOperations(JsonNode select); @Override RequestResponse<LogbookOperation> selectOperations(JsonNode select, boolean sliced); @Override void createBulkLogbookOperation(LogbookOperationParameters[] operationArray); @Override void updateBulkLogbookOperation(LogbookOperationParameters[] operationArray); }
AlertLogbookOperationsDecorator extends LogbookOperationsDecorator { @VisibleForTesting boolean isAlertEvent(LogbookOperationParameters parameters) { for (LogbookEvent logbookEvent : alertEvents) { if (logbookEvent.getOutDetail() != null) { String outDetail = parameters.getParameterValue(LogbookParameterName.outcomeDetail); if (Strings.isNullOrEmpty(outDetail)) { return false; } if (outDetail.equals(logbookEvent.getOutDetail())) { return true; } } else { String eventType = parameters.getParameterValue(LogbookParameterName.eventType); if (Strings.isNullOrEmpty(eventType)) { return false; } String outcome = parameters.getParameterValue(LogbookParameterName.outcome); if (Strings.isNullOrEmpty(outcome)) { return false; } if (eventType.equals(logbookEvent.getEvType()) && outcome.equals(logbookEvent.getOutcome())) { return true; } } } return false; } AlertLogbookOperationsDecorator(LogbookOperations logbookOperations, List<LogbookEvent> alertEvents); @VisibleForTesting  AlertLogbookOperationsDecorator(LogbookOperations logbookOperations, List<LogbookEvent> alertEvents, AlertService alertService); @Override void create(LogbookOperationParameters parameters); @Override void update(LogbookOperationParameters parameters); @Override RequestResponse<LogbookOperation> selectOperations(JsonNode select); @Override RequestResponse<LogbookOperation> selectOperations(JsonNode select, boolean sliced); @Override void createBulkLogbookOperation(LogbookOperationParameters[] operationArray); @Override void updateBulkLogbookOperation(LogbookOperationParameters[] operationArray);  }