[jbpm-commits] JBoss JBPM SVN: r6479 - in jbpm4/trunk/modules: jpdl/src/test/java/org/jbpm/jpdl/parsing and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 14 02:21:50 EDT 2010


Author: alex.guizar at jboss.com
Date: 2010-07-14 02:21:50 -0400 (Wed, 14 Jul 2010)
New Revision: 6479

Added:
   jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java
Modified:
   jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd
   jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
Log:
JBPM-2506: incorporate variable declarations into jpdl schema

Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd	2010-07-14 00:56:00 UTC (rev 6478)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd	2010-07-14 06:21:50 UTC (rev 6479)
@@ -21,6 +21,7 @@
           <element ref="tns:swimlane" />
           <element ref="tns:on" />
           <element ref="tns:timer" />
+          <element ref="tns:variable" />
           <group ref="tns:activityGroup" />
         </choice>
         <element ref="tns:migrate-instances" minOccurs="0" />
@@ -94,7 +95,7 @@
           </attribute>
           <attribute name="state" default="ended" type="string">
             <annotation>
-              <documentation>Set the end state of the execution explicitly.</documentation>
+              <documentation>Specify the end state of the execution explicitly.</documentation>
             </annotation>
           </attribute>
         </complexType>
@@ -496,8 +497,7 @@
           <attribute name="swimlane" type="string" />
           <attribute name="form" type="string">
             <annotation>
-              <documentation>the resource name of the form in the
-                deployment.</documentation>
+              <documentation>Resource name of the form in the deployment.</documentation>
             </annotation>
           </attribute>
           <attribute name="duedate" type="string" />
@@ -516,9 +516,8 @@
       <!-- ~~~ SUB-PROCESS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       <element name="sub-process">
         <annotation>
-          <documentation>Waits while a sub process instance is
-            being executed and continues when
-            the sub process instance ends.</documentation>
+          <documentation>Waits while a sub process instance is being executed
+            and continues when the sub process instance ends.</documentation>
         </annotation>
         <complexType>
           <sequence>
@@ -565,8 +564,7 @@
             <annotation>
               <documentation>References a sub-process by key. Therefore, the latest
                 version of the process definition with the given key is referenced.
-                The latest version is resolved each time the activity executes.
-              </documentation>
+                The latest version is resolved in each execution.</documentation>
             </annotation>
           </attribute>
           <attribute name="outcome" type="string">
@@ -582,8 +580,7 @@
       <!-- ~~~ GROUP ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       <element name="group">
         <annotation>
-          <documentation>Scope enclosing a number of activities.
-        </documentation>
+          <documentation>Scope enclosing a number of activities.</documentation>
         </annotation>
         <complexType>
           <sequence>
@@ -628,8 +625,8 @@
       <!-- ~~~ RULES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       <element name="rules">
         <annotation>
-          <documentation>Evaluates rules after feeding in some facts in a stateful knowledge
-            session.</documentation>
+          <documentation>Evaluates rules after feeding in some facts in a stateful
+            knowledge session.</documentation>
         </annotation>
         <complexType>
           <sequence>
@@ -1514,6 +1511,34 @@
     </complexType>
   </element>
 
+  <element name="variable">
+    <complexType>
+      <annotation>
+        <documentation>Explicit variable declaration.</documentation>
+      </annotation>
+      <sequence>
+        <group ref="tns:wireObjectGroup" minOccurs="0" />
+      </sequence>
+      <attribute name="name" type="string">
+        <annotation>
+          <documentation>Name of the variable. Must differ from other variable
+            names.</documentation>
+        </annotation>
+      </attribute>
+      <attribute name="type" type="string">
+        <annotation>
+          <documentation>Type of the variable.</documentation>
+        </annotation>
+      </attribute>
+      <attribute name="init-expr" type="string">
+        <annotation>
+          <documentation></documentation>
+        </annotation>
+      </attribute>
+      <attribute name="history" type="tns:booleanValueType" />
+    </complexType>
+  </element>
+
   <group name="eventListenerGroup">
     <choice>
       <element name="event-listener">

Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java	2010-07-14 00:56:00 UTC (rev 6478)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java	2010-07-14 06:21:50 UTC (rev 6479)
@@ -33,16 +33,14 @@
  */
 public abstract class JpdlParseTestCase extends BaseJbpmTestCase {
 
-  static JpdlParser jpdlParser = new JpdlParser();
+  protected static final JpdlParser jpdlParser = new JpdlParser();
 
   public List<Problem> parseProblems(String xmlString) {
     List<Problem> problems = jpdlParser.createParse()
                .setString(xmlString)
                .execute()
                .getProblems();
-    if ( (problems==null)
-         || (problems.isEmpty())
-       ) {
+    if (problems.isEmpty()) {
       fail("expected problems during parse");
     }
     return problems;

Added: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java	2010-07-14 06:21:50 UTC (rev 6479)
@@ -0,0 +1,49 @@
+/*
+ * 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.jpdl.parsing;
+
+import java.util.List;
+
+import org.jbpm.pvm.internal.xml.Problem;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class VariableParsingTest extends JpdlParseTestCase {
+
+  public void testVariableParse() {
+    List<Problem> problems = jpdlParser.createParse()
+      .setString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+        + "  <variable name='s' type='string' init-expr='static' history='true'/>"
+        + "  <variable name='i' type='integer' init-expr='#{param * 2}' history='false'/>"
+        + "  <variable name='d' type='serializable'>"
+        + "    <object class='java.util.Date'>"
+        + "      <constructor><arg><long value='1276086573250'/></arg></constructor>"
+        + "    </object>"
+        + "  </variable>"
+        + "  <start/>"
+        + "</process>")
+      .execute()
+      .getProblems();
+    assertEquals(problems.toString(), 0, problems.size());
+  }
+}


Property changes on: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java	2010-07-14 00:56:00 UTC (rev 6478)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java	2010-07-14 06:21:50 UTC (rev 6479)
@@ -187,7 +187,7 @@
    * 'warning'. */
   public Parse checkErrors(String description) {
     if (hasErrors()) {
-      throw getJbpmException();
+      throw getJbpmException(description);
     }
     return this;
   }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java	2010-07-14 00:56:00 UTC (rev 6478)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java	2010-07-14 06:21:50 UTC (rev 6479)
@@ -31,10 +31,6 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;



More information about the jbpm-commits mailing list