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

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jul 5 22:15:49 EDT 2010


Author: rebody
Date: 2010-07-05 22:15:49 -0400 (Mon, 05 Jul 2010)
New Revision: 6462

Modified:
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
   jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/SlashInActivityTest.java
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/jbpm.cfg.xml
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
Log:
JBPM-2904 allow slash(/) in activity name by default

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java	2010-07-05 23:20:17 UTC (rev 6461)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java	2010-07-06 02:15:49 UTC (rev 6462)
@@ -56,7 +56,7 @@
         parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
       }
 
-      boolean isActivityAllowSlash = false;
+      boolean isActivityAllowSlash = true;
       Boolean candidateCondition = (Boolean) EnvironmentImpl.getFromCurrent("jbpm.activity.allow.slash", false);
       if (candidateCondition != null) {
         isActivityAllowSlash = candidateCondition.booleanValue();

Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java	2010-07-05 23:20:17 UTC (rev 6461)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java	2010-07-06 02:15:49 UTC (rev 6462)
@@ -34,15 +34,6 @@
  */
 public class ActivityParsingTest extends JpdlParseTestCase {
 
-  public void testInvalidActivityName() {
-    List<Problem> problems = parseProblems(
-      "<process name='p'>" +
-      "  <state name='invalid / activityname' />" +
-      "</process>"
-    );
-    assertTextPresent("attribute <state name=\"invalid / activityname\" contains slash (/)", problems.get(0).getMsg());
-  }
-
   public void testEmptyActivityName() {
     List<Problem> problems = parseProblems(
       "<process name='p'>" +

Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/SlashInActivityTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/SlashInActivityTest.java	2010-07-05 23:20:17 UTC (rev 6461)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/SlashInActivityTest.java	2010-07-06 02:15:49 UTC (rev 6462)
@@ -1,52 +1,60 @@
-/*
- * 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.test.slashinactivity;
-
-import org.jbpm.api.Configuration;
-import org.jbpm.api.Execution;
-import org.jbpm.api.ExecutionService;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.api.ProcessInstance;
-import org.jbpm.test.JbpmCustomCfgTestCase;
-import org.jbpm.test.JbpmTestCase;
-
-
-public class SlashInActivityTest extends JbpmCustomCfgTestCase {
-
-  private static final String PROCESS_KEY = "test_process";
-
-  private static final String TEST_PROCESS =
-    "<process name='" + PROCESS_KEY + "'>" +
-      "  <start name='1/2'>" +
-      "    <transition to='theEnd' />" +
-      "  </start>" +
-      "  <end name='theEnd' />" +
-      "</process>";
-
-  public void testSlashInActivity() {
-    deployJpdlXmlString(TEST_PROCESS);
-  }
-}
+/*
+ * 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.test.slashinactivity;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.Execution;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmCustomCfgTestCase;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Huisheng Xu
+ */
+public class SlashInActivityTest extends JbpmCustomCfgTestCase {
+
+  private static final String PROCESS_KEY = "test_process";
+
+  private static final String TEST_PROCESS =
+    "<process name='" + PROCESS_KEY + "'>" +
+      "  <start name='1/2'>" +
+      "    <transition to='theEnd' />" +
+      "  </start>" +
+      "  <end name='theEnd' />" +
+      "</process>";
+
+  public void testSlashInActivity() {
+    try {
+      deployJpdlXmlString(TEST_PROCESS);
+      fail("shouldn't success deploy");
+    } catch(JbpmException ex) {
+      assertEquals("error: attribute <start name=\"1/2\" contains slash (/) [line=1 column=50 ]",
+        ex.getMessage().trim());
+    }
+  }
+}

Modified: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/jbpm.cfg.xml	2010-07-05 23:20:17 UTC (rev 6461)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/jbpm.cfg.xml	2010-07-06 02:15:49 UTC (rev 6462)
@@ -7,7 +7,7 @@
   <import resource="jbpm.jpdl.cfg.xml" />
 
   <process-engine-context>
-    <true name='jbpm.activity.allow.slash'/>
+    <false name='jbpm.activity.allow.slash'/>
   </process-engine-context>
 
 </jbpm-configuration>

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml	2010-07-05 23:20:17 UTC (rev 6461)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml	2010-07-06 02:15:49 UTC (rev 6462)
@@ -101,12 +101,13 @@
               The <literal>""</literal> isnot allowed to be used by the name of activity.</para>
           </listitem>
           <listitem>
-              <para>The name of activity cannot contain slash(/).  It comes from jBPM 3.x.
+              <para>Before jBPM 4.4, the name of activity cannot contain slash(/).  It comes from jBPM 3.x.
               Because jBPM 3.x supported <literal>hierarchical names</literal>,
               it allowed an execution could jump from a super-state to the other level of activities.
               But in jBPM 4.x, there would be no chance to achieve this feature.
-              So if someone want to use slash(/) in the name of activity.
-              He could add this configuration parameter into jbpm.cfg.xml.</para>
+              So since jBPM 4.4, we allowed slash(/) in the name of activity by default.
+              If someone want to use the previous validation rule for slash(/) in jBPM 4.4,
+              he could add this configuration parameter into jbpm.cfg.xml.</para>
               <programlisting>
 &lt;jbpm-configuration>
   &lt;import resource="jbpm.default.cfg.xml" />
@@ -114,11 +115,10 @@
   &lt;import resource="jbpm.jpdl.cfg.xml" />
 
   &lt;process-engine-context>
-    <emphasis role="bold">&lt;true name='jbpm.activity.allow.slash'/></emphasis>
+    <emphasis role="bold">&lt;false name='jbpm.activity.allow.slash'/></emphasis>
   &lt;/process-engine-context>
 &lt;/jbpm-configuration>
               </programlisting>
-              <para>By using this, JpdlBinding will skip validation for slash(/) in activity name.</para>
           </listitem>
       </itemizedlist>
     </para>



More information about the jbpm-commits mailing list