JBoss JBPM SVN: r6395 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/activity and 1 other directories.
by do-not-reply@jboss.org
Author: swiderski.maciej
Date: 2010-06-07 16:23:16 -0400 (Mon, 07 Jun 2010)
New Revision: 6395
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/script/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/script/ScriptTest.java
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
Log:
JBPM-2882: ensure that either expr attribute is given or text nested element for script activity
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2010-06-04 08:48:07 UTC (rev 6394)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2010-06-07 20:23:16 UTC (rev 6395)
@@ -49,11 +49,13 @@
ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
language = scriptManager.getDefaultExpressionLanguage();
if (textElement!=null) {
- parse.addProblem("in <script ...> attribute expr can't be combined with a nexted text element", element);
+ parse.addProblem("in <script ...> attribute expr can't be combined with a nested text element", element);
}
- } else {
+ } else if(textElement != null) {
language = XmlUtil.attribute(element, "lang");
script = XmlUtil.getContentText(textElement);
+ } else {
+ parse.addProblem("<script...> element must have either expr attribute or nested text element", element);
}
String variableName = XmlUtil.attribute(element, "var");
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/script/ScriptTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/script/ScriptTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/script/ScriptTest.java 2010-06-07 20:23:16 UTC (rev 6395)
@@ -0,0 +1,82 @@
+package org.jbpm.test.activity.script;
+
+import java.util.HashMap;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+public class ScriptTest extends JbpmTestCase {
+
+ public void testIncompleteScriptDefinition() {
+
+ try {
+ deployJpdlXmlString(
+ "<process name='ScriptProcess'> " +
+ " <start name='start'> " +
+ " <transition to='script'/> " +
+ " </start> " +
+ " <script name='script'> " +
+ " </script> " +
+ "</process>"
+ );
+
+ fail("Should fail sine script definition is incomplete");
+
+ } catch (Exception e) {
+ String expectedErrorMsg = "error: <script...> element must have either expr attribute or nested text element";
+
+ assertTrue(e.getMessage().trim().startsWith(expectedErrorMsg));
+ }
+ }
+
+ public void testScriptDefinitionWithExpr() {
+
+ deployJpdlXmlString(
+ "<process name='ScriptProcess'> " +
+ " <start name='start'> " +
+ " <transition to='script'/> " +
+ " </start> " +
+ " <script name='script' expr='Send packet to #{receiver}' var='result'> " +
+ " <transition to='wait' />" +
+ " </script> " +
+ " <state name='wait' />" +
+ "</process>"
+ );
+
+ HashMap<String, String> variables = new HashMap<String, String>();
+ variables.put("receiver", "johndoe");
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ScriptProcess", variables);
+
+ String resultVariable = (String) executionService.getVariable(processInstance.getId(), "result");
+
+ assertEquals("Send packet to johndoe", resultVariable);
+ }
+
+ public void testScriptDefinitionWithTextElement() {
+
+
+ deployJpdlXmlString(
+ "<process name='ScriptProcess'> " +
+ " <start name='start'> " +
+ " <transition to='script'/> " +
+ " </start> " +
+ " <script name='script' var='result'> " +
+ " <text>Send packet to #{receiver}</text> " +
+ " <transition to='wait' />" +
+ " </script> " +
+ " <state name='wait' />" +
+ "</process>"
+ );
+
+ HashMap<String, String> variables = new HashMap<String, String>();
+ variables.put("receiver", "johndoe");
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ScriptProcess", variables);
+
+ String resultVariable = (String) executionService.getVariable(processInstance.getId(), "result");
+
+ assertEquals("Send packet to johndoe", resultVariable);
+ }
+}
15 years, 11 months
JBoss JBPM SVN: r6394 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/stream and 2 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-06-04 04:48:07 -0400 (Fri, 04 Jun 2010)
New Revision: 6394
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/stream/StringStreamInput.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/ForkSwimlaneTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
Log:
JBPM-2746: do not replace non-latin letters away from process definition key
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java 2010-06-03 19:13:17 UTC (rev 6393)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java 2010-06-04 08:48:07 UTC (rev 6394)
@@ -125,7 +125,7 @@
if (processDefinitionKey==null) {
// derive the key from the name
// replace any non-word character with an underscore
- processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
+ processDefinitionKey = processDefinitionName.replaceAll("[^\\p{L}\\p{N}]", "_");
processDefinition.setKey(processDefinitionKey);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/stream/StringStreamInput.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/stream/StringStreamInput.java 2010-06-03 19:13:17 UTC (rev 6393)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/stream/StringStreamInput.java 2010-06-04 08:48:07 UTC (rev 6394)
@@ -23,22 +23,28 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
-
/**
* @author Tom Baeyens
*/
public class StringStreamInput extends StreamInput {
-
- String string;
-
+
+ private String string;
+
public StringStreamInput(String string) {
this.name = "string";
this.string = string;
}
public InputStream openStream() {
- byte[] bytes = string.getBytes();
- return new ByteArrayInputStream(bytes);
+ try {
+ byte[] bytes = string.getBytes("UTF-8");
+ return new ByteArrayInputStream(bytes);
+ }
+ catch (UnsupportedEncodingException e) {
+ // every implementation of the Java platform is required to support UTF-8
+ throw new AssertionError(e);
+ }
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/ForkSwimlaneTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/ForkSwimlaneTest.java 2010-06-03 19:13:17 UTC (rev 6393)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/ForkSwimlaneTest.java 2010-06-04 08:48:07 UTC (rev 6394)
@@ -22,17 +22,7 @@
package org.jbpm.test.activity.task;
import java.util.List;
-import org.jbpm.api.ProcessInstance;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.cmd.Environment;
-import org.jbpm.api.task.Task;
-import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.events.VariableCreate;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.repository.RepositoryCache;
-import org.jbpm.pvm.internal.task.TaskImpl;
-import org.jbpm.pvm.internal.type.Variable;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -91,8 +81,7 @@
}
public void testSwimlane() {
- ProcessInstance processInstance = executionService
- .startProcessInstanceByKey("ForkSwimlane");
+ executionService.startProcessInstanceByKey("ForkSwimlane");
takeAndCompleteTask("lingo");
takeAndCompleteTask("lingo");
completeTask("lingo");
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java 2010-06-03 19:13:17 UTC (rev 6393)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java 2010-06-04 08:48:07 UTC (rev 6394)
@@ -30,7 +30,6 @@
import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
-
/**
* @author Tom Baeyens
*/
@@ -374,4 +373,33 @@
assertTrue(execution.isEnded());
}
+
+ /**
+ * Non-latin letters are replaced away from process definition key.
+ * @see <a href="https://jira.jboss.org/browse/JBPM-2746">JBPM-2746</a>
+ */
+ public void testNonLatinProcessName() {
+ // "Lev Trotskij"
+ deployJpdlXmlString("<process name='\u041B\u0435\u0412 \u0422\u0440\u043E\u0446\u043A\u0438\u0439'>" +
+ " <start/>" +
+ "</process>");
+
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .processDefinitionKey("\u041B\u0435\u0412_\u0422\u0440\u043E\u0446\u043A\u0438\u0439")
+ .uniqueResult();
+
+ assertEquals("\u041B\u0435\u0412 \u0422\u0440\u043E\u0446\u043A\u0438\u0439", processDefinition.getName());
+ }
+
+ public void testNumberProcessName() {
+ deployJpdlXmlString("<process name='jbpm 2746'>" +
+ " <start/>" +
+ "</process>");
+
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .processDefinitionKey("jbpm_2746")
+ .uniqueResult();
+
+ assertEquals("jbpm 2746", processDefinition.getName());
+ }
}
15 years, 11 months
JBoss JBPM SVN: r6393 - jbpm4/trunk.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2010-06-03 15:13:17 -0400 (Thu, 03 Jun 2010)
New Revision: 6393
Modified:
jbpm4/trunk/pom.xml
Log:
set console version 2.1
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2010-06-03 13:10:59 UTC (rev 6392)
+++ jbpm4/trunk/pom.xml 2010-06-03 19:13:17 UTC (rev 6393)
@@ -52,7 +52,7 @@
<drools.version>5.0.1</drools.version>
<aspectjrt.version>1.5.3</aspectjrt.version>
<freemarker.version>2.3.15</freemarker.version>
- <gwt.console.version>2.1-SNAPSHOT</gwt.console.version>
+ <gwt.console.version>2.1</gwt.console.version>
<errai.version>1.1-M1</errai.version>
<jbpm.gpd.version>4.3</jbpm.gpd.version>
<hibernate.version>3.3.1.GA</hibernate.version>
15 years, 11 months
JBoss JBPM SVN: r6392 - in jbpm4/trunk/modules: integration/console/src/main/resources and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2010-06-03 09:10:59 -0400 (Thu, 03 Jun 2010)
New Revision: 6392
Removed:
jbpm4/trunk/modules/integration/console/src/main/resources/ErraiService.properties
Modified:
jbpm4/trunk/modules/distro/src/main/files/install/build.xml
Log:
Fix JBPM-2880: Console deployment on tomcat
Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2010-06-03 13:09:39 UTC (rev 6391)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2010-06-03 13:10:59 UTC (rev 6392)
@@ -559,23 +559,32 @@
</fileset>
</copy>
- <!-- Copy jbpm-console wars into /webapps -->
- <copy todir="${tomcat.home}/webapps" overwrite="true">
- <fileset dir="${jbpm.home}/lib">
- <include name="gwt-console-jbpm.war" />
- <include name="gwt-console-server-jbpm.war" />
- </fileset>
- </copy>
+ <!-- Copy jbpm-console wars and configuration into /webapps -->
+ <mkdir dir="${tomcat.home}/webapps/jbpm-console"/>
+ <mkdir dir="${tomcat.home}/webapps/gwt-console-server"/>
+
+ <unzip src="${jbpm.home}/lib/gwt-console-jbpm.war"
+ dest="${tomcat.home}/webapps/jbpm-console"/>
+
+ <unzip src="${jbpm.home}/lib/gwt-console-server-jbpm.war"
+ dest="${tomcat.home}/webapps/gwt-console-server"/>
+
+ <move todir="${tomcat.home}/lib">
+ <fileset dir="${tomcat.home}/webapps/jbpm-console/WEB-INF/lib">
+ <include name="guice*.jar"/>
+ <include name="errai*.jar"/>
+ <include name="mvel*.jar"/>
+ </fileset>
+ <fileset dir="${tomcat.home}/webapps/jbpm-console/WEB-INF/classes">
+ <include name="ErraiService.properties"/>
+ <include name="ErraiApp.properties"/>
+ </fileset>
+ </move>
+
<!-- Copy Signavio war into /webapps -->
<antcall target="install.signavio.into.tomcat" />
- <!-- Rename wars (the context root is configured by WEB-INF/jboss-web.xml,
- which is neglected by Tomcat -->
- <move file="${tomcat.home}/webapps/gwt-console-jbpm.war"
- tofile="${tomcat.home}/webapps/jbpm-console.war" />
- <move file="${tomcat.home}/webapps/gwt-console-server-jbpm.war"
- tofile="${tomcat.home}/webapps/gwt-console-server.war" />
<!-- reporting -->
<property name="birt.dir" value="${tomcat.home}/birt" />
Deleted: jbpm4/trunk/modules/integration/console/src/main/resources/ErraiService.properties
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/resources/ErraiService.properties 2010-06-03 13:09:39 UTC (rev 6391)
+++ jbpm4/trunk/modules/integration/console/src/main/resources/ErraiService.properties 2010-06-03 13:10:59 UTC (rev 6392)
@@ -1,48 +0,0 @@
-
-#
-# Copyright 2009 JBoss, a divison Red Hat, Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Request dispatcher implementation (default is SimpleDispatcher)
-#
-#errai.dispatcher_implementation=org.jboss.errai.bus.server.SimpleDispatcher
-errai.dispatcher_implementation=org.jboss.errai.bus.server.AsyncDispatcher
-
-#
-# Worker pool size. This is the number of threads the asynchronous worker pool should provide for processing
-# incoming messages. This option is only valid when using the AsyncDispatcher implementation.
-#
-errai.async.thread_pool_size=5
-
-#
-# Worker timeout (in seconds). This defines the time that a single asychronous process may run, before the worker pool
-# terminates it and reclaims the thread. This option is only valid when using the AsyncDispatcher implementation.
-#
-errai.async.worker.timeout=20
-
-#
-# Specify the Authentication/Authorization Adapter sendNowWith use
-#
-#errai.authentication_adapter=org.jboss.errai.persistence.server.security.HibernateAuthenticationAdapter
-errai.authentication_adapter=org.jboss.errai.bus.server.security.auth.JAASAdapter
-
-##
-## This property indicates whether or not authentication is required for all communication with the bus. Set this
-## to 'true' if all access to your application should be secure.
-##
-errai.require_authentication_for_all=false
-
-
15 years, 11 months
JBoss JBPM SVN: r6391 - jbpm4/trunk.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2010-06-03 09:09:39 -0400 (Thu, 03 Jun 2010)
New Revision: 6391
Modified:
jbpm4/trunk/pom.xml
Log:
set errai version 1.1-M1
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2010-06-03 00:56:21 UTC (rev 6390)
+++ jbpm4/trunk/pom.xml 2010-06-03 13:09:39 UTC (rev 6391)
@@ -53,7 +53,7 @@
<aspectjrt.version>1.5.3</aspectjrt.version>
<freemarker.version>2.3.15</freemarker.version>
<gwt.console.version>2.1-SNAPSHOT</gwt.console.version>
- <errai.version>1.1-SNAPSHOT</errai.version>
+ <errai.version>1.1-M1</errai.version>
<jbpm.gpd.version>4.3</jbpm.gpd.version>
<hibernate.version>3.3.1.GA</hibernate.version>
<slf4j.version>1.5.2</slf4j.version>
15 years, 11 months
JBoss JBPM SVN: r6390 - jbpm4/trunk/modules/userguide/src/main/docbook/en/modules.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-06-02 20:56:21 -0400 (Wed, 02 Jun 2010)
New Revision: 6390
Modified:
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
correct document
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2010-06-02 18:23:10 UTC (rev 6389)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2010-06-03 00:56:21 UTC (rev 6390)
@@ -902,8 +902,8 @@
<para>After starting, a task will be created. The task will not show up in anyone's
personal task list. Following task lists will be empty.
</para>
- <programlisting>taskService.getAssignedTasks("johndoe");
-taskService.getAssignedTasks("joesmoe");</programlisting>
+ <programlisting>taskService.getPersonalTasks("johndoe");
+taskService.getPersonalTasks("joesmoe");</programlisting>
<para>But the task will show up in the group task list of all members of the <literal>sales-dept</literal>
group.
</para>
15 years, 11 months
JBoss JBPM SVN: r6389 - jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console.
by do-not-reply@jboss.org
Author: swiderski.maciej
Date: 2010-06-02 14:23:10 -0400 (Wed, 02 Jun 2010)
New Revision: 6389
Modified:
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessEnginePluginImpl.java
Log:
BPMC-58: deploy process (definition and archives) through BPM console
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessEnginePluginImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessEnginePluginImpl.java 2010-06-02 00:50:02 UTC (rev 6388)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessEnginePluginImpl.java 2010-06-02 18:23:10 UTC (rev 6389)
@@ -21,14 +21,18 @@
*/
package org.jbpm.integration.console;
+import java.io.File;
+import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.zip.ZipInputStream;
import org.jboss.bpm.console.client.model.DeploymentRef;
import org.jboss.bpm.console.client.model.JobRef;
import org.jboss.bpm.console.server.plugin.ProcessEnginePlugin;
import org.jbpm.api.Deployment;
import org.jbpm.api.ManagementService;
+import org.jbpm.api.NewDeployment;
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessDefinitionQuery;
import org.jbpm.api.RepositoryService;
@@ -119,4 +123,29 @@
ManagementService mgmtService = this.processEngine.getManagementService();
mgmtService.executeJob(jobId);
}
+
+ public String deployFile(File processFile) {
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ NewDeployment deployment = repositoryService.createDeployment();
+ deployment.setName(processFile.getName());
+ deployment.setTimestamp(System.currentTimeMillis());
+
+ if (processFile.getName().endsWith(".xml")) {
+
+ deployment.addResourceFromFile(processFile);
+
+ } else if (processFile.getName().endsWith("ar")) {
+
+ try {
+ FileInputStream fileInputStream = new FileInputStream(processFile);
+ ZipInputStream zipInputStream = new ZipInputStream(fileInputStream);
+ deployment.addResourcesFromZipInputStream(zipInputStream);
+ } catch (Exception e) {
+ throw new RuntimeException("couldn't read business archive "+processFile, e);
+ }
+
+ }
+
+ return deployment.deploy();
+ }
}
15 years, 11 months
JBoss JBPM SVN: r6388 - projects/jsf-console/branches/jsf-console-3.2-soa/console/src/main/webapp/app and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-06-01 20:50:02 -0400 (Tue, 01 Jun 2010)
New Revision: 6388
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Token.java
projects/jsf-console/branches/jsf-console-3.2-soa/console/src/main/webapp/app/t_tokens.xhtml
Log:
JBPM-1930: do not sort if there are no available transitions
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Token.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Token.java 2010-06-01 18:39:14 UTC (rev 6387)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Token.java 2010-06-02 00:50:02 UTC (rev 6388)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -223,10 +224,10 @@
* resolves to true.
*/
public Set getAvailableTransitions() {
+ if (node == null) return Collections.EMPTY_SET;
+
Set availableTransitions = new HashSet();
- if (node != null) {
- addAvailableTransitionsOfNode(node, availableTransitions);
- }
+ addAvailableTransitionsOfNode(node, availableTransitions);
return availableTransitions;
}
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/console/src/main/webapp/app/t_tokens.xhtml
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console/src/main/webapp/app/t_tokens.xhtml 2010-06-01 18:39:14 UTC (rev 6387)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console/src/main/webapp/app/t_tokens.xhtml 2010-06-02 00:50:02 UTC (rev 6388)
@@ -152,7 +152,8 @@
<h:form>
<ga:attribute name="rendered" value="#{token.end == null and ! token.suspended}"/>
<ga:responseActions>
- <gd:sort source="#{token.availableTransitions}" target="#{transitions}"
+ <gd:sort if="#{! empty token.availableTransitions}"
+ source="#{token.availableTransitions}" target="#{transitions}"
entryVar="t" argument="#{t.name != null ? t.name : ''}"/>
</ga:responseActions>
<gd:repeat value="#{transitions}" var="transition">
15 years, 11 months
JBoss JBPM SVN: r6387 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/bpmn and 1 other directories.
by do-not-reply@jboss.org
Author: swiderski.maciej
Date: 2010-06-01 14:39:14 -0400 (Tue, 01 Jun 2010)
New Revision: 6387
Added:
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayTwoTransitions.bpmn.xml
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java
Log:
JBPM-2826: taking first transition from the list if there are more than one for exclusive gateway
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java 2010-06-01 08:29:00 UTC (rev 6386)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java 2010-06-01 18:39:14 UTC (rev 6387)
@@ -53,8 +53,8 @@
List<Transition> transitions = findOutgoingSequenceFlow(execution, CONDITIONS_CHECKED);
int numTransitions = transitions.size();
- if (numTransitions > 2) {
- transitions = transitions.subList(0, 0);
+ if (numTransitions > 1) {
+ transitions = transitions.subList(0, 1);
if (log.isInfoEnabled()) {
log.info("More than one outgoing sequenceFlow conditions evaluated to true for "
+ execution.getActivity() + ", taking the first one ("
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java 2010-06-01 08:29:00 UTC (rev 6386)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java 2010-06-01 18:39:14 UTC (rev 6387)
@@ -29,12 +29,10 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.dom4j.DocumentFactory;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.TaskQuery;
import org.jbpm.api.task.Task;
import org.jbpm.bpmn.parser.BpmnParser;
-import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Problem;
import org.jbpm.test.JbpmTestCase;
import org.w3c.dom.Document;
@@ -103,6 +101,45 @@
}
}
+ public void testTwoTransitionsEvaluatedToTrueExecuteDecisionCondition() {
+
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/exclusiveGatewayTwoTransitions.bpmn.xml").deploy();
+
+ try {
+ ProcessInstance pi = executionService.startProcessInstanceByKey("exclusiveGatewayTwoTransitions");
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ assertEquals(1, allTasks.size());
+ assertEquals("testTask1", allTasks.get(0).getActivityName());
+ taskService.completeTask( allTasks.get(0).getId());
+
+ allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+ assertEquals("testTask2", allTasks.get(0).getActivityName());
+
+ HashMap<String, Integer> vars = new HashMap<String, Integer>();
+ vars.put("variable", 3);
+
+ taskService.completeTask( allTasks.get(0).getId(),vars);
+
+ allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+
+ taskService.completeTask( allTasks.get(0).getId());
+
+ // process instance should be ended
+ pi = executionService.findProcessInstanceById(pid);
+ assertNull(pi);
+
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
public void testNormalExecuteDefault() {
String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/exclusiveGateway.bpmn.xml").deploy();
Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayTwoTransitions.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayTwoTransitions.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayTwoTransitions.bpmn.xml 2010-06-01 18:39:14 UTC (rev 6387)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions id="testComplexSituationExecuteDecisionConditionProcesses" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 BPMN20.xsd"
+ xmlns="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://vitras.com/rwar"
+ xmlns:jbpm="http://jbpm.org/bpmn2">
+
+ <process id="exclusiveGatewayTwoTransitions" name="exclusiveGatewayTwoTransitions">
+
+ <startEvent id="start" />
+
+ <sequenceFlow id="initial" name="toTestTask1" sourceRef="start"
+ targetRef="testTask1" />
+
+ <userTask id="testTask1" name="testTask1" implementation="other" />
+
+ <sequenceFlow id="toTestTask1" sourceRef="testTask1"
+ targetRef="testTask2" />
+
+ <userTask id="testTask2" name="testTask2" implementation="other" />
+
+ <sequenceFlow id="toExclusiveGateway1" sourceRef="testTask2"
+ targetRef="exclusiveGateway1" />
+
+ <exclusiveGateway id="exclusiveGateway1" name="exclusiveGateway1" />
+
+ <sequenceFlow id="toTestTask3" sourceRef="exclusiveGateway1" targetRef="testTask3">
+ <conditionExpression xsi:type="tFormalExpression">${variable>2}</conditionExpression>
+ </sequenceFlow>
+
+ <sequenceFlow id="toTestTask1Again" sourceRef="exclusiveGateway1"
+ targetRef="testTask1" />
+
+ <userTask id="testTask3" name="TestTask3" implementation="other" />
+
+ <sequenceFlow id="toEnd" name="to End" sourceRef="testTask3"
+ targetRef="end" />
+
+ <endEvent id="end" name="End" />
+
+ </process>
+</definitions>
15 years, 11 months
JBoss JBPM SVN: r6386 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src: test/java/org/jbpm and 1 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-06-01 04:29:00 -0400 (Tue, 01 Jun 2010)
New Revision: 6386
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2825/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
Log:
JBPM-2825: do not throw NPE from ProcessClassLoader when there is no current context
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java 2010-06-01 03:21:15 UTC (rev 6385)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java 2010-06-01 08:29:00 UTC (rev 6386)
@@ -54,54 +54,54 @@
}
protected ProcessDefinition getProcessDefinition() {
- return processDefinition != null ? processDefinition : JbpmContext.getCurrentJbpmContext()
- .getGraphSession()
- .loadProcessDefinition(processDefinitionId);
+ if (processDefinition != null) return processDefinition;
+
+ JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
+ if (jbpmContext != null) {
+ return jbpmContext.getGraphSession().loadProcessDefinition(processDefinitionId);
+ }
+
+ return null;
}
public URL findResource(String name) {
ProcessDefinition processDefinition = getProcessDefinition();
- FileDefinition fileDefinition = processDefinition.getFileDefinition();
- if (fileDefinition != null) {
- // we know that the leading slashes are removed in the names of the
- // file definitions, therefore we skip the leading slashes
- int off = 0;
- for (int len = name.length(); off < len && name.charAt(off) == '/'; off++)
- /* just increase offset */;
+ FileDefinition fileDefinition;
+ if (processDefinition == null
+ || (fileDefinition = processDefinition.getFileDefinition()) == null) return null;
- // if the name of the resources is absolute (starts with one or more slashes)
- if (off > 0) {
- // then start searching from the root of the process archive
- name = name.substring(off);
- }
- else {
- // otherwise (if the resource is relative), look in the classes
- // directory in the process archive
- name = "classes/" + name;
- }
+ // we know that the leading slashes are removed in the names of the
+ // file definitions, therefore we skip the leading slashes
+ int off = 0;
+ for (int len = name.length(); off < len && name.charAt(off) == '/'; off++)
+ /* just increase offset */;
- byte[] bytes = null;
- if (fileDefinition.hasFile(name)) {
- bytes = fileDefinition.getBytes(name);
- }
- if (bytes != null) {
- try {
- return new URL(null, "processresource://"
- + processDefinition.getName()
- + "/classes/"
- + name, new BytesUrlStreamHandler(bytes));
- }
- catch (MalformedURLException e) {
- throw new JbpmException("couldn't create url", e);
- }
- }
+ // if the name of the resources is absolute (starts with one or more slashes)
+ if (off > 0) {
+ // then start searching from the root of the process archive
+ name = name.substring(off);
}
- return null;
+ else {
+ // otherwise (if the resource is relative), look in the classes
+ // directory of the file module definition
+ name = "classes/" + name;
+ }
+
+ byte[] bytes = fileDefinition.getBytes(name);
+ if (bytes == null) return null;
+
+ try {
+ return new URL("processresource", processDefinition.getName(), -1, "classes/" + name,
+ new BytesUrlStreamHandler(bytes));
+ }
+ catch (MalformedURLException e) {
+ throw new JbpmException("could not create url", e);
+ }
}
public static class BytesUrlStreamHandler extends URLStreamHandler {
- byte[] bytes;
+ private byte[] bytes;
public BytesUrlStreamHandler(byte[] bytes) {
this.bytes = bytes;
@@ -114,7 +114,7 @@
public static class BytesUrlConnection extends URLConnection {
- byte[] bytes = null;
+ private byte[] bytes;
public BytesUrlConnection(byte[] bytes, URL u) {
super(u);
@@ -131,30 +131,30 @@
public Class findClass(String className) throws ClassNotFoundException {
ProcessDefinition processDefinition = getProcessDefinition();
- FileDefinition fileDefinition = processDefinition.getFileDefinition();
- if (fileDefinition != null) {
- String fileName = "classes/" + className.replace('.', '/') + ".class";
- byte[] classBytes = fileDefinition.getBytes(fileName);
+ FileDefinition fileDefinition;
+ if (processDefinition == null
+ || (fileDefinition = processDefinition.getFileDefinition()) == null) {
+ throw new ClassNotFoundException(className);
+ }
- if (classBytes != null) {
- // define the package before defining the class
- // see https://jira.jboss.org/jira/browse/JBPM-1404
- int packageIndex = className.lastIndexOf('.');
+ // look in the classes directory of the file module definition
+ String fileName = "classes/" + className.replace('.', '/') + ".class";
+ byte[] classBytes = fileDefinition.getBytes(fileName);
+ if (classBytes == null) throw new ClassNotFoundException(className);
- if (packageIndex != -1) {
- String packageName = className.substring(0, packageIndex);
+ // define the package before defining the class
+ // see https://jira.jboss.org/jira/browse/JBPM-1404
+ int packageIndex = className.lastIndexOf('.');
- if (getPackage(packageName) == null) {
- Package jbpmPackage = ProcessClassLoader.class.getPackage();
- definePackage(packageName, processDefinition.getName(),
- Integer.toString(processDefinition.getVersion()), null,
- jbpmPackage.getImplementationTitle(), jbpmPackage.getImplementationVersion(),
- jbpmPackage.getImplementationVersion(), null);
- }
- }
- return defineClass(className, classBytes, 0, classBytes.length);
+ if (packageIndex != -1) {
+ String packageName = className.substring(0, packageIndex);
+
+ if (getPackage(packageName) == null) {
+ Package jbpmPackage = ProcessClassLoader.class.getPackage();
+ definePackage(packageName, null, null, null, jbpmPackage.getImplementationTitle(),
+ jbpmPackage.getImplementationVersion(), jbpmPackage.getImplementationVendor(), null);
}
}
- throw new ClassNotFoundException(className);
+ return defineClass(className, classBytes, 0, classBytes.length);
}
}
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java 2010-06-01 08:29:00 UTC (rev 6386)
@@ -0,0 +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.jbpm2825;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.file.def.FileDefinition;
+import org.jbpm.graph.def.ProcessDefinition;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class JBPM2825Test extends AbstractDbTestCase {
+
+ public void testProcessClassLoaderOutsideContext() {
+ FileDefinition fileDefinition = new FileDefinition();
+ byte[] magicNumber = {
+ (byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE
+ };
+ fileDefinition.addFile("classes/org/example/Undef", magicNumber);
+
+ ProcessDefinition processDefinition = new ProcessDefinition(getName());
+ processDefinition.addDefinition(fileDefinition);
+ jbpmContext.deployProcessDefinition(processDefinition);
+
+ ClassLoader procClassLoader = JbpmConfiguration.getProcessClassLoader(processDefinition);
+ String undefClassName = "org.example.Undef";
+
+ closeJbpmContext();
+ try {
+ Class.forName(undefClassName, false, procClassLoader);
+ fail("expected class " + undefClassName + " to not be found");
+ }
+ catch (ClassNotFoundException e) {
+ assertEquals(undefClassName, e.getMessage());
+ }
+ finally {
+ createJbpmContext();
+ }
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
15 years, 11 months