Class MailerModel
-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable,org.apache.jmeter.gui.Searchable,org.apache.jmeter.testelement.TestElement
public class MailerModel extends AbstractTestElement implements Serializable
The model for a MailerVisualizer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumMailerModel.MailAuthType
-
Field Summary
Fields Modifier and Type Field Description public longfailureCountpublic longsuccessCountpublic transient JMeterContextthreadContextpublic transient StringthreadNamepublic final static TestElement.CompanionCompanionpublic final static StringNAMEpublic final static StringGUI_CLASSpublic final static StringENABLEDpublic final static StringTEST_CLASSpublic final static StringCOMMENTS
-
Constructor Summary
Constructors Constructor Description MailerModel()Constructs a MailerModel.
-
Method Summary
Modifier and Type Method Description longgetFailureCount()longgetSuccessCount()voidaddChangeListener(ChangeListener list)Objectclone()voidnotifyChangeListeners()List<String>getAddressList()Gets a List of String-objects. voidadd(SampleResult sample)Adds a SampleResult for display in the Visualizer. synchronized voidadd(SampleResult sample, boolean sendMails)Adds a SampleResult. synchronized voidclear()Resets the state of this object to its default. StringtoString()Returns a String-representation of this object. voidsendMail(String from, List<String> vEmails, String subject, String attText, String smtpHost)Sends a mail with the given parameters using SMTP. voidsendMail(String from, List<String> vEmails, String subject, String attText, String smtpHost, String smtpPort, String user, String password, MailerModel.MailAuthType mailAuthType, boolean debug)Sends a mail with the given parameters using SMTP. synchronized voidsendTestMail()Send a Test Mail to check configuration voidsetToAddress(String str)voidsetFromAddress(String str)voidsetSmtpHost(String str)voidsetSmtpPort(String value)voidsetLogin(String login)voidsetPassword(String password)voidsetMailAuthType(String value)voidsetFailureSubject(String str)voidsetSuccessSubject(String str)voidsetSuccessLimit(String limit)voidsetFailureLimit(String limit)StringgetToAddress()StringgetFromAddress()StringgetSmtpHost()StringgetSmtpPort()StringgetFailureSubject()StringgetSuccessSubject()longgetSuccessLimit()longgetFailureLimit()StringgetLogin()StringgetPassword()MailerModel.MailAuthTypegetMailAuthType()-
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addTestElement, canRemove, clearTestElementChildren, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse -
Methods inherited from class org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProps, getSchema, getString, removed, set -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getFailureCount
long getFailureCount()
-
getSuccessCount
long getSuccessCount()
-
addChangeListener
void addChangeListener(ChangeListener list)
-
notifyChangeListeners
void notifyChangeListeners()
-
getAddressList
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 separated 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
void add(SampleResult sample)
Adds a SampleResult for display in the Visualizer.
- Parameters:
sample- the SampleResult encapsulating information about the last sample.
-
add
synchronized 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
successCountandfailureCount.- Parameters:
sample- the SampleResult encapsulating information about the last sample.sendMails- whether or not to send e-mails
-
clear
synchronized 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.
-
toString
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...).
- Returns:
A String-representation of this object.
-
sendMail
void sendMail(String from, List<String> vEmails, String subject, String attText, String smtpHost)
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.subject- the subject of the mail.attText- the message-body.smtpHost- the smtp-server used to send the mail.
-
sendMail
void sendMail(String from, List<String> vEmails, String subject, String attText, String smtpHost, String smtpPort, String user, String password, MailerModel.MailAuthType mailAuthType, boolean debug)
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.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 authenticatepassword- the password used to authenticatemailAuthType- MailAuthType Security policydebug- Flag whether debug messages for the mail session should be generated
-
sendTestMail
synchronized void sendTestMail()
Send a Test Mail to check configuration
-
setToAddress
void setToAddress(String str)
-
setFromAddress
void setFromAddress(String str)
-
setSmtpHost
void setSmtpHost(String str)
-
setSmtpPort
void setSmtpPort(String value)
-
setPassword
void setPassword(String password)
-
setMailAuthType
void setMailAuthType(String value)
-
setFailureSubject
void setFailureSubject(String str)
-
setSuccessSubject
void setSuccessSubject(String str)
-
setSuccessLimit
void setSuccessLimit(String limit)
-
setFailureLimit
void setFailureLimit(String limit)
-
getToAddress
String getToAddress()
-
getFromAddress
String getFromAddress()
-
getSmtpHost
String getSmtpHost()
-
getSmtpPort
String getSmtpPort()
-
getFailureSubject
String getFailureSubject()
-
getSuccessSubject
String getSuccessSubject()
-
getSuccessLimit
long getSuccessLimit()
-
getFailureLimit
long getFailureLimit()
-
getPassword
String getPassword()
-
getMailAuthType
MailerModel.MailAuthType getMailAuthType()
-
-
-
-