[jbpm-commits] JBoss JBPM SVN: r2157 - in jbpm3/trunk/modules/core: src/test/java/org/jbpm/instantiation and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Sep 10 03:07:32 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-09-10 03:07:31 -0400 (Wed, 10 Sep 2008)
New Revision: 2157

Added:
   jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/memleaktest.processdefinition.xml
Removed:
   jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/convert/
   jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/.gpd.memleaktest.processdefinition.xml
Modified:
   jbpm3/trunk/modules/core/pom.xml
   jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/UserCodeInterceptorTest.java
   jbpm3/trunk/modules/core/src/test/java/org/jbpm/perf/PerfWithoutDbTest.java
Log:
Cleanup stale core tests

Modified: jbpm3/trunk/modules/core/pom.xml
===================================================================
--- jbpm3/trunk/modules/core/pom.xml	2008-09-10 06:04:08 UTC (rev 2156)
+++ jbpm3/trunk/modules/core/pom.xml	2008-09-10 07:07:31 UTC (rev 2157)
@@ -175,37 +175,19 @@
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
               <excludes>
-                <!--
-                  Cleanup stale tests from the testsuite http://jira.jboss.org/jira/browse/JBPM-1205
-                -->
-                <exclude>org/jbpm/context/exe/VariableQueryDbTest.java</exclude>
-                <exclude>org/jbpm/db/ContextSessionDbTest.java</exclude>
-                <exclude>org/jbpm/DefaultConfigurationTest.java</exclude>
-                <exclude>org/jbpm/graph/def/ExceptionHandlerDbTest.java</exclude>
-                <exclude>org/jbpm/graph/def/TransitionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/StateDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SubProcessCancellationTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SuperStateActionExecutionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/log/NodeLogTest.java</exclude>
-                <exclude>org/jbpm/instantiation/UserCodeInterceptorTest.java</exclude>
-                <exclude>org/jbpm/JbpmDefaultConfigTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1720 -->
                 <exclude>org/jbpm/jcr/JcrDbTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
                 <exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
                 <exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
-                <exclude>org/jbpm/jpdl/convert/ConversionTestCase.java</exclude>
-                <exclude>org/jbpm/jpdl/xml/SchemaTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LoggingConfigDbTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LogLogTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
                 <exclude>org/jbpm/mail/MailTest.java</exclude>
                 <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
                 <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
-                <exclude>org/jbpm/mock/JdbcProxyTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
                 <exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
                 <exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
-                <exclude>org/jbpm/perf/TasklistEagerLoadingTest.java</exclude>
-                <exclude>org/jbpm/perf/TaskWithVariablesTest.java</exclude>
-                <exclude>org/jbpm/persistence/db/PersistenceConfigurationTest.java</exclude>
-                <exclude>org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
                 <exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
               </excludes>
             </configuration>
@@ -232,38 +214,24 @@
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
               <excludes>
-                <!--
-                  Cleanup stale tests from the testsuite http://jira.jboss.org/jira/browse/JBPM-1205
-                -->
-                <exclude>org/jbpm/context/exe/VariableQueryDbTest.java</exclude>
-                <exclude>org/jbpm/db/ContextSessionDbTest.java</exclude>
-                <exclude>org/jbpm/DefaultConfigurationTest.java</exclude>
-                <exclude>org/jbpm/graph/def/ExceptionHandlerDbTest.java</exclude>
-                <exclude>org/jbpm/graph/def/TransitionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/StateDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SubProcessCancellationTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SuperStateActionExecutionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/log/NodeLogTest.java</exclude>
-                <exclude>org/jbpm/instantiation/UserCodeInterceptorTest.java</exclude>
-                <exclude>org/jbpm/JbpmDefaultConfigTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1720 -->
                 <exclude>org/jbpm/jcr/JcrDbTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
                 <exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
                 <exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
-                <exclude>org/jbpm/jpdl/convert/ConversionTestCase.java</exclude>
-                <exclude>org/jbpm/jpdl/xml/SchemaTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LoggingConfigDbTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LogLogTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
                 <exclude>org/jbpm/mail/MailTest.java</exclude>
                 <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
                 <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
-                <exclude>org/jbpm/mock/JdbcProxyTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
                 <exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
                 <exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
-                <exclude>org/jbpm/perf/TasklistEagerLoadingTest.java</exclude>
-                <exclude>org/jbpm/perf/TaskWithVariablesTest.java</exclude>
-                <exclude>org/jbpm/persistence/db/PersistenceConfigurationTest.java</exclude>
-                <exclude>org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
                 <exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1725 -->
+                <exclude>org/jbpm/context/exe/ContextInstanceDbTest.java</exclude>
+                <exclude>org/jbpm/graph/node/StartStateDbTest.java</exclude>
+                <exclude>org/jbpm/optimisticlocking/LockingTest.java</exclude>
               </excludes>
             </configuration>
           </plugin>
@@ -289,44 +257,20 @@
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
               <excludes>
-                <!--
-                  Cleanup stale tests from the testsuite http://jira.jboss.org/jira/browse/JBPM-1205
-                -->
-                <exclude>org/jbpm/context/exe/VariableQueryDbTest.java</exclude>
-                <exclude>org/jbpm/db/ContextSessionDbTest.java</exclude>
-                <exclude>org/jbpm/DefaultConfigurationTest.java</exclude>
-                <exclude>org/jbpm/graph/def/ExceptionHandlerDbTest.java</exclude>
-                <exclude>org/jbpm/graph/def/TransitionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/StateDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SubProcessCancellationTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SuperStateActionExecutionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/log/NodeLogTest.java</exclude>
-                <exclude>org/jbpm/instantiation/UserCodeInterceptorTest.java</exclude>
-                <exclude>org/jbpm/JbpmDefaultConfigTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1720 -->
                 <exclude>org/jbpm/jcr/JcrDbTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
                 <exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
                 <exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
-                <exclude>org/jbpm/jpdl/convert/ConversionTestCase.java</exclude>
-                <exclude>org/jbpm/jpdl/xml/SchemaTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LoggingConfigDbTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LogLogTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
                 <exclude>org/jbpm/mail/MailTest.java</exclude>
                 <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
                 <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
-                <exclude>org/jbpm/mock/JdbcProxyTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
                 <exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
                 <exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
-                <exclude>org/jbpm/perf/TasklistEagerLoadingTest.java</exclude>
-                <exclude>org/jbpm/perf/TaskWithVariablesTest.java</exclude>
-                <exclude>org/jbpm/persistence/db/PersistenceConfigurationTest.java</exclude>
-                <exclude>org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
                 <exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
-                <!--
-                  Fix MySQL regression
-                  https://jira.jboss.org/jira/browse/JBPM-1711 
-                 -->
-                <exclude>org/jbpm/persistence/db/PersistenceServiceDbTest.java</exclude>
-                <exclude>org/jbpm/persistence/db/PersistenceServiceFactoryDbTest.java</exclude>
               </excludes>
             </configuration>
           </plugin>
@@ -352,37 +296,19 @@
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
               <excludes>
-                <!--
-                  Cleanup stale tests from the testsuite http://jira.jboss.org/jira/browse/JBPM-1205
-                -->
-                <exclude>org/jbpm/context/exe/VariableQueryDbTest.java</exclude>
-                <exclude>org/jbpm/db/ContextSessionDbTest.java</exclude>
-                <exclude>org/jbpm/DefaultConfigurationTest.java</exclude>
-                <exclude>org/jbpm/graph/def/ExceptionHandlerDbTest.java</exclude>
-                <exclude>org/jbpm/graph/def/TransitionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/StateDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SubProcessCancellationTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SuperStateActionExecutionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/log/NodeLogTest.java</exclude>
-                <exclude>org/jbpm/instantiation/UserCodeInterceptorTest.java</exclude>
-                <exclude>org/jbpm/JbpmDefaultConfigTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1720 -->
                 <exclude>org/jbpm/jcr/JcrDbTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
                 <exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
                 <exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
-                <exclude>org/jbpm/jpdl/convert/ConversionTestCase.java</exclude>
-                <exclude>org/jbpm/jpdl/xml/SchemaTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LoggingConfigDbTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LogLogTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
                 <exclude>org/jbpm/mail/MailTest.java</exclude>
                 <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
                 <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
-                <exclude>org/jbpm/mock/JdbcProxyTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
                 <exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
                 <exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
-                <exclude>org/jbpm/perf/TasklistEagerLoadingTest.java</exclude>
-                <exclude>org/jbpm/perf/TaskWithVariablesTest.java</exclude>
-                <exclude>org/jbpm/persistence/db/PersistenceConfigurationTest.java</exclude>
-                <exclude>org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
                 <exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
               </excludes>
             </configuration>
@@ -409,37 +335,19 @@
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
               <excludes>
-                <!--
-                  Cleanup stale tests from the testsuite http://jira.jboss.org/jira/browse/JBPM-1205
-                -->
-                <exclude>org/jbpm/context/exe/VariableQueryDbTest.java</exclude>
-                <exclude>org/jbpm/db/ContextSessionDbTest.java</exclude>
-                <exclude>org/jbpm/DefaultConfigurationTest.java</exclude>
-                <exclude>org/jbpm/graph/def/ExceptionHandlerDbTest.java</exclude>
-                <exclude>org/jbpm/graph/def/TransitionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/StateDbTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SubProcessCancellationTest.java</exclude>
-                <exclude>org/jbpm/graph/exe/SuperStateActionExecutionDbTest.java</exclude>
-                <exclude>org/jbpm/graph/log/NodeLogTest.java</exclude>
-                <exclude>org/jbpm/instantiation/UserCodeInterceptorTest.java</exclude>
-                <exclude>org/jbpm/JbpmDefaultConfigTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1720 -->
                 <exclude>org/jbpm/jcr/JcrDbTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
                 <exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
                 <exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
-                <exclude>org/jbpm/jpdl/convert/ConversionTestCase.java</exclude>
-                <exclude>org/jbpm/jpdl/xml/SchemaTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LoggingConfigDbTest.java</exclude>
-                <exclude>org/jbpm/logging/exe/LogLogTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
                 <exclude>org/jbpm/mail/MailTest.java</exclude>
                 <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
                 <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
-                <exclude>org/jbpm/mock/JdbcProxyTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
                 <exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
                 <exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
-                <exclude>org/jbpm/perf/TasklistEagerLoadingTest.java</exclude>
-                <exclude>org/jbpm/perf/TaskWithVariablesTest.java</exclude>
-                <exclude>org/jbpm/persistence/db/PersistenceConfigurationTest.java</exclude>
-                <exclude>org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java</exclude>
+                <!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
                 <exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
               </excludes>
             </configuration>

Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/UserCodeInterceptorTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/UserCodeInterceptorTest.java	2008-09-10 06:04:08 UTC (rev 2156)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/UserCodeInterceptorTest.java	2008-09-10 07:07:31 UTC (rev 2157)
@@ -21,53 +21,24 @@
   
   static List logs = null;
 
-  public static class TestInterceptor implements UserCodeInterceptor {
-    
-    public void executeAction(Action action, ExecutionContext executionContext) throws Exception {
-      logs.add("before action "+action.getName()+" in node "+ executionContext.getNode().getName());
-      action.execute(executionContext);
-      logs.add("after action "+action.getName()+" in node "+ executionContext.getNode().getName());
-    }
-    
-    public void executeAssignment(AssignmentHandler assignmentHandler, Assignable assignable, ExecutionContext executionContext) throws Exception {
-      logs.add("before assignment");
-      assignmentHandler.assign(assignable, executionContext);
-      logs.add("after assignment");
-    }
-    
-    public void executeTaskControllerInitialization(TaskControllerHandler taskControllerHandler, TaskInstance taskInstance, ContextInstance contextInstance, Token token) {
-      logs.add("before task controller initialization");
-      taskControllerHandler.initializeTaskVariables(taskInstance, contextInstance, token);
-      logs.add("after task controller initialization");
-    }
-    public void executeTaskControllerSubmission(TaskControllerHandler taskControllerHandler, TaskInstance taskInstance, ContextInstance contextInstance, Token token) {
-      logs.add("before task controller submission");
-      taskControllerHandler.submitTaskVariables(taskInstance, contextInstance, token);
-      logs.add("after task controller submission");
-    }
-  }
-  
   TestInterceptor testInterceptor = null;
 
-  protected void setUp() throws Exception {
+  protected void setUp() throws Exception
+  {
     logs = new ArrayList();
     testInterceptor = new TestInterceptor();
     UserCodeInterceptorConfig.setUserCodeInterceptor(testInterceptor);
   }
-  protected void tearDown() throws Exception {
+
+  protected void tearDown() throws Exception
+  {
     UserCodeInterceptorConfig.setUserCodeInterceptor(null);
     testInterceptor = null;
     logs = null;
   }
   
-  public static class TestAction implements ActionHandler {
-    private static final long serialVersionUID = 1L;
-    public void execute(ExecutionContext executionContext) throws Exception {
-      logs.add("action executed");
-    }
-  }
-  
-  public void testAction() {
+  public void testAction() 
+  {
     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       "  <start-state name='start'>" +
@@ -91,15 +62,74 @@
     assertEquals(expectedLogs, logs);
   }
   
-  public static class TestAutoAction implements ActionHandler {
-    private static final long serialVersionUID = 1L;
-    public void execute(ExecutionContext executionContext) throws Exception {
-      logs.add("auto action executed");
-      executionContext.leaveNode();
-    }
+  public void testInterceptControllerInitialization() 
+  {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
+      "<process-definition>" +
+      "  <start-state name='start'>" +
+      "    <transition to='t'/>" +
+      "  </start-state>" +
+      "  <task-node name='t'>" +
+      "    <task>" +
+      "      <controller class='"+TestController.class.getName()+"'/>" +
+      "    </task>" +
+      "    <transition to='end'/>" +
+      "  </task-node>" +
+      "  <state name='end' />" +
+      "</process-definition>"
+    );
+    // create the process instance
+    ProcessInstance processInstance = new ProcessInstance(processDefinition);
+    processInstance.signal();
+    
+    List expectedLogs = new ArrayList();
+    expectedLogs.add("before task controller initialization");
+    expectedLogs.add("initializing task variables for TaskInstance(t)");
+    expectedLogs.add("after task controller initialization");
+    
+    assertEquals(expectedLogs,logs);
   }
+
+  public void testInterceptControllerSubmission() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
+      "<process-definition>" +
+      "  <start-state name='start'>" +
+      "    <transition to='t'/>" +
+      "  </start-state>" +
+      "  <task-node name='t'>" +
+      "    <task>" +
+      "      <controller class='"+TestController.class.getName()+"'/>" +
+      "    </task>" +
+      "    <transition to='end'/>" +
+      "  </task-node>" +
+      "  <state name='end' />" +
+      "</process-definition>"
+    );
+    // create the process instance
+    ProcessInstance processInstance = new ProcessInstance(processDefinition);
+    processInstance.signal();
+
+    TaskInstance ti = (TaskInstance) processInstance.getTaskMgmtInstance().getTaskInstances().iterator().next();
+    ti.end();
+
+    List expectedLogs = new ArrayList();
+    expectedLogs.add("before task controller initialization");
+    expectedLogs.add("initializing task variables for TaskInstance(t)");
+    expectedLogs.add("after task controller initialization");
+    expectedLogs.add("before task controller submission");
+    expectedLogs.add("submitting task variables for TaskInstance(t)");
+    expectedLogs.add("after task controller submission");
+    
+    assertEquals(expectedLogs.get(0),logs.get(0));
+    assertEquals(expectedLogs.get(1),logs.get(1));
+    assertEquals(expectedLogs.get(2),logs.get(2));
+    assertEquals(expectedLogs.get(3),logs.get(3));
+    assertEquals(expectedLogs.get(4),logs.get(4));
+    assertEquals(expectedLogs.get(5),logs.get(5));
+  }
   
-  public void testNodeBehaviour() {
+  public void testNodeBehaviour() 
+  {
     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       "  <start-state name='start'>" +
@@ -124,7 +154,8 @@
     assertEquals(expectedLogs, logs);
   }
 
-  public void testReferencedNodeBehaviour() {
+  public void testReferencedNodeBehaviour() 
+  {
     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       "  <start-state name='start'>" +
@@ -150,7 +181,8 @@
     assertEquals(expectedLogs, logs);
   }
 
-  public void testReferencedAction() {
+  public void testReferencedAction() 
+  {
     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       "  <start-state name='start'>" +
@@ -178,15 +210,8 @@
     assertEquals(expectedLogs, logs);
   }
   
-  public static class TestAssignment implements AssignmentHandler {
-    private static final long serialVersionUID = 1L;
-    public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception {
-      logs.add("assigning "+assignable);
-      assignable.setActorId("shipper");
-    }
-  }
- 
-  public void testInterceptAssignment() {
+  public void testInterceptAssignment() 
+  {
     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       "  <start-state name='start'>" +
@@ -207,84 +232,89 @@
 
     List expectedLogs = new ArrayList();
     expectedLogs.add("before assignment");
-    expectedLogs.add("assigning TaskInstance[t]");
+    expectedLogs.add("assigning TaskInstance(t)");
     expectedLogs.add("after assignment");
     
     assertEquals(expectedLogs, logs);
   }
 
-  public static class TestController implements TaskControllerHandler {
+  public static class TestInterceptor implements UserCodeInterceptor
+  {
+
+    public void executeAction(Action action, ExecutionContext executionContext) throws Exception
+    {
+      logs.add("before action " + action.getName() + " in node " + executionContext.getNode().getName());
+      action.execute(executionContext);
+      logs.add("after action " + action.getName() + " in node " + executionContext.getNode().getName());
+    }
+
+    public void executeAssignment(AssignmentHandler assignmentHandler, Assignable assignable, ExecutionContext executionContext) throws Exception
+    {
+      logs.add("before assignment");
+      assignmentHandler.assign(assignable, executionContext);
+      logs.add("after assignment");
+    }
+
+    public void executeTaskControllerInitialization(TaskControllerHandler taskControllerHandler, TaskInstance taskInstance, ContextInstance contextInstance, Token token)
+    {
+      logs.add("before task controller initialization");
+      taskControllerHandler.initializeTaskVariables(taskInstance, contextInstance, token);
+      logs.add("after task controller initialization");
+    }
+
+    public void executeTaskControllerSubmission(TaskControllerHandler taskControllerHandler, TaskInstance taskInstance, ContextInstance contextInstance, Token token)
+    {
+      logs.add("before task controller submission");
+      taskControllerHandler.submitTaskVariables(taskInstance, contextInstance, token);
+      logs.add("after task controller submission");
+    }
+  }
+
+  public static class TestAction implements ActionHandler
+  {
     private static final long serialVersionUID = 1L;
-    public void initializeTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token) {
-      logs.add("initializing task variables for "+taskInstance);
+
+    public void execute(ExecutionContext executionContext) throws Exception
+    {
+      logs.add("action executed");
     }
-    public void submitTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token) {
-      logs.add("submitting task variables for "+taskInstance);
+  }
+
+  public static class TestAutoAction implements ActionHandler
+  {
+    private static final long serialVersionUID = 1L;
+
+    public void execute(ExecutionContext executionContext) throws Exception
+    {
+      logs.add("auto action executed");
+      executionContext.leaveNode();
     }
   }
-  
-  public void testInterceptControllerInitialization() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state name='start'>" +
-      "    <transition to='t'/>" +
-      "  </start-state>" +
-      "  <task-node name='t'>" +
-      "    <task>" +
-      "      <controller class='"+TestController.class.getName()+"'/>" +
-      "    </task>" +
-      "    <transition to='end'/>" +
-      "  </task-node>" +
-      "  <state name='end' />" +
-      "</process-definition>"
-    );
-    // create the process instance
-    ProcessInstance processInstance = new ProcessInstance(processDefinition);
-    processInstance.signal();
-    
-    List expectedLogs = new ArrayList();
-    expectedLogs.add("before task controller initialization");
-    expectedLogs.add("initializing task variables for TaskInstance[t]");
-    expectedLogs.add("after task controller initialization");
-    
-    assertEquals(expectedLogs,logs);
+
+  public static class TestAssignment implements AssignmentHandler
+  {
+    private static final long serialVersionUID = 1L;
+
+    public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception
+    {
+      logs.add("assigning " + assignable);
+      assignable.setActorId("shipper");
+    }
   }
 
-  public void testInterceptControllerSubmission() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state name='start'>" +
-      "    <transition to='t'/>" +
-      "  </start-state>" +
-      "  <task-node name='t'>" +
-      "    <task>" +
-      "      <controller class='"+TestController.class.getName()+"'/>" +
-      "    </task>" +
-      "    <transition to='end'/>" +
-      "  </task-node>" +
-      "  <state name='end' />" +
-      "</process-definition>"
-    );
-    // create the process instance
-    ProcessInstance processInstance = new ProcessInstance(processDefinition);
-    processInstance.signal();
+  public static class TestController implements TaskControllerHandler
+  {
+    private static final long serialVersionUID = 1L;
 
-    TaskInstance ti = (TaskInstance) processInstance.getTaskMgmtInstance().getTaskInstances().iterator().next();
-    ti.end();
+    public void initializeTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token)
+    {
+      logs.add("initializing task variables for " + taskInstance);
+    }
 
-    List expectedLogs = new ArrayList();
-    expectedLogs.add("before task controller initialization");
-    expectedLogs.add("initializing task variables for TaskInstance[t]");
-    expectedLogs.add("after task controller initialization");
-    expectedLogs.add("before task controller submission");
-    expectedLogs.add("submitting task variables for TaskInstance[t]");
-    expectedLogs.add("after task controller submission");
-    
-    assertEquals(expectedLogs.get(0),logs.get(0));
-    assertEquals(expectedLogs.get(1),logs.get(1));
-    assertEquals(expectedLogs.get(2),logs.get(2));
-    assertEquals(expectedLogs.get(3),logs.get(3));
-    assertEquals(expectedLogs.get(4),logs.get(4));
-    assertEquals(expectedLogs.get(5),logs.get(5));
+    public void submitTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token)
+    {
+      logs.add("submitting task variables for " + taskInstance);
+    }
   }
+
 }

Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/perf/PerfWithoutDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/perf/PerfWithoutDbTest.java	2008-09-10 06:04:08 UTC (rev 2156)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/perf/PerfWithoutDbTest.java	2008-09-10 07:07:31 UTC (rev 2157)
@@ -1,5 +1,7 @@
 package org.jbpm.perf;
 
+import java.io.FileWriter;
+import java.io.PrintWriter;
 import java.util.Collection;
 
 import junit.framework.TestCase;
@@ -11,56 +13,64 @@
 import org.jbpm.graph.exe.Token;
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
-public class PerfWithoutDbTest extends TestCase {
+public class PerfWithoutDbTest extends TestCase
+{
 
-  JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
-      "<jbpm-configuration><jbpm-context /></jbpm-configuration>"
-  );
+  JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration><jbpm-context /></jbpm-configuration>");
 
-  ProcessDefinition processDefinition = parseWebSale(); 
+  ProcessDefinition processDefinition = parseWebSale();
 
-  /* this test tests/shows the memory consumption
-  
-  public void testLoop() throws Exception {
+  /*
+   * this test tests/shows the memory consumption
+   */
+  public void testMemory() throws Exception
+  {
     PrintWriter out = new PrintWriter(new FileWriter("mem.txt"));
     int i = 1;
     long total = 0;
-    while (true) {
+    while (true)
+    {
       long start = System.currentTimeMillis();
       executeWebSale();
       long stop = System.currentTimeMillis();
       long freeMemory = Runtime.getRuntime().freeMemory();
 
-      long millis = stop-start;
+      long millis = stop - start;
 
       String avg;
-      if (i>20) {
+      if (i > 20)
+      {
         total += millis;
-        avg = Float.toString((float)total/(float)(i-20));
-      } else {
+        avg = Float.toString((float)total / (float)(i - 20));
+      }
+      else
+      {
         avg = "";
       }
+
+      String msg = i + " " + millis + " " + freeMemory + " " + avg; 
       
-      String msg = i+" "+millis+" "+freeMemory+" "+avg;
-      // System.out.println(msg);
-      out.println(msg);
+      // System.out.println(msg); 
+      out.println(msg); 
       out.flush();
 
       System.gc();
       i++;
     }
   }
-  */
 
   /** this test shows the performance */
-  public void testLoop() throws Exception {
-    
+  public void testPerformance() throws Exception
+  {
+
     int nbrOfExecutions = 1000;
     int i = 0;
     long start = System.currentTimeMillis();
-    while (true) {
+    while (true)
+    {
       executeWebSale();
-      if (i>nbrOfExecutions) {
+      if (i > nbrOfExecutions)
+      {
         long elapsed = System.currentTimeMillis() - start;
         // System.out.println(Float.toString((float)nbrOfExecutions/(float)elapsed));
         i = 0;
@@ -70,52 +80,63 @@
     }
   }
 
-  void executeWebSale() {
+  void executeWebSale()
+  {
     ProcessInstance processInstance;
-    
+
     JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-    try {
+    try
+    {
       processInstance = new ProcessInstance(processDefinition);
       TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
       taskInstance.setVariable("item", "cookies");
       taskInstance.setVariable("quantity", "lots of them");
       taskInstance.setVariable("address", "46 Main St.");
       taskInstance.end();
-    } finally {
+    }
+    finally
+    {
       jbpmContext.close();
     }
 
     jbpmContext = jbpmConfiguration.createJbpmContext();
-    try {
+    try
+    {
       Token token = processInstance.getRootToken();
       Collection taskInstances = processInstance.getTaskMgmtInstance().getUnfinishedTasks(token);
-      TaskInstance taskInstance = (TaskInstance) taskInstances.iterator().next();
+      TaskInstance taskInstance = (TaskInstance)taskInstances.iterator().next();
       taskInstance.end("OK");
-    } finally {
+    }
+    finally
+    {
       jbpmContext.close();
     }
-    
+
     jbpmContext = jbpmConfiguration.createJbpmContext();
-    try {
+    try
+    {
       Token token = processInstance.getRootToken();
       Token shipping = token.getChild("payment");
       Collection taskInstances = processInstance.getTaskMgmtInstance().getUnfinishedTasks(shipping);
-      TaskInstance taskInstance = (TaskInstance) taskInstances.iterator().next();
+      TaskInstance taskInstance = (TaskInstance)taskInstances.iterator().next();
       taskInstance.end();
-    } finally {
+    }
+    finally
+    {
       jbpmContext.close();
     }
   }
 
-  
-  ProcessDefinition parseWebSale() {
+  ProcessDefinition parseWebSale()
+  {
     JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-    try {
-      ProcessDefinition processDefinition = 
-        ProcessDefinition.parseXmlResource("org/jbpm/perf/memleaktest.processdefinition.xml");
-      
+    try
+    {
+      ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/perf/memleaktest.processdefinition.xml");
       return processDefinition;
-    } finally {
+    }
+    finally
+    {
       jbpmContext.close();
     }
   }

Deleted: jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/.gpd.memleaktest.processdefinition.xml
===================================================================
--- jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/.gpd.memleaktest.processdefinition.xml	2008-09-10 06:04:08 UTC (rev 2156)
+++ jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/.gpd.memleaktest.processdefinition.xml	2008-09-10 07:07:31 UTC (rev 2157)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process-diagram />
\ No newline at end of file

Added: jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/memleaktest.processdefinition.xml
===================================================================
--- jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/memleaktest.processdefinition.xml	                        (rev 0)
+++ jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/memleaktest.processdefinition.xml	2008-09-10 07:07:31 UTC (rev 2157)
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+
+<process-definition name="websale"
+                    xmlns="urn:jbpm.org:jpdl-3.1">
+
+  <!-- SWIMLANES (= process roles) -->
+
+  <swimlane name="buyer" />
+  
+  <swimlane name="salesman">
+    <assignment actor-id="manager" />
+  </swimlane>
+  
+  <swimlane name="accountant">
+    <assignment actor-id="shipper" />
+  </swimlane>
+  
+  <swimlane name="shipper">
+    <assignment actor-id="admin" />
+  </swimlane>
+ 
+  <!-- NODES -->
+
+  <start-state name="Create new web sale order">
+    <task swimlane="buyer" />
+    <transition to="Evaluate web order" />
+  </start-state>
+  
+  <task-node name="Evaluate web order">
+    <task swimlane="salesman">
+    </task>
+    <transition name="OK" to="salefork" />
+    <transition name="More info needed" to="Fix web order data" />
+  </task-node>
+
+  <task-node name="Fix web order data">
+    <task swimlane="buyer" />
+    <transition to="Evaluate web order" />
+  </task-node>
+
+  <fork name="salefork">
+    <transition name="payment"  to="Wait for money" />
+    <transition name="shipping" to="ship item" />
+  </fork>  
+  
+  <task-node name="Wait for money">
+    <task swimlane="accountant" />
+    <transition to="update books" />
+  </task-node>
+  
+  <node name="update books">
+    <action class="org.jbpm.websale.UpdateBooks">
+      <msg>accountancy application is now informed of the payment</msg>
+    </action>
+    <transition to="salejoin" />
+  </node>
+  
+  <node name="ship item">
+    <action class="org.jbpm.websale.ShipItem">
+      <swimlaneName>shipper</swimlaneName>
+      <msg>${shipper} now ships ${item} to ${address}</msg>
+    </action>
+    <transition to="salejoin" />
+  </node>
+  
+  <join name="salejoin">
+    <transition to="end" />
+  </join>  
+
+  <end-state name="end" />
+
+</process-definition>


Property changes on: jbpm3/trunk/modules/core/src/test/resources/org/jbpm/perf/memleaktest.processdefinition.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbpm-commits mailing list