[jboss-svn-commits] JBL Code SVN: r13404 - in labs/jbossesb/trunk/product: samples/quickstarts/bpm_orchestration1 and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jul 12 12:18:47 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-07-12 12:18:47 -0400 (Thu, 12 Jul 2007)
New Revision: 13404
Added:
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/gpd.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processimage.jpg
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/gpd.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processimage.jpg
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java
Removed:
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/gpd.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processimage.jpg
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition1/
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition2/
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/gpd.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processimage.jpg
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition1/
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2UnitTest.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java
Modified:
labs/jbossesb/trunk/product/extras/jaxbintros/
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/build.xml
Log:
JBESB-664, removing duplicate action
Property changes on: labs/jbossesb/trunk/product/extras/jaxbintros
___________________________________________________________________
Name: svn:ignore
+ target
Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/build.xml 2007-07-12 16:10:56 UTC (rev 13403)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/build.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -12,7 +12,7 @@
<property name="jbossesb.inputdir" location="${build.dir}/inputdir"/>
- <property name="project.process.dir" value="processDefinition1"/>
+ <property name="project.process.dir" value="processDefinition"/>
<target name="config">
<delete dir="${jbossesb.inputdir}" quiet="true"/>
Added: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/deployment.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/deployment.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=jbpm.esb</depends>
+</jbossesb-deployment>
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/deployment.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition (from rev 13400, labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition2)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/gpd.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition2/gpd.xml 2007-07-12 12:35:40 UTC (rev 13400)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/gpd.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process-diagram name="processDefinition2" width="688" height="577">
- <node name="start" x="0" y="0" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="node1" x="0" y="0" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="node2" x="0" y="0" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="node3" x="0" y="0" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="end1" x="0" y="0" width="140" height="40"/>
- <node name="Send Results" x="0" y="0" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
-</process-diagram>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/gpd.xml (from rev 13403, labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition2/gpd.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/gpd.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/gpd.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-diagram name="processDefinition2" width="688" height="577">
+ <node name="start" x="0" y="0" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="node1" x="0" y="0" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="node2" x="0" y="0" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="node3" x="0" y="0" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="end1" x="0" y="0" width="140" height="40"/>
+ <node name="Send Results" x="0" y="0" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+</process-diagram>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition2/processdefinition.xml 2007-07-12 12:35:40 UTC (rev 13400)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process-definition
- xmlns="" name="processDefinition2">
- <start-state name="start">
- <event type="node-enter">
- <action name="action1" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.process_actions.MyBPMActionHandler" config-type="bean"></action>
- </event>
- <transition name="" to="node1"></transition>
- </start-state>
-
- <node name="node1">
- <event type="node-enter">
- <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbAction2">
- <esbCategoryName>BPM_Orchestration_Service1</esbCategoryName>
- <esbServiceName>Service1</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
- </jbpmToEsbVars>
- <returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
- </returnVars>
- </action>
- </event>
- <transition name="" to="node2"></transition>
- </node>
- <node name="node2">
- <event type="node-enter">
- <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbAction2">
- <esbCategoryName>BPM_Orchestration_Service2</esbCategoryName>
- <esbServiceName>Service2</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
- </jbpmToEsbVars>
- <returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
- </returnVars>
- </action>
- </event>
- <transition name="" to="node3"></transition>
- </node>
- <node name="node3">
- <event type="node-enter">
- <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbAction2">
- <esbCategoryName>BPM_Orchestration_Service3</esbCategoryName>
- <esbServiceName>Service3</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
- </jbpmToEsbVars>
- <returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
- </returnVars>
- </action>
- </event>
- <transition name="" to="Send Results"></transition>
- </node>
- <end-state name="end1"></end-state>
- <node name="Send Results">
- <event type="node-enter">
- <action name="action1" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.process_actions.MyBPMActionHandler" config-type="bean"></action>
- <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbAction2">
- <esbCategoryName>BPM_Orchestration_ResultsService</esbCategoryName>
- <esbServiceName>ResultsService</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
- </jbpmToEsbVars>
- <returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
- </returnVars>
- </action>
- </event>
-
- <transition name="" to="end1"></transition>
- </node>
-</process-definition>
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml (from rev 13403, labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition2/processdefinition.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition
+ xmlns="" name="processDefinition2">
+ <start-state name="start">
+ <event type="node-enter">
+ <action name="action1" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.process_actions.MyBPMActionHandler" config-type="bean"></action>
+ </event>
+ <transition name="" to="node1"></transition>
+ </start-state>
+
+ <node name="node1">
+ <event type="node-enter">
+ <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration_Service1</esbCategoryName>
+ <esbServiceName>Service1</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="node2"></transition>
+ </node>
+ <node name="node2">
+ <event type="node-enter">
+ <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration_Service2</esbCategoryName>
+ <esbServiceName>Service2</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="node3"></transition>
+ </node>
+ <node name="node3">
+ <event type="node-enter">
+ <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration_Service3</esbCategoryName>
+ <esbServiceName>Service3</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="Send Results"></transition>
+ </node>
+ <end-state name="end1"></end-state>
+ <node name="Send Results">
+ <event type="node-enter">
+ <action name="action1" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.process_actions.MyBPMActionHandler" config-type="bean"></action>
+ <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration_ResultsService</esbCategoryName>
+ <esbServiceName>ResultsService</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+
+ <transition name="" to="end1"></transition>
+ </node>
+</process-definition>
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processimage.jpg
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processimage.jpg (from rev 13403, labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition2/processimage.jpg)
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2
___________________________________________________________________
Name: svn:ignore
+ build
Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/build.xml 2007-07-12 16:10:56 UTC (rev 13403)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/build.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -10,7 +10,7 @@
<!-- Import the base Ant build script... -->
<import file="../conf/base-build.xml"/>
- <property name="project.process.dir" value="processDefinition1"/>
+ <property name="project.process.dir" value="processDefinition"/>
<target name="quickstart-specific-dependencies">
<path id="quickstart-dependencies-classpath">
Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition (from rev 13402, labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition1)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/gpd.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition1/gpd.xml 2007-07-12 15:59:27 UTC (rev 13402)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/gpd.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process-diagram name="processDefinition1" width="546" height="540">
- <node name="start" x="225" y="10" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="Receive Order" x="114" y="81" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="Validate Order" x="336" y="79" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="fork1" x="170" y="234" width="325" height="25">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- <transition name="tr2">
- <label x="5" y="-10"/>
- </transition>
- <transition name="tr3">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="Los Angeles WHSE" x="49" y="294" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="Dallas WHSE" x="235" y="295" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="Atlanta WHSE" x="405" y="297" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="join1" x="143" y="379" width="341" height="25">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="Shipment Notice" x="246" y="432" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="end1" x="246" y="499" width="140" height="40"/>
- <node name="Credit Check" x="116" y="155" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
- <node name="Inventory Check" x="335" y="156" width="140" height="40">
- <transition name="">
- <label x="5" y="-10"/>
- </transition>
- </node>
-</process-diagram>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/gpd.xml (from rev 13403, labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition1/gpd.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/gpd.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/gpd.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-diagram name="processDefinition1" width="546" height="540">
+ <node name="start" x="225" y="10" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="Receive Order" x="114" y="81" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="Validate Order" x="336" y="79" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="fork1" x="170" y="234" width="325" height="25">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ <transition name="tr2">
+ <label x="5" y="-10"/>
+ </transition>
+ <transition name="tr3">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="Los Angeles WHSE" x="49" y="294" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="Dallas WHSE" x="235" y="295" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="Atlanta WHSE" x="405" y="297" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="join1" x="143" y="379" width="341" height="25">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="Shipment Notice" x="246" y="432" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="end1" x="246" y="499" width="140" height="40"/>
+ <node name="Credit Check" x="116" y="155" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="Inventory Check" x="335" y="156" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+</process-diagram>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition1/processdefinition.xml 2007-07-12 15:59:27 UTC (rev 13402)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process-definition
- xmlns="urn:jbpm.org:jpdl-3.1" name="processDefinition1">
- <start-state name="start">
- <event type="node-enter">
- <action name="action1" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.process_actions.MyBPMActionHandler" config-type="bean"></action>
- </event>
- <transition name="" to="Receive Order"></transition>
- </start-state>
-
- <node name="Receive Order">
- <event type="node-enter">
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration2_Service1</esbCategoryName>
- <esbServiceName>Service1</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsb_variables>theBody</jbpmToEsb_variables>
- <jbpmToEsb_esbNames>BODY_CONTENT</jbpmToEsb_esbNames>
- <return_variables>theBody</return_variables>
- <return_esbNames>BODY_CONTENT</return_esbNames>
- </action>
- </event>
- <transition name="" to="Validate Order"></transition>
- </node>
- <node name="Validate Order">
- <event type="node-enter">
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration2_Service2</esbCategoryName>
- <esbServiceName>Service2</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsb_variables>theBody</jbpmToEsb_variables>
- <jbpmToEsb_esbNames>BODY_CONTENT</jbpmToEsb_esbNames>
- <return_variables>theBody</return_variables>
- <return_esbNames>BODY_CONTENT</return_esbNames>
- </action>
- </event>
- <transition name="" to="Credit Check"></transition>
- </node>
-
- <fork name="fork1">
- <transition name="" to="Los Angeles WHSE"></transition>
- <transition name="tr2" to="Dallas WHSE"></transition>
- <transition name="tr3" to="Atlanta WHSE"></transition>
- </fork>
- <node name="Los Angeles WHSE">
- <event type="node-enter">
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration2_Service5</esbCategoryName>
- <esbServiceName>Service5</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsb_variables>theBody</jbpmToEsb_variables>
- <jbpmToEsb_esbNames>BODY_CONTENT</jbpmToEsb_esbNames>
- <return_variables>theBody</return_variables>
- <return_esbNames>BODY_CONTENT</return_esbNames>
- </action>
- </event>
- <transition name="" to="join1"></transition>
- </node>
- <node name="Dallas WHSE">
- <event type="node-enter">
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration2_Service6</esbCategoryName>
- <esbServiceName>Service6</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsb_variables>theBody</jbpmToEsb_variables>
- <jbpmToEsb_esbNames>BODY_CONTENT</jbpmToEsb_esbNames>
- <return_variables>theBody</return_variables>
- <return_esbNames>BODY_CONTENT</return_esbNames>
- </action>
- </event>
- <transition name="" to="join1"></transition>
- </node>
-
- <node name="Atlanta WHSE">
- <event type="node-enter">
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration2_Service7</esbCategoryName>
- <esbServiceName>Service7</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsb_variables>theBody</jbpmToEsb_variables>
- <jbpmToEsb_esbNames>BODY_CONTENT</jbpmToEsb_esbNames>
- <return_variables>theBody</return_variables>
- <return_esbNames>BODY_CONTENT</return_esbNames>
- </action>
- </event>
- <transition name="" to="join1"></transition>
- </node>
-
- <join name="join1">
- <transition name="" to="Shipment Notice"></transition>
- </join>
-
- <node name="Shipment Notice">
- <event type="node-enter">
- <action name="action1" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration2.process_actions.MyBPMActionHandler" config-type="bean"></action>
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration2_ResultsService</esbCategoryName>
- <esbServiceName>ResultsService</esbServiceName>
- <jbpmToEsb_variables>theBody</jbpmToEsb_variables>
- <jbpmToEsb_esbNames>BODY_CONTENT</jbpmToEsb_esbNames>
- <return_variables>theBody</return_variables>
- <return_esbNames>BODY_CONTENT</return_esbNames>
- </action>
- </event>
-
- <transition name="" to="end1"></transition>
- </node>
-
- <end-state name="end1"></end-state>
- <node name="Credit Check">
- <event type="node-enter">
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration2_Service3</esbCategoryName>
- <esbServiceName>Service3</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsb_variables>theBody</jbpmToEsb_variables>
- <jbpmToEsb_esbNames>BODY_CONTENT</jbpmToEsb_esbNames>
- <return_variables>theBody</return_variables>
- <return_esbNames>BODY_CONTENT</return_esbNames>
- </action>
- </event>
- <transition name="" to="Inventory Check"></transition>
- </node>
- <node name="Inventory Check">
- <event type="node-enter">
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration2_Service4</esbCategoryName>
- <esbServiceName>Service4</esbServiceName>
- <millisToWaitForResponse>5000</millisToWaitForResponse>
- <jbpmToEsb_variables>theBody</jbpmToEsb_variables>
- <jbpmToEsb_esbNames>BODY_CONTENT</jbpmToEsb_esbNames>
- <return_variables>theBody</return_variables>
- <return_esbNames>BODY_CONTENT</return_esbNames>
- </action>
- </event>
- <transition name="" to="fork1"></transition>
- </node>
-
-</process-definition>
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml (from rev 13403, labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition1/processdefinition.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml 2007-07-12 16:18:47 UTC (rev 13404)
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition
+ xmlns="urn:jbpm.org:jpdl-3.1" name="processDefinition1">
+ <start-state name="start">
+ <event type="node-enter">
+ <action name="action1" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.process_actions.MyBPMActionHandler" config-type="bean"></action>
+ </event>
+ <transition name="" to="Receive Order"></transition>
+ </start-state>
+
+ <node name="Receive Order">
+ <event type="node-enter">
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration2_Service1</esbCategoryName>
+ <esbServiceName>Service1</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="Validate Order"></transition>
+ </node>
+ <node name="Validate Order">
+ <event type="node-enter">
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration2_Service2</esbCategoryName>
+ <esbServiceName>Service2</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="Credit Check"></transition>
+ </node>
+
+ <fork name="fork1">
+ <transition name="" to="Los Angeles WHSE"></transition>
+ <transition name="tr2" to="Dallas WHSE"></transition>
+ <transition name="tr3" to="Atlanta WHSE"></transition>
+ </fork>
+ <node name="Los Angeles WHSE">
+ <event type="node-enter">
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration2_Service5</esbCategoryName>
+ <esbServiceName>Service5</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="join1"></transition>
+ </node>
+ <node name="Dallas WHSE">
+ <event type="node-enter">
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration2_Service6</esbCategoryName>
+ <esbServiceName>Service6</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="join1"></transition>
+ </node>
+
+ <node name="Atlanta WHSE">
+ <event type="node-enter">
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration2_Service7</esbCategoryName>
+ <esbServiceName>Service7</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="join1"></transition>
+ </node>
+
+ <join name="join1">
+ <transition name="" to="Shipment Notice"></transition>
+ </join>
+
+ <node name="Shipment Notice">
+ <event type="node-enter">
+ <action name="action1" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration2.process_actions.MyBPMActionHandler" config-type="bean"></action>
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration2_ResultsService</esbCategoryName>
+ <esbServiceName>ResultsService</esbServiceName>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+
+ <transition name="" to="end1"></transition>
+ </node>
+
+ <end-state name="end1"></end-state>
+ <node name="Credit Check">
+ <event type="node-enter">
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration2_Service3</esbCategoryName>
+ <esbServiceName>Service3</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="Inventory Check"></transition>
+ </node>
+ <node name="Inventory Check">
+ <event type="node-enter">
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration2_Service4</esbCategoryName>
+ <esbServiceName>Service4</esbServiceName>
+ <millisToWaitForResponse>5000</millisToWaitForResponse>
+ <jbpmToEsbVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </jbpmToEsbVars>
+ <returnVars>
+ <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ </returnVars>
+ </action>
+ </event>
+ <transition name="" to="fork1"></transition>
+ </node>
+
+</process-definition>
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processimage.jpg
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processimage.jpg (from rev 13403, labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition1/processimage.jpg)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2.java 2007-07-12 16:10:56 UTC (rev 13403)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2.java 2007-07-12 16:18:47 UTC (rev 13404)
@@ -1,261 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.jboss.soa.esb.services.jbpm.actionhandlers;
-
-import java.net.URI;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-import org.dom4j.Element;
-import org.dom4j.tree.DefaultElement;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.addressing.Call;
-import org.jboss.soa.esb.listeners.message.Invoker;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.services.jbpm.Constants;
-import org.jboss.soa.esb.services.jbpm.util.Helper;
-import org.jbpm.context.exe.ContextInstance;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.def.Node;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.graph.exe.Token;
-
-/**
- *
- * Send messages to ESB services from jBPM applications, and optionally wait for response.
- * <li/>esbCategoryName - for ESB registry lookup
- * <li/>esbServiceName - for ESB registry lookup
- * <li>millisToWaitForResponse - if a value > 0 is supplied, a response will be expected from the ESB service
- * and maximum wait time will be set accordingly. If response is not received, a CourierTimeoutException will
- * be thrown
- * </li>
- *
- * @author <a href="mailto:schifest at heuristica.com.ar">Esteban</a>
- *
- */
-
-public class EsbAction2 implements ActionHandler
-{
- public static final String OUTGOING_VARS_TAG = "jbpmToEsbVars";
- public static final String RETURN_VARS_TAG = "returnVars";
- public static final String MAPPING_TAG = "mapping";
- public static final String JBPM_NAME_ATTR = "jbpm-name";
- public static final String ESB_NAME_ATTR = "esb-name";
- public static final String PROCESS_SCOPE_ATTR = "process-scope";
-
- private static final long serialVersionUID = 1L;
-
- public String esbCategoryName;
- public String esbServiceName;
- public Integer millisToWaitForResponse;
- public Boolean globalProcessScope;
- public DefaultElement jbpmToEsbVars;
- public DefaultElement returnVars;
-
- protected Logger _logger = Logger.getLogger(getClass());
-
- protected Map<String, String>_outVarMapping;
- protected Map<String, String>_retVarMapping;
- protected transient Token _token;
-
- public void execute(ExecutionContext executionContext) throws Exception
- {
- _token = executionContext.getToken();
-
- Message request = getMessageTemplate();
- varsToRequest(request);
- if (null==millisToWaitForResponse || millisToWaitForResponse < 1)
- {
- Invoker.invoke(request,esbCategoryName, esbServiceName);
- return;
- }
-
- Message response = null;
- if ("MOCK_CATEGORY".equals(esbCategoryName)
- && "MOCK_SERVICE".equals(esbServiceName))
- response = request;
- else
- Invoker.invokeAndAwaitResponse (request,esbCategoryName, esbServiceName, millisToWaitForResponse);
- if (null!=response)
- varsFromResponse(response);
- } //________________________________
-
- protected void varsToRequest(Message request)
- throws Exception
- {
- ContextInstance ctxInstance = _token.getProcessInstance().getContextInstance();
- Body body = request.getBody();
- boolean gblPrcScope = (null==globalProcessScope)
- ? false : globalProcessScope;
- if (null==jbpmToEsbVars)
- {
- Map map = (gblPrcScope)? ctxInstance.getVariables()
- : ctxInstance.getVariables(_token);
- if (null!=map)
- for (Iterator iter=map.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry curr = (Map.Entry)iter.next();
- body.add(curr.getKey().toString(), curr.getValue());
- }
- return;
- }
- List list = jbpmToEsbVars.elements(MAPPING_TAG);
- // do nothing if empty list
- if (list.size()<1 )
- return;
-
- for (Object iter: list)
- {
- Element curr = (Element)iter;
- String jbpmKey = curr.attributeValue(JBPM_NAME_ATTR);
- String esbKey = curr.attributeValue(ESB_NAME_ATTR);
- String processScope = curr.attributeValue(PROCESS_SCOPE_ATTR);
- boolean isPrcScope = (null==processScope) ? gblPrcScope
- : Boolean.parseBoolean(processScope);
- Object obj = (isPrcScope)
- ? ctxInstance.getVariable(jbpmKey)
- : ctxInstance.getVariable(jbpmKey, _token);
- if (null!=obj)
- {
- if(Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbKey))
- {
- if (obj instanceof byte[])
- body.setByteArray((byte[])obj);
- else
- body.setByteArray(obj.toString().getBytes());
- }
- else
- body.add(esbKey, obj);
- }
- }
- } //________________________________
-
- protected void varsFromResponse(Message response) throws Exception
- {
- ContextInstance ctxInstance = _token.getProcessInstance().getContextInstance();
- Body body = response.getBody();
- boolean gblPrcScope = (null==globalProcessScope)
- ? false : globalProcessScope;
- if (null==returnVars)
- {
- Map map = (gblPrcScope)? ctxInstance.getVariables()
- : ctxInstance.getVariables(_token);
- if (null!=map)
- for (Iterator iter=map.keySet().iterator(); iter.hasNext();)
- {
- String key = iter.next().toString();
- Object obj = body.get(key);
- if (null!=obj)
- {
- if (gblPrcScope)
- ctxInstance.setVariable(key, obj);
- else
- ctxInstance.setVariable(key, obj, _token);
- }
- }
- return;
- }
- List list = returnVars.elements(MAPPING_TAG);
- // do nothing if empty list
- if (list.size()<1 )
- return;
-
- for (Object iter: list)
- {
- Element curr = (Element)iter;
- String jbpmVar = curr.attributeValue(JBPM_NAME_ATTR);
- String esbVar = curr.attributeValue(ESB_NAME_ATTR);
- String processScope = curr.attributeValue(PROCESS_SCOPE_ATTR);
- boolean isPrcScope = (null==processScope) ? gblPrcScope
- : Boolean.parseBoolean(processScope);
- Object obj = (Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbVar))
- ?body.getByteArray()
- :body.get(esbVar);
- Object oldVal = (isPrcScope) ? ctxInstance.getVariable(jbpmVar)
- : ctxInstance.getVariable(jbpmVar,_token);
- if (null==oldVal)
- {
- if (null!=obj)
- {
- if (isPrcScope)
- ctxInstance.createVariable(jbpmVar, obj);
- else
- ctxInstance.createVariable(jbpmVar, obj, _token);
- }
- }
- else
- {
- if (null==obj)
- {
- if (isPrcScope)
- ctxInstance.deleteVariable(jbpmVar);
- else
- ctxInstance.deleteVariable(jbpmVar, _token);
- }
- else
- {
- if (isPrcScope)
- ctxInstance.setVariable(jbpmVar,obj);
- else
- ctxInstance.setVariable(jbpmVar,obj,_token);
- }
- }
- }
- } //________________________________
-
- protected Message getMessageTemplate() throws Exception
- {
- if (null==esbCategoryName)
- throw new ConfigurationException("Service category (esbCategoryName element) must not be null");
- if (null==esbServiceName)
- throw new ConfigurationException("Service name (esbServiceName element) must not be null");
-
- Message template = MessageFactory.getInstance().getMessage();
- Call call = template.getHeader().getCall();
- call.setMessageID(new URI(UUID.randomUUID().toString()));
-
- Helper.setLongValue (template,Constants.TOKEN_ID,_token.getId());
- Node node = _token.getNode();
- if (null!=node)
- Helper.setStringValue(template, Constants.CURRENT_NODE_NAME, node.getName());
-
- ProcessInstance instance = _token.getProcessInstance();
- Helper.setLongValue(template,Constants.PROCESS_INSTANCE_ID,instance.getId());
-
- ProcessDefinition process = instance.getProcessDefinition();
- Helper.setObjectValue(template ,Constants.PROCESS_DEFINITION_NAME, process.getName());
- Helper.setIntValue (template ,Constants.PROCESS_DEFINITION_VERSION, process.getVersion());
- Helper.setLongValue (template ,Constants.PROCESS_DEFINITION_ID, process.getId());
-
-
- return template;
- } //________________________________
-
-}
Deleted: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java 2007-07-12 16:10:56 UTC (rev 13403)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java 2007-07-12 16:18:47 UTC (rev 13404)
@@ -1,289 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.jboss.soa.esb.services.jbpm.actionhandlers;
-
-import java.net.URI;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.addressing.Call;
-import org.jboss.soa.esb.listeners.message.Invoker;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.services.jbpm.Constants;
-import org.jboss.soa.esb.services.jbpm.util.Helper;
-import org.jboss.soa.esb.util.Util;
-import org.jbpm.context.exe.ContextInstance;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.graph.exe.Token;
-
-/**
- *
- * Send messages to ESB services from jBPM applications, and optionally wait for response.
- * <li/>esbCategoryName - for ESB registry lookup
- * <li/>esbServiceName - for ESB registry lookup
- * <li>jbpmToEsb_variables
- * <br/> if this variable missing in the jpdl (null value in the context),
- * then <b>ALL</b> context instance variables will be added to the body of the esb message using
- * the jbpm variable name as the key in the message body
- * <br/> otherwise, you can specify a comma delimited list of
- * names indicating which jbpm context variables must be added to the message body
- * <br/> if you wish NOT to add objects in the body of the
- * outgoing message, you must specify a zero-length string as the value
- * </li>
- * <li>jbpmToEsb_esbNames
- * <br/> if this value is not specified, then the jbpm variable
- * names will be used as a key to add the objects in the message body
- * <br/> otherwise, a comma delimited list of names
- * <b>of the same length as</b>
- * the jbpmToEsb_variables list, must be supplied and will be used as keys in the message body
- * </li>
- * <li>millisToWaitForResponse - if a value > 0 is supplied, a response will be expected from the ESB service
- * and maximum wait time will be set accordingly. If response is not received, a CourierTimeoutException will
- * be thrown
- * </li>
- * <li>return_esbNames
- * <br/> If this value is missing in the jpdl (null value in the context), then an attempt will me made
- * to find <b>ALL</b> jbpm context variables in the body of the incoming message, and only those objects
- * found with a valid jbpm context variable name, will update the jbpm context
- * <br/> Otherwise, a comma delimited list of names must be supplied. These will
- * be used to obtain values from the incoming response from the ESB service
- * <br/> If you wish NOT to use objects in the body of the
- * response to update the context, you must specify a zero-length string as the value
- * </li>
- * <li>return_variables
- * <br/> if this value is not specified, then the esb object
- * names will be used both as key in the message body, and as the jbpm variable name
- * <br/> otherwise, a comma delimited list of names of the same lenght as
- * the return_esbNames list, must be supplied and will be used as the jbpm variable names
- * </li>
- * <li>processVariables
- * <br/> If this variable is specified with a 'true' value, then
- * process instance level variables will be used to populate the message, and values returned
- * in the response message, will go back to process instance level, otherwise, token variables will
- * be used, (and set with response values)
- * </li>
- * @author <a href="mailto:schifest at heuristica.com.ar">Esteban</a>
- *
- */
-
-public class EsbActionHandler implements ActionHandler
-{
-
- private static final long serialVersionUID = 1L;
-
- public String esbCategoryName;
- public String esbServiceName;
-
- public String jbpmToEsb_variables;
- public String jbpmToEsb_esbNames;
-
- public Integer millisToWaitForResponse;
- public String return_esbNames;
- public String return_variables;
-
- public Boolean processVariables;
-
- protected Logger _logger = Logger.getLogger(getClass());
-
- protected Map<String, String>_outVarMapping;
- protected Map<String, String>_retVarMapping;
- protected transient Token _token;
-
- public void execute(ExecutionContext executionContext) throws Exception
- {
- _token = executionContext.getToken();
-
- Message request = getMessageTemplate();
- varsToRequest(request);
- if (null==millisToWaitForResponse || millisToWaitForResponse < 1)
- {
- Invoker.invoke(request,esbCategoryName, esbServiceName);
- return;
- }
-
- Message response = Invoker.invokeAndAwaitResponse
- (request,esbCategoryName, esbServiceName, millisToWaitForResponse);
- if (null!=response)
- varsFromResponse(response);
- } //________________________________
-
- protected void varsToRequest(Message request)
- throws Exception
- {
- ContextInstance ctxInstance = _token.getProcessInstance().getContextInstance();
- Body body = request.getBody();
- boolean global = (null==processVariables) ? false : processVariables;
- if (null==jbpmToEsb_variables)
- {
- Map map = (global)? ctxInstance.getVariables()
- : ctxInstance.getVariables(_token);
- if (null!=map)
- for (Iterator iter=map.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry curr = (Map.Entry)iter.next();
- body.add(curr.getKey().toString(), curr.getValue());
- }
- return;
- }
- String[]jbpmNames = jbpmToEsb_variables.split(",");
- // do nothing if empty list
- if (jbpmNames.length==1 && Util.isNullString(jbpmNames[0]))
- return;
-
- String[]esbNames = (null==jbpmToEsb_esbNames)
- ? jbpmNames
- : jbpmToEsb_esbNames.split(",");
- if (jbpmNames.length != esbNames.length)
- throw new ConfigurationException("One to one mapping required from jbpm variables to esb names");
-
- int index = 0;
- for (String curr: jbpmNames)
- {
- String esbKey = esbNames[index++];
- Object obj = (global) ? ctxInstance.getVariable(curr)
- : ctxInstance.getVariable(curr, _token);
- if (null!=obj)
- {
- if(Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbKey))
- {
- if (obj instanceof byte[])
- body.setByteArray((byte[])obj);
- else
- body.setByteArray(obj.toString().getBytes());
- }
- else
- body.add(esbKey, obj);
- }
- }
- } //________________________________
-
- protected void varsFromResponse(Message response) throws Exception
- {
- ContextInstance ctxInstance = _token.getProcessInstance().getContextInstance();
- Body body = response.getBody();
- boolean global = (null==processVariables) ? false : processVariables;
- if (null==return_esbNames)
- {
- Map map = (global)? ctxInstance.getVariables()
- : ctxInstance.getVariables(_token);
- if (null!=map)
- for (Iterator iter=map.keySet().iterator(); iter.hasNext();)
- {
- String key = iter.next().toString();
- Object obj = body.get(key);
- if (null!=obj)
- {
- if (global)
- ctxInstance.setVariable(key, obj);
- else
- ctxInstance.setVariable(key, obj, _token);
- }
- }
- return;
- }
- String[]esbNames = return_esbNames.split(",");
- // do nothing if empty list
- if (esbNames.length==1 && Util.isNullString(esbNames[0]))
- return;
-
- String[]jbpmNames = (null==return_variables)
- ? esbNames
- : return_variables.split(",");
- if (jbpmNames.length != esbNames.length)
- throw new ConfigurationException("One to one mapping required between esb returned variables and jbpm names");
-
- int index = 0;
- for (String curr: esbNames)
- {
- Object obj = (Constants.BODY_CONTENT_VARIABLE_NAME.equals(curr))
- ?body.getByteArray()
- :body.get(curr);
- String jbpmVar = jbpmNames[index];
- Object oldVal = (global) ? ctxInstance.getVariable(jbpmVar)
- : ctxInstance.getVariable(jbpmVar,_token);
- if (null==oldVal)
- {
- if (null!=obj)
- {
- if (global)
- ctxInstance.createVariable(jbpmVar, obj);
- else
- ctxInstance.createVariable(jbpmVar, obj, _token);
- }
- }
- else
- {
- if (null==obj)
- {
- if (global)
- ctxInstance.deleteVariable(jbpmVar);
- else
- ctxInstance.deleteVariable(jbpmVar, _token);
- }
- else
- {
- if (global)
- ctxInstance.setVariable(jbpmVar,obj);
- else
- ctxInstance.setVariable(jbpmVar,obj,_token);
- }
- }
- index++;
- }
- } //________________________________
-
- protected Message getMessageTemplate() throws Exception
- {
- if (null==esbCategoryName)
- throw new ConfigurationException("Service category (esbCategoryName element) must not be null");
- if (null==esbServiceName)
- throw new ConfigurationException("Service name (esbServiceName element) must not be null");
-
- Message template = MessageFactory.getInstance().getMessage();
- Call call = template.getHeader().getCall();
- call.setMessageID(new URI(UUID.randomUUID().toString()));
-
- Helper.setLongValue (template,Constants.TOKEN_ID,_token.getId());
- Helper.setStringValue(template, Constants.CURRENT_NODE_NAME, _token.getNode().getName());
-
- ProcessInstance instance = _token.getProcessInstance();
- Helper.setLongValue(template,Constants.PROCESS_INSTANCE_ID,instance.getId());
-
- ProcessDefinition process = instance.getProcessDefinition();
- Helper.setObjectValue(template ,Constants.PROCESS_DEFINITION_NAME, process.getName());
- Helper.setIntValue (template ,Constants.PROCESS_DEFINITION_VERSION, process.getVersion());
- Helper.setLongValue (template ,Constants.PROCESS_DEFINITION_ID, process.getId());
-
-
- return template;
- } //________________________________
-
-}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java (from rev 13400, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java 2007-07-12 16:18:47 UTC (rev 13404)
@@ -0,0 +1,261 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.services.jbpm.actionhandlers;
+
+import java.net.URI;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.listeners.message.Invoker;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.util.Helper;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.exe.Token;
+
+/**
+ *
+ * Send messages to ESB services from jBPM applications, and optionally wait for response.
+ * <li/>esbCategoryName - for ESB registry lookup
+ * <li/>esbServiceName - for ESB registry lookup
+ * <li>millisToWaitForResponse - if a value > 0 is supplied, a response will be expected from the ESB service
+ * and maximum wait time will be set accordingly. If response is not received, a CourierTimeoutException will
+ * be thrown
+ * </li>
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">Esteban</a>
+ *
+ */
+
+public class EsbActionHandler implements ActionHandler
+{
+ public static final String OUTGOING_VARS_TAG = "jbpmToEsbVars";
+ public static final String RETURN_VARS_TAG = "returnVars";
+ public static final String MAPPING_TAG = "mapping";
+ public static final String JBPM_NAME_ATTR = "jbpm-name";
+ public static final String ESB_NAME_ATTR = "esb-name";
+ public static final String PROCESS_SCOPE_ATTR = "process-scope";
+
+ private static final long serialVersionUID = 1L;
+
+ public String esbCategoryName;
+ public String esbServiceName;
+ public Integer millisToWaitForResponse;
+ public Boolean globalProcessScope;
+ public DefaultElement jbpmToEsbVars;
+ public DefaultElement returnVars;
+
+ protected Logger _logger = Logger.getLogger(getClass());
+
+ protected Map<String, String>_outVarMapping;
+ protected Map<String, String>_retVarMapping;
+ protected transient Token _token;
+
+ public void execute(ExecutionContext executionContext) throws Exception
+ {
+ _token = executionContext.getToken();
+
+ Message request = getMessageTemplate();
+ varsToRequest(request);
+ if (null==millisToWaitForResponse || millisToWaitForResponse < 1)
+ {
+ Invoker.invoke(request,esbCategoryName, esbServiceName);
+ return;
+ }
+
+ Message response = null;
+ if ("MOCK_CATEGORY".equals(esbCategoryName)
+ && "MOCK_SERVICE".equals(esbServiceName))
+ response = request;
+ else
+ Invoker.invokeAndAwaitResponse (request,esbCategoryName, esbServiceName, millisToWaitForResponse);
+ if (null!=response)
+ varsFromResponse(response);
+ } //________________________________
+
+ protected void varsToRequest(Message request)
+ throws Exception
+ {
+ ContextInstance ctxInstance = _token.getProcessInstance().getContextInstance();
+ Body body = request.getBody();
+ boolean gblPrcScope = (null==globalProcessScope)
+ ? false : globalProcessScope;
+ if (null==jbpmToEsbVars)
+ {
+ Map map = (gblPrcScope)? ctxInstance.getVariables()
+ : ctxInstance.getVariables(_token);
+ if (null!=map)
+ for (Iterator iter=map.entrySet().iterator(); iter.hasNext();)
+ {
+ Map.Entry curr = (Map.Entry)iter.next();
+ body.add(curr.getKey().toString(), curr.getValue());
+ }
+ return;
+ }
+ List list = jbpmToEsbVars.elements(MAPPING_TAG);
+ // do nothing if empty list
+ if (list.size()<1 )
+ return;
+
+ for (Object iter: list)
+ {
+ Element curr = (Element)iter;
+ String jbpmKey = curr.attributeValue(JBPM_NAME_ATTR);
+ String esbKey = curr.attributeValue(ESB_NAME_ATTR);
+ String processScope = curr.attributeValue(PROCESS_SCOPE_ATTR);
+ boolean isPrcScope = (null==processScope) ? gblPrcScope
+ : Boolean.parseBoolean(processScope);
+ Object obj = (isPrcScope)
+ ? ctxInstance.getVariable(jbpmKey)
+ : ctxInstance.getVariable(jbpmKey, _token);
+ if (null!=obj)
+ {
+ if(Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbKey))
+ {
+ if (obj instanceof byte[])
+ body.setByteArray((byte[])obj);
+ else
+ body.setByteArray(obj.toString().getBytes());
+ }
+ else
+ body.add(esbKey, obj);
+ }
+ }
+ } //________________________________
+
+ protected void varsFromResponse(Message response) throws Exception
+ {
+ ContextInstance ctxInstance = _token.getProcessInstance().getContextInstance();
+ Body body = response.getBody();
+ boolean gblPrcScope = (null==globalProcessScope)
+ ? false : globalProcessScope;
+ if (null==returnVars)
+ {
+ Map map = (gblPrcScope)? ctxInstance.getVariables()
+ : ctxInstance.getVariables(_token);
+ if (null!=map)
+ for (Iterator iter=map.keySet().iterator(); iter.hasNext();)
+ {
+ String key = iter.next().toString();
+ Object obj = body.get(key);
+ if (null!=obj)
+ {
+ if (gblPrcScope)
+ ctxInstance.setVariable(key, obj);
+ else
+ ctxInstance.setVariable(key, obj, _token);
+ }
+ }
+ return;
+ }
+ List list = returnVars.elements(MAPPING_TAG);
+ // do nothing if empty list
+ if (list.size()<1 )
+ return;
+
+ for (Object iter: list)
+ {
+ Element curr = (Element)iter;
+ String jbpmVar = curr.attributeValue(JBPM_NAME_ATTR);
+ String esbVar = curr.attributeValue(ESB_NAME_ATTR);
+ String processScope = curr.attributeValue(PROCESS_SCOPE_ATTR);
+ boolean isPrcScope = (null==processScope) ? gblPrcScope
+ : Boolean.parseBoolean(processScope);
+ Object obj = (Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbVar))
+ ?body.getByteArray()
+ :body.get(esbVar);
+ Object oldVal = (isPrcScope) ? ctxInstance.getVariable(jbpmVar)
+ : ctxInstance.getVariable(jbpmVar,_token);
+ if (null==oldVal)
+ {
+ if (null!=obj)
+ {
+ if (isPrcScope)
+ ctxInstance.createVariable(jbpmVar, obj);
+ else
+ ctxInstance.createVariable(jbpmVar, obj, _token);
+ }
+ }
+ else
+ {
+ if (null==obj)
+ {
+ if (isPrcScope)
+ ctxInstance.deleteVariable(jbpmVar);
+ else
+ ctxInstance.deleteVariable(jbpmVar, _token);
+ }
+ else
+ {
+ if (isPrcScope)
+ ctxInstance.setVariable(jbpmVar,obj);
+ else
+ ctxInstance.setVariable(jbpmVar,obj,_token);
+ }
+ }
+ }
+ } //________________________________
+
+ protected Message getMessageTemplate() throws Exception
+ {
+ if (null==esbCategoryName)
+ throw new ConfigurationException("Service category (esbCategoryName element) must not be null");
+ if (null==esbServiceName)
+ throw new ConfigurationException("Service name (esbServiceName element) must not be null");
+
+ Message template = MessageFactory.getInstance().getMessage();
+ Call call = template.getHeader().getCall();
+ call.setMessageID(new URI(UUID.randomUUID().toString()));
+
+ Helper.setLongValue (template,Constants.TOKEN_ID,_token.getId());
+ Node node = _token.getNode();
+ if (null!=node)
+ Helper.setStringValue(template, Constants.CURRENT_NODE_NAME, node.getName());
+
+ ProcessInstance instance = _token.getProcessInstance();
+ Helper.setLongValue(template,Constants.PROCESS_INSTANCE_ID,instance.getId());
+
+ ProcessDefinition process = instance.getProcessDefinition();
+ Helper.setObjectValue(template ,Constants.PROCESS_DEFINITION_NAME, process.getName());
+ Helper.setIntValue (template ,Constants.PROCESS_DEFINITION_VERSION, process.getVersion());
+ Helper.setLongValue (template ,Constants.PROCESS_DEFINITION_ID, process.getId());
+
+
+ return template;
+ } //________________________________
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2UnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2UnitTest.java 2007-07-12 16:10:56 UTC (rev 13403)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2UnitTest.java 2007-07-12 16:18:47 UTC (rev 13404)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.jboss.soa.esb.services.jbpm.actionhandlers;
-
-import java.io.File;
-
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.graph.exe.Token;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class EsbAction2UnitTest extends TestCase
-{
-
- private static Class thisClass = EsbAction2UnitTest.class;
- static Logger _logger = Logger.getLogger(thisClass);
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(thisClass);
- }
-
- static File WORKDIR;
- static
- {
- String os = System.getProperty("os.name","").toLowerCase();
- String dflt = (os.indexOf("win")>=0) ? "/temp": "/tmp";
- WORKDIR = new File(System.getProperty("java.io.tmpdir",dflt));
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- _logger.info("@BeforeClass invoked");
- try
- {
- }
- catch (Exception e)
- {
- e.printStackTrace();
- assertTrue(false);
- }
- }
-
-
- @AfterClass
- public static void runAfterAllTests() throws Exception
- {
- _logger.info("@AfterClass invoked");
- }
-
- @Test
- public void testSimpleProcess() throws Exception
- {
- // Extract a process definition from the processdefinition.xml file.
- ProcessDefinition processDefinition
- = ProcessDefinition.parseXmlResource("testMappingDefinition.xml");
- assertTrue("Definition should not be null", null!=processDefinition);
-
- // Create an instance of the process definition.
- ProcessInstance instance = new ProcessInstance(processDefinition);
- assertTrue(
- "Instance is in start state",
- instance.getRootToken().getNode().getName().equals("start"));
-
- String varVal = "HELLO world";
- String second = "Second Hello";
- String body = "This text in Message body";
-
- Token token = instance.getRootToken();
- instance.getContextInstance().createVariable("v1", varVal, token);
- instance.getContextInstance().createVariable("g2", second);
- instance.getContextInstance().createVariable("body", body.getBytes(),token);
- instance.signal();
-
- assertTrue(
- "Instance is in first state",
- instance.getRootToken().getNode().getName().equals("first"));
-
- _logger.info("Instance Var x1= "+varVal);
- assertTrue(varVal.equals(instance.getContextInstance().getVariable("x1")));
- _logger.info("Token Var x2= "+second);
- assertTrue(second.equals(instance.getContextInstance().getVariable("x2",instance.getRootToken())));
- _logger.info("Token Var x3= "+body);
- assertTrue(body.equals(new String((byte[])instance.getContextInstance().getVariable("x3",instance.getRootToken()))));
-
- instance.signal();
- assertTrue(
- "Instance is in end state",
- instance.getRootToken().getNode().getName().equals("end"));
- assertTrue("Instance has ended", instance.hasEnded());
- }
-
-}
Deleted: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java 2007-07-12 16:10:56 UTC (rev 13403)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java 2007-07-12 16:18:47 UTC (rev 13404)
@@ -1,266 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.jboss.soa.esb.services.jbpm.actionhandlers;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.jbpm.Constants;
-import org.jboss.soa.esb.services.jbpm.actions.BpmProcessor;
-import org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler;
-import org.jboss.soa.esb.services.jbpm.actions.JbpmTestUtil;
-import org.jboss.soa.esb.services.jbpm.util.Helper;
-import org.jbpm.context.exe.ContextInstance;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.graph.exe.Token;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test the EsbActionHandler class
- *
- * @author <a href="mailto:schifest at heuristica.com.ar">Esteban</a>
- */
-
-
-public class EsbActionHandlerUnitTest
-{
-
- private static Class thisClass = EsbActionHandlerUnitTest.class;
- static Logger _logger = Logger.getLogger(thisClass);
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(thisClass);
- }
-
- static File WORKDIR;
- static
- {
- String os = System.getProperty("os.name","").toLowerCase();
- String dflt = (os.indexOf("win")>=0) ? "/temp": "/tmp";
- WORKDIR = new File(System.getProperty("java.io.tmpdir",dflt));
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- _logger.info("@BeforeClass invoked");
- try
- {
- }
- catch (Exception e)
- {
- e.printStackTrace();
- assertTrue(false);
- }
- }
-
-
- @AfterClass
- public static void runAfterAllTests() throws Exception
- {
- _logger.info("@AfterClass invoked");
- }
-
- @Test
- public void mockTest()
- {
- // place holder so test will run even with no other @Test
- _logger.info("Mock test invoked");
- assertTrue(true);
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testEsbActionHandler()
- {
- Message msg=null;
- MyEsbActionHandler handler = null;
-
- for(Boolean processVars: new boolean[]{false,true})
- try
- {
- // use the same config as the BpmProcessorUnitTest
- String xml = JbpmTestUtil.stringFromFile("testSingleCommands.xml");
- ConfigTree[] actions = ConfigTree.fromXml(xml).getChildren("action");
-
- // create a process def
- BpmProcessor command = new BpmProcessor(actions[0]);
- command.process(Helper.commandMessageTemplate());
-
- // create a process instance
- command = new BpmProcessor(actions[1]);
- msg = command.process(Helper.commandMessageTemplate());
- ProcessInstance inst = (ProcessInstance)msg.getBody()
- .get(Constants.JBPM_RETURN_OBJECT);
-
- Token token = inst.getRootToken();
- ContextInstance ctx = inst.getContextInstance();
-
- handler = getHandler(token, "No variables - No mappings - no response",processVars);
- handler.execute(null);
-
- handler = getHandler(token,"V3 and V2 - No mappings - no response",processVars);
- handler.jbpmToEsb_variables="jbV3,jbV2";
- handler.execute(null);
-
- handler = getHandler(token,"V3 and V2 mapped - no response",processVars);
- handler.jbpmToEsb_variables="jbV3,jbV2";
- handler.jbpmToEsb_esbNames="esbV3,esbV2";
- handler.execute(null);
-
- handler = getHandler(token, "No variables - No mappings - Response expected",processVars);
- handler.millisToWaitForResponse=1;
- handler.execute(null);
- assertTrue((s_varMap.get("jbV1")+"_P").equals(ctx.getVariable("jbV1",token)));
- assertTrue((s_varMap.get("jbV2")+"_P").equals(ctx.getVariable("jbV2",token)));
- assertTrue((s_varMap.get("jbV3")+"_P").equals(ctx.getVariable("jbV3",token)));
-
- handler = getHandler(token,"All variables mapped both ways - Response expected",processVars);
- handler.jbpmToEsb_variables="jbV3,jbV2,jbV1";
- handler.jbpmToEsb_esbNames="esbV3,esbV2,esbV1";
- handler.millisToWaitForResponse=1;
-
- handler.return_esbNames="esbV1,esbV2,esbV3";
- handler.return_variables="jbV1,jbV2,jbV3";
-
- handler.execute(null);
- assertTrue((s_varMap.get("jbV1")+"_P").equals(ctx.getVariable("jbV1",token)));
- assertTrue((s_varMap.get("jbV2")+"_P").equals(ctx.getVariable("jbV2",token)));
- assertTrue((s_varMap.get("jbV3")+"_P").equals(ctx.getVariable("jbV3",token)));
-
- handler = getHandler(token,"V1 mapped both ways (trick j1 to e3 and back) - Response expected",processVars);
- handler.jbpmToEsb_variables="jbV1";
- handler.jbpmToEsb_esbNames="esbV3";
- handler.return_esbNames="esbV3";
- handler.return_variables="jbV1";
- handler.millisToWaitForResponse=1;
- handler.execute(null);
- assertTrue((s_varMap.get("jbV1")+"_P").equals(ctx.getVariable("jbV1",token)));
- assertTrue(s_varMap.get("jbV2").equals(ctx.getVariable("jbV2",token)));
- assertTrue(s_varMap.get("jbV3").equals(ctx.getVariable("jbV3",token)));
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- assertTrue(false);
- }
- } //________________________________
-
- private static MyEsbActionHandler getHandler(Token token, String title, boolean processVars)
- {
- Iterator iter=null;
-
- ContextInstance ctxInstance = token.getProcessInstance().getContextInstance();
-
- iter = ctxInstance.getVariables(token).keySet().iterator();
- while (iter.hasNext())
- ctxInstance.deleteVariable((String)iter.next(),token);
-
- iter = ctxInstance.getVariables().keySet().iterator();
- while (iter.hasNext())
- ctxInstance.deleteVariable((String)iter.next());
-
- ctxInstance.addVariables(s_varMap,token);
-
- MyEsbActionHandler handler = new MyEsbActionHandler(title,processVars);
- handler.setToken(token);
-
- return handler;
- } //________________________________
-
- private static final String[] s_vars =
- {"jbV1","jbV2","jbV3","esbV1","esbV2","esbV3"};
- private static final Map<String,Object> s_varMap = new HashMap<String, Object>();
- static
- {
- s_varMap.put("jbV1","1");
- s_varMap.put("jbV2","22");
- s_varMap.put("jbV3","333");
- };
- private static void dumpMessage(String title, Message msg) throws Exception
- {
- StringBuilder sb = new StringBuilder("\n---").append(title).append("---");
- Body body = msg.getBody();
- for (String curr:s_vars)
- sb.append(" ").append(curr).append("=").append(body.get(curr));
- System.out.println(sb);
- }
-
- private static class MyEsbActionHandler extends EsbActionHandler
- {
- public static final long serialVersionUID = 1L;
- public void setToken(Token token) {_token = token; }
-
- public MyEsbActionHandler(String title, boolean processLevelVars)
- {
- String level = (processLevelVars)?"PROCESS VARS ":"TOKEN VARS";
- System.out.println(level+" "+title);
- esbCategoryName = "mockCategory";
- esbServiceName = "mockServiceName";
- processVariables = processLevelVars;
- }
-
-
- // this is a mock execute method to avoid need of ESB running for
- // the unit test
- @Override
- public void execute(ExecutionContext ctx) throws Exception
- {
- // Does the same as the real one, but does not go to ESB
- Message request = getMessageTemplate();
- varsToRequest(request);
- dumpMessage("Request ",request);
-
- if (null!=millisToWaitForResponse && millisToWaitForResponse > 0)
- {
- Body body = request.getBody();
- for(String curr:s_vars)
- {
- String val = (String)body.get(curr);
- if (null!=val)
- body.add(curr, val+"_P");
- }
-
- dumpMessage("Response ",request);
- varsFromResponse(request);
- }
- System.out.println("______________________________________");
- }
- };
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java (from rev 13400, labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbAction2UnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java 2007-07-12 16:18:47 UTC (rev 13404)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.services.jbpm.actionhandlers;
+
+import java.io.File;
+
+import junit.framework.JUnit4TestAdapter;
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.exe.Token;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class EsbActionHandlerUnitTest extends TestCase
+{
+
+ private static Class thisClass = EsbActionHandlerUnitTest.class;
+ static Logger _logger = Logger.getLogger(thisClass);
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(thisClass);
+ }
+
+ static File WORKDIR;
+ static
+ {
+ String os = System.getProperty("os.name","").toLowerCase();
+ String dflt = (os.indexOf("win")>=0) ? "/temp": "/tmp";
+ WORKDIR = new File(System.getProperty("java.io.tmpdir",dflt));
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ _logger.info("@BeforeClass invoked");
+ try
+ {
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+
+ @AfterClass
+ public static void runAfterAllTests() throws Exception
+ {
+ _logger.info("@AfterClass invoked");
+ }
+
+ @Test
+ public void testSimpleProcess() throws Exception
+ {
+ // Extract a process definition from the processdefinition.xml file.
+ ProcessDefinition processDefinition
+ = ProcessDefinition.parseXmlResource("testMappingDefinition.xml");
+ assertTrue("Definition should not be null", null!=processDefinition);
+
+ // Create an instance of the process definition.
+ ProcessInstance instance = new ProcessInstance(processDefinition);
+ assertTrue(
+ "Instance is in start state",
+ instance.getRootToken().getNode().getName().equals("start"));
+
+ String varVal = "HELLO world";
+ String second = "Second Hello";
+ String body = "This text in Message body";
+
+ Token token = instance.getRootToken();
+ instance.getContextInstance().createVariable("v1", varVal, token);
+ instance.getContextInstance().createVariable("g2", second);
+ instance.getContextInstance().createVariable("body", body.getBytes(),token);
+ instance.signal();
+
+ assertTrue(
+ "Instance is in first state",
+ instance.getRootToken().getNode().getName().equals("first"));
+
+ _logger.info("Instance Var x1= "+varVal);
+ assertTrue(varVal.equals(instance.getContextInstance().getVariable("x1")));
+ _logger.info("Token Var x2= "+second);
+ assertTrue(second.equals(instance.getContextInstance().getVariable("x2",instance.getRootToken())));
+ _logger.info("Token Var x3= "+body);
+ assertTrue(body.equals(new String((byte[])instance.getContextInstance().getVariable("x3",instance.getRootToken()))));
+
+ instance.signal();
+ assertTrue(
+ "Instance is in end state",
+ instance.getRootToken().getNode().getName().equals("end"));
+ assertTrue("Instance has ended", instance.hasEnded());
+ }
+
+}
More information about the jboss-svn-commits
mailing list