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 enum
MailerModel.MailAuthType
-
Field Summary
Fields Modifier and Type Field Description public long
failureCount
public long
successCount
public transient JMeterContext
threadContext
public transient String
threadName
public final static TestElement.Companion
Companion
public final static String
NAME
public final static String
GUI_CLASS
public final static String
ENABLED
public final static String
TEST_CLASS
public final static String
COMMENTS
-
Constructor Summary
Constructors Constructor Description MailerModel()
Constructs a MailerModel.
-
Method Summary
Modifier and Type Method Description long
getFailureCount()
long
getSuccessCount()
void
addChangeListener(ChangeListener list)
Object
clone()
void
notifyChangeListeners()
List<String>
getAddressList()
Gets a List of String-objects. void
add(SampleResult sample)
Adds a SampleResult for display in the Visualizer. synchronized void
add(SampleResult sample, boolean sendMails)
Adds a SampleResult. synchronized void
clear()
Resets the state of this object to its default. String
toString()
Returns a String-representation of this object. void
sendMail(String from, List<String> vEmails, String subject, String attText, String smtpHost)
Sends a mail with the given parameters using SMTP. 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. synchronized void
sendTestMail()
Send a Test Mail to check configuration void
setToAddress(String str)
void
setFromAddress(String str)
void
setSmtpHost(String str)
void
setSmtpPort(String value)
void
setLogin(String login)
void
setPassword(String password)
void
setMailAuthType(String value)
void
setFailureSubject(String str)
void
setSuccessSubject(String str)
void
setSuccessLimit(String limit)
void
setFailureLimit(String limit)
String
getToAddress()
String
getFromAddress()
String
getSmtpHost()
String
getSmtpPort()
String
getFailureSubject()
String
getSuccessSubject()
long
getSuccessLimit()
long
getFailureLimit()
String
getLogin()
String
getPassword()
MailerModel.MailAuthType
getMailAuthType()
-
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.
-
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
successCount
andfailureCount
.- 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...).
-
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()
-
-
-
-