[jbpm-commits] JBoss JBPM SVN: r6309 - jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon May 10 02:22:20 EDT 2010


Author: alex.guizar at jboss.com
Date: 2010-05-10 02:22:19 -0400 (Mon, 10 May 2010)
New Revision: 6309

Added:
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTestSetup.java
Modified:
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/AttachmentTest.java
Log:
introduce mail test setup to prevent bind exceptions

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/AttachmentTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/AttachmentTest.java	2010-05-08 02:36:35 UTC (rev 6308)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/AttachmentTest.java	2010-05-10 06:22:19 UTC (rev 6309)
@@ -34,6 +34,8 @@
 import javax.mail.Multipart;
 import javax.mail.internet.MimeMessage;
 
+import junit.framework.Test;
+
 import org.jbpm.api.ProcessInstance;
 import org.jbpm.pvm.internal.util.IoUtil;
 import org.jbpm.test.JbpmTestCase;
@@ -45,21 +47,18 @@
  */
 public class AttachmentTest extends JbpmTestCase {
 
-  private Wiser wiser = new Wiser();
+  private static Wiser wiser = new Wiser();
 
-  protected void setUp() throws Exception {
-    super.setUp();
-    // start mail server
-    wiser.setPort(2525);
-    wiser.start();
-  }
-
+  @Override
   protected void tearDown() throws Exception {
-    // stop mail server
-    wiser.stop();
+    wiser.getMessages().clear();
     super.tearDown();
   }
 
+  public static Test suite() {
+    return new MailTestSetup(AttachmentTest.class, wiser);
+  }
+
   public void testVariableAttachment() throws MessagingException, IOException {
     // deploy process definition
     deployJpdlXmlString("<process name='varattachment'>"

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTestSetup.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTestSetup.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTestSetup.java	2010-05-10 06:22:19 UTC (rev 6309)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.activity.mail;
+
+import org.subethamail.wiser.Wiser;
+
+import junit.extensions.TestSetup;
+import junit.framework.TestSuite;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailTestSetup extends TestSetup {
+
+  private final Wiser wiser;
+
+  public MailTestSetup(Class<?> testClass, Wiser wiser) {
+    super(new TestSuite(testClass));
+    this.wiser = wiser;
+  }
+
+  public Wiser getWiser() {
+    return wiser;
+  }
+
+  @Override
+  protected void setUp() throws Exception {
+    wiser.setPort(2525);
+    wiser.start();
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    wiser.stop();
+  }
+
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTestSetup.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native



More information about the jbpm-commits mailing list