[jbpm-commits] JBoss JBPM SVN: r6280 - jbpm3/branches/jbpm-3.2-soa/modules/core and 10 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Apr 27 00:49:18 EDT 2010
Author: alex.guizar at jboss.com
Date: 2010-04-27 00:49:17 -0400 (Tue, 27 Apr 2010)
New Revision: 6280
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTestSetup.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/PerformanceTest.java
Removed:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2852/JBPM2852Test.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTest.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/TaskMailTest.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/gpd.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/mail.templates.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/processdefinition.xml
jbpm3/branches/jbpm-3.2-soa/modules/examples/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java
jbpm3/branches/jbpm-3.2-soa/pom.xml
projects/jsf-console/branches/jsf-console-3.2-soa/pom.xml
projects/parent/trunk/pom.xml
Log:
JBPM-2852: test bcc addresses
switch to wiser for mail tests
migrate to nexus maven repo
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2010-04-27 04:49:17 UTC (rev 6280)
@@ -82,11 +82,6 @@
<!-- Test Dependencies -->
<dependency>
- <groupId>dumbster</groupId>
- <artifactId>dumbster</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<scope>test</scope>
@@ -96,6 +91,23 @@
<artifactId>hsqldb</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>net.sf.retrotranslator</groupId>
+ <artifactId>retrotranslator-runtime</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.subethamail</groupId>
+ <artifactId>subethasmtp-wiser</artifactId>
+ <classifier>java14</classifier>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.subethamail</groupId>
+ <artifactId>subethasmtp-smtp</artifactId>
+ <classifier>java14</classifier>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<!-- Plugins -->
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -868,6 +868,20 @@
config.append("<cc>").append(cc).append("</cc>");
}
// cc - actors
+ String ccActors = element.attributeValue("cc-actors");
+ if (ccActors != null) {
+ config.append("<ccActors>").append(ccActors).append("</ccActors>");
+ }
+ // bcc - addresses
+ String bcc = element.attributeValue("cc");
+ if (bcc != null) {
+ config.append("<bcc>").append(bcc).append("</bcc>");
+ }
+ // bcc - actors
+ String bccActors = element.attributeValue("bcc-actors");
+ if (bccActors != null) {
+ config.append("<bccActors>").append(bccActors).append("</bccActors>");
+ }
// subject
String subject = getProperty("subject", element);
if (subject != null) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -363,19 +363,14 @@
addTemplateProperty(templateElement, "cc", templateProperties);
addTemplateProperty(templateElement, "cc-actors", templateProperties);
addTemplateProperty(templateElement, "bcc", templateProperties);
- addTemplateProperty(templateElement, "bcc-actors", templateProperties);
// preserve backwards compatibility with bccActors element
Element bccActorsElement = XmlUtil.element(templateElement, "bccActors");
if (bccActorsElement != null) {
- String bccActors = templateProperties.getProperty("bcc-actors");
- if (bccActors != null) {
- bccActors += ';' + XmlUtil.getContentText(bccActorsElement);
- }
- else {
- bccActors = XmlUtil.getContentText(bccActorsElement);
- }
- templateProperties.setProperty("bcc-actors", bccActors);
+ templateProperties.setProperty("bcc-actors", XmlUtil.getContentText(bccActorsElement));
}
+ else {
+ addTemplateProperty(templateElement, "bcc-actors", templateProperties);
+ }
templatePropertiesMap.put(templateElement.getAttribute("name"), templateProperties);
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2852/JBPM2852Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2852/JBPM2852Test.java 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2852/JBPM2852Test.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -21,29 +21,41 @@
*/
package org.jbpm.jbpm2852;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.mail.MessagingException;
+import javax.mail.Message.RecipientType;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import junit.framework.Test;
+
+import org.subethamail.wiser.Wiser;
+import org.subethamail.wiser.WiserMessage;
+
import org.jbpm.AbstractJbpmTestCase;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.mail.MailTest;
+import org.jbpm.mail.MailTestSetup;
-import com.dumbster.smtp.SimpleSmtpServer;
-import com.dumbster.smtp.SmtpMessage;
-
/**
* CC support in mail nodes and mail templates.
*
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2852">JBPM-2852</a>
* @author Alejandro Guizar
*/
public class JBPM2852Test extends AbstractJbpmTestCase {
private JbpmContext jbpmContext;
- private SimpleSmtpServer smtpServer;
private ProcessInstance processInstance;
private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("org/jbpm/jbpm2852/jbpm.cfg.xml");
+ private static Wiser wiser;
protected void setUp() throws Exception {
super.setUp();
@@ -55,36 +67,55 @@
ContextInstance contextInstance = processInstance.getContextInstance();
contextInstance.setVariable("technician", "technician at example.com");
contextInstance.setVariable("supervisor", "supervisor at example.com");
+ contextInstance.setVariable("observer", "observer at example.com");
processInstance.signal();
-
- smtpServer = MailTest.startSmtpServer(2525);
}
protected void tearDown() throws Exception {
- smtpServer.stop();
+ wiser.getMessages().clear();
jbpmContext.close();
super.tearDown();
}
- public void testMailNodeInlineCC() {
+ public static Test suite() {
+ MailTestSetup testSetup = new MailTestSetup(JBPM2852Test.class);
+ wiser = testSetup.getWiser();
+ return testSetup;
+ }
+
+ public void testMailNodeInlineCC() throws MessagingException {
processInstance.signal("high");
assertEquals("alert", processInstance.getRootToken().getNode().getName());
- assertEquals(1, smtpServer.getReceivedEmailSize());
- SmtpMessage message = (SmtpMessage) smtpServer.getReceivedEmail().next();
- assertEquals("Reactor temperature exceeded threshold", message.getHeaderValue("Subject"));
- assertEquals("technician at example.com", message.getHeaderValue("To"));
- assertEquals("supervisor at example.com", message.getHeaderValue("Cc"));
+ List messages = wiser.getMessages();
+ assertEquals(3, messages.size());
+
+ for (Iterator iter = messages.iterator(); iter.hasNext();) {
+ WiserMessage wiserMessage = (WiserMessage) iter.next();
+ MimeMessage message = wiserMessage.getMimeMessage();
+ assertEquals("Reactor temperature exceeded threshold", message.getSubject());
+ assert Arrays.equals(InternetAddress.parse("technician at example.com"), message.getRecipients(RecipientType.TO));
+ assert Arrays.equals(InternetAddress.parse("supervisor at example.com"), message.getRecipients(RecipientType.CC));
+ // bcc recipients undisclosed
+ assertNull(message.getRecipients(RecipientType.BCC));
+ }
}
- public void testMailActionTemplateCC() {
+ public void testMailActionTemplateCC() throws MessagingException {
processInstance.signal("normal");
assertEquals("ok", processInstance.getRootToken().getNode().getName());
- assertEquals(1, smtpServer.getReceivedEmailSize());
- SmtpMessage message = (SmtpMessage) smtpServer.getReceivedEmail().next();
- assertEquals("Reactor temperature normal", message.getHeaderValue("Subject"));
- assertEquals("technician at example.com", message.getHeaderValue("To"));
- assertEquals("supervisor at example.com", message.getHeaderValue("Cc"));
+ List messages = wiser.getMessages();
+ assertEquals(3, messages.size());
+
+ for (Iterator iter = messages.iterator(); iter.hasNext();) {
+ WiserMessage wiserMessage = (WiserMessage) iter.next();
+ MimeMessage message = wiserMessage.getMimeMessage();
+ assertEquals("Reactor temperature normal", message.getSubject());
+ assert Arrays.equals(InternetAddress.parse("technician at example.com"), message.getRecipients(RecipientType.TO));
+ assert Arrays.equals(InternetAddress.parse("supervisor at example.com"), message.getRecipients(RecipientType.CC));
+ // bcc recipients undisclosed
+ assertNull(message.getRecipients(RecipientType.BCC));
+ }
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTest.java 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTest.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -1,8 +1,19 @@
package org.jbpm.mail;
+import java.io.IOException;
import java.util.Arrays;
-import java.util.Iterator;
+import java.util.List;
+import javax.mail.MessagingException;
+import javax.mail.Message.RecipientType;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import junit.framework.Test;
+
+import org.subethamail.wiser.Wiser;
+import org.subethamail.wiser.WiserMessage;
+
import org.jbpm.AbstractJbpmTestCase;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
@@ -11,13 +22,10 @@
import org.jbpm.taskmgmt.def.Swimlane;
import org.jbpm.taskmgmt.exe.SwimlaneInstance;
-import com.dumbster.smtp.SimpleSmtpServer;
-import com.dumbster.smtp.SmtpMessage;
-
public class MailTest extends AbstractJbpmTestCase {
- private SimpleSmtpServer smtpServer;
private JbpmContext jbpmContext;
+
private static final String XML_DECL = "<?xml version='1.0'?>";
private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(XML_DECL
@@ -29,44 +37,26 @@
+ "' singleton='true' />"
+ "</jbpm-configuration>");
- public 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.
- *
- * 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);
+ private static Wiser wiser;
- // 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;
- }
-
protected void setUp() throws Exception {
super.setUp();
jbpmContext = jbpmConfiguration.createJbpmContext();
- smtpServer = startSmtpServer(2525);
}
protected void tearDown() throws Exception {
- smtpServer.stop();
+ wiser.getMessages().clear();
jbpmContext.close();
super.tearDown();
}
- public void testWithoutAddressResolving() {
+ public static Test suite() {
+ MailTestSetup testSetup = new MailTestSetup(MailTest.class);
+ wiser = testSetup.getWiser();
+ return testSetup;
+ }
+
+ public void testWithoutAddressResolving() throws MessagingException, IOException {
String to = "sample.shipper at example.domain";
String subject = "latest news";
String text = "roy is assurancetourix";
@@ -74,16 +64,17 @@
Mail mail = new Mail(null, null, to, subject, text);
mail.send();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("latest news", email.getHeaderValue("Subject"));
- assertEquals("roy is assurancetourix", email.getBody());
- assertEquals("sample.shipper at example.domain", email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("latest news", email.getSubject());
+ assertEquals("roy is assurancetourix", email.getContent());
+ assert Arrays.equals(InternetAddress.parse("sample.shipper at example.domain"), email.getRecipients(RecipientType.TO));
}
- public void testMailWithAddressResolving() {
+ public void testMailWithAddressResolving() throws MessagingException, IOException {
String actors = "manager";
String subject = "latest news";
String text = "roy is assurancetourix";
@@ -91,16 +82,17 @@
Mail mail = new Mail(null, actors, null, subject, text);
mail.send();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("latest news", email.getHeaderValue("Subject"));
- assertEquals("roy is assurancetourix", email.getBody());
- assertEquals("manager at example.domain", email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("latest news", email.getSubject());
+ assertEquals("roy is assurancetourix", email.getContent());
+ assert Arrays.equals(InternetAddress.parse("manager at example.domain"), email.getRecipients(RecipientType.TO));
}
- public void testMailWithBccAddress() {
+ public void testMailWithBccAddress() throws MessagingException, IOException {
String bcc = "bcc at example.domain";
String subject = "latest news";
String text = "roy is assurancetourix";
@@ -108,16 +100,17 @@
Mail mail = new Mail(null, null, null, null, bcc, subject, text);
mail.send();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("latest news", email.getHeaderValue("Subject"));
- assertEquals("roy is assurancetourix", email.getBody());
- assertNull(email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("latest news", email.getSubject());
+ assertEquals("roy is assurancetourix", email.getContent());
+ assertNull(email.getRecipients(RecipientType.TO));
}
- public void testMailNodeAttributes() {
+ public void testMailNodeAttributes() throws MessagingException, IOException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -131,16 +124,17 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("readmylips", email.getHeaderValue("Subject"));
- assertEquals("nomoretaxes", email.getBody());
- assertEquals("george at example.domain", email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("readmylips", email.getSubject());
+ assertEquals("nomoretaxes", email.getContent());
+ assert Arrays.equals(InternetAddress.parse("george at example.domain"), email.getRecipients(RecipientType.TO));
}
- public void testMailNodeElements() {
+ public void testMailNodeElements() throws MessagingException, IOException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -156,16 +150,17 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("readmylips", email.getHeaderValue("Subject"));
- assertEquals("nomoretaxes", email.getBody());
- assertEquals("george at example.domain", email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("readmylips", email.getSubject());
+ assertEquals("nomoretaxes", email.getContent());
+ assert Arrays.equals(InternetAddress.parse("george at example.domain"), email.getRecipients(RecipientType.TO));
}
- public void testMailActionAttributes() {
+ public void testMailActionAttributes() throws MessagingException, IOException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -178,16 +173,17 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("readmylips", email.getHeaderValue("Subject"));
- assertEquals("nomoretaxes", email.getBody());
- assertEquals("george at example.domain", email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("readmylips", email.getSubject());
+ assertEquals("nomoretaxes", email.getContent());
+ assert Arrays.equals(InternetAddress.parse("george at example.domain"), email.getRecipients(RecipientType.TO));
}
- public void testMailActionElements() {
+ public void testMailActionElements() throws MessagingException, IOException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -204,16 +200,17 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("readmylips", email.getHeaderValue("Subject"));
- assertEquals("nomoretaxes", email.getBody());
- assertEquals("george at example.domain", email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("readmylips", email.getSubject());
+ assertEquals("nomoretaxes", email.getContent());
+ assert Arrays.equals(InternetAddress.parse("george at example.domain"), email.getRecipients(RecipientType.TO));
}
- public void testMultipleRecipients() {
+ public void testMultipleRecipients() throws MessagingException, IOException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -227,20 +224,18 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(3, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("readmylips", email.getHeaderValue("Subject"));
- assertEquals("nomoretaxes", email.getBody());
- 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);
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("readmylips", email.getSubject());
+ assertEquals("nomoretaxes", email.getContent());
+ InternetAddress[] expectedTo = InternetAddress.parse("george at example.domain, barbara at example.domain, suzy at example.domain");
+ assert Arrays.equals(expectedTo, email.getRecipients(RecipientType.TO));
}
- public void testMailWithoutAddressResolving() {
+ public void testMailWithoutAddressResolving() throws MessagingException, IOException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -254,18 +249,18 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(2, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- String[] expectedTo = {
- "george at humpydumpy.gov", "spiderman at hollywood.ca.us"
- };
- String[] to = email.getHeaderValues("To");
- assert Arrays.equals(expectedTo, to) : Arrays.asList(to);
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("readmylips", email.getSubject());
+ assertEquals("nomoretaxes", email.getContent());
+ InternetAddress[] expectedTo = InternetAddress.parse("george at humpydumpy.gov, spiderman at hollywood.ca.us");
+ assert Arrays.equals(expectedTo, email.getRecipients(RecipientType.TO));
}
- public void testToVariableExpression() {
+ public void testToVariableExpression() throws MessagingException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -282,14 +277,15 @@
processInstance.getContextInstance().setVariable("user", mrNobody);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("hucklebuck at example.domain", email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assert Arrays.equals(InternetAddress.parse("hucklebuck at example.domain"), email.getRecipients(RecipientType.TO));
}
- public void testToSwimlaneExpression() {
+ public void testToSwimlaneExpression() throws MessagingException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -300,21 +296,22 @@
+ " <end-state name='end' />"
+ "</process-definition>");
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- Swimlane initiator = new Swimlane("initiator");
- SwimlaneInstance initiatorInstance = new SwimlaneInstance(initiator);
+ SwimlaneInstance initiatorInstance = new SwimlaneInstance(new Swimlane("initiator"));
initiatorInstance.setActorId("huckelberry");
+
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.getTaskMgmtInstance().addSwimlaneInstance(initiatorInstance);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("huckelberry at example.domain", email.getHeaderValue("To"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assert Arrays.equals(InternetAddress.parse("huckelberry at example.domain"), email.getRecipients(RecipientType.TO));
}
- public void testSubjectExpression() {
+ public void testSubjectExpression() throws MessagingException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -329,14 +326,15 @@
processInstance.getContextInstance().setVariable("item", "cookies");
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("your cookies order", email.getHeaderValue("Subject"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("your cookies order", email.getSubject());
}
- public void testTextExpression() {
+ public void testTextExpression() throws IOException, MessagingException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
+ "<process-definition>"
+ " <start-state>"
@@ -351,11 +349,12 @@
processInstance.getContextInstance().setVariable("item", "cookies");
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- Iterator emailIter = smtpServer.getReceivedEmail();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- SmtpMessage email = (SmtpMessage) emailIter.next();
- assertEquals("your cookies order", email.getBody());
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assertEquals("your cookies order", email.getContent());
}
public static class User {
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTestSetup.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTestSetup.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTestSetup.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -0,0 +1,54 @@
+/*
+ * 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.mail;
+
+import org.subethamail.wiser.Wiser;
+
+import junit.extensions.TestSetup;
+import junit.framework.TestSuite;
+
+public class MailTestSetup extends TestSetup {
+
+ private Wiser wiser = new Wiser();
+
+ public MailTestSetup(Class testClass) {
+ super(new TestSuite(testClass));
+ }
+
+ public Wiser getWiser() {
+ return wiser;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ wiser.setPort(2525);
+ wiser.start();
+ }
+
+ protected void tearDown() throws Exception {
+ wiser.stop();
+ wiser = null;
+
+ super.tearDown();
+ }
+}
\ No newline at end of file
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/MailTestSetup.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/TaskMailTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/TaskMailTest.java 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/TaskMailTest.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -1,9 +1,20 @@
package org.jbpm.mail;
+import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Arrays;
import java.util.List;
+import javax.mail.MessagingException;
+import javax.mail.Message.RecipientType;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import junit.framework.Test;
+
+import org.subethamail.wiser.Wiser;
+import org.subethamail.wiser.WiserMessage;
+
import org.jbpm.AbstractJbpmTestCase;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
@@ -22,13 +33,9 @@
import org.jbpm.taskmgmt.exe.TaskInstance;
import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
-import com.dumbster.smtp.SimpleSmtpServer;
-import com.dumbster.smtp.SmtpMessage;
-
public class TaskMailTest extends AbstractJbpmTestCase {
private JbpmContext jbpmContext;
- private SimpleSmtpServer smtpServer;
private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
+ " <jbpm-context>"
@@ -42,14 +49,15 @@
+ "' singleton='true' />"
+ "</jbpm-configuration>");
+ private static Wiser wiser;
+
protected void setUp() throws Exception {
super.setUp();
jbpmContext = jbpmConfiguration.createJbpmContext();
- smtpServer = MailTest.startSmtpServer(2525);
}
protected void tearDown() throws Exception {
- smtpServer.stop();
+ wiser.getMessages().clear();
TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServiceFactory(Services.SERVICENAME_SCHEDULER);
testSchedulerService.reset();
@@ -58,6 +66,12 @@
super.tearDown();
}
+ public static Test suite() {
+ MailTestSetup testSetup = new MailTestSetup(TaskMailTest.class);
+ wiser = testSetup.getWiser();
+ return testSetup;
+ }
+
public static class RoundRobinAssigner implements AssignmentHandler {
private static final long serialVersionUID = 1L;
@@ -67,7 +81,7 @@
}
}
- public void testTaskInstanceNotification() {
+ public void testTaskInstanceNotification() throws IOException, MessagingException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ " <start-state>"
+ " <transition to='a' />"
@@ -85,16 +99,18 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertTrue(smtpServer.getReceivedEmailSize() == 1);
- Iterator emailIter = smtpServer.getReceivedEmail();
- SmtpMessage email = (SmtpMessage) emailIter.next();
- emailIter.remove();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- assertEquals("you at example.domain", email.getHeaderValue("To"));
- assertEquals("Task 'laundry'", email.getHeaderValue("Subject"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+
+ assert Arrays.equals(InternetAddress.parse("you at example.domain"), email.getRecipients(RecipientType.TO));
+ assertEquals("Task 'laundry'", email.getSubject());
// just to make sure that all expressions were resolved
- assertEquals(-1, email.getBody().indexOf("#{"));
- assertTrue(-1 != email.getBody().indexOf("http://localhost:8080/jbpm/home?taskId=0"));
+ String content = (String) email.getContent();
+ assertEquals(-1, content.indexOf("#{"));
+ assertTrue(content.indexOf("http://localhost:8080/jbpm/home?taskId=0") != -1);
}
public static class TestSchedulerService implements SchedulerService, ServiceFactory {
@@ -150,7 +166,7 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertTrue(smtpServer.getReceivedEmailSize() == 0);
+ assertEquals(0, wiser.getMessages().size());
TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices()
.getService("scheduler");
@@ -162,16 +178,18 @@
createdTimer.execute(jbpmContext);
- assertTrue(smtpServer.getReceivedEmailSize() == 1);
- Iterator emailIter = smtpServer.getReceivedEmail();
- SmtpMessage email = (SmtpMessage) emailIter.next();
- emailIter.remove();
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- assertEquals("you at example.domain", email.getHeaderValue("To"));
- assertEquals("Task 'laundry' !", email.getHeaderValue("Subject"));
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+
+ assert Arrays.equals(InternetAddress.parse("you at example.domain"), email.getRecipients(RecipientType.TO));
+ assertEquals("Task 'laundry' !", email.getSubject());
// just to make sure that all expressions were resolved
- assertEquals(-1, email.getBody().indexOf("#{"));
- assertTrue(-1 != email.getBody().indexOf("http://localhost:8080/jbpm/home?taskId=0"));
+ String content = (String) email.getContent();
+ assertEquals(-1, content.indexOf("#{"));
+ assertTrue(content.indexOf("http://localhost:8080/jbpm/home?taskId=0") != -1);
TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
TaskInstance taskInstance = (TaskInstance) taskMgmtInstance.getTaskInstances()
@@ -209,7 +227,7 @@
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertEquals(0, smtpServer.getReceivedEmailSize());
+ assertEquals(0, wiser.getMessages().size());
TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
TaskInstance taskInstance = (TaskInstance) taskMgmtInstance.getTaskInstances()
@@ -221,6 +239,6 @@
assertEquals("ghost", taskInstance.getActorId());
taskInstance.end();
- assertEquals(0, smtpServer.getReceivedEmailSize());
+ assertEquals(0, wiser.getMessages().size());
}
}
Copied: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/PerformanceTest.java (from rev 6262, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java)
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/PerformanceTest.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/PerformanceTest.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -0,0 +1,91 @@
+/*
+ * 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.perf;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * This test creates a number of process instances. Every instance has a call to
+ * an ActionHandler.
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2043">JBPM-2043</a>
+ * @author mvecera at redhat.com
+ * @author pmacik at redhat.com
+ * @author Alejandro Guizar
+ * @since 18-Feb-2009
+ */
+public class PerformanceTest extends AbstractDbTestCase {
+
+ private static final int WARMUP_INSTANCES = 100;
+ private static final int MEASURED_INSTANCES = 1000;
+ private static final long TIMEOUT = 2 * 60 * 1000;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition name='jbpm2043'>"
+ + " <start-state name='start'>"
+ + " <transition to='midway'/>"
+ + " </start-state>"
+ + " <node name='midway' async='true'>"
+ + " <transition to='end'/>"
+ + " </node>"
+ + " <end-state name='end'/>"
+ + "</process-definition>");
+ deployProcessDefinition(processDefinition);
+ }
+
+ public void testAsyncCall() {
+ Runtime rt = Runtime.getRuntime();
+ System.out.print("Free memory: ");
+ System.out.println(rt.freeMemory());
+ System.out.print("Total memory: ");
+ System.out.println(rt.totalMemory());
+ System.out.print("Max memory: ");
+ System.out.println(rt.maxMemory());
+ System.out.print("Processors: ");
+ System.out.println(rt.availableProcessors());
+
+ long firstTime = System.currentTimeMillis();
+ launchProcessInstances(WARMUP_INSTANCES);
+ processJobs(TIMEOUT);
+
+ long secondTime = System.currentTimeMillis();
+ launchProcessInstances(MEASURED_INSTANCES);
+ processJobs((secondTime - firstTime) * (MEASURED_INSTANCES / WARMUP_INSTANCES + 1));
+
+ long duration = System.currentTimeMillis() - secondTime;
+ System.out.println("### Processed "
+ + (1000 * MEASURED_INSTANCES / duration)
+ + " instances per second ###");
+ }
+
+ private void launchProcessInstances(int count) {
+ for (int i = 0; i < count; i++) {
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("jbpm2043");
+ processInstance.signal();
+ newTransaction();
+ }
+ }
+}
Deleted: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -1,91 +0,0 @@
-/*
- * 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.perf;
-
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-
-/**
- * This test creates a number of process instances. Every instance has a call to
- * an ActionHandler.
- *
- * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2043">JBPM-2043</a>
- * @author mvecera at redhat.com
- * @author pmacik at redhat.com
- * @author Alejandro Guizar
- * @since 18-Feb-2009
- */
-public class SimplePerformanceTest extends AbstractDbTestCase {
-
- private static final int WARMUP_INSTANCES = 100;
- private static final int MEASURED_INSTANCES = 1000;
- private static final long TIMEOUT = 2 * 60 * 1000;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition name='jbpm2043'>"
- + " <start-state name='start'>"
- + " <transition to='midway'/>"
- + " </start-state>"
- + " <node name='midway' async='true'>"
- + " <transition to='end'/>"
- + " </node>"
- + " <end-state name='end'/>"
- + "</process-definition>");
- deployProcessDefinition(processDefinition);
- }
-
- public void testAsyncCall() {
- Runtime rt = Runtime.getRuntime();
- System.out.print("Free memory: ");
- System.out.println(rt.freeMemory());
- System.out.print("Total memory: ");
- System.out.println(rt.totalMemory());
- System.out.print("Max memory: ");
- System.out.println(rt.maxMemory());
- System.out.print("Processors: ");
- System.out.println(rt.availableProcessors());
-
- long firstTime = System.currentTimeMillis();
- launchProcessInstances(WARMUP_INSTANCES);
- processJobs(TIMEOUT);
-
- long secondTime = System.currentTimeMillis();
- launchProcessInstances(MEASURED_INSTANCES);
- processJobs((secondTime - firstTime) * (MEASURED_INSTANCES / WARMUP_INSTANCES + 1));
-
- long duration = System.currentTimeMillis() - secondTime;
- System.out.println("### Processed "
- + (1000 * MEASURED_INSTANCES / duration)
- + " instances per second ###");
- }
-
- private void launchProcessInstances(int count) {
- for (int i = 0; i < count; i++) {
- ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("jbpm2043");
- processInstance.signal();
- newTransaction();
- }
- }
-}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/gpd.xml 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/gpd.xml 2010-04-27 04:49:17 UTC (rev 6280)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<root-container name="jbpm2852" width="788" height="568">
+<root-container name="jbpm2852" width="788" height="574">
<node name="start" x="36" y="36" width="121" height="37">
<edge>
<label x="5" y="-10"/>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/mail.templates.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/mail.templates.xml 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/mail.templates.xml 2010-04-27 04:49:17 UTC (rev 6280)
@@ -3,6 +3,7 @@
<mail-template name='a-ok'>
<to>${technician}</to>
<cc>${supervisor}</cc>
+ <bcc>${observer}</bcc>
<subject>Reactor temperature normal</subject>
<text><![CDATA[Keep up the good work!]]></text>
</mail-template>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/processdefinition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/processdefinition.xml 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2852/processdefinition.xml 2010-04-27 04:49:17 UTC (rev 6280)
@@ -13,7 +13,7 @@
</transition>
</state>
- <mail-node name="contact technician" to="${technician}" cc="${supervisor}">
+ <mail-node name="contact technician" to="${technician}" cc="${supervisor}" bcc="${observer}">
<subject>Reactor temperature exceeded threshold</subject>
<text>Act fast! We do not want another Chernobyl.</text>
<transition to="alert" />
Modified: jbpm3/branches/jbpm-3.2-soa/modules/examples/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/examples/pom.xml 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/examples/pom.xml 2010-04-27 04:49:17 UTC (rev 6280)
@@ -74,10 +74,22 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>dumbster</groupId>
- <artifactId>dumbster</artifactId>
- <scope>test</scope>
+ <groupId>net.sf.retrotranslator</groupId>
+ <artifactId>retrotranslator-runtime</artifactId>
+ <scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.subethamail</groupId>
+ <artifactId>subethasmtp-smtp</artifactId>
+ <classifier>java14</classifier>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.subethamail</groupId>
+ <artifactId>subethasmtp-wiser</artifactId>
+ <classifier>java14</classifier>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<!-- Plugins -->
Modified: jbpm3/branches/jbpm-3.2-soa/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java 2010-04-27 04:49:17 UTC (rev 6280)
@@ -21,6 +21,17 @@
*/
package org.jbpm.examples.mail;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.mail.MessagingException;
+import javax.mail.Message.RecipientType;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import org.subethamail.wiser.Wiser;
+import org.subethamail.wiser.WiserMessage;
+
import org.jbpm.AbstractJbpmTestCase;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
@@ -28,61 +39,37 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.mail.AddressResolver;
-import com.dumbster.smtp.SimpleSmtpServer;
-import com.dumbster.smtp.SmtpMessage;
-
public class MailTest extends AbstractJbpmTestCase {
private JbpmContext jbpmContext;
- private SimpleSmtpServer smtpServer;
+ private Wiser wiser = new Wiser();
private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("mail/jbpm.cfg.xml");
protected void setUp() throws Exception {
super.setUp();
jbpmContext = jbpmConfiguration.createJbpmContext();
- smtpServer = startSmtpServer(2525);
+ wiser.setPort(2525);
+ wiser.start();
}
protected void tearDown() throws Exception {
- smtpServer.stop();
+ wiser.stop();
jbpmContext.close();
super.tearDown();
}
- public void testSimpleProcess() throws Exception {
+ public void testSimpleProcess() throws MessagingException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("mail/processdefinition.xml");
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- assertEquals(1, smtpServer.getReceivedEmailSize());
- SmtpMessage smtpMessage = (SmtpMessage) smtpServer.getReceivedEmail().next();
- assertEquals("grandma at dalton.com", smtpMessage.getHeaderValue("To"));
- }
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
- 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;
+ WiserMessage message = (WiserMessage) messages.get(0);
+ MimeMessage email = message.getMimeMessage();
+ assert Arrays.equals(InternetAddress.parse("grandma at dalton.com"), email.getRecipients(RecipientType.TO));
}
public static class MyAddressResolver implements AddressResolver {
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2010-04-26 17:01:15 UTC (rev 6279)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2010-04-27 04:49:17 UTC (rev 6280)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-parent</artifactId>
- <version>1.0.2</version>
+ <version>1.0.3-SNAPSHOT</version>
</parent>
<!-- Modules -->
@@ -47,12 +47,11 @@
<desmoj.version>2.1.1</desmoj.version>
<dom4j.version>1.6.1</dom4j.version>
<drools.version>4.0.7</drools.version>
- <dumbster.version>1.6</dumbster.version>
<hibernate.version>3.2.4.sp1</hibernate.version>
<jackrabbit.version>1.4.5</jackrabbit.version>
<jasper.reports.version>3.5.3</jasper.reports.version>
<javax.el.version>1.2</javax.el.version>
- <javax.jcr.version>1.0.1</javax.jcr.version>
+ <javax.jcr.version>1.0</javax.jcr.version>
<javax.mail.version>1.4</javax.mail.version>
<javax.servlet.version>2.5</javax.servlet.version>
<jaxen.version>1.1.1</jaxen.version>
@@ -66,6 +65,7 @@
<mvel.version>1.3.1-java1.4</mvel.version>
<richfaces.ui.version>3.2.1.GA</richfaces.ui.version>
<sun.facelets.version>1.1.15</sun.facelets.version>
+ <wiser.version>1.2</wiser.version>
<xerces.version>2.6.2</xerces.version>
<!-- Database Driver Versions -->
@@ -77,6 +77,7 @@
<mysql.connector.version>5.0.7</mysql.connector.version>
<ojdbc.version>10.2.0.4</ojdbc.version>
<postgresql.version>8.2-504.jdbc3</postgresql.version>
+ <retrotranslator.version>1.2.7</retrotranslator.version>
</properties>
<!-- DependencyManagement -->
@@ -164,6 +165,16 @@
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>xercesImpl</artifactId>
+ <groupId>xerces</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.drools</groupId>
@@ -171,11 +182,6 @@
<version>${drools.version}</version>
</dependency>
<dependency>
- <groupId>dumbster</groupId>
- <artifactId>dumbster</artifactId>
- <version>${dumbster.version}</version>
- </dependency>
- <dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>${javax.el.version}</version>
@@ -241,6 +247,11 @@
<version>${javax.mail.version}</version>
</dependency>
<dependency>
+ <groupId>net.sf.retrotranslator</groupId>
+ <artifactId>retrotranslator-runtime</artifactId>
+ <version>${retrotranslator.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui</artifactId>
<version>${richfaces.ui.version}</version>
@@ -250,6 +261,24 @@
<artifactId>servlet-api</artifactId>
<version>${javax.servlet.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.subethamail</groupId>
+ <artifactId>subethasmtp-smtp</artifactId>
+ <version>${wiser.version}</version>
+ <classifier>java14</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.subethamail</groupId>
+ <artifactId>subethasmtp-wiser</artifactId>
+ <version>${wiser.version}</version>
+ <classifier>java14</classifier>
+ <exclusions>
+ <exclusion>
+ <groupId>org.subethamail</groupId>
+ <artifactId>subethasmtp-smtp</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<!-- Database Drivers -->
<dependency>
@@ -457,7 +486,7 @@
<jdbc.hsqldb.database>jbpm3</jdbc.hsqldb.database>
<jdbc.hsqldb.url>jdbc:hsqldb:mem:${jdbc.hsqldb.database}</jdbc.hsqldb.url>
<jdbc.hsqldb.username>sa</jdbc.hsqldb.username>
- <jdbc.hsqldb.password></jdbc.hsqldb.password>
+ <jdbc.hsqldb.password />
<jdbc.hsqldb.driver>org.hsqldb.jdbcDriver</jdbc.hsqldb.driver>
</properties>
<dependencies>
@@ -517,7 +546,7 @@
<jdbc.hsqldb.database>jbpm3</jdbc.hsqldb.database>
<jdbc.hsqldb.url>jdbc:hsqldb:mem:${jdbc.hsqldb.database}</jdbc.hsqldb.url>
<jdbc.hsqldb.username>sa</jdbc.hsqldb.username>
- <jdbc.hsqldb.password></jdbc.hsqldb.password>
+ <jdbc.hsqldb.password />
<jdbc.hsqldb.driver>org.hsqldb.jdbcDriver</jdbc.hsqldb.driver>
</properties>
<dependencies>
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/pom.xml
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/pom.xml 2010-04-26 17:01:15 UTC (rev 6279)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/pom.xml 2010-04-27 04:49:17 UTC (rev 6280)
@@ -37,7 +37,7 @@
<commons.fileupload.version>1.2.1</commons.fileupload.version>
<commons.io.version>1.4</commons.io.version>
<commons.logging.version>1.1.1</commons.logging.version>
- <javax.el.version>1.2</javax.el.version>
+ <javax.el.version>1.0</javax.el.version>
<javax.faces.version>1.2_13</javax.faces.version>
<javax.servlet.version>2.5</javax.servlet.version>
<jbpm.version>3.2.8</jbpm.version>
Modified: projects/parent/trunk/pom.xml
===================================================================
--- projects/parent/trunk/pom.xml 2010-04-26 17:01:15 UTC (rev 6279)
+++ projects/parent/trunk/pom.xml 2010-04-27 04:49:17 UTC (rev 6280)
@@ -7,7 +7,7 @@
<groupId>org.jbpm</groupId>
<artifactId>jbpm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.2</version>
+ <version>1.0.3-SNAPSHOT</version>
<!-- Organization -->
<organization>
@@ -32,7 +32,7 @@
<!-- Continuous Integration Management -->
<ciManagement>
<system>hudson</system>
- <url>http://hudson.qa.jboss.com/hudson</url>
+ <url>http://hudson.jboss.org/hudson</url>
</ciManagement>
<!-- Licenses -->
@@ -78,63 +78,26 @@
<!-- Plugin Management -->
<pluginManagement>
<plugins>
- <plugin>
- <groupId>com.sun.tools.jxc.maven2</groupId>
- <artifactId>maven-jaxb-schemagen-plugin</artifactId>
- <version>1.2</version>
- <dependencies>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.7</version>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-xjc</artifactId>
- <version>2.1.7</version>
- </dependency>
- </dependencies>
- </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>1.1</version>
+ <version>1.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
- <version>1.0-beta-1</version>
+ <version>1.0-beta-4</version>
</plugin>
<plugin>
<groupId>net.sourceforge.maven-taglib</groupId>
<artifactId>maven-taglib-plugin</artifactId>
- <version>2.3</version>
+ <version>2.4</version>
</plugin>
</plugins>
</pluginManagement>
-
- <extensions>
- <!-- Allow to deploy releases in SVN -->
- <extension>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-scm</artifactId>
- <version>1.0-beta-6</version>
- </extension>
- <extension>
- <groupId>org.apache.maven.scm</groupId>
- <artifactId>maven-scm-manager-plexus</artifactId>
- <version>1.0</version>
- </extension>
- <extension>
- <groupId>org.apache.maven.scm</groupId>
- <artifactId>maven-scm-provider-svnexe</artifactId>
- <version>1.0</version>
- </extension>
- </extensions>
-
</build>
<!-- Reporting -->
@@ -153,84 +116,18 @@
</plugins>
</reporting>
- <!-- Repositories -->
- <repositories>
- <repository>
- <id>maven2.java.net</id>
- <url>http://download.java.net/maven/2/</url>
- </repository>
-
- <repository>
- <id>repository.jboss.org</id>
- <url>http://repository.jboss.org/maven2</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- <repository>
- <id>snapshots.jboss.org</id>
- <url>http://snapshots.jboss.org/maven2</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
-
- <repository>
- <id>repository.codehaus.org</id>
- <url>http://repository.codehaus.org</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- <repository>
- <id>gwt-maven</id>
- <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>
- </repository>
- </repositories>
-
- <!-- Plugin Repositories -->
- <pluginRepositories>
- <pluginRepository>
- <id>maven2.java.net</id>
- <url>http://download.java.net/maven/2/</url>
- </pluginRepository>
-
- <pluginRepository>
- <id>repository.jboss.org</id>
- <url>http://repository.jboss.org/maven2</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
-
- <pluginRepository>
- <id>snapshots.jboss.org</id>
- <url>http://snapshots.jboss.org/maven2</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
-
- <pluginRepository>
- <id>gwt-maven</id>
- <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>
- </pluginRepository>
- </pluginRepositories>
-
<!-- Distribution Management -->
<distributionManagement>
<repository>
- <id>repository.jboss.org</id>
- <name>JBoss Release Repository</name>
- <url>scm:svn:https://svn.jboss.org/repos/repository.jboss.org/maven2</url>
+ <id>jboss-releases-repository</id>
+ <name>JBoss Releases Repository</name>
+ <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <url>dav:https://snapshots.jboss.org/maven2</url>
+ <id>jboss-snapshots-repository</id>
+ <name>JBoss Snapshots Repository</name>
+ <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
More information about the jbpm-commits
mailing list