org.apache.jmeter.reporters

Class MailerModel

Implemented Interfaces:
Cloneable, Serializable, TestElement

public class MailerModel
extends AbstractTestElement
implements Serializable

The model for a MailerVisualizer.

Fields inherited from interface org.apache.jmeter.testelement.TestElement

COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS

Constructor Summary

MailerModel()
Constructs a MailerModel.

Method Summary

void
add(SampleResult sample)
Adds a SampleResult.
void
addChangeListener(ChangeListener list)
void
clear()
Resets the state of this object to its default.
Object
clone()
Vector
getAddressVector()
Gets a Vector of String-objects.
long
getFailureCount()
long
getFailureLimit()
String
getFailureSubject()
String
getFromAddress()
String
getSmtpHost()
long
getSuccessCount()
long
getSuccessLimit()
String
getSuccessSubject()
String
getToAddress()
void
notifyChangeListeners()
void
sendMail(String from, Vector vEmails, String subject, String attText, String smtpHost)
Sends a mail with the given parameters using SMTP.
void
sendTestMail()
void
setFailureLimit(String limit)
void
setFailureSubject(String str)
void
setFromAddress(String str)
void
setSmtpHost(String str)
void
setSuccessLimit(String limit)
void
setSuccessSubject(String str)
void
setToAddress(String str)
String
toString()
Returns a String-representation of this object.

Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty

Constructor Details

MailerModel

public MailerModel()
Constructs a MailerModel.

Method Details

add

public void add(SampleResult sample)
Adds a SampleResult. If SampleResult represents a change concerning the failure/success of the sampling a message might be send to the addressies according to the settings of successCount and failureCount.
Parameters:
sample - the SampleResult encapsulating informations about the last sample.

addChangeListener

public void addChangeListener(ChangeListener list)

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 interface AbstractTestElement

clone

public Object clone()
Specified by:
clone in interface TestElement
Overrides:
clone in interface AbstractTestElement

getAddressVector

public Vector getAddressVector()
Gets a Vector 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 Vector.
Returns:
a Vector of String-objects wherein each String represents a mail-address.

getFailureCount

public long getFailureCount()

getFailureLimit

public long getFailureLimit()

getFailureSubject

public String getFailureSubject()

getFromAddress

public String getFromAddress()

getSmtpHost

public String getSmtpHost()

getSuccessCount

public long getSuccessCount()

getSuccessLimit

public long getSuccessLimit()

getSuccessSubject

public String getSuccessSubject()

getToAddress

public String getToAddress()

notifyChangeListeners

public void notifyChangeListeners()

sendMail

public void sendMail(String from,
                     Vector 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.

sendTestMail

public void sendTestMail()
            throws AddressException,
                   MessagingException

setFailureLimit

public void setFailureLimit(String limit)

setFailureSubject

public void setFailureSubject(String str)

setFromAddress

public void setFromAddress(String str)

setSmtpHost

public void setSmtpHost(String str)

setSuccessLimit

public void setSuccessLimit(String limit)

setSuccessSubject

public void setSuccessSubject(String str)

setToAddress

public void setToAddress(String str)

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...).
Returns:
A String-representation of this object.

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.