Attempt to update package to org.apache.taverna

.. but won't really combine because of error in spring dependency?


Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/commit/50373179
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/tree/50373179
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/diff/50373179

Branch: refs/heads/master
Commit: 50373179a0ab245d08d94b3dc9e6b0c2ad738315
Parents: 9012593
Author: Stian Soiland-Reyes <[email protected]>
Authored: Sun Oct 18 19:12:38 2015 +0100
Committer: Stian Soiland-Reyes <[email protected]>
Committed: Sun Oct 18 19:12:38 2015 +0100

----------------------------------------------------------------------
 .../org/apache/taverna/platform/ActivityIT.java |   68 ++
 .../taverna/platform/CommandLineToolIT.java     |   88 ++
 .../apache/taverna/platform/ExecutionIT.java    |  128 +++
 .../taverna/platform/LocalExecutionIT.java      |  117 ++
 .../taverna/platform/OSGIFrameworkIT.java       |   92 ++
 .../org/apache/taverna/platform/PlatformIT.java |  375 +++++++
 .../java/org/apache/taverna/platform/RunIT.java | 1000 +++++++++++++++++
 .../apache/taverna/platform/RunParallelIT.java  |   93 ++
 .../apache/taverna/platform/RunWorkflowsIT.java |  134 +++
 .../uk/org/taverna/platform/ActivityIT.java     |   72 --
 .../org/taverna/platform/CommandLineToolIT.java |   91 --
 .../uk/org/taverna/platform/ExecutionIT.java    |  134 ---
 .../org/taverna/platform/LocalExecutionIT.java  |  120 ---
 .../org/taverna/platform/OSGIFrameworkIT.java   |   93 --
 .../uk/org/taverna/platform/PlatformIT.java     |  378 -------
 .../java/uk/org/taverna/platform/RunIT.java     | 1005 ------------------
 .../uk/org/taverna/platform/RunParallelIT.java  |   95 --
 .../uk/org/taverna/platform/RunWorkflowsIT.java |  135 ---
 18 files changed, 2095 insertions(+), 2123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/ActivityIT.java
----------------------------------------------------------------------
diff --git 
a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/ActivityIT.java
 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/ActivityIT.java
new file mode 100644
index 0000000..ec5e483
--- /dev/null
+++ 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/ActivityIT.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program 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 program 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 program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ 
******************************************************************************/
+package org.apache.taverna.platform;
+
+import java.net.URI;
+import java.util.List;
+
+import 
org.apache.taverna.platform.capability.api.ActivityConfigurationException;
+import org.apache.taverna.platform.capability.api.ActivityNotFoundException;
+import org.osgi.framework.ServiceReference;
+
+
+public class ActivityIT extends PlatformIT {
+
+       public void testGetActivityURIs() {
+               ServiceReference activityServiceReference = 
bundleContext.getServiceReference("org.apache.taverna.platform.capability.api.ActivityService");
+               ActivityService activityService = (ActivityService) 
bundleContext.getService(activityServiceReference);
+               List<URI> activityURIs = activityService.getActivityURIs();
+               System.out.println("================= Available Activities 
===================");
+               for (URI uri : activityURIs) {
+                       System.out.println(uri);
+               }
+               
System.out.println("==========================================================");
+               System.out.println("");
+       }
+
+       public void testCreateActivity() throws ActivityNotFoundException, 
ActivityConfigurationException {
+               ServiceReference activityServiceReference = 
bundleContext.getServiceReference("org.apache.taverna.platform.capability.api.ActivityService");
+               ActivityService activityService = (ActivityService) 
bundleContext.getService(activityServiceReference);
+               List<URI> activityURIs = activityService.getActivityURIs();
+               for (URI uri : activityURIs) {
+                       System.out.println("Creating activity " + uri);
+                       Activity<?> activity = 
activityService.createActivity(uri, null);
+               }
+       }
+
+       public void testGetActivityConfigurationDefinition() throws Exception {
+               ServiceReference activityServiceReference = 
bundleContext.getServiceReference("org.apache.taverna.platform.capability.api.ActivityService");
+               ActivityService activityService = (ActivityService) 
bundleContext.getService(activityServiceReference);
+
+               List<URI> activityURIs = activityService.getActivityURIs();
+               System.out.println("============ Activity Configuration 
Definitions ==========");
+               for (URI uri : activityURIs) {
+                       ConfigurationDefinition configurationDefinition = 
activityService.getActivityConfigurationDefinition(uri);
+                       System.out.println(configurationDefinition);
+               }
+               
System.out.println("==========================================================");
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/CommandLineToolIT.java
----------------------------------------------------------------------
diff --git 
a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/CommandLineToolIT.java
 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/CommandLineToolIT.java
new file mode 100644
index 0000000..f42cb77
--- /dev/null
+++ 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/CommandLineToolIT.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program 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 program 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 program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ 
******************************************************************************/
+package org.apache.taverna.platform;
+
+import org.osgi.framework.ServiceReference;
+
+import org.apache.taverna.platform.run.api.RunService;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleReader;
+
+public class CommandLineToolIT extends PlatformIT {
+
+       private RunService runService;
+       private WorkflowBundleIO workflowBundleIO;
+       private WorkflowBundleReader workflowReader;
+
+       protected void setup() throws Exception {
+               super.setup();
+               if (runService == null) {
+                       ServiceReference runServiceReference = bundleContext
+                                       
.getServiceReference("org.apache.taverna.platform.run.api.RunService");
+                       runService = (RunService) 
bundleContext.getService(runServiceReference);
+               }
+
+               if (workflowReader == null) {
+                       ServiceReference workflowBundleReaderServiceReference = 
bundleContext
+                                       
.getServiceReferences("org.apache.taverna.scufl2.api.io.WorkflowBundleReader",
+                                                       
"(mediaType=application/vnd.taverna.t2flow+xml)")[0];
+                       workflowBundleReader = (WorkflowBundleReader) 
bundleContext
+                                       
.getService(workflowBundleReaderServiceReference);
+               }
+
+               if (workflowBundleIO == null) {
+                       ServiceReference workflowBundleIOServiceReference = 
bundleContext
+                                       
.getServiceReference("org.apache.taverna.scufl2.api.io.WorkflowBundleIO");
+                       workflowBundleIO = (WorkflowBundleIO) bundleContext
+                                       
.getService(workflowBundleIOServiceReference);
+               }
+       }
+
+       public void testCommandLineTool() throws Exception {
+
+               setup();
+
+               CommandLineTool cmdTool = new CommandLineTool();
+               cmdTool.setRunService(runService);
+               cmdTool.setCredentialManager(credentialManager);
+               cmdTool.setWorkflowBundleIO(workflowBundleIO);
+               cmdTool.setCommandLineArgumentsService(new 
CommandLineArguments() {
+                       public String[] getCommandLineArguments() {
+                               return new String[] { "-outputdoc", 
"/tmp/taverna3/baclava-output1.xml",
+                                               
"/Users/alex/Desktop/t2flows/simple-wf-no-inputs-one-output.t2flow" };
+                       }
+
+               });
+               cmdTool.run();
+
+               cmdTool.setCommandLineArgumentsService(new 
CommandLineArguments() {
+                       public String[] getCommandLineArguments() {
+                               return new String[] { "-inputvalue", "in", 
"Taverna 3 Platform rules",
+                                               "-outputdoc", 
"/tmp/taverna3/baclava-output2.xml",
+                                               
"/Users/alex/Desktop/t2flows/simple-wf-one-input-one-output.t2flow" };
+                       }
+
+               });
+               cmdTool.run();
+
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/ExecutionIT.java
----------------------------------------------------------------------
diff --git 
a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/ExecutionIT.java
 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/ExecutionIT.java
new file mode 100644
index 0000000..d28ac5d
--- /dev/null
+++ 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/ExecutionIT.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program 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 program 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 program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ 
******************************************************************************/
+package org.apache.taverna.platform;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.osgi.framework.ServiceReference;
+
+import org.apache.taverna.platform.execution.api.AbstractExecutionEnvironment;
+import org.apache.taverna.platform.execution.api.AbstractExecutionService;
+import org.apache.taverna.platform.execution.api.Execution;
+import org.apache.taverna.platform.execution.api.ExecutionEnvironment;
+import org.apache.taverna.platform.execution.api.ExecutionEnvironmentService;
+import org.apache.taverna.platform.execution.api.InvalidWorkflowException;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+public class ExecutionIT extends PlatformIT {
+
+       private ExecutionEnvironmentService executionEnvironmentService;
+
+       protected void setup() throws Exception {
+               super.setup();
+               ServiceReference[] executionServiceReferences = 
bundleContext.getServiceReferences(
+                               
"org.apache.taverna.platform.execution.api.ExecutionEnvironmentService", null);
+               assertEquals(1, executionServiceReferences.length);
+               executionEnvironmentService = (ExecutionEnvironmentService) 
bundleContext
+                               .getService(executionServiceReferences[0]);
+
+       }
+
+       public void testGetExecutionEnvironments() throws Exception {
+               setup();
+
+               Set<ExecutionEnvironment> executionEnvironments = 
executionEnvironmentService
+                               .getExecutionEnvironments();
+               int size = executionEnvironments.size();
+
+               
bundleContext.registerService("org.apache.taverna.platform.execution.api.ExecutionService",
+                               new AbstractExecutionService("test id", "test 
name", "test description") {
+                                       public Set<ExecutionEnvironment> 
getExecutionEnvivonments() {
+                                               return Collections
+                                                               
.<ExecutionEnvironment> singleton(new AbstractExecutionEnvironment(
+                                                                               
"test id", "test name", "test description", this) {
+                                                                       public 
List<URI> getDispatchLayerURIs() {
+                                                                               
return Collections.singletonList(URI
+                                                                               
                
.create("http://ns.taverna.org.uk/2010/dispatchlayer/testDispatchLayer";));
+                                                                       }
+
+                                                                       public 
List<URI> getActivityURIs() {
+                                                                               
return Collections.singletonList(URI
+                                                                               
                .create("http://ns.taverna.org.uk/2010/activity/testActivity";));
+                                                                       }
+
+                                                                       public 
boolean dispatchLayerExists(URI uri) {
+                                                                               
return false;
+                                                                       }
+
+                                                                       public 
boolean activityExists(URI uri) {
+                                                                               
return false;
+                                                                       }
+
+                                                                       public 
ConfigurationDefinition getActivityConfigurationDefinition(
+                                                                               
        URI uri) throws ActivityNotFoundException,
+                                                                               
        ActivityConfigurationException {
+                                                                               
return null;
+                                                                       }
+
+                                                                       public 
ConfigurationDefinition getDispatchLayerConfigurationDefinition(
+                                                                               
        URI uri) throws DispatchLayerNotFoundException,
+                                                                               
        DispatchLayerConfigurationException {
+                                                                               
return null;
+                                                                       }
+                                                               });
+                                       }
+
+                                       protected Execution 
createExecutionImpl(WorkflowBundle workflowBundle,
+                                                       Workflow workflow, 
Profile profile, Map<String, Data> inputs) throws InvalidWorkflowException {
+                                               return null;
+                                       }
+                               }, null);
+
+
+               executionEnvironments = executionEnvironmentService
+                               .getExecutionEnvironments();
+               assertEquals(size + 1, executionEnvironments.size());
+
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       System.out.println(executionEnvironment);
+               }
+       }
+
+       public void testGetExecutionEnvironmentsProfile() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/beanshell.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = 
executionEnvironmentService
+                               
.getExecutionEnvironments(workflowBundle.getMainProfile());
+               assertTrue(executionEnvironments.size() > 0);
+
+               System.out.println(executionEnvironments.iterator().next());
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/LocalExecutionIT.java
----------------------------------------------------------------------
diff --git 
a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/LocalExecutionIT.java
 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/LocalExecutionIT.java
new file mode 100644
index 0000000..431aa88
--- /dev/null
+++ 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/LocalExecutionIT.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program 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 program 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 program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ 
******************************************************************************/
+package org.apache.taverna.platform;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.osgi.framework.ServiceReference;
+
+import org.apache.taverna.platform.execution.api.ExecutionEnvironment;
+import org.apache.taverna.platform.execution.api.ExecutionService;
+import org.apache.taverna.platform.report.State;
+import org.apache.taverna.platform.report.WorkflowReport;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+public class LocalExecutionIT extends PlatformIT {
+
+       private ExecutionService executionService;
+       private Set<ExecutionEnvironment> executionEnvironments;
+
+       protected void setup() throws Exception {
+               super.setup();
+               if (executionService == null) {
+                       ServiceReference[] executionServiceReferences = 
bundleContext.getServiceReferences(
+                                       
"org.apache.taverna.platform.execution.api.ExecutionService",
+                                       
"(org.springframework.osgi.bean.name=localExecution)");
+                       assertEquals(1, executionServiceReferences.length);
+                       executionService = (ExecutionService) bundleContext
+                                       
.getService(executionServiceReferences[0]);
+                       executionEnvironments = 
executionService.getExecutionEnvivonments();
+                       assertEquals(1, executionEnvironments.size());
+               }
+               if (dataService == null) {
+                       ServiceReference dataServiceReference = bundleContext
+                                       
.getServiceReference("org.apache.taverna.platform.data.DataService");
+                       dataService = (DataService) 
bundleContext.getService(dataServiceReference);
+               }
+       }
+
+       public void testLocalExecution() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/in-out.t2flow");
+               Workflow workflow = workflowBundle.getMainWorkflow();
+               Profile profile = workflowBundle.getMainProfile();
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = 
Collections.singletonMap("in", dataService.create("test-input"));
+
+                       String executionId = 
executionService.createExecution(executionEnvironment,
+                                       workflowBundle, workflow, profile, 
inputs);
+                       WorkflowReport report = 
executionService.getWorkflowReport(executionId);
+                       assertEquals(State.CREATED, report.getState());
+                       executionService.start(executionId);
+
+                       Map<String, Data> results = report.getOutputs();
+                       assertNotNull(results);
+                       waitForResults(results, report, "out");
+
+                       Object result = results.get("out").getValue();
+                       assertEquals("test-input", result);
+                       assertEquals(State.COMPLETED, report.getState());
+                       System.out.println(report);
+               }
+       }
+
+       public void testLocalExecution2() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/beanshell.t2flow");
+               Workflow workflow = workflowBundle.getMainWorkflow();
+               Profile profile = workflowBundle.getMainProfile();
+
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = 
Collections.singletonMap("in", dataService.create("test-input"));
+
+                       String executionId = 
executionService.createExecution(executionEnvironment,
+                                       workflowBundle, workflow, profile, 
inputs);
+                       WorkflowReport report = 
executionService.getWorkflowReport(executionId);
+                       System.out.println(report);
+                       assertEquals(State.CREATED, report.getState());
+                       executionService.start(executionId);
+                       System.out.println(report);
+
+                       Map<String, Data> results = report.getOutputs();
+                       waitForResults(results, report, "out");
+
+                       List<Data> result = results.get("out").getElements();
+                       assertEquals(1000, result.size());
+                       assertEquals("test-input:0", result.get(0).getValue());
+                       assertEquals(State.COMPLETED, report.getState());
+                       System.out.println(report);
+               }
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/OSGIFrameworkIT.java
----------------------------------------------------------------------
diff --git 
a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/OSGIFrameworkIT.java
 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/OSGIFrameworkIT.java
new file mode 100644
index 0000000..b73b1ed
--- /dev/null
+++ 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/OSGIFrameworkIT.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program 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 program 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 program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ 
******************************************************************************/
+package org.apache.taverna.platform;
+
+import java.io.IOException;
+
+import org.osgi.framework.Bundle;
+import org.springframework.osgi.util.OsgiStringUtils;
+
+public class OSGIFrameworkIT extends PlatformIT {
+
+       public void testOsgiEnvironment() throws Exception {
+               Bundle[] bundles = bundleContext.getBundles();
+               for (int i = 0; i < bundles.length; i++) {
+                       
System.out.println(OsgiStringUtils.nullSafeName(bundles[i]));
+               }
+               System.out.println();
+       }
+
+       protected String[] getTestFrameworkBundlesNames() {
+               String[] frameworkBundles = 
super.getTestFrameworkBundlesNames();
+               System.out.println("Test Framework bundles:");
+               for (String bundle : frameworkBundles) {
+                       System.out.println("  " + bundle);
+               }
+               return frameworkBundles;
+       }
+
+       protected String[] getTestBundlesNames() {
+               String[] frameworkBundles = super.getTestBundlesNames();
+               System.out.println("Framework bundles:");
+               for (String bundle : frameworkBundles) {
+                       System.out.println("  " + bundle);
+               }
+               return frameworkBundles;
+       }
+
+       public void testPrintConfig() throws IOException {
+               Resource[] bundles = getTestBundles();
+               Resource[] testBundles = getTestFrameworkBundles();
+               StringBuilder sb = new StringBuilder();
+               StringBuilder sb2 = new StringBuilder();
+               System.out.println("mkdir platform");
+               System.out.println("mkdir platform/configuration");
+               sb2.append("cp ");
+               sb.append("osgi.bundles=");
+               boolean printComma = false;
+               for (Resource resource : bundles) {
+                       if (printComma) {
+                               sb.append(", ");
+                               sb2.append(" ");
+                       }
+                       sb.append(resource.getFilename() + "@start");
+                       sb2.append(resource.getFile());
+                       printComma = true;
+               }
+               for (Resource resource : testBundles) {
+                       if (!resource.getFilename().contains("test")) {
+                               if (printComma) {
+                                       sb.append(", ");
+                                       sb2.append(" ");
+                               }
+                               sb.append(resource.getFilename() + "@start");
+                               sb2.append(resource.getFile());
+                               printComma = true;
+                       }
+               }
+               sb2.append(" platform");
+               System.out.println("echo \"" + sb.toString() + "\" > 
platform/configuration/config.ini");
+               System.out.println(sb2.toString());
+               System.out.println("zip platform.zip platform/*");
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/PlatformIT.java
----------------------------------------------------------------------
diff --git 
a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/PlatformIT.java
 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/PlatformIT.java
new file mode 100644
index 0000000..822f5f2
--- /dev/null
+++ 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/PlatformIT.java
@@ -0,0 +1,375 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program 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 program 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 program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ 
******************************************************************************/
+package org.apache.taverna.platform;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Map;
+import java.util.Properties;
+
+
+import org.eclipse.osgi.framework.internal.core.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.jndi.JNDIContextManager;
+import org.springframework.osgi.test.AbstractConfigurableBundleCreatorTests;
+import org.springframework.osgi.test.platform.OsgiPlatform;
+import org.springframework.osgi.test.platform.Platforms;
+
+import org.apache.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.configuration.database.DatabaseConfiguration;
+import org.apache.taverna.platform.report.State;
+import org.apache.taverna.platform.report.WorkflowReport;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleReader;
+import org.apache.taverna.scufl2.translator.t2flow.T2FlowReader;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
+
+public class PlatformIT extends AbstractConfigurableBundleCreatorTests {
+
+       protected WorkflowBundleReader workflowBundleReader;
+       protected CredentialManager credentialManager;
+       protected MasterPasswordProvider masterPasswordProvider;
+       protected DatabaseConfiguration databaseConfiguration;
+       protected JNDIContextManager jndiContextManager;
+       protected ApplicationConfiguration applicationConfiguration;
+
+       protected String getPlatformName() {
+               // return Platforms.FELIX;
+               return Platforms.EQUINOX;
+       }
+
+       @Override
+       protected OsgiPlatform createPlatform() {
+               OsgiPlatform platform = super.createPlatform();
+               Properties config = platform.getConfigurationProperties();
+               config.setProperty("org.osgi.framework.system.packages.extra",
+                               "com.sun.org.apache.xml.internal.utils");
+               return platform;
+       }
+
+       @Override
+       protected String[] getTestBundlesNames() {
+               return new String[] {
+                               "com.jcraft.jsch, 
com.springsource.com.jcraft.jsch, 0.1.41",
+                               "com.sun.xml, 
com.springsource.com.sun.xml.bind, 2.2.0",
+                               "com.sun.xml, 
com.springsource.com.sun.xml.fastinfoset, 1.2.2",
+                               "com.thoughtworks.xstream, 
com.springsource.com.thoughtworks.xstream, 1.2.2",
+                               "commons-dbcp, commons-dbcp, 1.4",
+                               "commons-pool, commons-pool, 1.5.6",
+                               "javax.activation, 
com.springsource.javax.activation, 1.1.1",
+                               "javax.jms, com.springsource.javax.jms, 1.1.0",
+                               "javax.mail, com.springsource.javax.mail, 
1.4.0",
+                               "javax.servlet, com.springsource.javax.servlet, 
2.5.0",
+                               "javax.transaction, 
com.springsource.javax.transaction, 1.1.0",// for derby client
+                               "javax.wsdl, com.springsource.javax.wsdl, 
1.6.1",
+                               "javax.xml.bind, 
com.springsource.javax.xml.bind, 2.2.0",
+                               "javax.xml.rpc, com.springsource.javax.xml.rpc, 
1.1.0",
+                               "javax.xml.soap, 
com.springsource.javax.xml.soap, 1.3.0",
+                               "javax.xml.stream, 
com.springsource.javax.xml.stream, 1.0.1",
+                               "org.antlr, com.springsource.antlr, 2.7.6",
+                               "org.apache.aries, org.apache.aries.util, 0.3",
+                               "org.apache.aries.proxy, 
org.apache.aries.proxy.api, 0.3",
+                               "org.apache.aries.jndi, org.apache.aries.jndi, 
0.3",
+                               "org.apache.axis, 
com.springsource.org.apache.axis, 1.4.0",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.cli, 1.2.0",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.codec, 1.4.0",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.csv, 1.0.0.BUILD-20080106",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.collections, 3.2.0",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.discovery, 0.4.0",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.httpclient, 3.1.0",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.io, 1.4.0",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.lang, 2.5.0",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.logging, 1.1.1",
+                               "org.apache.commons, 
com.springsource.org.apache.commons.net, 1.4.1",
+                               // "org.apache.derby, derby, 10.5.3.0_1",
+                               "org.apache.derby, 
com.springsource.org.apache.derby, 10.5.1000001.764942",
+                               "org.apache.derby, 
com.springsource.org.apache.derby.client, 10.5.1000001.764942",
+                               "org.apache.derby, 
com.springsource.org.apache.derby.drda, 10.5.1000001.764942",
+                               "org.apache.httpcomponents, 
com.springsource.org.apache.httpcomponents.httpclient, 4.1.1",
+                               "org.apache.httpcore, 
com.springsource.org.apache.httpcomponents.httpcore, 4.1",
+                               "org.apache.log4j, 
com.springsource.org.apache.log4j, 1.2.16",
+                               "org.apache.ws, 
com.springsource.org.apache.ws.security, 1.5.8",
+                               // "org.apache.ws.security, wss4j, 1.5.12",
+                               "org.apache.xml, 
com.springsource.org.apache.xml.resolver, 1.2.0",
+                               "org.apache.xmlbeans, 
com.springsource.org.apache.xmlbeans, 2.4.0",
+                               "org.apache.xmlcommons, 
com.springsource.org.apache.xmlcommons, 1.3.4",
+                               "org.apache.xalan, 
com.springsource.org.apache.xalan, 2.7.1",
+                               "org.apache.xalan, 
com.springsource.org.apache.xml.serializer, 2.7.1",
+                               "org.apache.xerces, 
com.springsource.org.apache.xerces, 2.9.1",
+                               "org.apache.xml, 
com.springsource.org.apache.xml.security, 1.4.2",
+                               "org.aspectj, 
com.springsource.org.aspectj.runtime, 1.6.0",
+                               "org.aspectj, 
com.springsource.org.aspectj.weaver, 1.6.0",
+                               "org.beanshell, com.springsource.bsh, 2.0.0.b4",
+                               "org.biomart, martservice, 2.0-SNAPSHOT",
+                               "org.bouncycastle, bcprov-jdk16, 1.46",
+                               "org.dom4j, com.springsource.org.dom4j, 1.6.1",
+                               "org.hibernate, com.springsource.org.hibernate, 
3.2.6.ga",
+                               "org.jaxen, com.springsource.org.jaxen, 1.1.1",
+                               "org.jboss.javassist, 
com.springsource.javassist, 3.3.0.ga",
+                               "org.jdom, com.springsource.org.jdom, 1.1.0",
+                               "org.jvnet.staxex, 
com.springsource.org.jvnet.staxex, 1.0.0",
+                               "org.objectweb.asm, 
com.springsource.org.objectweb.asm, 1.5.3",
+                               "org.objectweb.asm, 
com.springsource.org.objectweb.asm.attrs, 1.5.3",
+                               "org.opensaml, com.springsource.org.opensaml, 
1.1.0",
+                               "org.springframework, org.springframework.jdbc, 
3.0.0.RC1",
+                               "org.springframework, org.springframework.orm, 
3.0.0.RC1",
+                               "org.springframework, 
org.springframework.transaction, 3.0.0.RC1",
+                               // "org.springframework, 
org.springframework.beans, 3.0.5.RELEASE",
+                               // "org.springframework, 
org.springframework.core, 3.0.5.RELEASE",
+                               // "org.springframework, 
org.springframework.context, 3.0.5.RELEASE",
+                               // "org.springframework, 
org.springframework.transaction, 3.0.5.RELEASE",
+                               "org.xmlpull, com.springsource.org.xmlpull, 
1.1.3.4-O",
+                               "net.sf.taverna, wsdl-generic, 1.10-SNAPSHOT",
+                               "net.sf.taverna.jedit, jedit-syntax, 
2.2.4-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
apiconsumer-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
beanshell-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
biomart-activity, 2.0-SNAPSHOT",
+                               // "net.sf.taverna.t2.activities, 
biomoby-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
dataflow-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
dependency-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
external-tool-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
localworker-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, rest-activity, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, rshell-activity, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
soaplab-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
spreadsheet-import-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, 
stringconstant-activity, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, wsdl-activity, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.activities, xpath-activity, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, provenance-derby, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, provenance-mysql, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, provenanceconnector, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, reference-api, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, 
reference-core-extensions, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, reference-impl, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, workflowmodel-api, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, 
workflowmodel-core-extensions, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.core, workflowmodel-impl, 
2.0-SNAPSHOT",
+                               // "net.sf.taverna.t2.infrastructure, 
appconfig, 3.0-SNAPSHOT",
+                               "net.sf.taverna.t2.lang, ui, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.lang, observer, 
2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.security, 
credential-manager, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2.security, 
credential-manager-impl, 2.0-SNAPSHOT",
+                               "net.sourceforge.cglib, 
com.springsource.net.sf.cglib, 2.1.3",
+                               "uk.org.taverna.configuration, 
taverna-app-configuration-api, 0.1.0-SNAPSHOT",
+                               "uk.org.taverna.configuration, 
taverna-app-configuration-impl, 0.1.0-SNAPSHOT",
+                               "uk.org.taverna.configuration, 
taverna-configuration-api, 0.1.0-SNAPSHOT",
+                               "uk.org.taverna.configuration, 
taverna-configuration-impl, 0.1.0-SNAPSHOT",
+                               "uk.org.taverna.configuration, 
taverna-database-configuration-api, 0.1.0-SNAPSHOT",
+                               "uk.org.taverna.configuration, 
taverna-database-configuration-impl, 0.1.0-SNAPSHOT",
+                               "org.apache.taverna.platform, report, 
0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, data, 
0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, execution-local, 
0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, execution-remote, 
0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, 
taverna-capability-api, 0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, 
taverna-capability-impl, 0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, 
taverna-execution-api, 0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, 
taverna-execution-impl, 0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, taverna-run-api, 
0.1.2-SNAPSHOT",
+                               "org.apache.taverna.platform, taverna-run-impl, 
0.1.2-SNAPSHOT",
+                               "uk.org.taverna.osgi.services, 
xml-parser-service, 0.0.1-SNAPSHOT",
+                               "uk.org.taverna.osgi.services, 
xml-transformer-service, 0.0.1-SNAPSHOT",
+                               // FIXME: Add the other scufl2 modules
+                               "org.apache.taverna.scufl2, scufl2-api, 0.9.2",
+                               "org.apache.taverna.scufl2, scufl2-rdfxml, 
0.9.2",
+                               "org.apache.taverna.scufl2, scufl2-ucfpackage, 
0.9.2",
+                               "org.apache.taverna.scufl2, scufl2-t2flow, 
0.9.2",
+                               "org.apache.taverna.scufl2, scufl2-validation, 
0.9.2",
+                               "org.apache.taverna.scufl2, 
scufl2-validation-correctness, 0.9.2",
+                               "org.apache.taverna.scufl2, 
scufl2-validation-structural, 0.9.2",
+                               "net.sf.taverna.t2, results, 2.0-SNAPSHOT",
+                               "net.sf.taverna.t2, baclava, 0.1-SNAPSHOT",
+               // "net.sf.taverna.t2.taverna-commandline, 
taverna-commandline-common, 2.0-SNAPSHOT"
+               };
+       }
+
+       protected void setup() throws Exception {
+
+               if (masterPasswordProvider == null) {
+                       masterPasswordProvider = new MasterPasswordProvider() {
+                               public String getMasterPassword(boolean 
firstTime) {
+                                       return "test";
+                               }
+
+                               public void setMasterPassword(String password) {
+                               }
+
+                               public int getProviderPriority() {
+                                       return 0;
+                               }
+                       };
+                       bundleContext.registerService(
+                                       
"net.sf.taverna.t2.security.credentialmanager.MasterPasswordProvider",
+                                       masterPasswordProvider, null);
+               }
+
+               if (credentialManager == null) {
+                       ServiceReference credentialManagerReference = 
bundleContext
+                                       
.getServiceReference("net.sf.taverna.t2.security.credentialmanager.CredentialManager");
+                       credentialManager = (CredentialManager) bundleContext
+                                       .getService(credentialManagerReference);
+               }
+
+               if (workflowBundleReader == null) {
+                       ServiceReference[] workflowBundleReaderReferences = 
bundleContext.getServiceReferences(
+                                       
"org.apache.taverna.scufl2.api.io.WorkflowBundleReader", null);
+                       for (ServiceReference serviceReference : 
workflowBundleReaderReferences) {
+                               workflowBundleReader = (WorkflowBundleReader) 
bundleContext
+                                               .getService(serviceReference);
+                               if 
(workflowBundleReader.getMediaTypes().contains(
+                                               
T2FlowReader.APPLICATION_VND_TAVERNA_T2FLOW_XML)) {
+                                       break;
+                               }
+                       }
+               }
+
+               if (databaseConfiguration == null) {
+                       ServiceReference databaseConfigurationReference = 
bundleContext
+                                       
.getServiceReference("uk.org.taverna.configuration.database.DatabaseConfiguration");
+                       databaseConfiguration = (DatabaseConfiguration) 
bundleContext
+                                       
.getService(databaseConfigurationReference);
+                       ServiceReference jndiContextManagerReference = 
bundleContext
+                                       
.getServiceReference("org.osgi.service.jndi.JNDIContextManager");
+                       jndiContextManager = (JNDIContextManager) bundleContext
+                                       
.getService(jndiContextManagerReference);
+                       ServiceReference applicationConfigurationReference = 
bundleContext
+                                       
.getServiceReference("uk.org.taverna.configuration.app.ApplicationConfiguration");
+                       applicationConfiguration = (ApplicationConfiguration) 
bundleContext
+                                       
.getService(applicationConfigurationReference);
+               }
+
+       }
+
+       public void testOsgiPlatformStarts() throws Exception {
+               System.out.println(Constants.FRAMEWORK_VENDOR + " = "
+                               + 
bundleContext.getProperty(Constants.FRAMEWORK_VENDOR));
+               System.out.println(Constants.FRAMEWORK_VERSION + " = "
+                               + 
bundleContext.getProperty(Constants.FRAMEWORK_VERSION));
+               System.out.println(Constants.FRAMEWORK_EXECUTIONENVIRONMENT + " 
= "
+                               + 
bundleContext.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT));
+               System.out.println(Constants.OSGI_IMPL_VERSION_KEY + " = "
+                               + 
bundleContext.getProperty(Constants.OSGI_IMPL_VERSION_KEY));
+       }
+
+       public WorkflowBundle loadWorkflow(String t2FlowFile) throws Exception {
+               URL wfResource = getClass().getResource(t2FlowFile);
+               assertNotNull(wfResource);
+               return workflowBundleReader.readBundle(wfResource.openStream(),
+                               
T2FlowReader.APPLICATION_VND_TAVERNA_T2FLOW_XML);
+       }
+
+       public File loadFile(String fileName) throws IOException, 
FileNotFoundException {
+               File file = File.createTempFile("platform-test", null);
+               InputStream inputStream = 
getClass().getResource(fileName).openStream();
+               OutputStream outputStream = new FileOutputStream(file);
+               byte[] buffer = new byte[64];
+               int length = -1;
+               while ((length = inputStream.read(buffer)) >= 0) {
+                       outputStream.write(buffer, 0, length);
+               }
+               outputStream.flush();
+               outputStream.close();
+               return file;
+       }
+
+//     public void printErrors(Data data) {
+//                     ErrorDocument error = (ErrorDocument) data.getValue();
+//                     String message = error.getMessage();
+//                     if (message != null) {
+//                             System.out.println(message);
+//                     }
+//                     String exceptionMessage = error.getExceptionMessage();
+//                     if (exceptionMessage != null) {
+//                             System.out.println(exceptionMessage);
+//                     }
+//                     for (StackTraceElementBean stackTraceElementBean : 
error.getStackTraceStrings()) {
+//                             
System.out.println(stackTraceElementBean.getClassName());
+//                             
System.out.println(stackTraceElementBean.getMethodName());
+//                             
System.out.println(stackTraceElementBean.getLineNumber());
+//                     }
+////                   Set<T2Reference> errorReferences = 
error.getErrorReferences();
+////                   for (T2Reference t2Reference : errorReferences) {
+////                           printErrors(referenceService, t2Reference);
+////                   }
+//     }
+//
+//     public boolean checkResult(Data result, String expectedResult) {
+//             if (result.isError()) {
+//                     printErrors(result);
+//                     return false;
+//             } else {
+//                     Object resultObject = result.getValue();
+//                     String resultValue = null;
+//                     if (resultObject instanceof byte[]) {
+//                             resultValue = new String((byte[]) resultObject);
+//                     } else {
+//                             resultValue = (String) resultObject;
+//                     }
+//
+//                     if (resultValue.startsWith(expectedResult)) {
+//                             return true;
+//                     } else {
+//                             System.out.println("Expected: " + 
expectedResult + ", Actual: " + resultValue);
+//                             return false;
+//                     }
+//             }
+//     }
+
+       public boolean waitForState(WorkflowReport report, State state) throws 
InterruptedException {
+               return waitForState(report, state, true);
+       }
+
+       public boolean waitForState(WorkflowReport report, State state, boolean 
printReport)
+                       throws InterruptedException {
+               int wait = 0;
+               while (!report.getState().equals(state) && wait++ < 30) {
+                       if (printReport)
+                               System.out.println(report);
+                       Thread.sleep(500);
+               }
+               return report.getState().equals(state);
+       }
+
+//     public void waitForResults(Map<String, Data> results, WorkflowReport 
report, String... ports)
+//                     throws InterruptedException {
+//             int wait = 0;
+//             while (!resultsReady(results, ports) && wait++ < 20) {
+//                     System.out.println(report);
+//                     Thread.sleep(500);
+//             }
+//     }
+//
+//     private boolean resultsReady(Map<String, Data> results, String... 
ports) {
+//             for (String port : ports) {
+//                     if (!results.containsKey(port)) {
+//                             return false;
+//                     }
+//             }
+//             return true;
+//     }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunIT.java
----------------------------------------------------------------------
diff --git 
a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunIT.java
 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunIT.java
new file mode 100644
index 0000000..5387afd
--- /dev/null
+++ 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunIT.java
@@ -0,0 +1,1000 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program 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 program 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 program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ 
******************************************************************************/
+package org.apache.taverna.platform;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.osgi.framework.ServiceReference;
+
+import org.apache.taverna.platform.execution.api.ExecutionEnvironment;
+import org.apache.taverna.platform.report.State;
+import org.apache.taverna.platform.report.WorkflowReport;
+import org.apache.taverna.platform.run.api.RunProfile;
+import org.apache.taverna.platform.run.api.RunService;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public class RunIT extends PlatformIT {
+
+       private RunService runService;
+
+       protected void setup() throws Exception {
+               super.setup();
+               if (runService == null) {
+                       ServiceReference runServiceReference = bundleContext
+                                       
.getServiceReference("org.apache.taverna.platform.run.api.RunService");
+                       runService = (RunService) 
bundleContext.getService(runServiceReference);
+               }
+               if (dataService == null) {
+                       ServiceReference dataServiceReference = bundleContext
+                                       
.getServiceReference("org.apache.taverna.platform.data.DataService");
+                       dataService = (DataService) 
bundleContext.getService(dataServiceReference);
+               }
+               databaseConfiguration.setProvenanceEnabled(false);
+       }
+
+       public void testRun() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/in-out.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = new HashMap<String, Data>();
+                       inputs.put("in", dataService.create("test-input"));
+
+                       String runId = runService.createRun(new 
RunProfile(executionEnvironment,
+                                       workflowBundle, inputs));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       assertNotNull(results);
+                       waitForResults(results, 
runService.getWorkflowReport(runId), "out");
+
+                       assertTrue(checkResult(results.get("out"), 
"test-input"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunApiConsumer() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/apiconsumer.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = new HashMap<String, Data>();
+                       inputs.put("in", dataService.create("test-input"));
+
+                       String runId = runService.createRun(new 
RunProfile(executionEnvironment,
+                                       workflowBundle, inputs));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       assertNotNull(results);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"), 
"TEST-INPUT"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunBeanshell() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/beanshell.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = new HashMap<String, Data>();
+                       inputs.put("in", dataService.create("test-input"));
+
+                       String runId = runService.createRun(new 
RunProfile(executionEnvironment,
+                                       workflowBundle, inputs));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       assertNotNull(results);
+                       waitForResults(results, report, "out");
+
+                       List<Data> result = results.get("out").getElements();
+                       assertEquals(1000, result.size());
+                       assertEquals("test-input:0", result.get(0).getValue());
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunBiomart() throws Exception {
+               setup();
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/biomart.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       assertNotNull(results);
+                       waitForResults(results, report, "out");
+
+                       List<Data> result = results.get("out").getElements();
+                       assertEquals(5, result.size());
+                       assertEquals("ENSBTAG00000018854", 
result.get(0).getValue());
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       // public void testRunBiomoby() throws Exception {
+       // setup();
+       // WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/biomoby.t2flow");
+       //
+       // Set<ExecutionEnvironment> executionEnvironments = runService
+       // .getExecutionEnvironments(workflowBundle);
+       // for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+       //
+       //
+       // String runId = runService.createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+       // assertEquals(State.CREATED, runService.getState(runId));
+       //
+       // WorkflowReport report = runService.getWorkflowReport(runId);
+       // System.out.println(report);
+       //
+       // runService.start(runId);
+       // assertTrue(runService.getState(runId).equals(State.RUNNING)
+       // || runService.getState(runId).equals(State.COMPLETED));
+       // System.out.println(report);
+       //
+       // Map<String, Data> results = runService.getOutputs(runId);
+       // assertNotNull(results);
+       // waitForResults(results, report, "out");
+       //
+       // T2Reference resultReference = results.get("out");
+       // if (resultReference.containsErrors()) {
+       // printErrors(referenceService, resultReference);
+       // }
+       // assertFalse(resultReference.containsErrors());
+       // @SuppressWarnings("unchecked")
+       // List<String> result = (List<String>) 
referenceService.renderIdentifier(resultReference,
+       // String.class, null);
+       // assertEquals(5, result.size());
+       // assertEquals("ENSBTAG00000018854", result.get(0));
+       // assertEquals(State.COMPLETED, runService.getState(runId));
+       // System.out.println(report);
+       // }
+       // }
+
+       public void testRunDataflow() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/dataflow.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = new HashMap<String, Data>();
+                       inputs.put("in", dataService.create("test input"));
+
+                       String runId = runService.createRun(new 
RunProfile(executionEnvironment,
+                                       workflowBundle, inputs));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertFalse(runService.getState(runId).equals(State.CREATED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"),
+                                       "nested dataflow : test input"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunLocalworker() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/localworker.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = new HashMap<String, Data>();
+                       inputs.put("in", dataService.create("Tom"));
+
+                       String runId = runService.createRun(new 
RunProfile(executionEnvironment,
+                                       workflowBundle, inputs));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       assertNotNull(results);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"), "Hello 
Tom"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunRest() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/rest.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       Object outResult = results.get("out").getValue();
+                       if (outResult instanceof byte[]) {
+                               outResult = new String((byte[]) outResult);
+                       }
+                       assertTrue(outResult instanceof String);
+                       String outString = (String) outResult;
+                       
assertTrue(outString.contains("<name>AATM_RABIT</name>"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunRestSecureBasic() throws Exception {
+               setup();
+               credentialManager.addUsernameAndPasswordForService(new 
UsernamePassword("testuser",
+                               "testpasswd"), URI
+                               
.create("http://heater.cs.man.ac.uk:7070/#Example+HTTP+BASIC+Authentication";));
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/secure-basic-authentication.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"),
+                                       "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD 
HTML 4.0 Transitional//EN\">\n"
+                                                       + 
"<HTML><HEAD><TITLE>Apache Tomcat Examples</TITLE>\n"
+                                                       + "<META 
http-equiv=Content-Type content=\"text/html\">\n"
+                                                       + "</HEAD>\n"
+                                                       + "<BODY>\n"
+                                                       + "<P>\n"
+                                                       + "<H3>Secure Apache 
Tomcat Examples</H3>\n"
+                                                       + "<P>Congratulations! 
If you see this page that means that you have authenticated yourself 
successfully using HTTP Basic Authentication.</P>\n"
+                                                       + "</BODY></HTML>"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunRestSecureBasicHttps() throws Exception {
+               setup();
+               credentialManager.addUsernameAndPasswordForService(new 
UsernamePassword("testuser",
+                               "testpasswd"), URI
+                               
.create("https://heater.cs.man.ac.uk:7443/#Example+HTTP+BASIC+Authentication";));
+
+               URL trustedCertficateFileURL = getClass().getResource(
+                               "/security/tomcat_heater_certificate.pem");
+               CertificateFactory certFactory = 
CertificateFactory.getInstance("X.509");
+               X509Certificate trustedCertficate = (X509Certificate) 
certFactory
+                               
.generateCertificate(trustedCertficateFileURL.openStream());
+               credentialManager.addTrustedCertificate(trustedCertficate);
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/secure-basic-authentication-https.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"),
+                                       "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD 
HTML 4.0 Transitional//EN\">\n"
+                                                       + 
"<HTML><HEAD><TITLE>Apache Tomcat Examples</TITLE>\n"
+                                                       + "<META 
http-equiv=Content-Type content=\"text/html\">\n"
+                                                       + "</HEAD>\n"
+                                                       + "<BODY>\n"
+                                                       + "<P>\n"
+                                                       + "<H3>Secure Apache 
Tomcat Examples</H3>\n"
+                                                       + "<P>Congratulations! 
If you see this page that means that you have authenticated yourself 
successfully using HTTP Basic Authentication.</P>\n"
+                                                       + "</BODY></HTML>"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunRestSecureDigest() throws Exception {
+               setup();
+               credentialManager.addUsernameAndPasswordForService(new 
UsernamePassword("testuser",
+                               "testpasswd"), URI
+                               
.create("http://heater.cs.man.ac.uk:7070/#Example+HTTP+BASIC+Authentication";));
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/secure-digest-authentication.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"),
+                                       "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD 
HTML 4.0 Transitional//EN\">\n"
+                                                       + 
"<HTML><HEAD><TITLE>Apache Tomcat Examples</TITLE>\n"
+                                                       + "<META 
http-equiv=Content-Type content=\"text/html\">\n"
+                                                       + "</HEAD>\n"
+                                                       + "<BODY>\n"
+                                                       + "<P>\n"
+                                                       + "<H3>Secure Apache 
Tomcat Examples</H3>\n"
+                                                       + "<P>Congratulations! 
If you see this page that means that you have authenticated yourself 
successfully using HTTP Digest Authentication.</P>\n"
+                                                       + "</BODY></HTML>"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunRestSecureDigestHttps() throws Exception {
+               setup();
+               credentialManager.addUsernameAndPasswordForService(new 
UsernamePassword("testuser",
+                               "testpasswd"), URI
+                               
.create("http://heater.cs.man.ac.uk:7443/#Example+HTTP+BASIC+Authentication";));
+
+               URL trustedCertficateFileURL = getClass().getResource(
+                               "/security/tomcat_heater_certificate.pem");
+               CertificateFactory certFactory = 
CertificateFactory.getInstance("X.509");
+               X509Certificate trustedCertficate = (X509Certificate) 
certFactory
+                               
.generateCertificate(trustedCertficateFileURL.openStream());
+               credentialManager.addTrustedCertificate(trustedCertficate);
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/secure-digest-authentication-https.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"),
+                                       "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD 
HTML 4.0 Transitional//EN\">\n"
+                                                       + 
"<HTML><HEAD><TITLE>Apache Tomcat Examples</TITLE>\n"
+                                                       + "<META 
http-equiv=Content-Type content=\"text/html\">\n"
+                                                       + "</HEAD>\n"
+                                                       + "<BODY>\n"
+                                                       + "<P>\n"
+                                                       + "<H3>Secure Apache 
Tomcat Examples</H3>\n"
+                                                       + "<P>Congratulations! 
If you see this page that means that you have authenticated yourself 
successfully using HTTP Digest Authentication.</P>\n"
+                                                       + "</BODY></HTML>"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunSpreadsheetImport() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/spreadsheetimport.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       List<Data> result = results.get("out").getElements();
+                       assertEquals(35, result.size());
+                       assertEquals("1971.0", result.get(1).getValue());
+                       assertEquals("2004.0", result.get(34).getValue());
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunSoaplab() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/soaplab.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "sequence");
+
+                       assertTrue(checkResult(results.get("sequence"),
+                                       "ID   X52524; SV 1; linear; genomic 
DNA; STD; INV; 4507 BP."));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunStringConstant() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/stringconstant.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"), "Test 
Value"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+               }
+       }
+
+       public void testRunTool() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/tool.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"), 
"HelloWorld"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+               }
+       }
+
+       public void testRunIteration() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/iteration.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = new HashMap<String, Data>();
+                       inputs.put("in", dataService.create("test"));
+
+                       String runId = runService.createRun(new 
RunProfile(executionEnvironment,
+                                       workflowBundle, inputs));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+
+                       waitForResults(results, report, "cross");
+                       List<Data> crossResult = 
results.get("cross").getElements();
+                       assertEquals(10, crossResult.size());
+                       assertEquals(10, 
crossResult.get(0).getElements().size());
+                       assertEquals(10, 
crossResult.get(5).getElements().size());
+                       assertEquals("test:0test:0", 
crossResult.get(0).getElements().get(0).getValue());
+                       assertEquals("test:0test:1", 
crossResult.get(0).getElements().get(1).getValue());
+                       assertEquals("test:4test:2", 
crossResult.get(4).getElements().get(2).getValue());
+                       assertEquals("test:7test:6", 
crossResult.get(7).getElements().get(6).getValue());
+
+                       waitForResults(results, report, "dot");
+
+                       List<Data> dotResult = results.get("dot").getElements();
+                       assertEquals(10, dotResult.size());
+                       assertEquals("test:0test:0", 
dotResult.get(0).getValue());
+                       assertEquals("test:5test:5", 
dotResult.get(5).getValue());
+
+                       waitForResults(results, report, "crossdot");
+
+                       List<Data> crossdotResult = 
results.get("crossdot").getElements();
+                       assertEquals(10, crossdotResult.size());
+                       assertEquals(10, 
crossdotResult.get(0).getElements().size());
+                       assertEquals(10, 
crossdotResult.get(5).getElements().size());
+                       assertEquals("test:0test:0test", 
crossdotResult.get(0).getElements().get(0).getValue());
+                       assertEquals("test:0test:1test", 
crossdotResult.get(0).getElements().get(1).getValue());
+                       assertEquals("test:4test:2test", 
crossdotResult.get(4).getElements().get(2).getValue());
+                       assertEquals("test:7test:6test", 
crossdotResult.get(7).getElements().get(6).getValue());
+
+                       waitForResults(results, report, "dotcross");
+
+                       List<Data> dotcrossResult = 
results.get("dotcross").getElements();
+                       assertEquals(10, dotResult.size());
+                       assertEquals("test:0test:0test", 
dotcrossResult.get(0).getValue());
+                       assertEquals("test:5test:5test", 
dotcrossResult.get(5).getValue());
+
+                       waitForResults(results, report, "dotdot");
+
+                       List<Data> dotdotResult = 
results.get("dotdot").getElements();
+                       assertEquals(10, dotResult.size());
+                       assertEquals("test:0test:0test:0", 
dotdotResult.get(0).getValue());
+                       assertEquals("test:5test:5test:5", 
dotdotResult.get(5).getValue());
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunWSDL() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/wsdl.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       // assertTrue(checkResult(results.get("out"),
+                       // "Apache Axis version: 1.4\nBuilt on Apr 22, 2006 
(06:55:48 PDT)"));
+                       assertTrue(checkResult(results.get("out"),
+                                       "Apache Axis version: 1.2\nBuilt on May 
03, 2005 (02:20:24 EDT)"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunWSDLSecure() throws Exception {
+               setup();
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("http://heater.cs.man.ac.uk:7070/axis/services/HelloService-PlaintextPassword?wsdl";));
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/wsdl-secure.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"), "Hello 
Alan!"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunWSDLSecureFull() throws Exception {
+               setup();
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("http://heater.cs.man.ac.uk:7070/axis/services/HelloService-PlaintextPassword?wsdl";));
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("http://heater.cs.man.ac.uk:7070/axis/services/HelloService-DigestPassword?wsdl";));
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("http://heater.cs.man.ac.uk:7070/axis/services/HelloService-DigestPassword-Timestamp?wsdl";));
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("http://heater.cs.man.ac.uk:7070/axis/services/HelloService-PlaintextPassword-Timestamp?wsdl";));
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/secure-ws.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out_plaintext", 
"out_digest", "out_digest_timestamp",
+                                       "out_plaintext_timestamp");
+
+                       assertTrue(checkResult(results.get("out_plaintext"), 
"Hello Alan!"));
+                       assertTrue(checkResult(results.get("out_digest"), 
"Hello Stian!"));
+                       
assertTrue(checkResult(results.get("out_digest_timestamp"),
+                                       "Hello David!"));
+                       
assertTrue(checkResult(results.get("out_plaintext_timestamp"),
+                                       "Hello Alex!"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunWSDLSecureSsh() throws Exception {
+               setup();
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("https://heater.cs.man.ac.uk:7443/axis/services/HelloService-PlaintextPassword?wsdl";));
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("https://heater.cs.man.ac.uk:7443/axis/services/HelloService-DigestPassword?wsdl";));
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("https://heater.cs.man.ac.uk:7443/axis/services/HelloService-DigestPassword-Timestamp?wsdl";));
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("https://heater.cs.man.ac.uk:7443/axis/services/HelloService-PlaintextPassword-Timestamp?wsdl";));
+
+               URL trustedCertficateFileURL = getClass().getResource(
+                               "/security/tomcat_heater_certificate.pem");
+               CertificateFactory certFactory = 
CertificateFactory.getInstance("X.509");
+               X509Certificate trustedCertficate = (X509Certificate) 
certFactory
+                               
.generateCertificate(trustedCertficateFileURL.openStream());
+               credentialManager.addTrustedCertificate(trustedCertficate);
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/secure-ws-https.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       assertEquals(State.RUNNING, runService.getState(runId));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out_plaintext", 
"out_digest", "out_digest_timestamp",
+                                       "out_plaintext_timestamp");
+
+                       assertTrue(checkResult(results.get("out_plaintext"), 
"Hello Alan!"));
+                       assertTrue(checkResult(results.get("out_digest"), 
"Hello Stian!"));
+                       
assertTrue(checkResult(results.get("out_digest_timestamp"),
+                                       "Hello David!"));
+                       
assertTrue(checkResult(results.get("out_plaintext_timestamp"),
+                                       "Hello Alex!"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunXMLSplitter() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/xmlSplitter.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = new HashMap<String, Data>();
+                       inputs.put("firstName", dataService.create("John"));
+                       inputs.put("lastName", dataService.create("Smith"));
+                       inputs.put("age", dataService.create("21"));
+
+                       String runId = runService.createRun(new 
RunProfile(executionEnvironment,
+                                       workflowBundle, inputs));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"),
+                                       "John Smith (21) of 40, Oxford Road. 
Manchester."));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunXPath() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/xpath.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       String runId = runService
+                                       .createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       waitForResults(results, report, "out");
+
+                       assertTrue(checkResult(results.get("out"),
+                                       "<test-element>test</test-element>"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+       public void testRunFromFile() throws Exception {
+               setup();
+
+               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/in-out.t2flow");
+
+               Set<ExecutionEnvironment> executionEnvironments = runService
+                               .getExecutionEnvironments(workflowBundle);
+               assertTrue(executionEnvironments.size() > 0);
+               for (ExecutionEnvironment executionEnvironment : 
executionEnvironments) {
+                       Map<String, Data> inputs = new HashMap<String, Data>();
+                       File file = loadFile("/t2flow/input.txt");
+                       Data data = dataService.create(file.toURI());
+                       assertTrue(data.isReference());
+                       inputs.put("in", data);
+
+                       String runId = runService.createRun(new 
RunProfile(executionEnvironment,
+                                       workflowBundle, inputs));
+                       assertEquals(State.CREATED, runService.getState(runId));
+
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println(report);
+
+                       runService.start(runId);
+                       
assertTrue(runService.getState(runId).equals(State.RUNNING)
+                                       || 
runService.getState(runId).equals(State.COMPLETED));
+                       System.out.println(report);
+
+                       Map<String, Data> results = 
runService.getOutputs(runId);
+                       assertNotNull(results);
+                       waitForResults(results, 
runService.getWorkflowReport(runId), "out");
+
+                       assertTrue(checkResult(results.get("out"), "test input 
value"));
+
+                       assertEquals(State.COMPLETED, 
runService.getState(runId));
+                       System.out.println(report);
+               }
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunParallelIT.java
----------------------------------------------------------------------
diff --git 
a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunParallelIT.java
 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunParallelIT.java
new file mode 100644
index 0000000..d9398ab
--- /dev/null
+++ 
b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunParallelIT.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (C) 2011 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program 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 program 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 program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ 
******************************************************************************/
+package org.apache.taverna.platform;
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.osgi.framework.ServiceReference;
+
+import org.apache.taverna.platform.execution.api.ExecutionEnvironment;
+import org.apache.taverna.platform.report.State;
+import org.apache.taverna.platform.report.WorkflowReport;
+import org.apache.taverna.platform.run.api.RunProfile;
+import org.apache.taverna.platform.run.api.RunService;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public class RunParallelIT extends PlatformIT {
+
+       private RunService runService;
+
+       private ExecutionEnvironment executionEnvironment;
+
+       protected void setup() throws Exception {
+               super.setup();
+               if (runService == null) {
+                       ServiceReference runServiceReference = bundleContext
+                                       
.getServiceReference("org.apache.taverna.platform.run.api.RunService");
+                       runService = (RunService) 
bundleContext.getService(runServiceReference);
+               }
+               if (executionEnvironment == null) {
+                       executionEnvironment = 
runService.getExecutionEnvironments().iterator().next();
+               }
+               credentialManager.addUsernameAndPasswordForService(new 
UsernamePassword("testuser",
+                               "testpasswd"), URI
+                               
.create("http://heater.cs.man.ac.uk:7070/#Example+HTTP+BASIC+Authentication";));
+               credentialManager
+                               .addUsernameAndPasswordForService(
+                                               new 
UsernamePassword("testuser", "testpasswd"),
+                                               
URI.create("http://heater.cs.man.ac.uk:7070/axis/services/HelloService-PlaintextPassword?wsdl";));
+       }
+
+       public void testRun() throws Exception {
+               setup();
+
+               String[] workflows = { "biomart", "rest", 
"secure-basic-authentication",
+                               "spreadsheetimport", "stringconstant", "wsdl", 
"wsdl-secure", "xpath" };
+               Set<String> runIDs= new HashSet<String>();
+
+               for (int i = 0; i < workflows.length; i++) {
+                       int runs = Math.max(1, (int) Math.ceil(Math.random() * 
10));
+                       System.out.println("Creating " + runs + " runs for 
workflow " + workflows[i]);
+                       for (int j = 0; j < runs; j++) {
+                               WorkflowBundle workflowBundle = 
loadWorkflow("/t2flow/" + workflows[i] + ".t2flow");
+                               String run = runService.createRun(new 
RunProfile(executionEnvironment, workflowBundle));
+                               
runService.getWorkflowReport(run).getSubject().setName(workflows[i] + j);
+                               runIDs.add(run);
+                       }
+               }
+
+               for (String runId : runIDs) {
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println("Starting " + 
report.getSubject().getName());
+                       runService.start(runId);
+               }
+
+               for (String runId : runIDs) {
+                       WorkflowReport report = 
runService.getWorkflowReport(runId);
+                       System.out.println("Waiting for " + 
report.getSubject().getName() + " to complete");
+                       assertTrue(waitForState(report, State.COMPLETED, 
false));
+               }
+
+       }
+
+}


Reply via email to