[jbpm-commits] JBoss JBPM SVN: r2451 - in projects/spec/trunk/modules: cts and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Sep 30 14:43:01 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-09-30 14:43:01 -0400 (Tue, 30 Sep 2008)
New Revision: 2451
Added:
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityInputSetTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityOutputSetTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityPropertyTest.java
Removed:
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/activity/
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityInputSetTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityOutputSetTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityPropertyTest.java
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Node.java
projects/spec/trunk/modules/cts/pom.xml
projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java
Log:
NodePropertyTest - pass
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Node.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Node.java 2008-09-30 15:07:24 UTC (rev 2450)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Node.java 2008-09-30 18:43:01 UTC (rev 2451)
@@ -23,6 +23,8 @@
//$Id$
+import java.util.List;
+
import org.jbpm.api.runtime.ExecutionHandler;
import org.jbpm.api.runtime.FlowHandler;
import org.jbpm.api.runtime.SignalHandler;
@@ -41,6 +43,12 @@
/** Get the unique name. */
String getName();
+ /**
+ * One or more assignment expressions MAY be made for the object.
+ * The Assignment SHALL be performed as defined by the AssignTime attribute.
+ */
+ List<Assignment> getAssignments();
+
/** Get the associated ExecutionHandler */
ExecutionHandler getExecutionHandler(boolean defaultHandler);
Modified: projects/spec/trunk/modules/cts/pom.xml
===================================================================
--- projects/spec/trunk/modules/cts/pom.xml 2008-09-30 15:07:24 UTC (rev 2450)
+++ projects/spec/trunk/modules/cts/pom.xml 2008-09-30 18:43:01 UTC (rev 2451)
@@ -70,9 +70,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
- <exclude>org/jbpm/test/cts/activity/ActivityInputSetTest.java</exclude>
- <exclude>org/jbpm/test/cts/activity/ActivityOutputSetTest.java</exclude>
- <exclude>org/jbpm/test/cts/activity/ActivityPropertyTest.java</exclude>
<exclude>org/jbpm/test/cts/endevent/EndEventMessageTest.java</exclude>
<exclude>org/jbpm/test/cts/executioncontext/ExecutionContextTest.java</exclude>
<exclude>org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewayMergeTest.java</exclude>
@@ -81,6 +78,8 @@
<exclude>org/jbpm/test/cts/gateway/inclusive/InclusiveGatewaySplitTest.java</exclude>
<exclude>org/jbpm/test/cts/gateway/parallel/ParallelGatewayMergeTest.java</exclude>
<exclude>org/jbpm/test/cts/gateway/parallel/ParallelGatewaySplitTest.java</exclude>
+ <exclude>org/jbpm/test/cts/node/ActivityInputSetTest.java</exclude>
+ <exclude>org/jbpm/test/cts/node/ActivityOutputSetTest.java</exclude>
<exclude>org/jbpm/test/cts/processmanager/ProcessManagerTest.java</exclude>
<exclude>org/jbpm/test/cts/signalmanager/SignalManagerTest.java</exclude>
<exclude>org/jbpm/test/cts/startevent/StartEventSignalTest.java</exclude>
Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node (from rev 2445, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/activity)
Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityInputSetTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/activity/ActivityInputSetTest.java 2008-09-30 08:24:31 UTC (rev 2445)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityInputSetTest.java 2008-09-30 18:43:01 UTC (rev 2451)
@@ -1,93 +0,0 @@
-/*
- * 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.cts.activity;
-
-// $Id$
-
-import java.io.IOException;
-
-import org.jbpm.api.model.Message;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.EndEvent.ResultType;
-import org.jbpm.api.model.builder.MessageBuilder;
-import org.jbpm.api.model.builder.ProcessBuilder;
-import org.jbpm.api.model.builder.ProcessBuilderService;
-import org.jbpm.api.runtime.BasicAttachments;
-import org.jbpm.api.test.CTSTestCase;
-
-/**
- * InputSets define the data requirements for input to the activity. Zero or more InputSets MAY be defined. Each
- * InputSet is sufficient to allow the activity to be performed (if it has first been instantiated by the appropriate
- * signal arriving from an incoming Sequence Flow).
- *
- * https://jira.jboss.org/jira/browse/JBPM-1702
- *
- * @author thomas.diesler at jboss.com
- * @since 15-Aug-2008
- */
-public class ActivityInputSetTest extends CTSTestCase
-{
- public void testValidProps() throws Exception
- {
- Process proc = getProcess();
-
- BasicAttachments att = new BasicAttachments();
- att.addAttachment("frog", "kermit");
- proc.startProcess(att);
- proc.waitForEnd();
-
- Message endMessage = getMessages().get(0);
- assertNotNull("EndMessage expected", endMessage);
- assertEquals("kermit", endMessage.getProperty("frog").getValue());
- }
-
- public void testInvalidProps() throws Exception
- {
- Process proc = getProcess();
-
- BasicAttachments att = new BasicAttachments();
- att.addAttachment("pig", "piggy");
- proc.startProcess(att);
-
- try
- {
- proc.waitForEnd();
- }
- catch (RuntimeException ex)
- {
- // expected
- }
- }
-
- protected Process getProcess() throws IOException
- {
- ProcessBuilder procBuilder = ProcessBuilderService.locateProcessBuilder();
- procBuilder.addProcess("ActivityInputSet").addStartEvent("Start").addSequenceFlow("TaskA");
- //TaskBuilder taskBuilder = procBuilder.addTask("TaskA");
- //taskBuilder.addInputSet().addPropertyInput("frog").addSequenceFlow("End");
- procBuilder.addEndEvent("End", ResultType.Message).addMessageRef("EndMessage");
- MessageBuilder msgBuilder = procBuilder.addMessage("EndMessage");
- msgBuilder.addToRef(getTestID()).addProperty("frog", null, true);
- Process proc = procBuilder.getProcess();
- return proc;
- }
-}
Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityInputSetTest.java (from rev 2450, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/activity/ActivityInputSetTest.java)
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityInputSetTest.java (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityInputSetTest.java 2008-09-30 18:43:01 UTC (rev 2451)
@@ -0,0 +1,93 @@
+/*
+ * 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.cts.node;
+
+// $Id$
+
+import java.io.IOException;
+
+import org.jbpm.api.model.Message;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.Event.EventDetailType;
+import org.jbpm.api.model.builder.MessageBuilder;
+import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.api.model.builder.ProcessBuilderService;
+import org.jbpm.api.runtime.BasicAttachments;
+import org.jbpm.api.test.CTSTestCase;
+
+/**
+ * InputSets define the data requirements for input to the activity. Zero or more InputSets MAY be defined. Each
+ * InputSet is sufficient to allow the activity to be performed (if it has first been instantiated by the appropriate
+ * signal arriving from an incoming Sequence Flow).
+ *
+ * https://jira.jboss.org/jira/browse/JBPM-1702
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 15-Aug-2008
+ */
+public class ActivityInputSetTest extends CTSTestCase
+{
+ public void testValidProps() throws Exception
+ {
+ Process proc = getProcess();
+
+ BasicAttachments att = new BasicAttachments();
+ att.addAttachment("frog", "kermit");
+ proc.startProcess(att);
+ proc.waitForEnd();
+
+ Message endMessage = getMessages().get(0);
+ assertNotNull("EndMessage expected", endMessage);
+ assertEquals("kermit", endMessage.getProperty("frog").getValue());
+ }
+
+ public void testInvalidProps() throws Exception
+ {
+ Process proc = getProcess();
+
+ BasicAttachments att = new BasicAttachments();
+ att.addAttachment("pig", "piggy");
+ proc.startProcess(att);
+
+ try
+ {
+ proc.waitForEnd();
+ }
+ catch (RuntimeException ex)
+ {
+ // expected
+ }
+ }
+
+ protected Process getProcess() throws IOException
+ {
+ ProcessBuilder procBuilder = ProcessBuilderService.locateProcessBuilder();
+ procBuilder.addProcess("ActivityInputSet").addStartEvent("Start").addSequenceFlow("TaskA");
+ //TaskBuilder taskBuilder = procBuilder.addTask("TaskA");
+ //taskBuilder.addInputSet().addPropertyInput("frog").addSequenceFlow("End");
+ procBuilder.addEndEvent("End", EventDetailType.Message).addMessageRef("EndMessage");
+ MessageBuilder msgBuilder = procBuilder.addProcessMessage("EndMessage");
+ msgBuilder.addToRef(getTestID()).addProperty("frog", null, true);
+ Process proc = procBuilder.getProcess();
+ return proc;
+ }
+}
Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityOutputSetTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/activity/ActivityOutputSetTest.java 2008-09-30 08:24:31 UTC (rev 2445)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityOutputSetTest.java 2008-09-30 18:43:01 UTC (rev 2451)
@@ -1,73 +0,0 @@
-/*
- * 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.cts.activity;
-
-// $Id$
-
-import java.io.IOException;
-
-import org.jbpm.api.model.Message;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.EndEvent.ResultType;
-import org.jbpm.api.model.builder.MessageBuilder;
-import org.jbpm.api.model.builder.ProcessBuilder;
-import org.jbpm.api.model.builder.ProcessBuilderService;
-import org.jbpm.api.test.CTSTestCase;
-
-/**
- * OutputSets define the data requirements for output from the activity. Zero or more OutputSets MAY be defined. At the
- * completion of the activity, only one of the OutputSets may be produced. It is up to the implementation of the
- * activity to determine which set will be produced. However, the IORules MAY indicate a relationship between an
- * OutputSet and an InputSet that started the activity.
- *
- * https://jira.jboss.org/jira/browse/JBPM-1703
- *
- * @author thomas.diesler at jboss.com
- * @since 15-Aug-2008
- */
-public class ActivityOutputSetTest extends CTSTestCase
-{
- public void testValidProps() throws Exception
- {
- Process proc = getProcess();
-
- proc.startProcess();
- proc.waitForEnd();
-
- Message endMessage = getMessages().get(0);
- assertNotNull("EndMessage expected", endMessage);
- assertEquals("kermit", endMessage.getProperty("frog").getValue());
- }
-
- protected Process getProcess() throws IOException
- {
- ProcessBuilder procBuilder = ProcessBuilderService.locateProcessBuilder();
- procBuilder.addProcess("ActivityInputSet").addStartEvent("Start").addSequenceFlow("TaskA");
- //TaskBuilder taskBuilder = procBuilder.addTask("TaskA");
- //taskBuilder.addOutputSet().addPropertyOutput("frog", "kermit").addSequenceFlow("End");
- procBuilder.addEndEvent("End", ResultType.Message).addMessageRef("EndMessage");
- MessageBuilder msgBuilder = procBuilder.addMessage("EndMessage");
- msgBuilder.addToRef(getTestID()).addProperty("frog", null, true);
- Process proc = procBuilder.getProcess();
- return proc;
- }
-}
Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityOutputSetTest.java (from rev 2450, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/activity/ActivityOutputSetTest.java)
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityOutputSetTest.java (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityOutputSetTest.java 2008-09-30 18:43:01 UTC (rev 2451)
@@ -0,0 +1,73 @@
+/*
+ * 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.cts.node;
+
+// $Id$
+
+import java.io.IOException;
+
+import org.jbpm.api.model.Message;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.Event.EventDetailType;
+import org.jbpm.api.model.builder.MessageBuilder;
+import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.api.model.builder.ProcessBuilderService;
+import org.jbpm.api.test.CTSTestCase;
+
+/**
+ * OutputSets define the data requirements for output from the activity. Zero or more OutputSets MAY be defined. At the
+ * completion of the activity, only one of the OutputSets may be produced. It is up to the implementation of the
+ * activity to determine which set will be produced. However, the IORules MAY indicate a relationship between an
+ * OutputSet and an InputSet that started the activity.
+ *
+ * https://jira.jboss.org/jira/browse/JBPM-1703
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 15-Aug-2008
+ */
+public class ActivityOutputSetTest extends CTSTestCase
+{
+ public void testValidProps() throws Exception
+ {
+ Process proc = getProcess();
+
+ proc.startProcess();
+ proc.waitForEnd();
+
+ Message endMessage = getMessages().get(0);
+ assertNotNull("EndMessage expected", endMessage);
+ assertEquals("kermit", endMessage.getProperty("frog").getValue());
+ }
+
+ protected Process getProcess() throws IOException
+ {
+ ProcessBuilder procBuilder = ProcessBuilderService.locateProcessBuilder();
+ procBuilder.addProcess("ActivityInputSet").addStartEvent("Start").addSequenceFlow("TaskA");
+ //TaskBuilder taskBuilder = procBuilder.addTask("TaskA");
+ //taskBuilder.addOutputSet().addPropertyOutput("frog", "kermit").addSequenceFlow("End");
+ procBuilder.addEndEvent("End", EventDetailType.Message).addMessageRef("EndMessage");
+ MessageBuilder msgBuilder = procBuilder.addProcessMessage("EndMessage");
+ msgBuilder.addToRef(getTestID()).addProperty("frog", null, true);
+ Process proc = procBuilder.getProcess();
+ return proc;
+ }
+}
Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityPropertyTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/activity/ActivityPropertyTest.java 2008-09-30 08:24:31 UTC (rev 2445)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityPropertyTest.java 2008-09-30 18:43:01 UTC (rev 2451)
@@ -1,73 +0,0 @@
-/*
- * 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.cts.activity;
-
-// $Id$
-
-import java.io.IOException;
-
-import org.jbpm.api.model.Message;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.EndEvent.ResultType;
-import org.jbpm.api.model.builder.MessageBuilder;
-import org.jbpm.api.model.builder.ProcessBuilder;
-import org.jbpm.api.model.builder.ProcessBuilderService;
-import org.jbpm.api.model.builder.TaskBuilder;
-import org.jbpm.api.test.CTSTestCase;
-
-/**
- * Modeler-defined Properties MAY be added to an activity. These Properties are "local" to the activity. These
- * Properties are only for use within the processing of the activity. The fully delineated name of these properties is
- * "<process name>.<activity name>.<property name>" (e.g., "Add Customer.Review Credit.Status").
- *
- * https://jira.jboss.org/jira/browse/JBPM-1621
- *
- * @author thomas.diesler at jboss.com
- * @since 15-Aug-2008
- */
-public class ActivityPropertyTest extends CTSTestCase
-{
- public void testActivityPropertyRead() throws Exception
- {
- Process proc = getProcess();
- proc.startProcess();
- proc.waitForEnd();
-
- Message endMessage = getMessages().get(0);
- assertNotNull("EndMessage expected", endMessage);
- assertEquals("bar", endMessage.getProperty("propValue").getValue());
- }
-
- protected Process getProcess() throws IOException
- {
- ProcessBuilder procBuilder = ProcessBuilderService.locateProcessBuilder();
- procBuilder.addProcess("ActivityProperties").addStartEvent("Start").addSequenceFlow("TaskA");
- TaskBuilder taskBuilder = procBuilder.addTask("TaskA");
- taskBuilder.addProperty("foo", "bar").addSequenceFlow("End");
- //taskBuilder.addAssignment(AssignTime.Start, ExpressionLanguage.MVEL, "ActivityProperties_TaskA_foo", "propValue");
- procBuilder.addEndEvent("End", ResultType.Message).addMessageRef("EndMessage");
- MessageBuilder msgBuilder = procBuilder.addMessage("EndMessage");
- msgBuilder.addToRef(getTestID()).addProperty("propValue", null, true);
- Process proc = procBuilder.getProcess();
- return proc;
- }
-}
Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityPropertyTest.java (from rev 2450, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/activity/ActivityPropertyTest.java)
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityPropertyTest.java (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityPropertyTest.java 2008-09-30 18:43:01 UTC (rev 2451)
@@ -0,0 +1,75 @@
+/*
+ * 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.cts.node;
+
+// $Id$
+
+import java.io.IOException;
+
+import org.jbpm.api.model.Message;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.Assignment.AssignTime;
+import org.jbpm.api.model.Event.EventDetailType;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
+import org.jbpm.api.model.builder.MessageBuilder;
+import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.api.model.builder.ProcessBuilderService;
+import org.jbpm.api.model.builder.TaskBuilder;
+import org.jbpm.api.test.CTSTestCase;
+
+/**
+ * Modeler-defined Properties MAY be added to an activity. These Properties are "local" to the activity. These
+ * Properties are only for use within the processing of the activity. The fully delineated name of these properties is
+ * "<process name>.<activity name>.<property name>" (e.g., "Add Customer.Review Credit.Status").
+ *
+ * https://jira.jboss.org/jira/browse/JBPM-1621
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 15-Aug-2008
+ */
+public class ActivityPropertyTest extends CTSTestCase
+{
+ public void testActivityPropertyRead() throws Exception
+ {
+ Process proc = getProcess();
+ proc.startProcess();
+ proc.waitForEnd();
+
+ Message endMessage = getMessages().get(0);
+ assertNotNull("EndMessage expected", endMessage);
+ assertEquals("bar", endMessage.getProperty("propValue").getValue());
+ }
+
+ protected Process getProcess() throws IOException
+ {
+ ProcessBuilder procBuilder = ProcessBuilderService.locateProcessBuilder();
+ procBuilder.addProcess("ActivityProperties").addStartEvent("Start").addSequenceFlow("TaskA");
+ TaskBuilder taskBuilder = procBuilder.addTask("TaskA");
+ taskBuilder.addNodeProperty("foo", "bar").addSequenceFlow("End");
+ taskBuilder.addNodeAssignment(AssignTime.Start, ExpressionLanguage.MVEL, "ActivityProperties_TaskA_foo", "propValue");
+ procBuilder.addEndEvent("End", EventDetailType.Message).addMessageRef("EndMessage");
+ MessageBuilder msgBuilder = procBuilder.addProcessMessage("EndMessage");
+ msgBuilder.addToRef(getTestID()).addProperty("propValue", null, true);
+ Process proc = procBuilder.getProcess();
+ return proc;
+ }
+}
Modified: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java 2008-09-30 15:07:24 UTC (rev 2450)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java 2008-09-30 18:43:01 UTC (rev 2451)
@@ -31,10 +31,14 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import org.jbpm.api.model.Assignment;
+import org.jbpm.api.model.Expression;
import org.jbpm.api.model.Node;
import org.jbpm.api.model.Process;
import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.Assignment.AssignTime;
import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.runtime.ExecutionContext;
import org.jbpm.api.runtime.ExecutionHandler;
import org.jbpm.api.runtime.FlowHandler;
import org.jbpm.api.runtime.SignalHandler;
@@ -237,9 +241,15 @@
// Throw the Enter Signal
sigHandler.throwEnterSignal(tokCopy);
+ // Process the start time assignments
+ startTimeAssignments(node, tokCopy);
+
// Execute the target Node
execHandler.execute(tokCopy);
+ // Process the end time assignments
+ endTimeAssignments(node, tokCopy);
+
// Transfer the token to the FlowHandler
flowHandler.execute(tokenExecutor, tokCopy);
@@ -291,6 +301,34 @@
}
}
+ private void startTimeAssignments(Node node, Token token)
+ {
+ for (Assignment ass : node.getAssignments())
+ {
+ if (ass.getAssignTime() == AssignTime.Start)
+ anyTimeAssignment(ass, token);
+ }
+ }
+
+ private void endTimeAssignments(Node node, Token token)
+ {
+ for (Assignment ass : node.getAssignments())
+ {
+ if (ass.getAssignTime() == AssignTime.End)
+ anyTimeAssignment(ass, token);
+ }
+ }
+
+ private void anyTimeAssignment(Assignment ass, Token token)
+ {
+ Expression expr = ass.getFrom();
+ ExpressionEvaluator exprEvaluator = new ExpressionEvaluator(expr);
+ Object result = exprEvaluator.evaluateExpression(token);
+ String propName = ass.getTo().getName();
+ ExecutionContext exContext = token.getExecutionContext();
+ exContext.addAttachment(propName, result);
+ }
+
private SignalHandler getSignalHandler(Node target)
{
SignalHandler customHandler = target.getSignalHandler(false);
More information about the jbpm-commits
mailing list