com.emarsys.ecommon.mail.test
Class SmtpBomber

java.lang.Object
  extended by com.emarsys.ecommon.mail.test.SmtpBomber
All Implemented Interfaces:
Configurable

@DeclareConfiguration(name="ecommon.mail.test.smtp.bomber",
                      type=DEFAULT)
public class SmtpBomber
extends java.lang.Object
implements Configurable

SmtpBomber is a testing utility for SMTP components which is able to create a high amount of test mails and sends them as concurrent as possible to an SMTP server.

Author:
Michael "kULO" Kulovits

Field Summary
protected  Configuration config
           
protected  java.util.concurrent.ExecutorService executors
           
protected  java.lang.String mailText
           
protected  int mailTextLength
           
protected  int nbrOfMails
           
protected  java.util.concurrent.atomic.AtomicInteger producedMailCount
           
protected  int sendDelayMillis
           
protected  java.util.concurrent.atomic.AtomicInteger sentMailCount
           
protected  javax.mail.Session session
           
static java.lang.String SMTP_BOMBER_MAIL_TEXT_SIZE
           
static java.lang.String SMTP_BOMBER_MAIL_TEXT_SIZE_DEFAULT
           
static java.lang.String SMTP_BOMBER_NBR_OF_MAILS
           
static java.lang.String SMTP_BOMBER_NBR_OF_MAILS_DEFAULT
           
static java.lang.String SMTP_BOMBER_SEND_DELAY_MILLIS
           
static java.lang.String SMTP_BOMBER_SEND_DELAY_MILLIS_DEFAULT
           
static java.lang.String SMTP_BOMBER_SEND_NBR_OF_RETRIALS
           
static java.lang.String SMTP_BOMBER_SEND_NBR_OF_RETRIALS_DEFAULT
           
static java.lang.String SMTP_BOMBER_SEND_RETRIAL_DELAY
           
static java.lang.String SMTP_BOMBER_SEND_RETRIAL_DELAY_DEFAULT
           
static java.lang.String SMTP_BOMBER_SERVER_HOST
           
static java.lang.String SMTP_BOMBER_SERVER_HOST_DEFAULT
           
static java.lang.String SMTP_BOMBER_SERVER_PORT
           
static java.lang.String SMTP_BOMBER_SERVER_PORT_DEFAULT
           
 
Constructor Summary
SmtpBomber()
          TODO documentation
SmtpBomber(javax.mail.Session session, java.util.Properties props)
          Creates a new SmtpBomber instance.
 
Method Summary
 Configuration getConfiguration()
          Provides the Configuration associated with this instance.
 int getProducedMailCount()
          Gets the atomic value of already produced mails by this bomber instance.
 int getSentMailCount()
          Gets the atomic value of already sent mails by this bomber instance.
protected  void init()
          initializes the components of the bomber
static void main(java.lang.String[] args)
           
protected  void sendTestMail()
           
 void sendTestMails(boolean awaitTermination)
          TODO documentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SMTP_BOMBER_NBR_OF_MAILS

public static final java.lang.String SMTP_BOMBER_NBR_OF_MAILS
See Also:
Constant Field Values

SMTP_BOMBER_NBR_OF_MAILS_DEFAULT

public static final java.lang.String SMTP_BOMBER_NBR_OF_MAILS_DEFAULT
See Also:
Constant Field Values

SMTP_BOMBER_MAIL_TEXT_SIZE

public static final java.lang.String SMTP_BOMBER_MAIL_TEXT_SIZE
See Also:
Constant Field Values

SMTP_BOMBER_MAIL_TEXT_SIZE_DEFAULT

public static final java.lang.String SMTP_BOMBER_MAIL_TEXT_SIZE_DEFAULT
See Also:
Constant Field Values

SMTP_BOMBER_SEND_DELAY_MILLIS

public static final java.lang.String SMTP_BOMBER_SEND_DELAY_MILLIS
See Also:
Constant Field Values

SMTP_BOMBER_SEND_DELAY_MILLIS_DEFAULT

public static final java.lang.String SMTP_BOMBER_SEND_DELAY_MILLIS_DEFAULT
See Also:
Constant Field Values

SMTP_BOMBER_SEND_NBR_OF_RETRIALS

public static final java.lang.String SMTP_BOMBER_SEND_NBR_OF_RETRIALS
See Also:
Constant Field Values

SMTP_BOMBER_SEND_NBR_OF_RETRIALS_DEFAULT

public static final java.lang.String SMTP_BOMBER_SEND_NBR_OF_RETRIALS_DEFAULT
See Also:
Constant Field Values

SMTP_BOMBER_SEND_RETRIAL_DELAY

public static final java.lang.String SMTP_BOMBER_SEND_RETRIAL_DELAY
See Also:
Constant Field Values

SMTP_BOMBER_SEND_RETRIAL_DELAY_DEFAULT

public static final java.lang.String SMTP_BOMBER_SEND_RETRIAL_DELAY_DEFAULT
See Also:
Constant Field Values

SMTP_BOMBER_SERVER_HOST

public static final java.lang.String SMTP_BOMBER_SERVER_HOST
See Also:
Constant Field Values

SMTP_BOMBER_SERVER_HOST_DEFAULT

public static final java.lang.String SMTP_BOMBER_SERVER_HOST_DEFAULT
See Also:
Constant Field Values

SMTP_BOMBER_SERVER_PORT

public static final java.lang.String SMTP_BOMBER_SERVER_PORT
See Also:
Constant Field Values

SMTP_BOMBER_SERVER_PORT_DEFAULT

public static final java.lang.String SMTP_BOMBER_SERVER_PORT_DEFAULT
See Also:
Constant Field Values

session

protected final javax.mail.Session session

config

protected Configuration config

nbrOfMails

protected int nbrOfMails

mailTextLength

protected int mailTextLength

sendDelayMillis

protected int sendDelayMillis

executors

protected java.util.concurrent.ExecutorService executors

producedMailCount

protected java.util.concurrent.atomic.AtomicInteger producedMailCount

sentMailCount

protected java.util.concurrent.atomic.AtomicInteger sentMailCount

mailText

protected java.lang.String mailText
Constructor Detail

SmtpBomber

public SmtpBomber(javax.mail.Session session,
                  java.util.Properties props)
Creates a new SmtpBomber instance.

Parameters:
session - the JavaMail Session whose Properties specify the Transport to send the mails
props - Properties that might specify

SmtpBomber

public SmtpBomber()
TODO documentation

Method Detail

init

protected void init()
initializes the components of the bomber


getConfiguration

public Configuration getConfiguration()
Description copied from interface: Configurable
Provides the Configuration associated with this instance.

Specified by:
getConfiguration in interface Configurable
Returns:
the bomber's configuration

getProducedMailCount

public int getProducedMailCount()
Gets the atomic value of already produced mails by this bomber instance. A priory the value is 0.

Returns:

getSentMailCount

public int getSentMailCount()
Gets the atomic value of already sent mails by this bomber instance. A priory the value is 0.

Returns:

sendTestMail

protected void sendTestMail()

sendTestMails

public void sendTestMails(boolean awaitTermination)
TODO documentation

Parameters:
awaitTermination -

main

public static void main(java.lang.String[] args)
Parameters:
args -


Copyright © 2010 emarsys AG. All Rights Reserved.