[jbpm-commits] JBoss JBPM SVN: r4930 - in jbpm3/branches/jbpm-3.2.5-soa/modules: core/src/main/java/org/jbpm/mail and 8 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu May 28 07:52:12 EDT 2009


Author: alex.guizar at jboss.com
Date: 2009-05-28 07:52:12 -0400 (Thu, 28 May 2009)
New Revision: 4930

Added:
   jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/resources/mail/
   jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/resources/mail/mail.properties
Modified:
   jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
   jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java
   jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/test/java/org/jbpm/mail/MailTest.java
   jbpm3/branches/jbpm-3.2.5-soa/modules/examples/pom.xml
   jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/action/ActionTest.java
   jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/context/ContextTest.java
   jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java
   jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/door/DoorTest.java
   jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java
Log:
JBPM-2292: Move jBPM3-SOA continuous integration to QA lab (CODING IN PROGRESS)
start dummy smtp server in mail example as the qa lab is not running sendmail on port 25
have other example tests extend AbstractJbpmTestCase


Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java	2009-05-28 11:52:12 UTC (rev 4930)
@@ -76,24 +76,28 @@
   }
 
   private void ensureCleanDatabase() {
+    DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory("persistence");
+    if (persistenceServiceFactory == null) return;
+
     boolean hasLeftOvers = false;
-
-    DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory(
-        "persistence");
-    Configuration configuration = dbPersistenceServiceFactory.getConfiguration();
+    Configuration configuration = persistenceServiceFactory.getConfiguration();
     JbpmSchema jbpmSchema = new JbpmSchema(configuration);
 
     Map rowsPerTable = jbpmSchema.getRowsPerTable();
     for (Iterator i = rowsPerTable.entrySet().iterator(); i.hasNext();) {
       Map.Entry entry = (Entry) i.next();
-      // String tableName = entry.getKey();
+      String tableName = (String) entry.getKey();
       Long count = (Long) entry.getValue();
       if (count.intValue() != 0) {
         hasLeftOvers = true;
-        // [JBPM-1812] Fix tests that don't cleanup the database
-        // Only uncomment this if you intend to fix it. Otherwise it just generates noise.
-        // System.err.println("FIXME: " + getClass().getName() + "." + getName() + " left " + count
-        // + " records in " + tableName);
+        System.err.println("FIXME: " +
+            getClass().getName() +
+            "." +
+            getName() +
+            " left " +
+            count +
+            " records in " +
+            tableName);
       }
     }
 

Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java	2009-05-28 11:52:12 UTC (rev 4930)
@@ -32,26 +32,24 @@
 import org.jbpm.util.ClassLoaderUtil;
 import org.jbpm.util.XmlUtil;
 
-public class Mail implements ActionHandler
-{
-  private static final long serialVersionUID = 1L;
+public class Mail implements ActionHandler {
 
-  String template = null;
-  String actors = null;
-  String to = null;
-  String bcc = null;
-  String bccActors = null;
-  String subject = null;
-  String text = null;
+  String template;
+  String actors;
+  String to;
+  String bcc;
+  String bccActors;
+  String subject;
+  String text;
 
-  ExecutionContext executionContext = null;
+  ExecutionContext executionContext;
 
-  public Mail()
-  {
+  private static final long serialVersionUID = 1L;
+
+  public Mail() {
   }
 
-  public Mail(String template, String actors, String to, String subject, String text)
-  {
+  public Mail(String template, String actors, String to, String subject, String text) {
     this.template = template;
     this.actors = actors;
     this.to = to;
@@ -59,8 +57,8 @@
     this.text = text;
   }
 
-  public Mail(String template, String actors, String to, String bccActors, String bcc, String subject, String text)
-  {
+  public Mail(String template, String actors, String to, String bccActors, String bcc,
+      String subject, String text) {
     this.template = template;
     this.actors = actors;
     this.to = to;
@@ -70,106 +68,82 @@
     this.text = text;
   }
 
-  public void execute(ExecutionContext executionContext)
-  {
+  public void execute(ExecutionContext executionContext) {
     this.executionContext = executionContext;
     send();
   }
 
-  public List getRecipients()
-  {
+  public List getRecipients() {
     List recipients = new ArrayList();
-    if (actors != null)
-    {
+    if (actors != null) {
       String evaluatedActors = evaluate(actors);
       List tokenizedActors = tokenize(evaluatedActors);
-      if (tokenizedActors != null)
-      {
+      if (tokenizedActors != null) {
         recipients.addAll(resolveAddresses(tokenizedActors));
       }
     }
-    if (to != null)
-    {
+    if (to != null) {
       String resolvedTo = evaluate(to);
       recipients.addAll(tokenize(resolvedTo));
     }
     return recipients;
   }
 
-  public List getBccRecipients()
-  {
+  public List getBccRecipients() {
     List recipients = new ArrayList();
-    if (bccActors != null)
-    {
+    if (bccActors != null) {
       String evaluatedActors = evaluate(bccActors);
       List tokenizedActors = tokenize(evaluatedActors);
-      if (tokenizedActors != null)
-      {
+      if (tokenizedActors != null) {
         recipients.addAll(resolveAddresses(tokenizedActors));
       }
     }
-    if (bcc != null)
-    {
+    if (bcc != null) {
       String resolvedTo = evaluate(bcc);
       recipients.addAll(tokenize(resolvedTo));
     }
-    if (JbpmConfiguration.Configs.hasObject("jbpm.mail.bcc.address"))
-    {
+    if (JbpmConfiguration.Configs.hasObject("jbpm.mail.bcc.address")) {
       recipients.addAll(tokenize(JbpmConfiguration.Configs.getString("jbpm.mail.bcc.address")));
     }
     return recipients;
   }
 
-  public String getSubject()
-  {
-    if (subject == null)
-      return null;
+  public String getSubject() {
+    if (subject == null) return null;
     return evaluate(subject);
   }
 
-  public String getText()
-  {
-    if (text == null)
-      return null;
+  public String getText() {
+    if (text == null) return null;
     return evaluate(text);
   }
 
-  public String getFromAddress()
-  {
-    if (JbpmConfiguration.Configs.hasObject("jbpm.mail.from.address"))
-    {
+  public String getFromAddress() {
+    if (JbpmConfiguration.Configs.hasObject("jbpm.mail.from.address")) {
       return JbpmConfiguration.Configs.getString("jbpm.mail.from.address");
     }
     return "jbpm at noreply";
   }
 
-  public void send()
-  {
-    if (template != null)
-    {
+  public void send() {
+    if (template != null) {
       Properties properties = getMailTemplateProperties(template);
-      if (actors == null)
-      {
+      if (actors == null) {
         actors = properties.getProperty("actors");
       }
-      if (to == null)
-      {
+      if (to == null) {
         to = properties.getProperty("to");
       }
-      if (subject == null)
-      {
+      if (subject == null) {
         subject = properties.getProperty("subject");
       }
-      if (text == null)
-      {
+      if (text == null) {
         text = properties.getProperty("text");
       }
-      if (bcc == null)
-      {
+      if (bcc == null) {
         bcc = properties.getProperty("bcc");
       }
-      if (bccActors == null)
-      {
+      if (bccActors == null) {
         bccActors = properties.getProperty("bccActors");
       }
     }
@@ -177,34 +151,29 @@
     send(getMailServerProperties(), getFromAddress(), getRecipients(), getBccRecipients(), getSubject(), getText());
   }
 
-  public static void send(Properties mailServerProperties, String fromAddress, List recipients, String subject, String text)
-  {
+  public static void send(Properties mailServerProperties, String fromAddress, List recipients,
+      String subject, String text) {
     send(mailServerProperties, fromAddress, recipients, null, subject, text);
   }
 
-  public static void send(Properties mailServerProperties, String fromAddress, List recipients, List bccRecipients, String subject, String text)
-  {
-    if (((recipients == null) || (recipients.isEmpty())) && ((bccRecipients == null) || (bccRecipients.isEmpty())))
-    {
+  public static void send(Properties mailServerProperties, String fromAddress, List recipients,
+      List bccRecipients, String subject, String text) {
+    if ((recipients == null || recipients.isEmpty()) &&
+        (bccRecipients == null || bccRecipients.isEmpty())) {
       log.debug("skipping mail because there are no recipients");
       return;
     }
 
-    try
-    {
+    try {
       int retries = 5;
-      while (0 < retries)
-      {
+      while (0 < retries) {
         retries--;
-        try
-        {
+        try {
           sendMailInternal(mailServerProperties, fromAddress, recipients, bccRecipients, subject, text);
           break;
         }
-        catch (MessagingException msgex)
-        {
-          if (retries == 0)
-            throw msgex;
+        catch (MessagingException msgex) {
+          if (retries == 0) throw msgex;
 
           System.out.println("Cannot send mail, now retrying: " + msgex);
           log.error("Cannot send mail, now retrying: " + msgex);
@@ -212,43 +181,41 @@
         }
       }
     }
-    catch (Exception e)
-    {
+    catch (Exception e) {
       throw new JbpmException("Cannot send email", e);
     }
   }
 
-  private static void sendMailInternal(Properties mailServerProperties, String fromAddress, List recipients, List bccRecipients, String subject, String text)
-      throws Exception
-  {
-    log.debug("sending email to '" + recipients + "' " + (bccRecipients != null ? "and in bcc to '" + bccRecipients + "' " : "") + "about '" + subject + "'");
+  private static void sendMailInternal(Properties mailServerProperties, String fromAddress,
+      List recipients, List bccRecipients, String subject, String text) throws Exception {
+    log.debug("sending email to '" +
+        recipients +
+        "' " +
+        (bccRecipients != null ? "and in bcc to '" + bccRecipients + "' " : "") +
+        "about '" +
+        subject +
+        "'");
     Session session = Session.getDefaultInstance(mailServerProperties, null);
     MimeMessage message = new MimeMessage(session);
-    if (fromAddress != null)
-    {
+    if (fromAddress != null) {
       message.setFrom(new InternetAddress(fromAddress));
     }
     Iterator iter = recipients.iterator();
-    while (iter.hasNext())
-    {
-      InternetAddress recipient = new InternetAddress((String)iter.next());
+    while (iter.hasNext()) {
+      InternetAddress recipient = new InternetAddress((String) iter.next());
       message.addRecipient(Message.RecipientType.TO, recipient);
     }
-    if (bccRecipients != null)
-    {
+    if (bccRecipients != null) {
       iter = bccRecipients.iterator();
-      while (iter.hasNext())
-      {
-        InternetAddress recipient = new InternetAddress((String)iter.next());
+      while (iter.hasNext()) {
+        InternetAddress recipient = new InternetAddress((String) iter.next());
         message.addRecipient(Message.RecipientType.BCC, recipient);
       }
     }
-    if (subject != null)
-    {
+    if (subject != null) {
       message.setSubject(subject);
     }
-    if (text != null)
-    {
+    if (text != null) {
       message.setText(text);
     }
     message.setSentDate(new Date());
@@ -256,81 +223,69 @@
     Transport.send(message);
   }
 
-  protected List tokenize(String text)
-  {
-    if (text == null)
-    {
+  protected List tokenize(String text) {
+    if (text == null) {
       return null;
     }
     List list = new ArrayList();
     StringTokenizer tokenizer = new StringTokenizer(text, ";:");
-    while (tokenizer.hasMoreTokens())
-    {
+    while (tokenizer.hasMoreTokens()) {
       list.add(tokenizer.nextToken());
     }
     return list;
   }
 
-  protected Collection resolveAddresses(List actorIds)
-  {
+  protected Collection resolveAddresses(List actorIds) {
     List emailAddresses = new ArrayList();
     Iterator iter = actorIds.iterator();
-    while (iter.hasNext())
-    {
-      String actorId = (String)iter.next();
-      AddressResolver addressResolver = (AddressResolver)JbpmConfiguration.Configs.getObject("jbpm.mail.address.resolver");
+    while (iter.hasNext()) {
+      String actorId = (String) iter.next();
+      AddressResolver addressResolver = (AddressResolver) JbpmConfiguration.Configs.getObject("jbpm.mail.address.resolver");
       Object resolvedAddresses = addressResolver.resolveAddress(actorId);
-      if (resolvedAddresses != null)
-      {
-        if (resolvedAddresses instanceof String)
-        {
-          emailAddresses.add((String)resolvedAddresses);
+      if (resolvedAddresses != null) {
+        if (resolvedAddresses instanceof String) {
+          emailAddresses.add((String) resolvedAddresses);
         }
-        else if (resolvedAddresses instanceof Collection)
-        {
-          emailAddresses.addAll((Collection)resolvedAddresses);
+        else if (resolvedAddresses instanceof Collection) {
+          emailAddresses.addAll((Collection) resolvedAddresses);
         }
-        else if (resolvedAddresses instanceof String[])
-        {
-          emailAddresses.addAll(Arrays.asList((String[])resolvedAddresses));
+        else if (resolvedAddresses instanceof String[]) {
+          emailAddresses.addAll(Arrays.asList((String[]) resolvedAddresses));
         }
-        else
-        {
-          throw new JbpmException("Address resolver '" + addressResolver + "' returned '" + resolvedAddresses.getClass().getName()
-              + "' instead of a String, Collection or String-array: " + resolvedAddresses);
+        else {
+          throw new JbpmException("Address resolver '" +
+              addressResolver +
+              "' returned '" +
+              resolvedAddresses.getClass().getName() +
+              "' instead of a String, Collection or String-array: " +
+              resolvedAddresses);
         }
       }
     }
     return emailAddresses;
   }
 
-  Properties getMailServerProperties()
-  {
+  Properties getMailServerProperties() {
     Properties mailServerProperties = new Properties();
 
-    if (JbpmConfiguration.Configs.hasObject("resource.mail.properties"))
-    {
+    if (JbpmConfiguration.Configs.hasObject("resource.mail.properties")) {
       String mailServerPropertiesResource = JbpmConfiguration.Configs.getString("resource.mail.properties");
-      try
-      {
+      try {
         InputStream mailServerStream = ClassLoaderUtil.getStream(mailServerPropertiesResource);
         mailServerProperties.load(mailServerStream);
       }
-      catch (Exception e)
-      {
-        throw new JbpmException("couldn't get configuration properties for jbpm mail server from resource '" + mailServerPropertiesResource + "'", e);
+      catch (Exception e) {
+        throw new JbpmException(
+            "couldn't get configuration properties for jbpm mail server from resource '" +
+                mailServerPropertiesResource +
+                "'", e);
       }
-
     }
-    else if (JbpmConfiguration.Configs.hasObject("jbpm.mail.smtp.host"))
-    {
+    else if (JbpmConfiguration.Configs.hasObject("jbpm.mail.smtp.host")) {
       String smtpServer = JbpmConfiguration.Configs.getString("jbpm.mail.smtp.host");
       mailServerProperties.put("mail.smtp.host", smtpServer);
-
     }
-    else
-    {
-
+    else {
       log.error("couldn't get mail properties");
     }
 
@@ -340,18 +295,15 @@
   static Map templates = null;
   static Map templateVariables = null;
 
-  synchronized Properties getMailTemplateProperties(String templateName)
-  {
-    if (templates == null)
-    {
+  synchronized Properties getMailTemplateProperties(String templateName) {
+    if (templates == null) {
       templates = new HashMap();
       String mailTemplatesResource = JbpmConfiguration.Configs.getString("resource.mail.templates");
-      org.w3c.dom.Element mailTemplatesElement = XmlUtil.parseXmlResource(mailTemplatesResource, false).getDocumentElement();
+      org.w3c.dom.Element mailTemplatesElement = XmlUtil.parseXmlResource(mailTemplatesResource, false)
+          .getDocumentElement();
       List mailTemplateElements = XmlUtil.elements(mailTemplatesElement, "mail-template");
-      Iterator iter = mailTemplateElements.iterator();
-      while (iter.hasNext())
-      {
-        org.w3c.dom.Element mailTemplateElement = (org.w3c.dom.Element)iter.next();
+      for (Iterator iter = mailTemplateElements.iterator(); iter.hasNext();) {
+        org.w3c.dom.Element mailTemplateElement = (org.w3c.dom.Element) iter.next();
 
         Properties templateProperties = new Properties();
         addTemplateProperty(mailTemplateElement, "actors", templateProperties);
@@ -366,55 +318,45 @@
 
       templateVariables = new HashMap();
       List variableElements = XmlUtil.elements(mailTemplatesElement, "variable");
-      iter = variableElements.iterator();
-      while (iter.hasNext())
-      {
-        org.w3c.dom.Element variableElement = (org.w3c.dom.Element)iter.next();
+      for (Iterator iter = variableElements.iterator(); iter.hasNext();) {
+        org.w3c.dom.Element variableElement = (org.w3c.dom.Element) iter.next();
         templateVariables.put(variableElement.getAttribute("name"), variableElement.getAttribute("value"));
       }
     }
-    return (Properties)templates.get(templateName);
+    return (Properties) templates.get(templateName);
   }
 
-  void addTemplateProperty(org.w3c.dom.Element mailTemplateElement, String property, Properties templateProperties)
-  {
+  void addTemplateProperty(org.w3c.dom.Element mailTemplateElement, String property,
+      Properties templateProperties) {
     org.w3c.dom.Element element = XmlUtil.element(mailTemplateElement, property);
-    if (element != null)
-    {
+    if (element != null) {
       templateProperties.put(property, XmlUtil.getContentText(element));
     }
   }
 
-  String evaluate(String expression)
-  {
-    if (expression == null)
-    {
+  String evaluate(String expression) {
+    if (expression == null) {
       return null;
     }
     VariableResolver variableResolver = JbpmExpressionEvaluator.getUsedVariableResolver();
-    if (variableResolver != null)
-    {
+    if (variableResolver != null) {
       variableResolver = new MailVariableResolver(templateVariables, variableResolver);
     }
-    return (String)JbpmExpressionEvaluator.evaluate(expression, executionContext, variableResolver, JbpmExpressionEvaluator.getUsedFunctionMapper());
+    return (String) JbpmExpressionEvaluator.evaluate(expression, executionContext, variableResolver, JbpmExpressionEvaluator.getUsedFunctionMapper());
   }
 
-  class MailVariableResolver implements VariableResolver, Serializable
-  {
+  class MailVariableResolver implements VariableResolver, Serializable {
     private static final long serialVersionUID = 1L;
     Map templateVariables = null;
     VariableResolver variableResolver = null;
 
-    public MailVariableResolver(Map templateVariables, VariableResolver variableResolver)
-    {
+    public MailVariableResolver(Map templateVariables, VariableResolver variableResolver) {
       this.templateVariables = templateVariables;
       this.variableResolver = variableResolver;
     }
 
-    public Object resolveVariable(String pName) throws ELException
-    {
-      if ((templateVariables != null) && (templateVariables.containsKey(pName)))
-      {
+    public Object resolveVariable(String pName) throws ELException {
+      if (templateVariables != null && templateVariables.containsKey(pName)) {
         return templateVariables.get(pName);
       }
       return variableResolver.resolveVariable(pName);

Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/test/java/org/jbpm/mail/MailTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/test/java/org/jbpm/mail/MailTest.java	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/core/src/test/java/org/jbpm/mail/MailTest.java	2009-05-28 11:52:12 UTC (rev 4930)
@@ -7,9 +7,8 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.jbpm.AbstractJbpmTestCase;
 import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
+import org.jbpm.db.AbstractDbTestCase;
 import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.graph.exe.ProcessInstance;
 import org.jbpm.taskmgmt.def.Swimlane;
@@ -18,80 +17,64 @@
 import com.dumbster.smtp.SimpleSmtpServer;
 import com.dumbster.smtp.SmtpMessage;
 
-public class MailTest extends AbstractJbpmTestCase
-{
-  private static final int SMTP_PORT = 23583;
+public class MailTest extends AbstractDbTestCase {
 
   private static SimpleSmtpServer server;
-  private JbpmContext jbpmContext;
-  
-  static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
-    "<jbpm-configuration>" +
-    "  <jbpm-context />" +
-    "  <string name='resource.mail.properties' value='org/jbpm/mail/test.mail.properties' />" +
-    "  <bean name='jbpm.mail.address.resolver' class='" + TestAddressResolver.class.getName() + "' singleton='true' />" +
-    "</jbpm-configuration>"
-  );
 
-  public static Test suite()
-  {
-    return new TestSetup(new TestSuite(MailTest.class))
-    {
-      protected void setUp() throws Exception
-      {
-        server = startSmtpServer(SMTP_PORT);
+  private static final String XML_DECL = "<?xml version='1.0'?>";
+
+  public static Test suite() {
+    return new TestSetup(new TestSuite(MailTest.class)) {
+      protected void setUp() throws Exception {
+        server = startSmtpServer(23583);
       }
 
-      protected void tearDown() throws Exception
-      {
+      protected void tearDown() throws Exception {
         server.stop();
       }
     };
   }
-  
-  protected void setUp() throws Exception
-  {
-    super.setUp();
-    jbpmContext = jbpmConfiguration.createJbpmContext();
-  }
 
-  protected void tearDown() throws Exception
-  {
-    jbpmContext.close();
-    super.tearDown();
-  }
-
-  static SimpleSmtpServer startSmtpServer(int port)
-  {
+  static SimpleSmtpServer startSmtpServer(int port) {
     /*
-     * SimpleSmtpServer.start(int) blocks the calling thread until the server socket is created. If the socket is
-     * created too quickly (seems to happen on Linux and Mac) then the notification is sent too early and the calling
-     * thread blocks forever.
+     * SimpleSmtpServer.start(int) blocks the calling thread until the server socket is created. If
+     * the socket is created too quickly (seems to happen on Linux and Mac) then the notification is
+     * sent too early and the calling thread blocks forever.
      * 
-     * The code below corresponds to SimpleSmtpServer.start(int) except that the thread start has been moved inside of
-     * the synchronized block.
+     * The code below corresponds to SimpleSmtpServer.start(int) except that the thread is started
+     * inside of the synchronized block.
      */
     SimpleSmtpServer server = new SimpleSmtpServer(port);
     Thread serverThread = new Thread(server);
 
     // Block until the server socket is created
-    synchronized (server)
-    {
+    synchronized (server) {
       serverThread.start();
-      try
-      {
+      try {
         server.wait(10 * 1000);
       }
-      catch (InterruptedException e)
-      {
+      catch (InterruptedException e) {
         // Ignore don't care.
       }
     }
     return server;
   }
 
-  public void testWithoutAddressResolving()
-  {
+  protected JbpmConfiguration getJbpmConfiguration() {
+    if (jbpmConfiguration == null) {
+      jbpmConfiguration = JbpmConfiguration.parseXmlString(XML_DECL +
+          "<jbpm-configuration>" +
+          "  <jbpm-context />" +
+          "  <string name='resource.mail.properties' value='org/jbpm/mail/test.mail.properties' />" +
+          "  <bean name='jbpm.mail.address.resolver' class='" +
+          TestAddressResolver.class.getName() +
+          "' singleton='true' />" +
+          "</jbpm-configuration>");
+    }
+    return jbpmConfiguration;
+  }
+
+  public void testWithoutAddressResolving() {
     String to = "sample.shipper at example.domain";
     String subject = "latest news";
     String text = "roy is assurancetourix";
@@ -99,18 +82,17 @@
     Mail mail = new Mail(null, null, to, subject, text);
     mail.send();
 
-    assertTrue(server.getReceivedEmailSize() == 1);
+    assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("latest news", email.getHeaderValue("Subject"));
     assertEquals("roy is assurancetourix", email.getBody());
     assertEquals("sample.shipper at example.domain", email.getHeaderValue("To"));
   }
 
-  public void testMailWithAddressResolving()
-  {
+  public void testMailWithAddressResolving() {
     String actors = "manager";
     String subject = "latest news";
     String text = "roy is assurancetourix";
@@ -118,18 +100,17 @@
     Mail mail = new Mail(null, actors, null, subject, text);
     mail.send();
 
-    assertTrue(server.getReceivedEmailSize() == 1);
+    assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("latest news", email.getHeaderValue("Subject"));
     assertEquals("roy is assurancetourix", email.getBody());
     assertEquals("manager at example.domain", email.getHeaderValue("To"));
   }
 
-  public void testMailWithBccAddress()
-  {
+  public void testMailWithBccAddress() {
     String bcc = "bcc at example.domain";
     String subject = "latest news";
     String text = "roy is assurancetourix";
@@ -139,184 +120,176 @@
 
     assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("latest news", email.getHeaderValue("Subject"));
     assertEquals("roy is assurancetourix", email.getBody());
     assertNull(email.getHeaderValue("To"));
-  }  
-  
-  public void testMailNodeAttributes() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='send email' />" +
-      "  </start-state>" +
-      "  <mail-node name='send email' actors='george' subject='readmylips' text='nomoretaxes'>" +
-      "    <transition to='end' />" +
-      "  </mail-node>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
+  }
+
+  public void testMailNodeAttributes() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='send email' />" +
+        "  </start-state>" +
+        "  <mail-node name='send email' actors='george' subject='readmylips' text='nomoretaxes'>" +
+        "    <transition to='end' />" +
+        "  </mail-node>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     processInstance.signal();
 
-    assertTrue(server.getReceivedEmailSize() == 1);
+    assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("readmylips", email.getHeaderValue("Subject"));
     assertEquals("nomoretaxes", email.getBody());
     assertEquals("george at example.domain", email.getHeaderValue("To"));
   }
-  
-  public void testMailNodeElements() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='send email' />" +
-      "  </start-state>" +
-      "  <mail-node name='send email' actors='george'>" +
-      "    <subject>readmylips</subject>" +
-      "    <text>nomoretaxes</text>" +
-      "    <transition to='end' />" +
-      "  </mail-node>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
+
+  public void testMailNodeElements() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='send email' />" +
+        "  </start-state>" +
+        "  <mail-node name='send email' actors='george'>" +
+        "    <subject>readmylips</subject>" +
+        "    <text>nomoretaxes</text>" +
+        "    <transition to='end' />" +
+        "  </mail-node>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     processInstance.signal();
 
-    assertTrue(server.getReceivedEmailSize() == 1);
+    assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("readmylips", email.getHeaderValue("Subject"));
     assertEquals("nomoretaxes", email.getBody());
     assertEquals("george at example.domain", email.getHeaderValue("To"));
   }
 
-  public void testMailActionAttributes() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='end'>" +
-      "      <mail name='send email' actors='george' subject='readmylips' text='nomoretaxes' />" +
-      "    </transition>" +
-      "  </start-state>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
+  public void testMailActionAttributes() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='end'>" +
+        "      <mail name='send email' actors='george' subject='readmylips' text='nomoretaxes' />" +
+        "    </transition>" +
+        "  </start-state>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     processInstance.signal();
 
-    assertTrue(server.getReceivedEmailSize() == 1);
+    assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("readmylips", email.getHeaderValue("Subject"));
     assertEquals("nomoretaxes", email.getBody());
     assertEquals("george at example.domain", email.getHeaderValue("To"));
   }
 
-  public void testMailActionElements() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='end'>" +
-      "      <mail actors='george'>" +
-      "        <subject>readmylips</subject>" +
-      "        <text>nomoretaxes</text>" +
-      "      </mail>" +
-      "    <transition to='end' />" +
-      "    </transition>" +
-      "  </start-state>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
+  public void testMailActionElements() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='end'>" +
+        "      <mail actors='george'>" +
+        "        <subject>readmylips</subject>" +
+        "        <text>nomoretaxes</text>" +
+        "      </mail>" +
+        "    <transition to='end' />" +
+        "    </transition>" +
+        "  </start-state>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     processInstance.signal();
 
-    assertTrue(server.getReceivedEmailSize() == 1);
+    assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("readmylips", email.getHeaderValue("Subject"));
     assertEquals("nomoretaxes", email.getBody());
     assertEquals("george at example.domain", email.getHeaderValue("To"));
   }
 
-  public void testMultipleRecipients() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='end'>" +
-      "      <mail name='send email' actors='george; barbara; suzy' subject='readmylips' text='nomoretaxes' />" +
-      "    </transition>" +
-      "  </start-state>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
+  public void testMultipleRecipients() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='end'>" +
+        "      <mail name='send email' actors='george; barbara; suzy'" +
+        " subject='readmylips' text='nomoretaxes' />" +
+        "    </transition>" +
+        "  </start-state>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     processInstance.signal();
 
     assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("readmylips", email.getHeaderValue("Subject"));
     assertEquals("nomoretaxes", email.getBody());
-    assertEquals(Arrays.asList(new String[] { "george at example.domain", "barbara at example.domain", "suzy at example.domain" }), Arrays.asList(email
-        .getHeaderValues("To")));
+    String[] expectedTo = { "george at example.domain", "barbara at example.domain",
+        "suzy at example.domain" };
+    String[] to = email.getHeaderValues("To");
+    assert Arrays.equals(expectedTo, to) : Arrays.asList(to);
   }
 
-  public void testMailWithoutAddressResolving() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='end'>" +
-      "      <mail name='send email' to='george at humpydumpy.gov; spiderman at hollywood.ca.us' subject='readmylips' text='nomoretaxes' />" +
-      "    </transition>" +
-      "  </start-state>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
+  public void testMailWithoutAddressResolving() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='end'>" +
+        "      <mail name='send email' to='george at humpydumpy.gov; spiderman at hollywood.ca.us'" +
+        " subject='readmylips' text='nomoretaxes' />" +
+        "    </transition>" +
+        "  </start-state>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     processInstance.signal();
 
     assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
-    assertEquals(Arrays.asList(new String[] { "george at humpydumpy.gov", "spiderman at hollywood.ca.us" }), Arrays.asList(email.getHeaderValues("To")));
+
+    String[] expectedTo = { "george at humpydumpy.gov", "spiderman at hollywood.ca.us" };
+    String[] to = email.getHeaderValues("To");
+    assert Arrays.equals(expectedTo, to) : Arrays.asList(to);
   }
 
-  public void testToVariableExpression() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='end'>" +
-      "      <mail name='send email' to='#{user.email}' subject='s' text='t' />" +
-      "    </transition>" +
-      "  </start-state>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
-    
+  public void testToVariableExpression() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='end'>" +
+        "      <mail name='send email' to='#{user.email}' subject='s' text='t' />" +
+        "    </transition>" +
+        "  </start-state>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
+
     User mrNobody = new User("hucklebuck at example.domain");
 
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
@@ -325,25 +298,23 @@
 
     assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("hucklebuck at example.domain", email.getHeaderValue("To"));
   }
 
-  public void testToSwimlaneExpression() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='end'>" +
-      "      <mail name='send email' actors='#{initiator}' subject='s' text='t' />" +
-      "    </transition>" +
-      "  </start-state>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
-    
+  public void testToSwimlaneExpression() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='end'>" +
+        "      <mail name='send email' actors='#{initiator}' subject='s' text='t' />" +
+        "    </transition>" +
+        "  </start-state>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
+
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     Swimlane initiator = new Swimlane("initiator");
     SwimlaneInstance initiatorInstance = new SwimlaneInstance(initiator);
@@ -353,85 +324,75 @@
 
     assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("huckelberry at example.domain", email.getHeaderValue("To"));
   }
 
-  public void testSubjectExpression() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='end'>" +
-      "      <mail name='send email' actors='me' subject='your ${item} order' text='t' />" +
-      "    </transition>" +
-      "  </start-state>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
-    
+  public void testSubjectExpression() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='end'>" +
+        "      <mail name='send email' actors='me' subject='your ${item} order' text='t' />" +
+        "    </transition>" +
+        "  </start-state>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
+
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     processInstance.getContextInstance().setVariable("item", "cookies");
     processInstance.signal();
 
     assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("your cookies order", email.getHeaderValue("Subject"));
   }
 
-  public void testTextExpression() 
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='end'>" +
-      "      <mail name='send email' actors='me' text='your ${item} order' />" +
-      "    </transition>" +
-      "  </start-state>" +
-      "  <end-state name='end' />" +
-      "</process-definition>"
-    );
-    
+  public void testTextExpression() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+        "<process-definition>" +
+        "  <start-state>" +
+        "    <transition to='end'>" +
+        "      <mail name='send email' actors='me' text='your ${item} order' />" +
+        "    </transition>" +
+        "  </start-state>" +
+        "  <end-state name='end' />" +
+        "</process-definition>");
+
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     processInstance.getContextInstance().setVariable("item", "cookies");
     processInstance.signal();
 
     assertEquals(1, server.getReceivedEmailSize());
     Iterator emailIter = server.getReceivedEmail();
-    SmtpMessage email = (SmtpMessage)emailIter.next();
+    SmtpMessage email = (SmtpMessage) emailIter.next();
     emailIter.remove();
-    
+
     assertEquals("your cookies order", email.getBody());
   }
 
-  public static class User
-  {
+  public static class User {
     String email;
 
-    public User(String email)
-    {
+    public User(String email) {
       this.email = email;
     }
 
-    public String getEmail()
-    {
+    public String getEmail() {
       return email;
     }
   }
 
-  public static class TestAddressResolver implements AddressResolver
-  {
+  public static class TestAddressResolver implements AddressResolver {
     private static final long serialVersionUID = 1L;
 
-    public Object resolveAddress(String actorId)
-    {
-      if ("ghost".equals(actorId))
-      {
+    public Object resolveAddress(String actorId) {
+      if ("ghost".equals(actorId)) {
         return null;
       }
       return actorId + "@example.domain";

Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/examples/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/examples/pom.xml	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/examples/pom.xml	2009-05-28 11:52:12 UTC (rev 4930)
@@ -75,6 +75,11 @@
       <artifactId>log4j</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>dumbster</groupId>
+      <artifactId>dumbster</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <!-- Plugins -->

Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/action/ActionTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/action/ActionTest.java	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/action/ActionTest.java	2009-05-28 11:52:12 UTC (rev 4930)
@@ -21,16 +21,16 @@
  */
 package org.jbpm.examples.action;
 
-import junit.framework.TestCase;
-
+import org.jbpm.AbstractJbpmTestCase;
 import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.graph.exe.ProcessInstance;
 
-public class ActionTest extends TestCase {
+public class ActionTest extends AbstractJbpmTestCase {
 
   // Each test will start with setting the static isExecuted 
   // member of MyActionHandler to false.
-  public void setUp() {
+  protected void setUp() throws Exception {
+  	super.setUp();
     MyActionHandler.isExecuted = false;
   }
 

Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/context/ContextTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/context/ContextTest.java	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/context/ContextTest.java	2009-05-28 11:52:12 UTC (rev 4930)
@@ -21,13 +21,12 @@
  */
 package org.jbpm.examples.context;
 
-import junit.framework.TestCase;
-
+import org.jbpm.AbstractJbpmTestCase;
 import org.jbpm.context.exe.ContextInstance;
 import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.graph.exe.ProcessInstance;
 
-public class ContextTest extends TestCase {
+public class ContextTest extends AbstractJbpmTestCase {
   
   public void testContext() {
     // Also this example starts from the hello world process.

Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java	2009-05-28 11:52:12 UTC (rev 4930)
@@ -1,267 +1,217 @@
 package org.jbpm.examples.door;
 
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.jbpm.AbstractJbpmTestCase;
 import org.jbpm.JbpmException;
 import org.jbpm.graph.def.Node;
 import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.graph.exe.ProcessInstance;
 import org.jbpm.graph.exe.Token;
 
-public class DoorProcessTest extends TestCase
-{
-  /**
-   * The doorProcess is a reference to the single ProcessDefinition that will be used for all executions in all the tests of this test case.
-   * 
-   * In this case, we'll just store the process definition object in memory in a static member field. In practice, most often process definitions will be deployed to a
-   * database.
-   */
-  static ProcessDefinition doorProcess;
-  static Node locked, closed, open, openLocked;
+public class DoorProcessTest extends AbstractJbpmTestCase {
+	/**
+	 * The doorProcess is a reference to the single ProcessDefinition that will be used for all
+	 * executions in all the tests of this test case.
+	 * 
+	 * In this case, we'll just store the process definition object in memory in a static member
+	 * field. In practice, most often process definitions will be deployed to a database.
+	 */
+	static ProcessDefinition doorProcess;
+	static Node locked, closed, open, openLocked;
 
-  public static Test suite()
-  {
-    return new TestSetup(new TestSuite(DoorProcessTest.class))
-    {
-      protected void setUp() throws Exception
-      {
-        super.setUp();
-        doorProcess = ProcessDefinition.parseXmlInputStream(DoorProcessTest.class.getResourceAsStream("/door/processdefinition.xml"));
-        locked = doorProcess.getNode("Locked");
-        closed = doorProcess.getNode("Closed");
-        open = doorProcess.getNode("Open");
-        openLocked = doorProcess.getNode("Open Locked");
-      }
-    };
-  }
+	static {
+		doorProcess = ProcessDefinition.parseXmlInputStream(DoorProcessTest.class.getResourceAsStream("/door/processdefinition.xml"));
+		locked = doorProcess.getNode("Locked");
+		closed = doorProcess.getNode("Closed");
+		open = doorProcess.getNode("Open");
+		openLocked = doorProcess.getNode("Open Locked");
+	}
 
-  /**
-   * This test shows how you can execute one scenario in a test method. Inside the test method, the external triggers (=signals) are provided to a process instance.
-   * Then you assert wether the process instance ends up in the expected state.
-   */
-  public void testScenarioOne()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    assertEquals("Closed", token.getNode().getName());
-    token.signal("open");
-    assertEquals("Open", token.getNode().getName());
-    token.signal("close");
-    assertEquals("Closed", token.getNode().getName());
-    try
-    {
-      token.signal("unlock");
-      fail("excepted exception");
-    }
-    catch (RuntimeException e)
-    {
-    }
-  }
+	/**
+	 * This test shows how you can execute one scenario in a test method. Inside the test method, the
+	 * external triggers (=signals) are provided to a process instance. Then you assert wether the
+	 * process instance ends up in the expected state.
+	 */
+	public void testScenarioOne() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		assertEquals("Closed", token.getNode().getName());
+		token.signal("open");
+		assertEquals("Open", token.getNode().getName());
+		token.signal("close");
+		assertEquals("Closed", token.getNode().getName());
+		try {
+			token.signal("unlock");
+			fail("excepted exception");
+		}
+		catch (RuntimeException e) {
+		}
+	}
 
-  // Below are all the simple state-change tests.
-  // Note that you can actually put a token into a given state with
-  // the setNode method.
+	// Below are all the simple state-change tests.
+	// Note that you can actually put a token into a given state with
+	// the setNode method.
 
-  public void testClosedOpen()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.signal("open");
-    assertEquals("Open", token.getNode().getName());
-  }
+	public void testClosedOpen() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.signal("open");
+		assertEquals("Open", token.getNode().getName());
+	}
 
-  public void testClosedLock()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.signal("lock");
-    assertEquals("Locked", token.getNode().getName());
-  }
+	public void testClosedLock() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.signal("lock");
+		assertEquals("Locked", token.getNode().getName());
+	}
 
-  public void testClosedClose()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    try
-    {
-      token.signal("close");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testClosedClose() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		try {
+			token.signal("close");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testClosedUnlock()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    try
-    {
-      token.signal("unlock");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testClosedUnlock() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		try {
+			token.signal("unlock");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testOpenedOpen()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(open);
-    try
-    {
-      token.signal("open");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testOpenedOpen() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(open);
+		try {
+			token.signal("open");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testOpenedLock()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(open);
-    token.signal("lock");
-    assertEquals("Open Locked", token.getNode().getName());
-  }
+	public void testOpenedLock() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(open);
+		token.signal("lock");
+		assertEquals("Open Locked", token.getNode().getName());
+	}
 
-  public void testOpenedClose()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(open);
-    token.signal("close");
-    assertEquals("Closed", token.getNode().getName());
-  }
+	public void testOpenedClose() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(open);
+		token.signal("close");
+		assertEquals("Closed", token.getNode().getName());
+	}
 
-  public void testOpenedUnlock()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(open);
-    try
-    {
-      token.signal("unlock");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testOpenedUnlock() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(open);
+		try {
+			token.signal("unlock");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testLockedOpen()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(locked);
-    try
-    {
-      token.signal("open");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testLockedOpen() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(locked);
+		try {
+			token.signal("open");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testLockedLock()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(locked);
-    try
-    {
-      token.signal("lock");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testLockedLock() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(locked);
+		try {
+			token.signal("lock");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testLockedClose()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(locked);
-    try
-    {
-      token.signal("close");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testLockedClose() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(locked);
+		try {
+			token.signal("close");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testLockedUnlock()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(locked);
-    token.signal("unlock");
-    assertEquals("Closed", token.getNode().getName());
-  }
+	public void testLockedUnlock() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(locked);
+		token.signal("unlock");
+		assertEquals("Closed", token.getNode().getName());
+	}
 
-  public void testOpenLockedOpen()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(openLocked);
-    try
-    {
-      token.signal("open");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testOpenLockedOpen() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(openLocked);
+		try {
+			token.signal("open");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testOpenLockedLock()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(openLocked);
-    try
-    {
-      token.signal("lock");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testOpenLockedLock() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(openLocked);
+		try {
+			token.signal("lock");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testOpenLockedClose()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(openLocked);
-    try
-    {
-      token.signal("close");
-      fail("expected exception");
-    }
-    catch (JbpmException e)
-    {
-    }
-  }
+	public void testOpenLockedClose() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(openLocked);
+		try {
+			token.signal("close");
+			fail("expected exception");
+		}
+		catch (JbpmException e) {
+		}
+	}
 
-  public void testOpenLockedUnlock()
-  {
-    ProcessInstance processInstance = new ProcessInstance(doorProcess);
-    Token token = processInstance.getRootToken();
-    token.setNode(openLocked);
-    token.signal("unlock");
-    assertEquals("Open", token.getNode().getName());
-  }
+	public void testOpenLockedUnlock() {
+		ProcessInstance processInstance = new ProcessInstance(doorProcess);
+		Token token = processInstance.getRootToken();
+		token.setNode(openLocked);
+		token.signal("unlock");
+		assertEquals("Open", token.getNode().getName());
+	}
 }

Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/door/DoorTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/door/DoorTest.java	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/door/DoorTest.java	2009-05-28 11:52:12 UTC (rev 4930)
@@ -3,193 +3,157 @@
 import junit.framework.TestCase;
 
 /**
- * This example shows the tradeoff between implementing the behaviour of a door in plain Java and using a jPDL process. This is intended for developers to learn about
- * the aspects that are handled better in a process versus plain programming.
+ * This example shows the tradeoff between implementing the behaviour of a door in plain Java and
+ * using a jPDL process. This is intended for developers to learn about the aspects that are handled
+ * better in a process versus plain programming.
  */
-public class DoorTest extends TestCase
-{
+public class DoorTest extends TestCase {
 
-  public void testClosedOpen()
-  {
-    Door door = new Door();
-    door.open();
-    assertSame(Door.OPEN, door.state);
-  }
+	public void testClosedOpen() {
+		Door door = new Door();
+		door.open();
+		assertSame(Door.OPEN, door.state);
+	}
 
-  public void testClosedLock()
-  {
-    Door door = new Door();
-    door.lock();
-    assertSame(Door.LOCKED, door.state);
-  }
+	public void testClosedLock() {
+		Door door = new Door();
+		door.lock();
+		assertSame(Door.LOCKED, door.state);
+	}
 
-  public void testClosedClose()
-  {
-    Door door = new Door();
-    try
-    {
-      door.close();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testClosedClose() {
+		Door door = new Door();
+		try {
+			door.close();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testClosedUnlock()
-  {
-    Door door = new Door();
-    try
-    {
-      door.unlock();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testClosedUnlock() {
+		Door door = new Door();
+		try {
+			door.unlock();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testOpenedOpen()
-  {
-    Door door = new Door();
-    door.state = Door.OPEN;
-    try
-    {
-      door.open();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testOpenedOpen() {
+		Door door = new Door();
+		door.state = Door.OPEN;
+		try {
+			door.open();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testOpenedLock()
-  {
-    Door door = new Door();
-    door.state = Door.OPEN;
-    door.lock();
-    assertSame(Door.OPEN_LOCKED, door.state);
-  }
+	public void testOpenedLock() {
+		Door door = new Door();
+		door.state = Door.OPEN;
+		door.lock();
+		assertSame(Door.OPEN_LOCKED, door.state);
+	}
 
-  public void testOpenedClose()
-  {
-    Door door = new Door();
-    door.state = Door.OPEN;
-    door.close();
-    assertSame(Door.CLOSED, door.state);
-  }
+	public void testOpenedClose() {
+		Door door = new Door();
+		door.state = Door.OPEN;
+		door.close();
+		assertSame(Door.CLOSED, door.state);
+	}
 
-  public void testOpenedUnlock()
-  {
-    Door door = new Door();
-    door.state = Door.OPEN;
-    try
-    {
-      door.unlock();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testOpenedUnlock() {
+		Door door = new Door();
+		door.state = Door.OPEN;
+		try {
+			door.unlock();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testLockedOpen()
-  {
-    Door door = new Door();
-    door.state = Door.LOCKED;
-    try
-    {
-      door.open();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testLockedOpen() {
+		Door door = new Door();
+		door.state = Door.LOCKED;
+		try {
+			door.open();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testLockedLock()
-  {
-    Door door = new Door();
-    door.state = Door.LOCKED;
-    try
-    {
-      door.lock();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testLockedLock() {
+		Door door = new Door();
+		door.state = Door.LOCKED;
+		try {
+			door.lock();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testLockedClose()
-  {
-    Door door = new Door();
-    door.state = Door.LOCKED;
-    try
-    {
-      door.close();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testLockedClose() {
+		Door door = new Door();
+		door.state = Door.LOCKED;
+		try {
+			door.close();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testLockedUnlock()
-  {
-    Door door = new Door();
-    door.state = Door.LOCKED;
-    door.unlock();
-    assertSame(Door.CLOSED, door.state);
-  }
+	public void testLockedUnlock() {
+		Door door = new Door();
+		door.state = Door.LOCKED;
+		door.unlock();
+		assertSame(Door.CLOSED, door.state);
+	}
 
-  public void testOpenLockedOpen()
-  {
-    Door door = new Door();
-    door.state = Door.OPEN_LOCKED;
-    try
-    {
-      door.open();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testOpenLockedOpen() {
+		Door door = new Door();
+		door.state = Door.OPEN_LOCKED;
+		try {
+			door.open();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testOpenLockedLock()
-  {
-    Door door = new Door();
-    door.state = Door.OPEN_LOCKED;
-    try
-    {
-      door.lock();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testOpenLockedLock() {
+		Door door = new Door();
+		door.state = Door.OPEN_LOCKED;
+		try {
+			door.lock();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testOpenLockedClose()
-  {
-    Door door = new Door();
-    door.state = Door.OPEN_LOCKED;
-    try
-    {
-      door.close();
-      fail("expected exception");
-    }
-    catch (IllegalStateException e)
-    {
-    }
-  }
+	public void testOpenLockedClose() {
+		Door door = new Door();
+		door.state = Door.OPEN_LOCKED;
+		try {
+			door.close();
+			fail("expected exception");
+		}
+		catch (IllegalStateException e) {
+		}
+	}
 
-  public void testOpenLockedUnlock()
-  {
-    Door door = new Door();
-    door.state = Door.OPEN_LOCKED;
-    door.unlock();
-    assertSame(Door.OPEN, door.state);
-  }
+	public void testOpenLockedUnlock() {
+		Door door = new Door();
+		door.state = Door.OPEN_LOCKED;
+		door.unlock();
+		assertSame(Door.OPEN, door.state);
+	}
 }

Modified: jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java	2009-05-28 11:17:32 UTC (rev 4929)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java	2009-05-28 11:52:12 UTC (rev 4930)
@@ -21,54 +21,103 @@
  */
 package org.jbpm.examples.mail;
 
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jbpm.AbstractJbpmTestCase;
 import org.jbpm.JbpmConfiguration;
 import org.jbpm.JbpmContext;
 import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.graph.exe.ProcessInstance;
 import org.jbpm.mail.AddressResolver;
 
-public class MailTest
-{
-  public static class MyAddressResolver implements AddressResolver
-  {
-    private static final long serialVersionUID = 1L;
+import com.dumbster.smtp.SimpleSmtpServer;
 
-    public Object resolveAddress(String actorId)
-    {
-      return actorId + "@dalton.com";
-    }
+public class MailTest extends AbstractJbpmTestCase {
+
+  private static SimpleSmtpServer server;
+
+  private static final String XML_DECL = "<?xml version='1.0'?>";
+
+  public static Test suite() {
+    return new TestSetup(new TestSuite(MailTest.class)) {
+      protected void setUp() throws Exception {
+        server = startSmtpServer(23583);
+      }
+
+      protected void tearDown() throws Exception {
+        server.stop();
+      }
+    };
   }
 
-  public void testSimpleProcess() throws Exception
-  {
-    JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
-        "<jbpm-configuration>" + 
-        "  <bean name='jbpm.mail.address.resolver' class='" + MyAddressResolver.class.getName() + "' singleton='true' />" + 
+  public void testSimpleProcess() throws Exception {
+    JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(XML_DECL +
+        "<jbpm-configuration>" +
+        "  <jbpm-context />" +
+        "  <string name='resource.mail.properties' value='mail/mail.properties' />" +
+        "  <bean name='jbpm.mail.address.resolver' class='" +
+        MyAddressResolver.class.getName() +
+        "' singleton='true' />" +
         "</jbpm-configuration>");
 
     JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-    try
-    {
-      ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-          "<process-definition name='mailtest'>" + 
-          "  <start-state name='start'>" + 
-          "    <transition to='start toothpick line' />" + 
-          "  </start-state>" + 
-          "  <task-node name='start toothpick line'>" + 
-          "    <task  notify='yes'>" + 
-          "      <assignment actor-id='grandma' />" + 
-          "    </task>" + 
-          "    <transition to='end' />" + 
-          "  </task-node>" + 
-          "  <end-state name='end' />" + 
+    try {
+      ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL +
+          "<process-definition name='mailtest'>" +
+          "  <start-state name='start'>" +
+          "    <transition to='start toothpick line' />" +
+          "  </start-state>" +
+          "  <task-node name='start toothpick line'>" +
+          "    <task notify='yes'>" +
+          "      <assignment actor-id='grandma' />" +
+          "    </task>" +
+          "    <transition to='end' />" +
+          "  </task-node>" +
+          "  <end-state name='end' />" +
           "</process-definition>");
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
       processInstance.signal();
-
+      jbpmContext.save(processInstance);
     }
-    finally
-    {
+    finally {
       jbpmContext.close();
     }
+
+    assertEquals(1, server.getReceivedEmailSize());
   }
+
+  static SimpleSmtpServer startSmtpServer(int port) {
+    /*
+     * SimpleSmtpServer.start(int) blocks the calling thread until the server socket is created. If
+     * the socket is created too quickly (happens on Linux and Mac) then the notification is sent
+     * too early and the calling thread blocks forever.
+     * 
+     * The code below corresponds to SimpleSmtpServer.start(int) except that the thread is started
+     * inside of the synchronized block.
+     */
+    SimpleSmtpServer server = new SimpleSmtpServer(port);
+    Thread serverThread = new Thread(server);
+
+    // Block until the server socket is created
+    synchronized (server) {
+      serverThread.start();
+      try {
+        server.wait(10 * 1000);
+      }
+      catch (InterruptedException e) {
+        // Ignore don't care.
+      }
+    }
+    return server;
+  }
+
+  public static class MyAddressResolver implements AddressResolver {
+    private static final long serialVersionUID = 1L;
+
+    public Object resolveAddress(String actorId) {
+      return actorId + "@dalton.com";
+    }
+  }
 }

Added: jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/resources/mail/mail.properties
===================================================================
--- jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/resources/mail/mail.properties	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2.5-soa/modules/examples/src/test/resources/mail/mail.properties	2009-05-28 11:52:12 UTC (rev 4930)
@@ -0,0 +1,2 @@
+mail.smtp.host	localhost
+mail.smtp.port	23583
\ No newline at end of file




More information about the jbpm-commits mailing list