@Test public void writeOpenEmailTest() throws Exception { Alert openAlert = WebContainerPendingRequestsData.getOpenAlert(); Action openAction = new Action(openAlert.getTriggerId(), "email", "email-to-test", openAlert); openAction.setProperties(properties); ActionMessage openMessage = new TestActionMessage(openAction); Message email = plugin.createMimeMessage(openMessage); assertNotNull(email); writeEmailFile(email, this.getClass().getSimpleName() + "-1-open.eml"); plugin.process(openMessage); // Test generates 2 messages on the mail server assertEquals(2, server.getReceivedMessages().length); }
public static Alert resolveAlert(Alert unresolvedAlert) { List<Set<ConditionEval>> resolvedEvals = new ArrayList<>(); Data rtGoodData = Data.forNumeric(autoResolveCondition.getDataId(), System.currentTimeMillis() + 20000, 900d); ThresholdConditionEval eval1 = new ThresholdConditionEval(autoResolveCondition, rtGoodData); Set<ConditionEval> evalSet1 = new HashSet<>(); evalSet1.add(eval1); resolvedEvals.add(evalSet1); unresolvedAlert.setResolvedEvalSets(resolvedEvals); unresolvedAlert.setStatus(Alert.Status.RESOLVED); unresolvedAlert.setResolvedBy(RESOLVED_BY); unresolvedAlert.addNote(RESOLVED_BY, RESOLVED_NOTES); unresolvedAlert.setResolvedTime(System.currentTimeMillis()); return unresolvedAlert; }