[jbpm-commits] JBoss JBPM SVN: r5299 - in jbpm4/branches/jimma/trunk/modules/migration/src: main/java/org/jbpm/jpdl/internal/convert/node and 2 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Jul 15 04:28:29 EDT 2009
Author: jim.ma
Date: 2009-07-15 04:28:29 -0400 (Wed, 15 Jul 2009)
New Revision: 5299
Added:
jbpm4/branches/jimma/trunk/modules/migration/src/test/resources/mail-node.xml
Modified:
jbpm4/branches/jimma/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Converter.java
jbpm4/branches/jimma/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/MailNode.java
jbpm4/branches/jimma/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
Log:
JBPM-2388:Added mail-node conversion support
Modified: jbpm4/branches/jimma/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Converter.java
===================================================================
--- jbpm4/branches/jimma/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Converter.java 2009-07-15 06:44:54 UTC (rev 5298)
+++ jbpm4/branches/jimma/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Converter.java 2009-07-15 08:28:29 UTC (rev 5299)
@@ -301,7 +301,7 @@
String nodeName = nodeElement.getName();
//This will affect the transition, so add error and throw exception
- if ("super-state".equalsIgnoreCase(nodeName) || "mail-node".equalsIgnoreCase(nodeName)) {
+ if ("super-state".equalsIgnoreCase(nodeName)) {
this.addError("Unsupported " + nodeName + " conversion : <" + nodeName
+ " name=\"" + jpdl3Element.attributeValue("name") + "\"");
}
Modified: jbpm4/branches/jimma/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/MailNode.java
===================================================================
--- jbpm4/branches/jimma/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/MailNode.java 2009-07-15 06:44:54 UTC (rev 5298)
+++ jbpm4/branches/jimma/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/MailNode.java 2009-07-15 08:28:29 UTC (rev 5299)
@@ -39,14 +39,14 @@
if (template != null) {
convertedElement.addAttribute("template", template);
}
- //TODO: handler actors and look at if there is the equivalent AddressResolver in jbpm4
+
if (actors != null) {
-
+ Element toElement = convertedElement.addElement("to");
+ toElement.addAttribute("users", actors);
}
if (to != null) {
Element toElement = convertedElement.addElement("to");
- //TODO: handler expression
- toElement.addAttribute("to", to);
+ toElement.addAttribute("addresses", to);
}
if (subject != null) {
Element subjectElement = convertedElement.addElement("subject");
@@ -57,38 +57,4 @@
textElement.addText(text);
}
}
-}
-
-
-/*<mail name="send rectify note" language="juel" g="99,25,115,45">
-<to addresses="winston at minitrue" />
-<cc users="bb" groups="innerparty" />
-<bcc groups="thinkpol" />
-<subject>rectify ${newspaper}</subject>
-<text>${newspaper} ${date} reporting bb dayorder doubleplusungood
- refs unpersons rewrite fullwise upsub antefiling</text>
-<!--
-<html><table><tr><td>${newspaper}</td><td>${date}</td>
- <td>reporting bb dayorder doubleplusungood
- refs unpersons rewrite fullwise upsub antefiling</td>
- </tr></table></html>
-<attachments>
- <attachment url='http://www.george-orwell.org/1984/3.html' />
- <attachment resource='org/example/pic.jpg' />
- <attachment file='${user.home}/.face' />
-</attachments>
--->
-<transition to="end" />
-</mail>*/
-
-/*
-<mail name="send rectify note"
- template="rectify-template"
- g="99,25,115,45">
-<transition to="end"/>
-</mail>*/
-
-
-
-
-
+}
\ No newline at end of file
Modified: jbpm4/branches/jimma/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
===================================================================
--- jbpm4/branches/jimma/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-07-15 06:44:54 UTC (rev 5298)
+++ jbpm4/branches/jimma/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-07-15 08:28:29 UTC (rev 5299)
@@ -56,7 +56,7 @@
@Test
public void testEvent() throws Exception {
- setUpScriptManager();
+ setUpEnviroment();
testConvert("process-event.xml");
}
@@ -72,7 +72,7 @@
@Test
public void testScript() throws Exception {
- setUpScriptManager();
+ setUpEnviroment();
testConvert("script.xml");
}
@@ -136,6 +136,19 @@
"unrecognized event listener"));
}
+ @Test
+ public void testMailNode() throws Exception {
+ setUpEnviroment();
+ String xml = convert("mail-node.xml");
+ System.out.println(xml);
+ List<Problem> problems = new JpdlParser().createParse().setString(xml)
+ .execute().getProblems();
+ Assert.assertEquals(0, problems.size());
+
+ }
+
+
+
private void testConvert(String resourcefile) throws Exception {
String xml = convert(resourcefile);
List<Problem> problems = new JpdlParser().createParse().setString(xml).execute().getProblems();
@@ -152,7 +165,7 @@
return doc.asXML();
}
- private void setUpScriptManager() throws Exception {
+ private void setUpEnviroment() throws Exception {
EnvironmentFactory environmentFactory = JbpmConfiguration
.parseXmlString("<jbpm-configuration>"
+ " <process-engine-context>"
@@ -160,6 +173,12 @@
+ " default-script-language='juel'>"
+ " <script-language name='juel' factory='com.sun.script.juel.JuelScriptEngineFactory' />"
+ " </script-manager>"
+
+ + " <mail-template name='my-template'> "
+ + " <to addresses='${addressee}' />"
+ + " <subject>rectify ${newspaper}</subject>"
+ + " <text>${newspaper} ${date} ${details}</text>"
+ + " </mail-template>"
+ " </process-engine-context> </jbpm-configuration>");
environmentFactory.openEnvironment();
Added: jbpm4/branches/jimma/trunk/modules/migration/src/test/resources/mail-node.xml
===================================================================
--- jbpm4/branches/jimma/trunk/modules/migration/src/test/resources/mail-node.xml (rev 0)
+++ jbpm4/branches/jimma/trunk/modules/migration/src/test/resources/mail-node.xml 2009-07-15 08:28:29 UTC (rev 5299)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition
+ xmlns="urn:jbpm.org:jpdl-3.2"
+ name="mail-node">
+ <start-state name="start">
+ <transition name="to_state" to="send_mail_to">
+ <action name="action" class="com.test.MessageActionHandler">
+ <message>Going to the first state!</message>
+ </action>
+ </transition>
+ </start-state>
+ <mail-node name="send_mail_to" to="test at jbpm.org">
+ <subject>my_subject</subject>
+ <text>my_text</text>
+ <transition to="send_mail_actors"/>
+ </mail-node>
+
+ <mail-node name="send_mail_actors" actors="aa,bb,cc">
+ <subject>my_subject</subject>
+ <text>my_text</text>
+ <transition to="send_mail_template"/>
+ </mail-node>
+
+ <mail-node name="send_mail_template" template="my-template">
+ <transition to="end"/>
+ </mail-node>
+
+ <end-state name="end"></end-state>
+</process-definition>
\ No newline at end of file
More information about the jbpm-commits
mailing list