[jbpm-commits] JBoss JBPM SVN: r7030 - in jbpm3/branches/jbpm-3.2-soa: core/src/test/java/org/jbpm and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Oct 10 21:39:55 EDT 2011


Author: marco.rietveld
Date: 2011-10-10 21:39:55 -0400 (Mon, 10 Oct 2011)
New Revision: 7030

Added:
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java
   jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/
   jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java
   jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml
Modified:
   jbpm3/branches/jbpm-3.2-soa/userguide/src/main/docbook/en-US/mail.xml
Log:
JBPM-3386: jBPM Mail Node does not authenticate, results in "Relay access denied" when recipient is not on local server

Added: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java	2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,85 @@
+package org.jbpm.mail;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jbpm.JbpmConfiguration.Configs;
+import org.jbpm.util.XmlUtil;
+import org.w3c.dom.Element;
+
+class MailTemplates {
+
+  private static final Map templatePropertiesByResource = new HashMap();
+  private static final Map templateVariablesByResource = new HashMap();
+
+  protected static Properties getTemplateProperties(String templateName) {
+    String resource = Configs.getString("resource.mail.templates");
+    synchronized (templatePropertiesByResource) {
+      Map templateProperties = (Map) templatePropertiesByResource.get(resource);
+      if (templateProperties == null) {
+        loadTemplates(resource);
+        templateProperties = (Map) templatePropertiesByResource.get(resource);
+      }
+      return (Properties) templateProperties.get(templateName);
+    }
+  }
+
+  protected static Map getTemplateVariables() {
+    String resource = Configs.getString("resource.mail.templates");
+    synchronized (templateVariablesByResource) {
+      Map templateVariables = (Map) templateVariablesByResource.get(resource);
+      if (templateVariables == null) {
+        loadTemplates(resource);
+        templateVariables = (Map) templateVariablesByResource.get(resource);
+      }
+      return templateVariables;
+    }
+  }
+
+  protected static void loadTemplates(String resource) {
+    Element templatesElement = XmlUtil.parseXmlResource(resource, true).getDocumentElement();
+
+    Map templatePropertiesMap = new HashMap();
+    for (Iterator iter = XmlUtil.elementIterator(templatesElement, "mail-template"); iter.hasNext();) {
+      Element templateElement = (Element) iter.next();
+
+      Properties templateProperties = new Properties();
+      addTemplateProperty(templateElement, "to", templateProperties);
+      addTemplateProperty(templateElement, "actors", templateProperties);
+      addTemplateProperty(templateElement, "subject", templateProperties);
+      addTemplateProperty(templateElement, "text", templateProperties);
+      addTemplateProperty(templateElement, "cc", templateProperties);
+      addTemplateProperty(templateElement, "cc-actors", templateProperties);
+      addTemplateProperty(templateElement, "bcc", templateProperties);
+      // preserve backwards compatibility with bccActors element
+      Element bccActorsElement = XmlUtil.element(templateElement, "bccActors");
+      if (bccActorsElement != null) {
+        templateProperties.setProperty("bcc-actors", XmlUtil.getContentText(bccActorsElement));
+      }
+      else {
+        addTemplateProperty(templateElement, "bcc-actors", templateProperties);
+      }
+
+      templatePropertiesMap.put(templateElement.getAttribute("name"), templateProperties);
+    }
+    templatePropertiesByResource.put(resource, templatePropertiesMap);
+
+    Map templateVariables = new HashMap();
+    for (Iterator iter = XmlUtil.elementIterator(templatesElement, "variable"); iter.hasNext();) {
+      Element variableElement = (Element) iter.next();
+      templateVariables.put(variableElement.getAttribute("name"), variableElement.getAttribute("value"));
+    }
+    templateVariablesByResource.put(resource, templateVariables);
+  }
+
+  protected static void addTemplateProperty(Element templateElement, String property,
+    Properties templateProperties) {
+    Element element = XmlUtil.element(templateElement, property);
+    if (element != null) {
+      templateProperties.setProperty(property, XmlUtil.getContentText(element));
+    }
+  }
+  
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java	2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,92 @@
+/*
+ * 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.Jbpm3386;
+
+import java.io.IOException;
+import java.util.Random;
+
+import javax.mail.MessagingException;
+
+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.Mail;
+
+/**
+ * CC support in mail nodes and mail templates.
+ * 
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-3386">JBPM-3386</a>
+ */
+public class JBPM3386IntegrationTest extends AbstractJbpmTestCase {
+
+  private static Random random = new Random();
+  int uniqueTestNum; 
+  
+  private JbpmContext jbpmContext;
+  private ProcessInstance processInstance;
+
+  private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("org/jbpm/jbpm3386/jbpm.integration.cfg.xml");
+
+  protected void setUp() throws Exception {
+    super.setUp();
+    jbpmContext = jbpmConfiguration.createJbpmContext();
+
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm3386/processdefinition.xml");
+    processInstance = new ProcessInstance(processDefinition);
+
+    ContextInstance contextInstance = processInstance.getContextInstance();
+    contextInstance.setVariable("to", "mrietvel at redhat.com");
+    
+    uniqueTestNum = random.nextInt(Integer.MAX_VALUE);
+  }
+
+  protected void tearDown() throws Exception {
+    jbpmContext.close();
+    super.tearDown();
+  }
+
+  public void testDoNothing() { 
+    
+  }
+  
+  /**
+   * This test sends an actual e-mail to a redhat e-mail address via the gmail smtp domain, 
+   *  which does NOT permit unauthenticated relaying -- and thus tests what we want it to.
+   * @throws MessagingException
+   * @throws IOException
+   */
+  public void dontTestSendViaAnotherDomainGmail() throws MessagingException, IOException {
+    String testMethod = (new Throwable()).getStackTrace()[0].getMethodName();
+    System.out.println( testMethod + ": " + uniqueTestNum );
+    
+    String to = "mrietvel at redhat.com";
+    String subject = this.getClass().getName() + " test message [" + uniqueTestNum + "]";
+    String text = "\nThis is an automatic message generated by the " + testMethod + " test.\n";
+
+    Mail mail = new Mail(null, null, to, subject, text);
+    mail.send();
+  }
+
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java	2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,185 @@
+/*
+ * 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.Jbpm3386;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.mail.AuthenticationFailedException;
+import javax.mail.Message.RecipientType;
+import javax.mail.MessagingException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import junit.framework.Test;
+
+import org.apache.log4j.Logger;
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.JbpmException;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.mail.MailTestSetup;
+import org.subethamail.smtp.AuthenticationHandler;
+import org.subethamail.smtp.AuthenticationHandlerFactory;
+import org.subethamail.smtp.auth.LoginAuthenticationHandler;
+import org.subethamail.smtp.auth.LoginFailedException;
+import org.subethamail.smtp.auth.PlainAuthenticationHandler;
+import org.subethamail.smtp.auth.PluginAuthenticationHandler;
+import org.subethamail.smtp.auth.UsernamePasswordValidator;
+import org.subethamail.smtp.server.MessageListenerAdapter;
+import org.subethamail.wiser.Wiser;
+import org.subethamail.wiser.WiserMessage;
+
+/**
+ * Auth/relay support in mail nodes.
+ * 
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-3386">JBPM-3386</a>
+ */
+public class JBPM3386Test extends AbstractJbpmTestCase {
+
+  protected static Logger log = Logger.getLogger(JBPM3386Test.class);
+
+  private JbpmContext jbpmContext;
+  private ProcessInstance processInstance;
+
+  private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("org/jbpm/jbpm3386/jbpm.cfg.xml");
+  private static Wiser wiser;
+
+  private static String authUsername = "doug at newcastle.uk";
+  private static String authPassword = "newcastlePoolHustler#1!";
+
+  private static final String toAddress = "tester at jboss.org";
+
+  protected void setUp() throws Exception {
+    wiser = new Wiser();
+    MessageListenerAdapter serverMessageListenerAdapter = (MessageListenerAdapter) wiser.getServer()
+      .getMessageHandlerFactory();
+    serverMessageListenerAdapter.setAuthenticationHandlerFactory(new JBPM3386AuthHandlerFactory());
+    wiser.setPort(2525);
+    wiser.start();
+
+    // jbpm test setup
+    super.setUp();
+
+    jbpmContext = jbpmConfiguration.createJbpmContext();
+
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm3386/processdefinition.xml");
+    processInstance = new ProcessInstance(processDefinition);
+
+    ContextInstance contextInstance = processInstance.getContextInstance();
+    contextInstance.setVariable("to", toAddress);
+
+    // start process
+    processInstance.signal();
+  }
+
+  protected void tearDown() throws Exception {
+    if (wiser != null) {
+      wiser.getMessages().clear();
+      wiser.stop();
+      wiser = null;
+    }
+    jbpmContext.close();
+    super.tearDown();
+  }
+
+  public void testMailWithAuthentication() throws MessagingException {
+    processInstance.signal();
+    assertEquals("end", processInstance.getRootToken().getNode().getName());
+
+    List messages = wiser.getMessages();
+    assertEquals(1, messages.size());
+
+    for (Iterator iter = messages.iterator(); iter.hasNext();) {
+      WiserMessage wiserMessage = (WiserMessage) iter.next();
+      MimeMessage message = wiserMessage.getMimeMessage();
+      assertEquals("Test message for jbpm 3386", message.getSubject());
+      assertTrue(Arrays.equals(InternetAddress.parse(toAddress), message.getRecipients(RecipientType.TO)));
+    }
+  }
+
+  public void testMailWithAuthenticationFailPassword() throws MessagingException {
+    authPassword = "bad password";
+    try {
+      processInstance.signal();
+      fail("An exception should have been thrown here.");
+    }
+    catch (Exception e) {
+      if (!(e instanceof JbpmException)) {
+        e.printStackTrace();
+        fail("Expected an JbpmException, not an exception of type " + e.getClass().getName() + ": " + e.getMessage());
+      }
+      
+      Throwable cause = e.getCause();
+      if(cause == null || !(cause instanceof AuthenticationFailedException)) {
+        e.printStackTrace();
+        fail("Expected an AuthenticationFailedException, not an exception of type "
+          + e.getClass().getName() + ": " + e.getMessage());
+      }
+    }
+  }
+
+  public void testMailWithAuthenticationFailUser() throws MessagingException {
+    authUsername = "trevor";
+    try {
+      processInstance.signal();
+      fail("An exception should have been thrown here.");
+    }
+    catch (Exception e) {
+      if (!(e instanceof JbpmException)) {
+        e.printStackTrace();
+        fail("Expected an JbpmException, not an exception of type " + e.getClass().getName() + ": " + e.getMessage());
+      }
+      
+      Throwable cause = e.getCause();
+      if(cause == null || !(cause instanceof AuthenticationFailedException)) {
+        e.printStackTrace();
+        fail("Expected an AuthenticationFailedException, not an exception of type "
+          + e.getClass().getName() + ": " + e.getMessage());
+      }
+    }
+  }
+  
+  public static class JBPM3386AuthHandlerFactory implements AuthenticationHandlerFactory {
+    public AuthenticationHandler create() {
+      PluginAuthenticationHandler ret = new PluginAuthenticationHandler();
+      UsernamePasswordValidator validator = new UsernamePasswordValidator() {
+        public void login(String username, String password) throws LoginFailedException {
+          if (!authUsername.equals(username) || !authPassword.equals(password)) {
+            String message = "Tried to login with user/password [" + username + "/" + password
+              + "]";
+            log.info(message);
+            System.out.println(message);
+            throw new LoginFailedException("Incorrect password for user " + authUsername);
+          }
+        }
+      };
+      ret.addPlugin(new PlainAuthenticationHandler(validator));
+      ret.addPlugin(new LoginAuthenticationHandler(validator));
+      return ret;
+    }
+  }
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml	2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="jbpm2852" width="1156" height="898">
+  <node name="start" x="138" y="144" width="121" height="37">
+    <edge>
+      <label x="5" y="-10"/>
+    </edge>
+  </node>
+  <node name="send mail" x="139" y="220" width="124" height="36">
+    <edge>
+      <label x="5" y="-10"/>
+    </edge>
+  </node>
+  <node name="end" x="129" y="298" width="132" height="36"/>
+  <deployment serverName="" serverPort="" serverDeployer=""/>
+</root-container>


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml	2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbpm-configuration>
+  <jbpm-context />
+  <string name="resource.mail.templates" value="org/jbpm/jbpm3386/mail.templates.xml" />
+  <int name="jbpm.mail.smtp.port" value="2525" />
+  <string name="jbpm.mail.user" value="doug at newcastle.uk" />
+  <string name="jbpm.mail.password" value="newcastlePoolHustler#1!" />
+</jbpm-configuration>


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml	2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbpm-configuration>
+  <jbpm-context />
+  <string name="resource.mail.templates" value="org/jbpm/jbpm3386/mail.templates.xml" />
+
+  <!--  Existing (standard) properties -->
+  <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
+  <string name="jbpm.mail.smtp.host" value="smtp.gmail.com" />
+  <int name="jbpm.mail.smtp.port" value="25" />
+  <string name="jbpm.mail.from.address" value="marcolof at gmail.com" />
+
+  <!-- Authentication -->
+  <string name="jbpm.mail.user" value="marcolof at gmail.com" />
+  <string name="jbpm.mail.password" value="this is not marco's gmail password" />
+  <boolean name="jbpm.mail.smtp.starttls" value="true" />
+  <boolean name="jbpm.mail.smtp.auth" value="true" />
+  
+  <!-- the client had this set to false -->
+  <boolean name="jbpm.mail.debug" value="true" />
+  
+</jbpm-configuration>


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml	2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mail-templates>
+  <mail-template name='jbpm3386-mail-template'>
+    <to>${to}</to>
+    <subject>Test message for jbpm 3386</subject>
+    <text><![CDATA[Keep up the good work!]]></text>
+  </mail-template>
+</mail-templates>


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml	2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="jbpm2852">
+
+  <start-state name="start">
+    <transition to="send mail" />
+  </start-state>
+
+  <state name="send mail">
+    <transition to="end">
+      <mail name="send mail" template="jbpm3386-mail-template" />
+    </transition>
+  </state>
+
+  <end-state name="end" />
+
+</process-definition>


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Modified: jbpm3/branches/jbpm-3.2-soa/userguide/src/main/docbook/en-US/mail.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/userguide/src/main/docbook/en-US/mail.xml	2011-09-08 10:53:16 UTC (rev 7029)
+++ jbpm3/branches/jbpm-3.2-soa/userguide/src/main/docbook/en-US/mail.xml	2011-10-11 01:39:55 UTC (rev 7030)
@@ -6,7 +6,7 @@
 
 <chapter id="mail">
   <title>
-    E. Mail Support
+    Email Support
  </title>
   
   <para>
@@ -26,10 +26,9 @@
         in turn.
     </para>
 
-
     <section id="mailaction">
       <title>
-            Mail Action
+        Mail Action
        </title> 
 
       <para>
@@ -86,7 +85,7 @@
  </note>     
  
       <para>
-              E. mails can be defined by the use of templates. Overwrite
+              Emails can be defined by the use of templates. Overwrite
               template properties in this way:
       </para>
       
@@ -133,7 +132,7 @@
     <section id="taskassignmails">
 
       <title>
-            "Task Assigned" E. Mail
+            "Task Assigned" Email
       </title>
       
       <para>
@@ -156,11 +155,11 @@
   
     <section id="taskremindermails">
       <title>
-        "Task Reminder" E. Mail
+        "Task Reminder" Email
      </title>
      
       <para>
-            E. mails can be sent as task reminders. JPDL's
+            Emails can be sent as task reminders. JPDL's
             <property>reminder</property> element utilizes the timer. The
             most commonly used attributes are <property>duedate</property>
             and <property>repeat</property>. Note that actions do not have
@@ -214,7 +213,7 @@
   
   <section id="specifyingmailrecipients">
     <title>
-        Specifying E. Mail Recipients
+        Specifying Email Recipients
      </title>
      
     <section id="multiplerecipients">
@@ -228,7 +227,7 @@
     
     <section id="BCC">
       <title>
-            Sending E. Mail to a BCC Address
+            Sending Email to a BCC Address
       </title>
 
         <para>
@@ -313,7 +312,7 @@
   
   <section id="mailtemplates">
     <title>
-          E. Mail Templates
+          Email Templates
      </title>
    
    
@@ -364,6 +363,93 @@
     
   </section>
 
+  <section id="emailauthorization">
+    <title>
+      Email Authentication 
+    </title>
+    
+    <section id="emailauthorizationparameters">
+      <title>
+        Email authentication configuration
+      </title>
+      
+      <para>
+        The following settings can be used to enable (SMTP) authentication when sending email. 
+      </para>
+  
+      <table>
+        <title>jBPM mail authentication properties</title>
+        <tgroup cols="3" colsep="1" rowsep="1">
+        <colspec colwidth="*"/>
+        <colspec colwidth="3"/>
+        <colspec colwidth="*"/>
+        <thead>
+          <row><entry>Property</entry><entry>Type</entry><entry>Description</entry></row>
+        </thead>
+        <tbody>
+          <row>
+            <entry><property>jbpm.mail.user</property></entry>
+            <entry><para>string</para></entry>
+            <entry><para>The email address of the user</para></entry>
+          </row>
+          <row>
+            <entry><property>jbpm.mail.password</property></entry>
+            <entry><para>string</para></entry>
+            <entry><para>The password for that email address</para></entry>
+          </row>
+          <row>
+            <entry><property>jbpm.mail.smtp.starttls</property></entry>
+            <entry><para>boolean</para></entry>
+            <entry><para>Whether or not to use the STARTTLS protocol with the SMTP server</para></entry>
+          </row>
+          <row>
+            <entry><property>jbpm.mail.smtp.auth</property></entry>
+            <entry><para>boolean</para></entry>
+            <entry><para>Whether or not to use the SMTP authentication protocol</para></entry>
+          </row>
+          <row>
+            <entry><property>jbpm.mail.debug</property></entry>
+            <entry><para>boolean</para></entry>
+            <entry><para>Whether or not to set the javax.mail.Session instance to debug mode</para></entry>
+          </row>
+        </tbody>
+        </tgroup>
+      </table>
+    </section>
+
+    <section id="emailauthorizationparameters">
+      <title>
+        Email authentication logic
+      </title>
+      
+      <para>
+        The following logic is applied with regards to the above properties: 
+      </para>
+
+      <para>
+        If neither the jbpm.mail.user nor the jbpm.mail.password property is set, authentication is
+        not used regardless of other settings set. 
+      </para>
+
+      <para>
+        If the jbpm.mail.user property is set, then the following is done: 
+        <itemizedlist>
+          <listitem><para>The mail.smtp.submitter property is set with the value of the jbpm.mail.user property</para></listitem>
+          <listitem><para>The jbpm engine will try to login into the smtp server when sending email.</para></listitem>
+        </itemizedlist>
+      </para>
+
+      <para>
+        If the jbpm.mail.user property and the jbpm.mail.password property are set, then the following is done: 
+        <itemizedlist>
+          <listitem><para>Everything that is done when at least the jbpm.mail.user is set, is also done in this case</para></listitem> 
+          <listitem><para>The mail.smtp.auth property is set to true, regardless of the value of the jbpm.mail.smtp.auth property</para></listitem>
+        </itemizedlist>
+      </para>
+    </section>
+
+  </section>
+
   <section id="fromaddressconfiguration">
     <title>
         "From" Address Configuration
@@ -381,7 +467,7 @@
   
   <section id="customizingmailsupport">
     <title>
-        Customizing E. Mail Support
+        Customizing Email Support
    </title>
    
     <para>



More information about the jbpm-commits mailing list