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

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Aug 30 09:12:54 EDT 2011


Author: marco.rietveld
Date: 2011-08-30 09:12:54 -0400 (Tue, 30 Aug 2011)
New Revision: 7008

Added:
   jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3213/
   jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3213/JBPM3213Test.java
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/gpd.xml
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/processdefinition.xml
   jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/processimage.jpg
Log:
Added simple test for transitions/conditions/decisions (SOA-2010). 

Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3213/JBPM3213Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3213/JBPM3213Test.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3213/JBPM3213Test.java	2011-08-30 13:12:54 UTC (rev 7008)
@@ -0,0 +1,66 @@
+/*
+ * 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.jbpm3213;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * Conditions on transitions from decisions.
+ * 
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2010">JBPM-2010</a>
+ */
+public class JBPM3213Test extends AbstractDbTestCase {
+
+  protected void setUp() throws Exception {
+    super.setUp();
+
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm3213/processdefinition.xml");
+    deployProcessDefinition(processDefinition);
+  }
+
+  protected void tearDown() throws Exception {
+    jbpmConfiguration.getJobExecutor().setNbrOfThreads(1);
+    super.tearDown();
+  }
+
+  public void testConditionsOnDecisions() {
+    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("jbpm2010");
+    try { 
+      processInstance.signal();
+      fail( "An exception should have been thrown because there are no viable guarded transitions.");
+    }
+    catch(Exception e ) { 
+      String message = e.getMessage();
+      assertTrue("Exception message should refer to failed condition.", message.matches("condition.*guarding Transition(.*) not met.*"));
+    }
+
+    long processInstanceId = processInstance.getId();
+
+    processJobs();
+
+    processInstance = jbpmContext.loadProcessInstance(processInstanceId);
+    assertTrue("expected " + processInstance + " to have NOT ended", ! processInstance.hasEnded());
+  }
+
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm3213/JBPM3213Test.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/jbpm3213/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/gpd.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/gpd.xml	2011-08-30 13:12:54 UTC (rev 7008)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="jbpm2010" width="1083" height="532">
+  <node name="start" x="150" y="64" width="132" height="36">
+    <edge>
+      <label x="5" y="-10"/>
+    </edge>
+  </node>
+  <node name="checkBody" x="140" y="165" width="132" height="36">
+    <edge>
+      <label x="5" y="-10"/>
+    </edge>
+    <edge>
+      <label x="5" y="-10"/>
+    </edge>
+  </node>
+  <node name="script1" x="26" y="247" width="132" height="36">
+    <edge>
+      <label x="5" y="-10"/>
+    </edge>
+  </node>
+  <node name="script2" x="295" y="254" width="132" height="36">
+    <edge>
+      <label x="5" y="-10"/>
+    </edge>
+  </node>
+  <node name="end" x="148" y="356" width="132" height="36"/>
+</root-container>


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/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/jbpm3213/processdefinition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/processdefinition.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/processdefinition.xml	2011-08-30 13:12:54 UTC (rev 7008)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition xmlns="" name="jbpm2010">
+   
+   <start-state name="start">
+      <transition to="checkBody"/>
+   </start-state>
+   
+   <decision name="checkBody">
+      <transition name="toScript1" to="script1">
+         <condition expression="#{theBody == 'execScript1'}"/>
+      </transition>
+      <transition name="toScript2" to="script2">
+         <condition expression="#{theBody == 'execScript2'}" />
+      </transition> 
+   </decision>
+   
+   <node name="script1">
+      <script>
+        <![CDATA[
+         System.out.println("### groovy script1");
+        ]]>
+      </script>
+      <transition to="end"/>
+   </node>
+   
+   <node name="script2">
+      <script>
+        <![CDATA[
+         System.out.println("### groovy script2");
+        ]]>
+      </script>
+      <transition to="end"/>
+   </node>
+   
+   <end-state name="end"/>
+   
+</process-definition>


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/processdefinition.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/jbpm3213/processimage.jpg
===================================================================
(Binary files differ)


Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3213/processimage.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the jbpm-commits mailing list