[jbpm-commits] JBoss JBPM SVN: r1713 - in jbossbpm/spec/trunk: modules/api/src/main/java/org/jboss/bpm and 12 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 24 10:24:54 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-07-24 10:24:54 -0400 (Thu, 24 Jul 2008)
New Revision: 1713

Added:
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/BPMException.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessTimeoutException.java
Removed:
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/JBPMException.java
   jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/
   jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/context/
Modified:
   jbossbpm/spec/trunk/.classpath
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/EngineShutdownException.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngineLocator.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/EmbeddedBeansDeployer.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/BPMNElement.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/DefaultEngineTestCase.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java
   jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
   jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
   jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
   jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
Log:
WIP

Modified: jbossbpm/spec/trunk/.classpath
===================================================================
--- jbossbpm/spec/trunk/.classpath	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/.classpath	2008-07-24 14:24:54 UTC (rev 1713)
@@ -2,12 +2,11 @@
 <classpath>
 	<classpathentry kind="src" output="modules/api/target/classes" path="modules/api/src/main/java"/>
 	<classpathentry kind="src" path="modules/ri/src/main/java"/>
+	<classpathentry kind="src" output="modules/testsuite/target/test-classes" path="modules/testsuite/src/test/java"/>
 	<classpathentry kind="src" path="modules/dialects/api10/src/main/java"/>
-	<classpathentry kind="src" path="modules/dialects/stp/src/test/java"/>
 	<classpathentry kind="src" path="modules/dialects/stp/src/main/java"/>
 	<classpathentry kind="src" path="modules/dialects/xpdl21/src/main/java"/>
 	<classpathentry kind="src" path="modules/dialects/jpdl32/src/main/java"/>
-	<classpathentry kind="src" output="modules/testsuite/target/test-classes" path="modules/testsuite/src/test/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>

Copied: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/BPMException.java (from rev 1699, jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/JBPMException.java)
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/BPMException.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/BPMException.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -0,0 +1,56 @@
+/*
+ * 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.jboss.bpm;
+
+// $Id$
+
+/**
+ * A RuntimeException that can be thrown for unrecoverable API errors
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class BPMException extends RuntimeException
+{
+  private static final long serialVersionUID = 1L;
+
+  public BPMException()
+  {
+    super();
+  }
+
+  public BPMException(String message, Throwable cause)
+  {
+    super(message, cause);
+  }
+
+  public BPMException(String message)
+  {
+    super(message);
+  }
+
+  public BPMException(Throwable cause)
+  {
+    super(cause);
+  }
+
+}

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/EngineShutdownException.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/EngineShutdownException.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/EngineShutdownException.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -30,7 +30,7 @@
  * @author thomas.diesler at jboss.com
  * @since 18-Jun-2008
  */
-public class EngineShutdownException extends JBPMException {
+public class EngineShutdownException extends BPMException {
 
   /**
    * 

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -30,7 +30,7 @@
  * @author thomas.diesler at jboss.com
  * @since 18-Jun-2008
  */
-public class InvalidProcessException extends JBPMException
+public class InvalidProcessException extends BPMException
 {
   /**
    * 

Deleted: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/JBPMException.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/JBPMException.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/JBPMException.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -1,55 +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.jboss.bpm;
-
-// $Id$
-
-/**
- * A RuntimeException that can be thrown for unrecoverable API errors
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class JBPMException extends RuntimeException {
-
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  public JBPMException() {
-    super();
-  }
-
-  public JBPMException(String message, Throwable cause) {
-    super(message, cause);
-  }
-
-  public JBPMException(String message) {
-    super(message);
-  }
-
-  public JBPMException(Throwable cause) {
-    super(cause);
-  }
-
-}

Added: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessTimeoutException.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessTimeoutException.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessTimeoutException.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -0,0 +1,55 @@
+/*
+ * 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.jboss.bpm;
+
+// $Id$
+
+/**
+ * A RuntimeException that is thrown when the process does not respond in time
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Jul-2008
+ */
+public class ProcessTimeoutException extends BPMException
+{
+  private static final long serialVersionUID = 1L;
+
+  public ProcessTimeoutException()
+  {
+    super();
+  }
+
+  public ProcessTimeoutException(String message, Throwable cause)
+  {
+    super(message, cause);
+  }
+
+  public ProcessTimeoutException(String message)
+  {
+    super(message);
+  }
+
+  public ProcessTimeoutException(Throwable cause)
+  {
+    super(cause);
+  }
+}


Property changes on: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessTimeoutException.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -23,10 +23,7 @@
 
 // $Id$
 
-import java.util.concurrent.Future;
-
 import org.jboss.bpm.model.FlowObject;
-import org.jboss.bpm.model.Result;
 import org.jboss.bpm.model.Signal;
 import org.jboss.bpm.runtime.Attachments;
 import org.jboss.bpm.runtime.ExecutionHandler;
@@ -57,7 +54,7 @@
    * @param att The Attachments in the ExecutionContext
    * @return The Future from which to obtain the process result
    */
-  public abstract Future<Result> startProcess(RuntimeProcess proc, Attachments att);
+  public abstract void startProcess(RuntimeProcess proc, Attachments att);
   
   /**
    * Locate the signal manager
@@ -71,19 +68,30 @@
   protected ExecutionHandler getExecutionHandler(FlowObject target)
   {
     HandlerSupport exfo = getHandlerSupport(target);
-    return exfo.getExecutionHandler();
+    ExecutionHandler handler = exfo.getExecutionHandler();
+    if (handler == null)
+      throw new IllegalStateException("Cannot obtain execution handler from: " + target);
+    return handler;
   }
 
   protected SignalHandler getSignalHandler(FlowObject target)
   {
     HandlerSupport exfo = getHandlerSupport(target);
-    return exfo.getSignalHandler();
+    SignalHandler handler = exfo.getSignalHandler();
+    if (handler == null)
+      throw new IllegalStateException("Cannot obtain signal handler from: " + target);
+    
+    return handler;
   }
 
   protected FlowHandler getFlowHandler(FlowObject target)
   {
     HandlerSupport exfo = getHandlerSupport(target);
-    return exfo.getFlowHandler();
+    FlowHandler handler = exfo.getFlowHandler();
+    if (handler == null)
+      throw new IllegalStateException("Cannot obtain flow handler from: " + target);
+    
+    return handler;
   }
 
   protected void throwSignal(Signal signal)

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngineLocator.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngineLocator.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngineLocator.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -25,7 +25,7 @@
 
 import java.net.URL;
 
-import org.jboss.bpm.JBPMException;
+import org.jboss.bpm.BPMException;
 import org.jboss.bpm.client.internal.EmbeddedBeansDeployer;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.plugins.util.KernelLocator;
@@ -85,7 +85,7 @@
     String config = ProcessEngine.JBPM_ENGINE_CONFIG;
     URL url = Thread.currentThread().getContextClassLoader().getResource(config);
     if (url == null)
-      throw new JBPMException("Cannot find resource: " + config);
+      throw new BPMException("Cannot find resource: " + config);
 
     new EmbeddedBeansDeployer().deploy(url);
   }

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -32,13 +32,18 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.management.ObjectName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.BPMException;
 import org.jboss.bpm.EngineShutdownException;
+import org.jboss.bpm.ProcessTimeoutException;
 import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Process.Status;
+import org.jboss.bpm.runtime.Attachments;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -143,6 +148,23 @@
   }
 
   /**
+   * Get a Process for a given id
+   * 
+   * @throws
+   */
+  public Process getProcessByID(ObjectName id)
+  {
+    for (Process aux : procs)
+    {
+      if (aux.getID().equals(id))
+      {
+        return aux;
+      }
+    }
+    throw new BPMException("Cannot find process: " + id);
+  }
+
+  /**
    * Register a Process
    */
   public final boolean registerProcess(Process proc)
@@ -155,9 +177,53 @@
    */
   public void removeProcess(Process proc)
   {
-    procs.remove(proc.getName());
+    procs.remove(proc);
   }
 
+  /**
+   * Start a Process with a given process ID 
+   */
+  public abstract ObjectName startProcess(ObjectName id, Attachments att);
+  
+  /**
+   * Wait for the Process to end. All Tokens that are generated at the Start Event for that Process must eventually
+   * arrive at an End Event. The Process will be in a running state until all Tokens are consumed.
+   * 
+   * @param id
+   * @param timeout
+   */
+  public void waitForEnd(ObjectName id, long timeout)
+  {
+    Process proc = getProcessByID(id);
+    Status status = proc.getStatus();
+    
+    if (status != Status.Active)
+      throw new IllegalStateException("Cannot wait for process in state: " + status);
+
+    boolean forever = (timeout < 1);
+    long now = System.currentTimeMillis();
+    long until = now + timeout;
+    try
+    {
+      while (forever || now < until)
+      {
+        status = proc.getStatus();
+        if (status == Status.Cancelled || status == Status.Aborted || status == Status.Completed)
+        {
+          return;
+        }
+        Thread.currentThread().sleep(100);
+        now = System.currentTimeMillis();
+      }
+    }
+    catch (InterruptedException ex)
+    {
+      log.warn(ex);
+    }
+    
+    throw new ProcessTimeoutException("Process timeout for: " + id);
+  }
+
   private String getNamespaceURI(InputStream inStream)
   {
     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -172,12 +238,12 @@
     {
       throw new IllegalStateException("Cannot parse process descriptor", ex);
     }
-    
+
     Element root = doc.getDocumentElement();
     String nsURI = root.getNamespaceURI();
     if (nsURI == null)
       throw new IllegalStateException("Cannot get namespace URI from root element");
-      
+
     return nsURI;
   }
 
@@ -187,7 +253,7 @@
     String dialectId = dialectRegistry.getDialect(nsURI);
     if (dialectId == null)
       throw new IllegalStateException("No dialect registered for: " + nsURI);
-    
+
     DialectHandler dialectHandler = dialectHandlers.get(dialectId);
     if (dialectHandler == null)
       throw new IllegalStateException("No dialect handler registered for: " + dialectId);

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/EmbeddedBeansDeployer.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/EmbeddedBeansDeployer.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/EmbeddedBeansDeployer.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -27,7 +27,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.JBPMException;
+import org.jboss.bpm.BPMException;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
 import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
@@ -61,7 +61,7 @@
       }
       catch (Throwable e)
       {
-        throw new JBPMException("Cannot bootstrap kernel", e);
+        throw new BPMException("Cannot bootstrap kernel", e);
       }
     }
     deployer = new BasicXMLDeployer(kernel);
@@ -82,12 +82,12 @@
 
       // The KernelLocator is expected to get deployed as a bean
       if (KernelLocator.getKernel() == null)
-        throw new JBPMException("KernelLocator not deployed as MC bean");
+        throw new BPMException("KernelLocator not deployed as MC bean");
 
     }
     catch (Throwable e)
     {
-      throw new JBPMException("Cannot deploy beans from: " + url, e);
+      throw new BPMException("Cannot deploy beans from: " + url, e);
     }
   }
 
@@ -103,7 +103,7 @@
     }
     catch (Throwable e)
     {
-      throw new JBPMException("Cannot undeploy beans from: " + url, e);
+      throw new BPMException("Cannot undeploy beans from: " + url, e);
     }
   }
 }
\ No newline at end of file

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/BPMNElement.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/BPMNElement.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/BPMNElement.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -23,21 +23,27 @@
 
 //$Id$
 
+import java.io.Serializable;
+
+import javax.management.ObjectName;
+
 /**
  * The parrent of all BPMN elements
  * 
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public interface BPMNElement 
+public interface BPMNElement extends Serializable
 {
-  /** 
-   * Get the associated Process 
-   */
-  Process getProcess();
-  
+  public static final String ID_DOMAIN = "jboss.bpm";
+
   /**
    * Get the ID of this element
    */
-  String getID();
+  ObjectName getID();
+
+  /**
+   * Get the associated Process
+   */
+  Process getProcess();
 }
\ No newline at end of file

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -24,8 +24,9 @@
 //$Id: MultipleInFlowSupport.java 1627 2008-07-14 15:16:28Z thomas.diesler at jboss.com $
 
 import java.util.List;
-import java.util.concurrent.Future;
 
+import javax.management.ObjectName;
+
 import org.jboss.bpm.runtime.Attachments;
 
 /**
@@ -41,7 +42,7 @@
    */
   enum ProcessType
   {
-    None, Private, Abstract, Collaboration 
+    None, Private, Abstract, Collaboration
   };
 
   /**
@@ -49,14 +50,14 @@
    */
   enum Status
   {
-    None, Ready, Active, Cancelled, Aborting, Aborted, Completing, Completed 
+    None, Ready, Active, Cancelled, Aborting, Aborted, Completing, Completed
   };
 
   /**
    * Get the process type
    */
   ProcessType getProcessType();
-  
+
   /**
    * Get the process state
    */
@@ -68,48 +69,48 @@
   List<FlowObject> getFlowObjects();
 
   /**
-   * One or more Performers MAY be entered. The Performers attribute defines the
-   * resource that will be responsible for the Process. The Performers entry could be in
-   * the form of a specific individual, a group, an organization role or position, or an
-   * organization.
+   * One or more Performers MAY be entered. The Performers attribute defines the resource that will be responsible for
+   * the Process. The Performers entry could be in the form of a specific individual, a group, an organization role or
+   * position, or an organization.
    */
   List<String> getPerformers();
-  
+
   /**
-   * One or more assignment expressions MAY be made for the object. The
-   * Assignment SHALL be performed as defined by the AssignTime attribute.
+   * One or more assignment expressions MAY be made for the object. The Assignment SHALL be performed as defined by the
+   * AssignTime attribute.
    */
   List<String> getAssignments();
-  
+
   /**
-   * Modeler-defined Properties MAY be added to a Process. These Properties are
-   * “local” to the Process. All Tasks, Sub-Process objects, and Sub-Processes that are
-   * embedded SHALL have access to these Properties. The fully delineated name of
-   * these properties are “<process name>.<property name>” (e.g., “Add Customer.Customer Name”). 
-   * If a process is embedded within another Process, then the fully delineated name SHALL 
-   * also be preceded by the Parent Process name for as many Parents there are until the top level Process.
+   * Modeler-defined Properties MAY be added to a Process. These Properties are “local” to the Process. All Tasks,
+   * Sub-Process objects, and Sub-Processes that are embedded SHALL have access to these Properties. The fully
+   * delineated name of these properties are “<process name>.<property name>” (e.g., “Add Customer.Customer Name”). If a
+   * process is embedded within another Process, then the fully delineated name SHALL also be preceded by the Parent
+   * Process name for as many Parents there are until the top level Process.
    */
   List<Property> getProperties();
 
   /**
-   * The InputSets attribute defines the data requirements for input to the Process.
-   * Zero or more InputSets MAY be defined. Each Input set is sufficient to allow the
-   * Process to be performed (if it has first been instantiated by the appropriate signal
-   * arriving from an incoming Sequence Flow)
+   * The InputSets attribute defines the data requirements for input to the Process. Zero or more InputSets MAY be
+   * defined. Each Input set is sufficient to allow the Process to be performed (if it has first been instantiated by
+   * the appropriate signal arriving from an incoming Sequence Flow)
    */
   List<InputSet> getInputSets();
-  
+
   /**
-   * The OutputSets attribute defines the data requirements for output from the
-   * Process. Zero or more OutputSets MAY be defined. At the completion of the
-   * Process, only one of the OutputSets may be produced--It is up to the
-   * implementation of the Process to determine which set will be produced. However,
-   * the IORules attribute MAY indicate a relationship between an OutputSet and an
-   * InputSet that started the Process.
+   * The OutputSets attribute defines the data requirements for output from the Process. Zero or more OutputSets MAY be
+   * defined. At the completion of the Process, only one of the OutputSets may be produced--It is up to the
+   * implementation of the Process to determine which set will be produced. However, the IORules attribute MAY indicate
+   * a relationship between an OutputSet and an InputSet that started the Process.
    */
   List<OutputSet> getOutputSets();
-  
+
   // Not Part of BPMN ========================================================================
+
+  /**
+   * Make a deep copy of the process
+   */
+  Process copyProcess();
   
   /**
    * Get the start event
@@ -121,13 +122,18 @@
    */
   List<EndEvent> getEndEvents();
 
+  /**
+   * Start the process
+   * @return the process instance identifier
+   */
+  ObjectName startProcess();
 
-  /** Start the process */
-  Future<Result> startProcess();
+  /**
+   * Start the process, with a given execution context
+   * @return the process instance identifier
+   */
+  ObjectName startProcess(Attachments att);
 
-  /** Start the process, with a given execution context */
-  Future<Result> startProcess(Attachments att);
-
   /**
    * Find a flow object by name
    * 
@@ -135,5 +141,19 @@
    */
   FlowObject findFlowObject(String name);
 
-
+  /**
+   * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event. 
+   * The Process will be in a running state until all Tokens are consumed.
+   * <p/>
+   * This method until the process ends without timeout.
+   */
+  void waitForEnd();
+  
+  /**
+   * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event. 
+   * The Process will be in a running state until all Tokens are consumed.
+   * <p/>
+   * This method until the process ends with a given timeout.
+   */
+  void waitForEnd(long timeout);
 }
\ No newline at end of file

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -32,7 +32,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.JBPMException;
+import org.jboss.bpm.BPMException;
 import org.jboss.bpm.client.SignalListener;
 import org.jboss.bpm.client.internal.EmbeddedBeansDeployer;
 import org.jboss.bpm.model.Signal;
@@ -98,7 +98,7 @@
   {
     URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
     if (url == null)
-      throw new JBPMException("Cannot find resource: " + resourceName);
+      throw new BPMException("Cannot find resource: " + resourceName);
     return url;
   }
 

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/DefaultEngineTestCase.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/DefaultEngineTestCase.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/DefaultEngineTestCase.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -38,10 +38,7 @@
    */
   protected String getDialect()
   {
-    String dialect = System.getProperty("jbpm.dialect");
-    if (dialect == null)
-      throw new IllegalStateException ("Cannot obtain jbpm.dialect");
-    
+    String dialect = System.getProperty("jbpm.dialect", "api10");
     return dialect;
   }
 }

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -23,21 +23,13 @@
 
 // $Id$
 
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.NotImplementedException;
 import org.jboss.bpm.client.ExecutionManager;
 import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.model.EndEvent;
 import org.jboss.bpm.model.Flow;
 import org.jboss.bpm.model.FlowObject;
 import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.Result;
 import org.jboss.bpm.model.Signal;
 import org.jboss.bpm.model.StartEvent;
 import org.jboss.bpm.model.internal.SequenceFlowImpl;
@@ -67,9 +59,10 @@
   }
 
   @Override
-  public Future<Result> startProcess(RuntimeProcess rtProc, Attachments att)
+  public void startProcess(RuntimeProcess rtProc, Attachments att)
   {
     Process proc = rtProc.getProcess();
+      
     throwSignal(new Signal(proc, Signal.Type.ENTER_PROCESS));
     MutableFlowScheduler flowScheduler = rtProc.getFlowScheduler();
     try
@@ -114,7 +107,6 @@
     {
       throwSignal(new Signal(proc, Signal.Type.EXIT_PROCESS));
     }
-    return new ResultFuture(proc);
   }
 
   /** 
@@ -128,60 +120,4 @@
       setTargetRef(start);
     }
   }
-  
-  /**
-   * A basic implementation of a Future 
-   */
-  class ResultFuture implements Future<Result>
-  {
-    private Result result;
-    private Process proc;
-
-    public ResultFuture(Process proc)
-    {
-      this.proc = proc;
-    }
-
-    public boolean cancel(boolean mayInterruptIfRunning)
-    {
-      throw new NotImplementedException();
-    }
-
-    public Result get() throws InterruptedException, ExecutionException
-    {
-      return getResult();
-    }
-
-    public Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
-    {
-      throw new NotImplementedException();
-    }
-
-    public boolean isCancelled()
-    {
-      return false;
-    }
-
-    public boolean isDone()
-    {
-      boolean isDone = getResult() != null;
-      return isDone;
-    }
-
-    private Result getResult()
-    {
-      if (result == null)
-      {
-        for (EndEvent aux : proc.getEndEvents())
-        {
-          result = aux.getResult();
-          if (result != null)
-          {
-            break;
-          }
-        }
-      }
-      return result;
-    }
-  }
 }
\ No newline at end of file

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -25,10 +25,19 @@
 
 import java.util.Map;
 
+import javax.management.ObjectName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jboss.bpm.client.DialectHandler;
 import org.jboss.bpm.client.DialectRegistry;
+import org.jboss.bpm.client.ExecutionManager;
 import org.jboss.bpm.client.ProcessEngine;
 import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.model.Process.Status;
+import org.jboss.bpm.model.internal.ProcessImpl;
+import org.jboss.bpm.model.internal.RuntimeProcessImpl;
+import org.jboss.bpm.runtime.Attachments;
 
 /**
  * The process manager is the entry point to create, find and otherwise manage processes.
@@ -38,18 +47,65 @@
  */
 public class ProcessManagerImpl extends ProcessManager
 {
+  // provide logging
+  private static final Log log = LogFactory.getLog(ProcessManagerImpl.class);
+  
   public void setProcessEngine(ProcessEngine engine)
   {
     this.engine = engine;
   }
-  
+
   public void setDialectHandlers(Map<String, DialectHandler> dialectHandlers)
   {
     this.dialectHandlers = dialectHandlers;
   }
-  
+
   public void setDialectRegistry(DialectRegistry dialectRegistry)
   {
     this.dialectRegistry = dialectRegistry;
   }
+
+  public ObjectName startProcess(ObjectName id, Attachments att)
+  {
+    ProcessImpl proc = (ProcessImpl)getProcessByID(id);
+    if (proc.getStatus() != Status.Ready)
+      throw new IllegalStateException("Cannot start process in state: " + proc.getStatus());
+
+    // Copy and register the process instance
+    proc = (ProcessImpl)proc.copyProcess();
+    registerProcess(proc);
+    
+    // Start the process in a thread
+    new Thread(new ProcessRunner(proc, att)).start();
+    
+    return proc.getID();
+  }
+
+  class ProcessRunner implements Runnable
+  {
+    ProcessImpl proc;
+    Attachments att;
+
+    public ProcessRunner(ProcessImpl proc, Attachments att)
+    {
+      this.proc = proc;
+      this.att = att;
+    }
+
+    public void run()
+    {
+      proc.setStatus(Status.Active);
+      try
+      {
+        ExecutionManager exm = ExecutionManager.locateExecutionManager();
+        exm.startProcess(new RuntimeProcessImpl(proc), att);
+        proc.setStatus(Status.Completed);
+      }
+      catch (RuntimeException ex)
+      {
+        log.error("Process aborted: " + proc, ex);
+        proc.setStatus(Status.Aborted);
+      }
+    }
+  }
 }

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -23,8 +23,18 @@
 
 //$Id$
 
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.bpm.InvalidProcessException;
 import org.jboss.bpm.model.BPMNElement;
+import org.jboss.bpm.model.Event;
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.Gateway;
+import org.jboss.bpm.model.NameSupport;
 import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Task;
+import org.jboss.util.id.UID;
 
 /**
  * 
@@ -33,9 +43,9 @@
  */
 public class BPMNElementImpl implements BPMNElement
 {
-  private String id;
+  private ObjectName id;
   private Process process;
-  
+
   public Process getProcess()
   {
     return process;
@@ -46,21 +56,59 @@
     this.process = process;
   }
 
-  public String getID()
+  public ObjectName getID()
   {
     return id;
   }
 
-  public void setID(String id)
-  {
-    this.id = id;
-  }
-  
   /**
    * Initialize the flow object
    */
   protected void initialize(Process proc)
   {
     setProcess(proc);
+    assignElementID();
   }
+
+  protected void assignElementID()
+  {
+    try
+    {
+      StringBuilder str = new StringBuilder(ID_DOMAIN + ":");
+      if (this instanceof Event)
+      {
+        str.append("type=Event");
+      }
+      else if (this instanceof Process)
+      {
+        str.append("type=Process");
+      }
+      else if (this instanceof Task)
+      {
+        str.append("type=Task");
+      }
+      else if (this instanceof Gateway)
+      {
+        str.append("type=Gateway");
+      }
+      else if (this instanceof Flow)
+      {
+        str.append("type=Flow");
+      }
+      else
+      {
+        str.append("type=Other");
+      }
+      if (this instanceof NameSupport)
+      {
+        str.append(",name=" + ((NameSupport)this).getName());
+      }
+      str.append(",id=" + new UID());
+      this.id = new ObjectName(str.toString());
+    }
+    catch (MalformedObjectNameException ex)
+    {
+      throw new InvalidProcessException("Cannot assign id", ex);
+    }
+  }
 }
\ No newline at end of file

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -23,14 +23,18 @@
 
 //$Id$
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.concurrent.Future;
 
+import javax.management.ObjectName;
+
 import org.jboss.bpm.InvalidProcessException;
 import org.jboss.bpm.NotImplementedException;
-import org.jboss.bpm.client.ExecutionManager;
 import org.jboss.bpm.client.ProcessManager;
 import org.jboss.bpm.model.EndEvent;
 import org.jboss.bpm.model.FlowObject;
@@ -39,7 +43,6 @@
 import org.jboss.bpm.model.OutputSet;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.Property;
-import org.jboss.bpm.model.Result;
 import org.jboss.bpm.model.StartEvent;
 import org.jboss.bpm.runtime.Attachments;
 
@@ -53,7 +56,7 @@
 {
   private String name;
   private List<FlowObject> flowObjects = new ArrayList<FlowObject>();
-  private Status processState = Status.None;
+  private Status status = Status.None;
 
   public ProcessImpl(String name)
   {
@@ -95,7 +98,7 @@
   {
     throw new NotImplementedException();
   }
-  
+
   public void addFlowObject(FlowObject flowObject)
   {
     flowObjects.add(flowObject);
@@ -131,27 +134,57 @@
   public List<FlowObject> getFlowObjects()
   {
 
-    if (processState == Status.None)
+    if (status == Status.None)
       return flowObjects;
 
     return Collections.unmodifiableList(flowObjects);
   }
 
-  public Future<Result> startProcess()
+  /**
+   * A naive copy implementation that relies on serialization
+   */
+  public Process copyProcess()
   {
+    try
+    {
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      ObjectOutputStream oos = new ObjectOutputStream(baos);
+      oos.writeObject(this);
+      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+      ObjectInputStream ois = new ObjectInputStream(bais);
+      ProcessImpl proc = (ProcessImpl)ois.readObject();
+      proc.assignElementID();
+      return proc;
+    }
+    catch (Exception ex)
+    {
+      throw new InvalidProcessException("Cannot create a copy of: " + this);
+    }
+  }
+  
+  public ObjectName startProcess()
+  {
     return startProcess(null);
   }
 
-  public Future<Result> startProcess(Attachments att)
+  public ObjectName startProcess(Attachments att)
   {
-    if (processState != Status.Ready)
-      throw new IllegalStateException("Cannot start process in state: " + processState);
+    ProcessManager pm = ProcessManager.locateProcessManager();
+    return pm.startProcess(getID(), att);
+  }
 
-    processState = Status.Active;
-    ExecutionManager exm = ExecutionManager.locateExecutionManager();
-    return exm.startProcess(new RuntimeProcessImpl(this), att);
+  public void waitForEnd()
+  {
+    ProcessManager pm = ProcessManager.locateProcessManager();
+    pm.waitForEnd(getID(), -1);
   }
 
+  public void waitForEnd(long timeout)
+  {
+    ProcessManager pm = ProcessManager.locateProcessManager();
+    pm.waitForEnd(getID(), timeout);
+  }
+
   public FlowObject findFlowObject(String name)
   {
     if (name == null)
@@ -175,16 +208,24 @@
 
   public Status getStatus()
   {
-    return processState;
+    return status;
   }
 
+  public void setStatus(Status status)
+  {
+    this.status = status;
+  }
+  
   /**
    * Set the process state
    */
   public void initialize()
   {
-    if (processState != Status.None)
-      throw new IllegalStateException("Cannot initialize process in state: " + processState);
+    if (status != Status.None)
+      throw new IllegalStateException("Cannot initialize process in state: " + status);
+    
+    // Initialize the Element
+    super.initialize(this);
 
     // Set the anonymous default name
     if (getName() == null)
@@ -205,7 +246,7 @@
       ((FlowObjectImpl)aux).initialize(this);
     }
 
-    processState = Status.Ready;
+    status = Status.Ready;
   }
 
   public String toString()

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -40,7 +40,6 @@
 
   public RuntimeProcessImpl(Process process)
   {
-    super();
     this.process = process;
   }
 

Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -45,6 +45,8 @@
     ProcessManager pm = ProcessManager.locateProcessManager();
     Process proc = pm.createProcess(jpdlURL);
     assertNotNull(proc);
+    
+    proc.startProcess();
 
   }
 }

Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -82,8 +82,8 @@
   private void runProcess(Process proc) throws InterruptedException, ExecutionException
   {
     // Start the Process
-    Future<Result> end = proc.startProcess();
-    Result result = end.get();
+    proc.startProcess();
+    proc.waitForEnd();
     
     // Validate received signals
     List<Signal> signals = getSignals();

Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -26,14 +26,12 @@
 import java.net.URL;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 
 import org.jboss.bpm.client.ProcessManager;
 import org.jboss.bpm.client.SignalManager;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.ProcessBuilder;
 import org.jboss.bpm.model.ProcessBuilderFactory;
-import org.jboss.bpm.model.Result;
 import org.jboss.bpm.model.Signal;
 import org.jboss.bpm.test.DefaultEngineTestCase;
 
@@ -83,13 +81,9 @@
   private void runProcess(Process proc) throws InterruptedException, ExecutionException
   {
     // Start the Process
-    Future<Result> end = proc.startProcess();
-    Result result = end.get();
+    proc.startProcess();
+    proc.waitForEnd();
 
-    // Validate the Result
-    assertNotNull("Result expected", result);
-    assertEquals("No attachments expected", 0, result.getAttachments().getAttachmentKeys().size());
-
     // Validate received signals
     List<Signal> signals = getSignals();
     assertEquals(Signal.Type.ENTER_PROCESS, signals.get(0).getType());

Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java	2008-07-24 12:40:28 UTC (rev 1712)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java	2008-07-24 14:24:54 UTC (rev 1713)
@@ -26,16 +26,13 @@
 import java.net.URL;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 
 import org.jboss.bpm.client.ProcessManager;
 import org.jboss.bpm.client.SignalManager;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.ProcessBuilder;
 import org.jboss.bpm.model.ProcessBuilderFactory;
-import org.jboss.bpm.model.Result;
 import org.jboss.bpm.model.Signal;
-import org.jboss.bpm.runtime.Attachments;
 import org.jboss.bpm.test.DefaultEngineTestCase;
 
 /**
@@ -75,8 +72,8 @@
   {
     // Create a Process through the ProcessBuilder
     ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder(getName());
-    Process proc = procBuilder.addStartEvent().addSequenceFlow("stateA").addTask("stateA").addExecutionHandler(TaskA.class).
-    addSequenceFlow("end").addEndEvent("end").getProcess();
+    Process proc = procBuilder.addStartEvent().addSequenceFlow("stateA").addTask("stateA").addExecutionHandler(
+        TaskA.class).addSequenceFlow("end").addEndEvent("end").getProcess();
 
     runProcess(proc);
   }
@@ -84,15 +81,9 @@
   private void runProcess(Process proc) throws InterruptedException, ExecutionException
   {
     // Start the Process
-    Future<Result> end = proc.startProcess();
-    Result result = end.get();
+    proc.startProcess();
+    proc.waitForEnd();
 
-    // Validate the Result
-    assertNotNull("Result expected", result);
-    Attachments att = result.getAttachments();
-    assertEquals("Attachments expected", 1, att.getAttachmentKeys().size());
-    assertEquals("Task: TaskA", att.getAttachment(String.class));
-
     // Validate received signals
     List<Signal> signals = getSignals();
     assertEquals(Signal.Type.ENTER_PROCESS, signals.get(0).getType());




More information about the jbpm-commits mailing list