Search in sources :

Example 46 with MailingListRecipient

use of com.serotonin.m2m2.vo.mailingList.MailingListRecipient in project ma-core-public by MangoAutomation.

the class EmailHandlerRTTest method testSendActive.

@Test
public void testSendActive() {
    EmailEventHandlerVO vo = createVO();
    List<MailingListRecipient> activeRecipients = createRecipients();
    vo.setActiveRecipients(activeRecipients);
    EmailHandlerRT rt = new EmailHandlerRT(vo);
    EventInstance evt = createDataPointEventInstance();
    rt.eventRaised(evt);
    // Ensure there is one scheduled
    assertEquals(1, scheduledItems.size());
    scheduledItems.clear();
    // Make Inactive
    evt.returnToNormal(this.timer.currentTimeMillis(), ReturnCause.RETURN_TO_NORMAL);
    rt.eventInactive(evt);
    assertEquals(0, scheduledItems.size());
}
Also used : EventInstance(com.serotonin.m2m2.rt.event.EventInstance) EmailEventHandlerVO(com.serotonin.m2m2.vo.event.EmailEventHandlerVO) MailingListRecipient(com.serotonin.m2m2.vo.mailingList.MailingListRecipient) Test(org.junit.Test)

Aggregations

MailingListRecipient (com.serotonin.m2m2.vo.mailingList.MailingListRecipient)31 ArrayList (java.util.ArrayList)17 AddressEntry (com.serotonin.m2m2.vo.mailingList.AddressEntry)13 MailingList (com.serotonin.m2m2.vo.mailingList.MailingList)13 Test (org.junit.Test)10 MailingListEntry (com.serotonin.m2m2.vo.mailingList.MailingListEntry)9 EmailEventHandlerVO (com.serotonin.m2m2.vo.event.EmailEventHandlerVO)8 UserEntry (com.serotonin.m2m2.vo.mailingList.UserEntry)8 PhoneEntry (com.serotonin.m2m2.vo.mailingList.PhoneEntry)7 EventInstance (com.serotonin.m2m2.rt.event.EventInstance)6 IntStringPair (com.serotonin.db.pair.IntStringPair)5 ShouldNeverHappenException (com.serotonin.ShouldNeverHappenException)4 User (com.serotonin.m2m2.vo.User)4 RecipientListEntryType (com.serotonin.m2m2.vo.mailingList.RecipientListEntryType)4 RecipientListEntryBean (com.serotonin.m2m2.web.dwr.beans.RecipientListEntryBean)4 HashSet (java.util.HashSet)4 List (java.util.List)4 ScriptPermissions (com.infiniteautomation.mango.util.script.ScriptPermissions)3 EmailRecipientModel (com.infiniteautomation.mango.rest.latest.model.mailingList.EmailRecipientModel)2 ExpectValidationException (com.infiniteautomation.mango.rules.ExpectValidationException)2