http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/3ecb1291/taverna-execution-remote/src/main/java/uk/org/taverna/platform/execution/impl/remote/RemoteExecution.java ---------------------------------------------------------------------- diff --git a/taverna-execution-remote/src/main/java/uk/org/taverna/platform/execution/impl/remote/RemoteExecution.java b/taverna-execution-remote/src/main/java/uk/org/taverna/platform/execution/impl/remote/RemoteExecution.java deleted file mode 100644 index cf94d39..0000000 --- a/taverna-execution-remote/src/main/java/uk/org/taverna/platform/execution/impl/remote/RemoteExecution.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * 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 uk.org.taverna.platform.execution.impl.remote; - -import org.purl.wf4ever.robundle.Bundle; - -import uk.org.taverna.platform.execution.api.AbstractExecution; -import uk.org.taverna.platform.report.ActivityReport; -import uk.org.taverna.platform.report.ProcessorReport; -import uk.org.taverna.platform.report.WorkflowReport; -import uk.org.taverna.scufl2.api.activity.Activity; -import uk.org.taverna.scufl2.api.container.WorkflowBundle; -import uk.org.taverna.scufl2.api.core.Processor; -import uk.org.taverna.scufl2.api.core.Workflow; -import uk.org.taverna.scufl2.api.profiles.Profile; - -/** - * An {@link uk.org.taverna.platform.execution.api.Execution Execution} for executing a Taverna workflow on a Taverna Server. - * - * @author David Withers - */ -public class RemoteExecution extends AbstractExecution { - - public RemoteExecution(WorkflowBundle workflowBundle, Workflow workflow, Profile profile, - Bundle inputs) { - super(workflowBundle, workflow, profile, inputs); - // TODO Auto-generated constructor stub - } - - @Override - protected WorkflowReport createWorkflowReport(Workflow workflow) { - // TODO Auto-generated method stub - return null; - } - - @Override - protected ProcessorReport createProcessorReport(Processor processor) { - // TODO Auto-generated method stub - return null; - } - - @Override - protected ActivityReport createActivityReport(Activity activity) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void start() { - // TODO Auto-generated method stub - - } - - @Override - public void pause() { - // TODO Auto-generated method stub - - } - - @Override - public void resume() { - // TODO Auto-generated method stub - - } - - @Override - public void cancel() { - // TODO Auto-generated method stub - - } - - @Override - public void delete() { - // TODO Auto-generated method stub - - } - -}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/3ecb1291/taverna-execution-remote/src/main/java/uk/org/taverna/platform/execution/impl/remote/RemoteExecutionService.java ---------------------------------------------------------------------- diff --git a/taverna-execution-remote/src/main/java/uk/org/taverna/platform/execution/impl/remote/RemoteExecutionService.java b/taverna-execution-remote/src/main/java/uk/org/taverna/platform/execution/impl/remote/RemoteExecutionService.java deleted file mode 100644 index 6ca8db7..0000000 --- a/taverna-execution-remote/src/main/java/uk/org/taverna/platform/execution/impl/remote/RemoteExecutionService.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * 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 uk.org.taverna.platform.execution.impl.remote; - -import java.util.Collections; -import java.util.Set; - -import org.purl.wf4ever.robundle.Bundle; - -import uk.org.taverna.platform.execution.api.AbstractExecutionService; -import uk.org.taverna.platform.execution.api.Execution; -import uk.org.taverna.platform.execution.api.ExecutionEnvironment; -import uk.org.taverna.platform.execution.api.InvalidWorkflowException; -import uk.org.taverna.scufl2.api.container.WorkflowBundle; -import uk.org.taverna.scufl2.api.core.Workflow; -import uk.org.taverna.scufl2.api.profiles.Profile; - -/** - * Service for executing Taverna workflows on a Taverna Server. - * - * @author David Withers - */ -public class RemoteExecutionService extends AbstractExecutionService { - - public RemoteExecutionService() { - super(RemoteExecutionService.class.getName(), "Taverna Remote Execution Service", - "Execution Service for executing Taverna workflows on a Taverna Server"); - } - - @Override - protected Execution createExecutionImpl(WorkflowBundle workflowBundle, Workflow workflow, - Profile profile, Bundle inputs) - throws InvalidWorkflowException { - return new RemoteExecution(workflowBundle, workflow, profile, inputs); - } - - @Override - public Set<ExecutionEnvironment> getExecutionEnvironments() { - return Collections.<ExecutionEnvironment>emptySet(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/3ecb1291/taverna-execution-remote/src/main/resources/META-INF/spring/execution-remote-context-osgi.xml ---------------------------------------------------------------------- diff --git a/taverna-execution-remote/src/main/resources/META-INF/spring/execution-remote-context-osgi.xml b/taverna-execution-remote/src/main/resources/META-INF/spring/execution-remote-context-osgi.xml deleted file mode 100644 index 2bce13d..0000000 --- a/taverna-execution-remote/src/main/resources/META-INF/spring/execution-remote-context-osgi.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans:beans xmlns="http://www.springframework.org/schema/osgi" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:beans="http://www.springframework.org/schema/beans" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/osgi - http://www.springframework.org/schema/osgi/spring-osgi.xsd"> - - <service ref="remoteExecution" interface="uk.org.taverna.platform.execution.api.ExecutionService" /> - -</beans:beans> http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/3ecb1291/taverna-execution-remote/src/main/resources/META-INF/spring/execution-remote-context.xml ---------------------------------------------------------------------- diff --git a/taverna-execution-remote/src/main/resources/META-INF/spring/execution-remote-context.xml b/taverna-execution-remote/src/main/resources/META-INF/spring/execution-remote-context.xml deleted file mode 100644 index 70f9f9d..0000000 --- a/taverna-execution-remote/src/main/resources/META-INF/spring/execution-remote-context.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - - <bean id="remoteExecution" class="uk.org.taverna.platform.execution.impl.remote.RemoteExecutionService" /> - -</beans> http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/3ecb1291/taverna-integration-tests/pom.xml ---------------------------------------------------------------------- diff --git a/taverna-integration-tests/pom.xml b/taverna-integration-tests/pom.xml deleted file mode 100644 index c1cd2be..0000000 --- a/taverna-integration-tests/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.taverna.engine</groupId> - <artifactId>taverna-engine</artifactId> - <version>3.1.0-incubating-SNAPSHOT</version> - </parent> - <artifactId>taverna-integration-tests</artifactId> - <name>Apache Taverna Integration Tests</name> - <dependencies> - <dependency> - <groupId>org.apache.taverna.engine</groupId> - <artifactId>taverna-engine-product</artifactId> - <version>0.0.1-SNAPSHOT</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.apache.xalan</groupId> - <artifactId>com.springsource.org.apache.xalan</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.xerces</groupId> - <artifactId>com.springsource.org.apache.xerces</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.taverna.language</groupId> - <artifactId>taverna-scufl2-api</artifactId> - <version>${taverna.language.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.taverna.language</groupId> - <artifactId>taverna-databundle</artifactId> - <version>${taverna.language.version}</version> - <exclusions> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>${project.parent.groupId}</groupId> - <artifactId>taverna-execution-api</artifactId> - <version>${project.parent.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>${project.parent.groupId}</groupId> - <artifactId>taverna-report-api</artifactId> - <version>${project.parent.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>${project.parent.groupId}</groupId> - <artifactId>taverna-run-api</artifactId> - <version>${project.parent.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse</groupId> - <artifactId>org.eclipse.osgi</artifactId> - <version>${osgi.equinox.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - <version>${osgi.core.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> - <version>${osgi.core.version}</version> - <scope>provided</scope> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/3ecb1291/taverna-integration-tests/src/test/java/uk/org/taverna/platform/ActivityIT.java ---------------------------------------------------------------------- diff --git a/taverna-integration-tests/src/test/java/uk/org/taverna/platform/ActivityIT.java b/taverna-integration-tests/src/test/java/uk/org/taverna/platform/ActivityIT.java deleted file mode 100644 index 5574ee0..0000000 --- a/taverna-integration-tests/src/test/java/uk/org/taverna/platform/ActivityIT.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * 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 uk.org.taverna.platform; - -import java.io.File; -import java.net.URI; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.osgi.framework.BundleContext; - -import uk.org.taverna.osgi.starter.TavernaStarter; -import uk.org.taverna.platform.execution.api.ExecutionEnvironment; -import uk.org.taverna.platform.run.api.RunService; - -public class ActivityIT extends PlatformIT { - - private static TavernaStarter tavernaStarter; - private static BundleContext bundleContext; - private static RunService runService; - - @BeforeClass - public static void setup() throws Exception { - tavernaStarter = new TavernaStarter(new File("/tmp")); - tavernaStarter.start(); - runService = tavernaStarter.getRunService(); - } - - @AfterClass - public static void shutdown() throws Exception { - tavernaStarter.stop(); - } - - @Test - public void testGetActivityURIs() { - System.out.println("================= Available Activities ==================="); - for (ExecutionEnvironment executionEnvironment : runService.getExecutionEnvironments()) { - for (URI uri : executionEnvironment.getActivityTypes()) { - System.out.println(uri); - } - } - System.out.println("=========================================================="); - System.out.println(""); - } - - public void testCreateActivity() throws Exception { -// for (URI uri : activityService.getActivityTypes()) { -// System.out.println("Creating activity " + uri); -// Activity<?> activity = activityService.createActivity(uri, null); -// } - } - - @Test - public void testGetActivityConfigurationDefinition() throws Exception { - System.out.println("============ Activity Configuration Definitions =========="); - for (ExecutionEnvironment executionEnvironment : runService.getExecutionEnvironments()) { - for (URI uri : executionEnvironment.getActivityTypes()) { - System.out.println(executionEnvironment.getActivityConfigurationSchema(uri)); - } - } - System.out.println("=========================================================="); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/3ecb1291/taverna-integration-tests/src/test/java/uk/org/taverna/platform/PlatformIT.java ---------------------------------------------------------------------- diff --git a/taverna-integration-tests/src/test/java/uk/org/taverna/platform/PlatformIT.java b/taverna-integration-tests/src/test/java/uk/org/taverna/platform/PlatformIT.java deleted file mode 100644 index 24bcbdb..0000000 --- a/taverna-integration-tests/src/test/java/uk/org/taverna/platform/PlatformIT.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * 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 uk.org.taverna.platform; - -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.nio.file.Path; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.junit.Ignore; - -import uk.org.taverna.databundle.DataBundles; -import uk.org.taverna.databundle.ErrorDocument; -import uk.org.taverna.platform.report.State; -import uk.org.taverna.platform.report.WorkflowReport; -import uk.org.taverna.scufl2.api.container.WorkflowBundle; -import uk.org.taverna.scufl2.api.io.WorkflowBundleIO; - -@Ignore -public class PlatformIT { - - public WorkflowBundle loadWorkflow(String t2FlowFile, WorkflowBundleIO workflowBundleIO) - throws Exception { - URL wfResource = getClass().getResource(t2FlowFile); - assertNotNull(wfResource); - return workflowBundleIO.readBundle(wfResource.openStream(), null); - } - - public File loadFile(String fileName) throws IOException, FileNotFoundException { - File file = File.createTempFile("platform-test", null); - file.deleteOnExit(); - FileUtils.copyURLToFile(getClass().getResource(fileName), file); - return file; - } - - public void printErrors(Path error) { - try { - ErrorDocument errorDocument = DataBundles.getError(error); - String message = errorDocument.getMessage(); - if (message != null) { - System.out.println(message); - } - String trace = errorDocument.getTrace(); - if (trace != null) { - System.out.println(trace); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - public boolean checkResult(Path result, String expectedResult) { - if (DataBundles.isError(result)) { - printErrors(result); - return false; - } else { - String resultValue; - if (DataBundles.isValue(result)) { - try { - resultValue = DataBundles.getStringValue(result); - } catch (IOException e) { - e.printStackTrace(); - return false; - } - } else if (DataBundles.isReference(result)) { - try { - URI reference = DataBundles.getReference(result); - resultValue = IOUtils.toString(reference); - } catch (IOException e) { - e.printStackTrace(); - return false; - } - } else { - System.out.println("Expected a value or reference"); - return false; - } - 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); - } - if (printReport) { - System.out.println(report); - } - return report.getState().equals(state); - } - - public void waitForResults(Path outputs, WorkflowReport report, String... ports) - throws InterruptedException { - int wait = 0; - while (!resultsReady(outputs, ports) && wait++ < 20) { - System.out.println(report); - Thread.sleep(500); - } - } - - private boolean resultsReady(Path outputs, String... ports) { - for (String port : ports) { - try { - if (DataBundles.isMissing(DataBundles.getPort(outputs, port))) { - return false; - } - } catch (IOException e) { - return false; - } - } - return true; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/3ecb1291/taverna-integration-tests/src/test/java/uk/org/taverna/platform/RunIT.java ---------------------------------------------------------------------- diff --git a/taverna-integration-tests/src/test/java/uk/org/taverna/platform/RunIT.java b/taverna-integration-tests/src/test/java/uk/org/taverna/platform/RunIT.java deleted file mode 100644 index 72cbe40..0000000 --- a/taverna-integration-tests/src/test/java/uk/org/taverna/platform/RunIT.java +++ /dev/null @@ -1,954 +0,0 @@ -/******************************************************************************* - * 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 uk.org.taverna.platform; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeTrue; - -import java.io.File; -import java.net.URI; -import java.net.URL; -import java.nio.file.Path; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.List; -import java.util.Set; - -import net.sf.taverna.t2.security.credentialmanager.CredentialManager; -import net.sf.taverna.t2.security.credentialmanager.MasterPasswordProvider; -import net.sf.taverna.t2.security.credentialmanager.UsernamePassword; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.osgi.framework.BundleContext; -import org.purl.wf4ever.robundle.Bundle; - -import uk.org.taverna.databundle.DataBundles; -import uk.org.taverna.osgi.starter.TavernaStarter; -import uk.org.taverna.platform.execution.api.ExecutionEnvironment; -import uk.org.taverna.platform.report.State; -import uk.org.taverna.platform.report.WorkflowReport; -import uk.org.taverna.platform.run.api.RunProfile; -import uk.org.taverna.platform.run.api.RunService; -import uk.org.taverna.scufl2.api.container.WorkflowBundle; -import uk.org.taverna.scufl2.api.io.WorkflowBundleIO; - -public class RunIT extends PlatformIT { - - private static TavernaStarter tavernaStarter; - private static BundleContext bundleContext; - private static WorkflowBundleIO workflowBundleIO; - private static CredentialManager credentialManager; - private static RunService runService; - - public WorkflowBundle loadWorkflow(String t2FlowFile) throws Exception { - return super.loadWorkflow(t2FlowFile, workflowBundleIO); - } - - @BeforeClass - public static void setup() throws Exception { - tavernaStarter = new TavernaStarter(new File("/tmp")); - tavernaStarter.start(); - bundleContext = tavernaStarter.getContext(); - runService = tavernaStarter.getRunService(); - credentialManager = tavernaStarter.getCredentialManager(); - workflowBundleIO = tavernaStarter.getWorkflowBundleIO(); - - bundleContext.registerService( - "net.sf.taverna.t2.security.credentialmanager.MasterPasswordProvider", - new MasterPasswordProvider() { - public String getMasterPassword(boolean firstTime) { - return "test"; - } - - public void setMasterPassword(String password) { - } - - public int getProviderPriority() { - return 0; - } - }, null); - - } - - @AfterClass - public static void shutdown() throws Exception { - tavernaStarter.stop(); - } - - @Test - public void testRun() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/in-out.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assertTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - Bundle inputBundle = DataBundles.createBundle(); - Path inputs = DataBundles.getInputs(inputBundle); - Path port = DataBundles.getPort(inputs, "in"); - DataBundles.setStringValue(port, "test-input"); - - String runId = runService.createRun(new RunProfile(executionEnvironment, - workflowBundle, inputBundle)); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "test-input")); - } - } - - @Test - public void testRunApiConsumer() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/apiconsumer.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assertTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - Bundle inputBundle = DataBundles.createBundle(); - Path inputs = DataBundles.getInputs(inputBundle); - Path port = DataBundles.getPort(inputs, "in"); - DataBundles.setStringValue(port, "test-input"); - - String runId = runService.createRun(new RunProfile(executionEnvironment, - workflowBundle, inputBundle)); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "TEST-INPUT")); - } - } - - @Test - public void testRunBeanshell() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/beanshell.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assertTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - Bundle inputBundle = DataBundles.createBundle(); - Path inputs = DataBundles.getInputs(inputBundle); - Path port = DataBundles.getPort(inputs, "in"); - DataBundles.setStringValue(port, "test-input"); - - String runId = runService.createRun(new RunProfile(executionEnvironment, - workflowBundle, inputBundle)); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - Path outPort = DataBundles.getPort(outputs, "out"); - assertTrue(DataBundles.isList(outPort)); - List<Path> result = DataBundles.getList(outPort); - assertEquals(1000, result.size()); - assertEquals("test-input:0", DataBundles.getStringValue(result.get(0))); - } - } - - @Test - public void testRunBiomart() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - Path outPort = DataBundles.getPort(outputs, "out"); - assertTrue(DataBundles.isList(outPort)); - List<Path> result = DataBundles.getList(outPort); - assertEquals(6, result.size()); - assertEquals("ENSBTAG00000018278", DataBundles.getStringValue(result.get(0))); - } - } - - @Test - @Ignore - public void testRunBiomoby() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/biomoby.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assumeTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - - String runId = runService - .createRun(new RunProfile(executionEnvironment, workflowBundle, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - Path outPort = DataBundles.getPort(outputs, "out"); - assertTrue(DataBundles.isList(outPort)); - List<Path> result = DataBundles.getList(outPort); - assertEquals(5, result.size()); - assertEquals("ENSBTAG00000018854", DataBundles.getStringValue(result.get(0))); - } - } - - @Test - public void testRunDataflow() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/dataflow.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assertTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - Bundle inputBundle = DataBundles.createBundle(); - Path inputs = DataBundles.getInputs(inputBundle); - Path port = DataBundles.getPort(inputs, "in"); - DataBundles.setStringValue(port, "test-input"); - - String runId = runService.createRun(new RunProfile(executionEnvironment, - workflowBundle, inputBundle)); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "nested dataflow : test-input")); - } - } - - @Test - public void testRunLocalworker() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/localworker.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assertTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - Bundle inputBundle = DataBundles.createBundle(); - Path inputs = DataBundles.getInputs(inputBundle); - Path port = DataBundles.getPort(inputs, "in"); - DataBundles.setStringValue(port, "Tom"); - - String runId = runService.createRun(new RunProfile(executionEnvironment, - workflowBundle, inputBundle)); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "Hello Tom")); - } - } - - @Test - public void testRunRest() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - String outString = DataBundles.getStringValue(DataBundles.getPort(outputs, "out")); - assertTrue(outString.contains("<name>AATM_RABIT</name>")); - } - } - - @Test - public void testRunRestSecureBasic() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult( - DataBundles.getPort(outputs, "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>")); - } - } - - @Test - public void testRunRestSecureBasicHttps() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult( - DataBundles.getPort(outputs, "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>")); - } - } - - @Test - public void testRunRestSecureDigest() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult( - DataBundles.getPort(outputs, "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>")); - } - } - - @Test - public void testRunRestSecureDigestHttps() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult( - DataBundles.getPort(outputs, "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>")); - } - } - - @Test - public void testRunSpreadsheetImport() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - Path outPort = DataBundles.getPort(outputs, "out"); - assertTrue(DataBundles.isList(outPort)); - List<Path> result = DataBundles.getList(outPort); - assertEquals(35, result.size()); - assertEquals("1971.0", DataBundles.getStringValue(result.get(1))); - assertEquals("2004.0", DataBundles.getStringValue(result.get(34))); - } - } - - @Test - public void testRunSoaplab() throws Exception { - // TODO find new soaplab service for testing - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "sequence"), - "ID X52524; SV 1; linear; genomic DNA; STD; INV; 4507 BP.")); - } - } - - @Test - public void testRunStringConstant() throws Exception { - 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, DataBundles.createBundle())); - WorkflowReport report = runService.getWorkflowReport(runId); - assertEquals(State.CREATED, runService.getState(runId)); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "Test Value")); - } - } - - @Test - public void testRunTool() throws Exception { - 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, DataBundles.createBundle())); - WorkflowReport report = runService.getWorkflowReport(runId); - assertEquals(State.CREATED, runService.getState(runId)); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "HelloWorld")); - } - } - - @Test - public void testRunIteration() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/iteration.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assertTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - Bundle inputBundle = DataBundles.createBundle(); - Path inputs = DataBundles.getInputs(inputBundle); - Path port = DataBundles.getPort(inputs, "in"); - DataBundles.setStringValue(port, "test"); - - String runId = runService.createRun(new RunProfile(executionEnvironment, - workflowBundle, inputBundle)); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - Path crossPort = DataBundles.getPort(outputs, "cross"); - assertTrue(DataBundles.isList(crossPort)); - List<Path> crossResult = DataBundles.getList(crossPort); - assertEquals(10, crossResult.size()); - assertEquals(10, DataBundles.getList(crossResult.get(0)).size()); - assertEquals(10, DataBundles.getList(crossResult.get(5)).size()); - assertEquals("test:0test:0", DataBundles.getStringValue(DataBundles.getListItem(DataBundles.getListItem(crossPort, 0), 0))); - assertEquals("test:0test:1", DataBundles.getStringValue(DataBundles.getListItem(DataBundles.getListItem(crossPort, 0), 1))); - assertEquals("test:4test:2", DataBundles.getStringValue(DataBundles.getListItem(DataBundles.getListItem(crossPort, 4), 2))); - assertEquals("test:7test:6", DataBundles.getStringValue(DataBundles.getListItem(DataBundles.getListItem(crossPort, 7), 6))); - - Path dotPort = DataBundles.getPort(outputs, "dot"); - assertTrue(DataBundles.isList(dotPort)); - List<Path> dotResult = DataBundles.getList(dotPort); - assertEquals(10, dotResult.size()); - assertEquals("test:0test:0", DataBundles.getStringValue(DataBundles.getListItem(dotPort, 0))); - assertEquals("test:5test:5", DataBundles.getStringValue(DataBundles.getListItem(dotPort, 5))); - - Path crossdotPort = DataBundles.getPort(outputs, "crossdot"); - assertTrue(DataBundles.isList(crossdotPort)); - List<Path> crossdotResult = DataBundles.getList(crossdotPort); - assertEquals(10, crossdotResult.size()); - assertEquals(10, DataBundles.getList(crossdotResult.get(0)).size()); - assertEquals(10, DataBundles.getList(crossdotResult.get(5)).size()); - assertEquals("test:0test:0test", DataBundles.getStringValue(DataBundles.getListItem(DataBundles.getListItem(crossdotPort, 0), 0))); - assertEquals("test:0test:1test", DataBundles.getStringValue(DataBundles.getListItem(DataBundles.getListItem(crossdotPort, 0), 1))); - assertEquals("test:4test:2test", DataBundles.getStringValue(DataBundles.getListItem(DataBundles.getListItem(crossdotPort, 4), 2))); - assertEquals("test:7test:6test", DataBundles.getStringValue(DataBundles.getListItem(DataBundles.getListItem(crossdotPort, 7), 6))); - - Path dotcrossPort = DataBundles.getPort(outputs, "dotcross"); - assertTrue(DataBundles.isList(dotcrossPort)); - List<Path> dotcrossResult = DataBundles.getList(crossdotPort); - assertEquals(10, dotcrossResult.size()); - assertEquals("test:0test:0test", DataBundles.getStringValue(DataBundles.getListItem(dotcrossPort, 0))); - assertEquals("test:5test:5test", DataBundles.getStringValue(DataBundles.getListItem(dotcrossPort, 5))); - - Path dotdotPort = DataBundles.getPort(outputs, "dotdot"); - assertTrue(DataBundles.isList(dotdotPort)); - List<Path> dotdotResult = DataBundles.getList(crossdotPort); - assertEquals(10, dotdotResult.size()); - assertEquals("test:0test:0test:0", DataBundles.getStringValue(DataBundles.getListItem(dotdotPort, 0))); - assertEquals("test:5test:5test:5", DataBundles.getStringValue(DataBundles.getListItem(dotdotPort, 5))); - } - } - - @Test - public void testRunWSDL() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - // assertTrue(checkResult(results.get("out"), - // "Apache Axis version: 1.4\nBuilt on Apr 22, 2006 (06:55:48 PDT)")); - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), - "Apache Axis version: 1.2\nBuilt on May 03, 2005 (02:20:24 EDT)")); - } - } - - @Test - public void testRunWSDLSecure() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "Hello Alan!")); - } - } - - @Test - public void testRunWSDLSecureFull() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out_plaintext"), "Hello Alan!")); - assertTrue(checkResult(DataBundles.getPort(outputs, "out_digest"), "Hello Stian!")); - assertTrue(checkResult(DataBundles.getPort(outputs, "out_digest_timestamp"), "Hello David!")); - assertTrue(checkResult(DataBundles.getPort(outputs, "out_plaintext_timestamp"), "Hello Alex!")); - } - } - - @Test - public void testRunWSDLSecureSsh() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out_plaintext"), "Hello Alan!")); - assertTrue(checkResult(DataBundles.getPort(outputs, "out_digest"), "Hello Stian!")); - assertTrue(checkResult(DataBundles.getPort(outputs, "out_digest_timestamp"), "Hello David!")); - assertTrue(checkResult(DataBundles.getPort(outputs, "out_plaintext_timestamp"), "Hello Alex!")); - } - } - - @Test - public void testRunXMLSplitter() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/xmlSplitter.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assertTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - Bundle inputBundle = DataBundles.createBundle(); - Path inputs = DataBundles.getInputs(inputBundle); - DataBundles.setStringValue(DataBundles.getPort(inputs, "firstName"), "John"); - DataBundles.setStringValue(DataBundles.getPort(inputs, "lastName"), "Smith"); - DataBundles.setStringValue(DataBundles.getPort(inputs, "age"), "21"); - - String runId = runService.createRun(new RunProfile(executionEnvironment, - workflowBundle, inputBundle)); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), - "John Smith (21) of 40, Oxford Road. Manchester.")); - } - } - - @Test - public void testRunXPath() throws Exception { - 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, DataBundles.createBundle())); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "<test-element>test</test-element>")); - } - } - - @Test - public void testRunFromFile() throws Exception { - WorkflowBundle workflowBundle = loadWorkflow("/t2flow/in-out.t2flow"); - - Set<ExecutionEnvironment> executionEnvironments = runService - .getExecutionEnvironments(workflowBundle); - assertTrue(executionEnvironments.size() > 0); - for (ExecutionEnvironment executionEnvironment : executionEnvironments) { - Bundle inputBundle = DataBundles.createBundle(); - Path inputs = DataBundles.getInputs(inputBundle); - File file = loadFile("/t2flow/input.txt"); - DataBundles.setReference(DataBundles.getPort(inputs, "in"), file.toURI()); - assertTrue(DataBundles.isReference(DataBundles.getPort(inputs, "in"))); - assertFalse(DataBundles.isValue(DataBundles.getPort(inputs, "in"))); - - String runId = runService.createRun(new RunProfile(executionEnvironment, - workflowBundle, inputBundle)); - assertEquals(State.CREATED, runService.getState(runId)); - - WorkflowReport report = runService.getWorkflowReport(runId); - System.out.println(report); - - runService.start(runId); - assertTrue(waitForState(report, State.COMPLETED)); - - Bundle outputBundle = runService.getDataBundle(runId); - assertNotNull(outputBundle); - Path outputs = DataBundles.getOutputs(outputBundle); - - assertTrue(checkResult(DataBundles.getPort(outputs, "out"), "test input value")); - } - } - -}
