[jbpm-commits] JBoss JBPM SVN: r2452 - in projects/spec/trunk/modules/cts: src/test/java/org/jbpm/test/cts/node and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Sep 30 14:45:02 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-09-30 14:45:02 -0400 (Tue, 30 Sep 2008)
New Revision: 2452

Added:
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeInputSetTest.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeOutputSetTest.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodePropertyTest.java
Removed:
   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/cts/pom.xml
Log:
EndEventMessageTest - pass

Modified: projects/spec/trunk/modules/cts/pom.xml
===================================================================
--- projects/spec/trunk/modules/cts/pom.xml	2008-09-30 18:43:01 UTC (rev 2451)
+++ projects/spec/trunk/modules/cts/pom.xml	2008-09-30 18:45:02 UTC (rev 2452)
@@ -70,7 +70,6 @@
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <excludes>
-            <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>
             <exclude>org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitTest.java</exclude>
@@ -78,8 +77,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/node/NodeInputSetTest.java</exclude>
+            <exclude>org/jbpm/test/cts/node/NodeOutputSetTest.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>

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/node/ActivityInputSetTest.java	2008-09-30 18:43:01 UTC (rev 2451)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityInputSetTest.java	2008-09-30 18:45:02 UTC (rev 2452)
@@ -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.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/node/ActivityOutputSetTest.java	2008-09-30 18:43:01 UTC (rev 2451)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityOutputSetTest.java	2008-09-30 18:45:02 UTC (rev 2452)
@@ -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.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/node/ActivityPropertyTest.java	2008-09-30 18:43:01 UTC (rev 2451)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/ActivityPropertyTest.java	2008-09-30 18:45:02 UTC (rev 2452)
@@ -1,75 +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.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;
-  }
-}

Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeInputSetTest.java (from rev 2451, 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/NodeInputSetTest.java	                        (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeInputSetTest.java	2008-09-30 18:45:02 UTC (rev 2452)
@@ -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 NodeInputSetTest 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;
+  }
+}

Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeOutputSetTest.java (from rev 2451, 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/NodeOutputSetTest.java	                        (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeOutputSetTest.java	2008-09-30 18:45:02 UTC (rev 2452)
@@ -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 NodeOutputSetTest 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;
+  }
+}

Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodePropertyTest.java (from rev 2451, 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/node/NodePropertyTest.java	                        (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodePropertyTest.java	2008-09-30 18:45:02 UTC (rev 2452)
@@ -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 NodePropertyTest 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;
+  }
+}




More information about the jbpm-commits mailing list