Class MailerModel

    • Constructor Detail

      • MailerModel

        public MailerModel()
        Constructs a MailerModel.
    • Method Detail

      • addChangeListener

        public void addChangeListener​(ChangeListener list)
      • notifyChangeListeners

        public void notifyChangeListeners()
      • getAddressList

        public List<String> getAddressList()
        Gets a List of String-objects. Each String is one mail-address of the addresses-String set by setToAddress(str). The addresses must be seperated by commas. Only String-objects containing a "@" are added to the returned List.
        Returns:
        a List of String-objects wherein each String represents a mail-address.
      • add

        public void add​(SampleResult sample)
        Adds a SampleResult for display in the Visualizer.
        Parameters:
        sample - the SampleResult encapsulating informations about the last sample.
      • add

        public void add​(SampleResult sample,
                        boolean sendMails)
        Adds a SampleResult. If SampleResult represents a change concerning the failure/success of the sampling a message might be sent to the addressies according to the settings of successCount and failureCount.
        Parameters:
        sample - the SampleResult encapsulating information about the last sample.
        sendMails - whether or not to send e-mails
      • clear

        public void clear()
        Resets the state of this object to its default. But: This method does not reset any mail-specific attributes (like sender, mail-subject...) since they are independent of the sampling.
        Specified by:
        clear in interface TestElement
        Overrides:
        clear in class AbstractTestElement
      • toString

        public String toString()
        Returns a String-representation of this object. Returns always "E-Mail-Notification". Might be enhanced in future versions to return some kind of String-representation of the mail-parameters (like sender, addressies, smtpHost...).
        Overrides:
        toString in class Object
        Returns:
        A String-representation of this object.
      • sendMail

        public void sendMail​(String from,
                             List<String> vEmails,
                             String subject,
                             String attText,
                             String smtpHost)
                      throws AddressException,
                             MessagingException
        Sends a mail with the given parameters using SMTP.
        Parameters:
        from - the sender of the mail as shown in the mail-client.
        vEmails - all receivers of the mail. The receivers are seperated by commas.
        subject - the subject of the mail.
        attText - the message-body.
        smtpHost - the smtp-server used to send the mail.
        Throws:
        MessagingException - if the building of the message fails
        AddressException - if any of the addresses is wrong
      • sendMail

        public void sendMail​(String from,
                             List<String> vEmails,
                             String subject,
                             String attText,
                             String smtpHost,
                             String smtpPort,
                             String user,
                             String password,
                             MailerModel.MailAuthType mailAuthType,
                             boolean debug)
                      throws AddressException,
                             MessagingException
        Sends a mail with the given parameters using SMTP.
        Parameters:
        from - the sender of the mail as shown in the mail-client.
        vEmails - all receivers of the mail. The receivers are seperated by commas.
        subject - the subject of the mail.
        attText - the message-body.
        smtpHost - the smtp-server used to send the mail.
        smtpPort - the smtp-server port used to send the mail.
        user - the login used to authenticate
        password - the password used to authenticate
        mailAuthType - MailerModel.MailAuthType Security policy
        debug - Flag whether debug messages for the mail session should be generated
        Throws:
        AddressException - If mail address is wrong
        MessagingException - If building MimeMessage fails
      • sendTestMail

        public void sendTestMail()
                          throws AddressException,
                                 MessagingException
        Send a Test Mail to check configuration
        Throws:
        AddressException - If mail address is wrong
        MessagingException - If building MimeMessage fails
      • setToAddress

        public void setToAddress​(String str)
      • setFromAddress

        public void setFromAddress​(String str)
      • setSmtpHost

        public void setSmtpHost​(String str)
      • setSmtpPort

        public void setSmtpPort​(String value)
      • setLogin

        public void setLogin​(String login)
      • setPassword

        public void setPassword​(String password)
      • setMailAuthType

        public void setMailAuthType​(String value)
      • setFailureSubject

        public void setFailureSubject​(String str)
      • setSuccessSubject

        public void setSuccessSubject​(String str)
      • setSuccessLimit

        public void setSuccessLimit​(String limit)
      • setFailureLimit

        public void setFailureLimit​(String limit)
      • getToAddress

        public String getToAddress()
      • getFromAddress

        public String getFromAddress()
      • getSmtpHost

        public String getSmtpHost()
      • getSmtpPort

        public String getSmtpPort()
      • getFailureSubject

        public String getFailureSubject()
      • getSuccessSubject

        public String getSuccessSubject()
      • getSuccessLimit

        public long getSuccessLimit()
      • getSuccessCount

        public long getSuccessCount()
      • getFailureLimit

        public long getFailureLimit()
      • getFailureCount

        public long getFailureCount()
      • getLogin

        public String getLogin()
      • getPassword

        public String getPassword()