http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/50373179/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunWorkflowsIT.java ---------------------------------------------------------------------- diff --git a/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunWorkflowsIT.java b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunWorkflowsIT.java new file mode 100644 index 0000000..758e872 --- /dev/null +++ b/taverna-platform-integration-tests/src/test/java/org/apache/taverna/platform/RunWorkflowsIT.java @@ -0,0 +1,134 @@ +/******************************************************************************* + * 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.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 RunWorkflowsIT 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); + } + } + + public void testRunFetchTodaysXkcdComic() throws Exception { + setup(); + + WorkflowBundle workflowBundle = loadWorkflow("/t2flow/FetchTodaysXkcdComic.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, "todaysXkcd"); + + List<Data> result = results.get("todaysXkcd").getElements(); + assertEquals(1, result.size()); + Object value = result.get(0).getValue(); + assert(value instanceof byte[]); + byte[] binaryValue = (byte[]) value; + assertEquals('P', (char) binaryValue[1]); + assertEquals('N', (char) binaryValue[2]); + assertEquals('G', (char) binaryValue[3]); + assertEquals(State.COMPLETED, runService.getState(runId)); + System.out.println(report); + } + } + + public void testRunGBSeqTest() throws Exception { + setup(); + + WorkflowBundle workflowBundle = loadWorkflow("/t2flow/GBSeqTest.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, runService.getWorkflowReport(runId), "nuc_tiny"); + + assertTrue(checkResult(results.get("nuc_tiny"), + "<?xml version=\"1.0\"?>\n" + + " <!DOCTYPE TSeqSet PUBLIC \"-//NCBI//NCBI TSeq/EN\" \"http://www.ncbi.nlm.nih.gov/dtd/NCBI_TSeq.dtd\">\n" + + " <TSeqSet>\n" + + "<TSeq>\n" + + " <TSeq_seqtype value=\"nucleotide\"/>\n" + + " <TSeq_gi>119395733</TSeq_gi>\n" + + " <TSeq_accver>NM_000059.3</TSeq_accver>\n" + + " <TSeq_taxid>9606</TSeq_taxid>\n" + + " <TSeq_orgname>Homo sapiens</TSeq_orgname>\n" + + " <TSeq_defline>Homo sapiens breast cancer 2, early onset (BRCA2), mRNA</TSeq_defline>\n" + + " <TSeq_length>11386</TSeq_length>\n" + + " <TSeq_sequence>GTGGCGCGAGCTTCTGAAACTAGGCGGCAGAGGCGGAGCCGCTGTGGCACTGCTGCGCCTCTGCTGCGCCTCGGGTGTCTTTTGCGGCGGTGGGTCGCCGCCGGGAGAAGCGTGAGGGGACAGATTTGTGACCGGCGCGGTTTTTGTCAGCTTACTCCGGCCAAAAAAGAACTGCACCTCTGGAGCGGACTTATTTACCAAGCATTGGAGGAATATCGTAGGTAAAAATGCCTATTGGATCCAAAGAGAGGCCAACATTTTTTGAAATTTTTAAGACACGCTGCAACAAAGCAGATTTAGGACCAATAAGTCTTAATTGGTTTGAAGAACTTTCTTCAGAAGCTCCACCCTATAATTCTGAACCTGCAGAAGAATCTGAACATAAAAACAACAATTACGAACCAAACCTATTTAAAACTCCACAAAGGAAACCATCTTATAATCAGCTGGCTTCAACTCCAATAATATTCAAAGAGCAAGGGCTGACTCTGCCGCTGTACCAATCTCCTGTAAAAGAATTAGATAAATTCAAATTAGACTTAGGAAGGAATGTTCCCAATAGTAGACATAAAAGTCTTCGCACAGTGAAAACTAAAATGGATCAAGCAGATGATGTTTCCTGTCCACTTCTAAATTCTTGTCTTAGTGAAAGTCCTGTTGTTCTACAATGTACACATGTAACACCACAAAGAGATAAGTCAGTGGTATGTGGGAGTTTGTTTCATACACCAAAGTTTGTGAAGGGTCGTCAGACACCAAAACATATTTCTGAAAGTCTAGGAGCTGAGGTGGATCCTGATATGTCTTGGTCAAGTTCTTTAGCTACACCACCCACCCTTAGTTCTACTGTGCTCATAGTCAGAAATGAAGAAGCATCTGAAACTGTATTTCCTCATGATACTACTGCTAATGTGAAAAGCTATTTTTCCAATCATGATGAAAGTCTGAAGAAAAATGATAGATTTATCGC TTCTGTGACAGACAGTGAAAACACAAATCAAAGAGAAGCTGCAAGTCATGGATTTGGAAAAACATCAGGGAATTCATTTAAAGTAAATAGCTGCAAAGACCACATTGGAAAGTCAATGCCAAATGTCCTAGAAGATGAAGTATATGAAACAGTTGTAGATACCTCTGAAGAAGATAGTTTTTCATTATGTTTTTCTAAATGTAGAACAAAAAATCTACAAAAAGTAAGAACTAGCAAGACTAGGAAAAAAATTTTCCATGAAGCAAACGCTGATGAATGTGAAAAATCTAAAAACCAAGTGAAAGAAAAATACTCATTTGTATCTGAAGTGGAACCAAATGATACTGATCCATTAGATTCAAATGTAGCAAATCAGAAGCCCTTTGAGAGTGGAAGTGACAAAATCTCCAAGGAAGTTGTACCGTCTTTGGCCTGTGAATGGTCTCAACTAACCCTTTCAGGTCTAAATGGAGCCCAGATGGAGAAAATACCCCTATTGCATATTTCTTCATGTGACCAAAATATTTCAGAAAAAGACCTATTAGACACAGAGAACAAAAGAAAGAAAGATTTTCTTACTTCAGAGAATTCTTTGCCACGTATTTCTAGCCTACCAAAATCAGAGAAGCCATTAAATGAGGAAACAGTGGTAAATAAGAGAGATGAAGAGCAGCATCTTGAATCTCATACAGACTGCATTCTTGCAGTAAAGCAGGCAATATCTGGAACTTCTCCAGTGGCTTCTTCATTTCAGGGTATCAAAAAGTCTATATTCAGAATAAGAGAATCACCTAAAGAGACTTTCAATGCAAGTTTTTCAGGTCATATGACTGATCCAAACTTTAAAAAAGAAACTGAAGCCTCTGAAAGTGGACTGGAAATACATACTGTTTGCTCACAGAAGGAGGACTCCTTATGTCCAAATTTAATTGATAATGGAAGCTGGCCAGCCACCACCACACAGAATTCTGTAGCTTTGAAGAATGCAGGTTTAATA TCCACTTTGAAAAAGAAAACAAATAAGTTTATTTATGCTATACATGATGAAACATCTTATAAAGGAAAAAAAATACCGAAAGACCAAAAATCAGAACTAATTAACTGTTCAGCCCAGTTTGAAGCAAATGCTTTTGAAGCACCACTTACATTTGCAAATGCTGATTCAGGTTTATTGCATTCTTCTGTGAAAAGAAGCTGTTCACAGAATGATTCTGAAGAACCAACTTTGTCCTTAACTAGCTCTTTTGGGACAATTCTGAGGAAATGTTCTAGAAATGAAACATGTTCTAATAATACAGTAATCTCTCAGGATCTTGATTATAAAGAAGCAAAATGTAATAAGGAAAAACTACAGTTATTTATTACCCCAGAAGCTGATTCTCTGTCATGCCTGCAGGAAGGACAGTGTGAAAATGATCCAAAAAGCAAAAAAGTTTCAGATATAAAAGAAGAGGTCTTGGCTGCAGCATGTCACCCAGTACAACATTCAAAAGTGGAATACAGTGATACTGACTTTCAATCCCAGAAAAGTCTTTTATATGATCATGAAAATGCCAGCACTCTTATTTTAACTCCTACTTCCAAGGATGTTCTGTCAAACCTAGTCATGATTTCTAGAGGCAAAGAATCATACAAAATGTCAGACAAGCTCAAAGGTAACAATTATGAATCTGATGTTGAATTAACCAAAAATATTCCCATGGAAAAGAATCAAGATGTATGTGCTTTAAATGAAAATTATAAAAACGTTGAGCTGTTGCCACCTGAAAAATACATGAGAGTAGCATCACCTTCAAGAAAGGTACAATTCAACCAAAACACAAATCTAAGAGTAATCCAAAAAAATCAAGAAGAAACTACTTCAATTTCAAAAATAACTGTCAATCCAGACTCTGAAGAACTTTTCTCAGACAATGAGAATAATTTTGTCTTCCAAGTAGCTAATGAAAGGAATAATCTTGCTTTAGGAAATACTAAGGAACTTCATGAAACAG ACTTGACTTGTGTAAACGAACCCATTTTCAAGAACTCTACCATGGTTTTATATGGAGACACAGGTGATAAACAAGCAACCCAAGTGTCAATTAAAAAAGATTTGGTTTATGTTCTTGCAGAGGAGAACAAAAATAGTGTAAAGCAGCATATAAAAATGACTCTAGGTCAAGATTTAAAATCGGACATCTCCTTGAATATAGATAAAATACCAGAAAAAAATAATGATTACATGAACAAATGGGCAGGACTCTTAGGTCCAATTTCAAATCACAGTTTTGGAGGTAGCTTCAGAACAGCTTCAAATAAGGAAATCAAGCTCTCTGAACATAACATTAAGAAGAGCAAAATGTTCTTCAAAGATATTGAAGAACAATATCCTACTAGTTTAGCTTGTGTTGAAATTGTAAATACCTTGGCATTAGATAATCAAAAGAAACTGAGCAAGCCTCAGTCAATTAATACTGTATCTGCACATTTACAGAGTAGTGTAGTTGTTTCTGATTGTAAAAATAGTCATATAACCCCTCAGATGTTATTTTCCAAGCAGGATTTTAATTCAAACCATAATTTAACACCTAGCCAAAAGGCAGAAATTACAGAACTTTCTACTATATTAGAAGAATCAGGAAGTCAGTTTGAATTTACTCAGTTTAGAAAACCAAGCTACATATTGCAGAAGAGTACATTTGAAGTGCCTGAAAACCAGATGACTATCTTAAAGACCACTTCTGAGGAATGCAGAGATGCTGATCTTCATGTCATAATGAATGCCCCATCGATTGGTCAGGTAGACAGCAGCAAGCAATTTGAAGGTACAGTTGAAATTAAACGGAAGTTTGCTGGCCTGTTGAAAAATGACTGTAACAAAAGTGCTTCTGGTTATTTAACAGATGAAAATGAAGTGGGGTTTAGGGGCTTTTATTCTGCTCATGGCACAAAACTGAATGTTTCTACTGAAGCTCTGCAAAAAGCTGTGAAACTGTTTAGTGATATTGA GAATATTAGTGAGGAAACTTCTGCAGAGGTACATCCAATAAGTTTATCTTCAAGTAAATGTCATGATTCTGTTGTTTCAATGTTTAAGATAGAAAATCATAATGATAAAACTGTAAGTGAAAAAAATAATAAATGCCAACTGATATTACAAAATAATATTGAAATGACTACTGGCACTTTTGTTGAAGAAATTACTGAAAATTACAAGAGAAATACTGAAAATGAAGATAACAAATATACTGCTGCCAGTAGAAATTCTCATAACTTAGAATTTGATGGCAGTGATTCAAGTAAAAATGATACTGTTTGTATTCATAAAGATGAAACGGACTTGCTATTTACTGATCAGCACAACATATGTCTTAAATTATCTGGCCAGTTTATGAAGGAGGGAAACACTCAGATTAAAGAAGATTTGTCAGATTTAACTTTTTTGGAAGTTGCGAAAGCTCAAGAAGCATGTCATGGTAATACTTCAAATAAAGAACAGTTAACTGCTACTAAAACGGAGCAAAATATAAAAGATTTTGAGACTTCTGATACATTTTTTCAGACTGCAAGTGGGAAAAATATTAGTGTCGCCAAAGAGTCATTTAATAAAATTGTAAATTTCTTTGATCAGAAACCAGAAGAATTGCATAACTTTTCCTTAAATTCTGAATTACATTCTGACATAAGAAAGAACAAAATGGACATTCTAAGTTATGAGGAAACAGACATAGTTAAACACAAAATACTGAAAGAAAGTGTCCCAGTTGGTACTGGAAATCAACTAGTGACCTTCCAGGGACAACCCGAACGTGATGAAAAGATCAAAGAACCTACTCTATTGGGTTTTCATACAGCTAGCGGGAAAAAAGTTAAAATTGCAAAGGAATCTTTGGACAAAGTGAAAAACCTTTTTGATGAAAAAGAGCAAGGTACTAGTGAAATCACCAGTTTTAGCCATCAATGGGCAAAGACCCTAAAGTACAGAGAGGCCTGTAAAGACCTTGAA TTAGCATGTGAGACCATTGAGATCACAGCTGCCCCAAAGTGTAAAGAAATGCAGAATTCTCTCAATAATGATAAAAACCTTGTTTCTATTGAGACTGTGGTGCCACCTAAGCTCTTAAGTGATAATTTATGTAGACAAACTGAAAATCTCAAAACATCAAAAAGTATCTTTTTGAAAGTTAAAGTACATGAAAATGTAGAAAAAGAAACAGCAAAAAGTCCTGCAACTTGTTACACAAATCAGTCCCCTTATTCAGTCATTGAAAATTCAGCCTTAGCTTTTTACACAAGTTGTAGTAGAAAAACTTCTGTGAGTCAGACTTCATTACTTGAAGCAAAAAAATGGCTTAGAGAAGGAATATTTGATGGTCAACCAGAAAGAATAAATACTGCAGATTATGTAGGAAATTATTTGTATGAAAATAATTCAAACAGTACTATAGCTGAAAATGACAAAAATCATCTCTCCGAAAAACAAGATACTTATTTAAGTAACAGTAGCATGTCTAACAGCTATTCCTACCATTCTGATGAGGTATATAATGATTCAGGATATCTCTCAAAAAATAAACTTGATTCTGGTATTGAGCCAGTATTGAAGAATGTTGAAGATCAAAAAAACACTAGTTTTTCCAAAGTAATATCCAATGTAAAAGATGCAAATGCATACCCACAAACTGTAAATGAAGATATTTGCGTTGAGGAACTTGTGACTAGCTCTTCACCCTGCAAAAATAAAAATGCAGCCATTAAATTGTCCATATCTAATAGTAATAATTTTGAGGTAGGGCCACCTGCATTTAGGATAGCCAGTGGTAAAATCGTTTGTGTTTCACATGAAACAATTAAAAAAGTGAAAGACATATTTACAGACAGTTTCAGTAAAGTAATTAAGGAAAACAACGAGAATAAATCAAAAATTTGCCAAACGAAAATTATGGCAGGTTGTTACGAGGCATTGGATGATTCAGAGGATATTCTTCATAACTCTCTAGATA ATGATGAATGTAGCACGCATTCACATAAGGTTTTTGCTGACATTCAGAGTGAAGAAATTTTACAACATAACCAAAATATGTCTGGATTGGAGAAAGTTTCTAAAATATCACCTTGTGATGTTAGTTTGGAAACTTCAGATATATGTAAATGTAGTATAGGGAAGCTTCATAAGTCAGTCTCATCTGCAAATACTTGTGGGATTTTTAGCACAGCAAGTGGAAAATCTGTCCAGGTATCAGATGCTTCATTACAAAACGCAAGACAAGTGTTTTCTGAAATAGAAGATAGTACCAAGCAAGTCTTTTCCAAAGTATTGTTTAAAAGTAACGAACATTCAGACCAGCTCACAAGAGAAGAAAATACTGCTATACGTACTCCAGAACATTTAATATCCCAAAAAGGCTTTTCATATAATGTGGTAAATTCATCTGCTTTCTCTGGATTTAGTACAGCAAGTGGAAAGCAAGTTTCCATTTTAGAAAGTTCCTTACACAAAGTTAAGGGAGTGTTAGAGGAATTTGATTTAATCAGAACTGAGCATAGTCTTCACTATTCACCTACGTCTAGACAAAATGTATCAAAAATACTTCCTCGTGTTGATAAGAGAAACCCAGAGCACTGTGTAAACTCAGAAATGGAAAAAACCTGCAGTAAAGAATTTAAATTATCAAATAACTTAAATGTTGAAGGTGGTTCTTCAGAAAATAATCACTCTATTAAAGTTTCTCCATATCTCTCTCAATTTCAACAAGACAAACAACAGTTGGTATTAGGAACCAAAGTGTCACTTGTTGAGAACATTCATGTTTTGGGAAAAGAACAGGCTTCACCTAAAAACGTAAAAATGGAAATTGGTAAAACTGAAACTTTTTCTGATGTTCCTGTGAAAACAAATATAGAAGTTTGTTCTACTTACTCCAAAGATTCAGAAAACTACTTTGAAACAGAAGCAGTAGAAATTGCTAAAGCTTTTATGGAAGATGATGAACTGACAGA TTCTAAACTGCCAAGTCATGCCACACATTCTCTTTTTACATGTCCCGAAAATGAGGAAATGGTTTTGTCAAATTCAAGAATTGGAAAAAGAAGAGGAGAGCCCCTTATCTTAGTGGGAGAACCCTCAATCAAAAGAAACTTATTAAATGAATTTGACAGGATAATAGAAAATCAAGAAAAATCCTTAAAGGCTTCAAAAAGCACTCCAGATGGCACAATAAAAGATCGAAGATTGTTTATGCATCATGTTTCTTTAGAGCCGATTACCTGTGTACCCTTTCGCACAACTAAGGAACGTCAAGAGATACAGAATCCAAATTTTACCGCACCTGGTCAAGAATTTCTGTCTAAATCTCATTTGTATGAACATCTGACTTTGGAAAAATCTTCAAGCAATTTAGCAGTTTCAGGACATCCATTTTATCAAGTTTCTGCTACAAGAAATGAAAAAATGAGACACTTGATTACTACAGGCAGACCAACCAAAGTCTTTGTTCCACCTTTTAAAACTAAATCACATTTTCACAGAGTTGAACAGTGTGTTAGGAATATTAACTTGGAGGAAAACAGACAAAAGCAAAACATTGATGGACATGGCTCTGATGATAGTAAAAATAAGATTAATGACAATGAGATTCATCAGTTTAACAAAAACAACTCCAATCAAGCAGCAGCTGTAACTTTCACAAAGTGTGAAGAAGAACCTTTAGATTTAATTACAAGTCTTCAGAATGCCAGAGATATACAGGATATGCGAATTAAGAAGAAACAAAGGCAACGCGTCTTTCCACAGCCAGGCAGTCTGTATCTTGCAAAAACATCCACTCTGCCTCGAATCTCTCTGAAAGCAGCAGTAGGAGGCCAAGTTCCCTCTGCGTGTTCTCATAAACAGCTGTATACGTATGGCGTTTCTAAACATTGCATAAAAATTAACAGCAAAAATGCAGAGTCTTTTCAGTTTCACACTGAAGATTATTTTGGTAAGGAAAGTTTATGG ACTGGAAAAGGAATACAGTTGGCTGATGGTGGATGGCTCATACCCTCCAATGATGGAAAGGCTGGAAAAGAAGAATTTTATAGGGCTCTGTGTGACACTCCAGGTGTGGATCCAAAGCTTATTTCTAGAATTTGGGTTTATAATCACTATAGATGGATCATATGGAAACTGGCAGCTATGGAATGTGCCTTTCCTAAGGAATTTGCTAATAGATGCCTAAGCCCAGAAAGGGTGCTTCTTCAACTAAAATACAGATATGATACGGAAATTGATAGAAGCAGAAGATCGGCTATAAAAAAGATAATGGAAAGGGATGACACAGCTGCAAAAACACTTGTTCTCTGTGTTTCTGACATAATTTCATTGAGCGCAAATATATCTGAAACTTCTAGCAATAAAACTAGTAGTGCAGATACCCAAAAAGTGGCCATTATTGAACTTACAGATGGGTGGTATGCTGTTAAGGCCCAGTTAGATCCTCCCCTCTTAGCTGTCTTAAAGAATGGCAGACTGACAGTTGGTCAGAAGATTATTCTTCATGGAGCAGAACTGGTGGGCTCTCCTGATGCCTGTACACCTCTTGAAGCCCCAGAATCTCTTATGTTAAAGATTTCTGCTAACAGTACTCGGCCTGCTCGCTGGTATACCAAACTTGGATTCTTTCCTGACCCTAGACCTTTTCCTCTGCCCTTATCATCGCTTTTCAGTGATGGAGGAAATGTTGGTTGTGTTGATGTAATTATTCAAAGAGCATACCCTATACAGTGGATGGAGAAGACATCATCTGGATTATACATATTTCGCAATGAAAGAGAGGAAGAAAAGGAAGCAGCAAAATATGTGGAGGCCCAACAAAAGAGACTAGAAGCCTTATTCACTAAAATTCAGGAGGAATTTGAAGAACATGAAGAAAACACAACAAAACCATATTTACCATCACGTGCACTAACAAGACAGCAAGTTCGTGCTTTGCAAGATGGTGCAGAGCTTTATGAAG CAGTGAAGAATGCAGCAGACCCAGCTTACCTTGAGGGTTATTTCAGTGAAGAGCAGTTAAGAGCCTTGAATAATCACAGGCAAATGTTGAATGATAAGAAACAAGCTCAGATCCAGTTGGAAATTAGGAAGGCCATGGAATCTGCTGAACAAAAGGAACAAGGTTTATCAAGGGATGTCACAACCGTGTGGAAGTTGCGTATTGTAAGCTATTCAAAAAAAGAAAAAGATTCAGTTATACTGAGTATTTGGCGTCCATCATCAGATTTATATTCTCTGTTAACAGAAGGAAAGAGATACAGAATTTATCATCTTGCAACTTCAAAATCTAAAAGTAAATCTGAAAGAGCTAACATACAGTTAGCAGCGACAAAAAAAACTCAGTATCAACAACTACCGGTTTCAGATGAAATTTTATTTCAGATTTACCAGCCACGGGAGCCCCTTCACTTCAGCAAATTTTTAGATCCAGACTTTCAGCCATCTTGTTCTGAGGTGGACCTAATAGGATTTGTCGTTTCTGTTGTGAAAAAAACAGGACTTGCCCCTTTCGTCTATTTGTCAGACGAATGTTACAATTTACTGGCAATAAAGTTTTGGATAGACCTTAATGAGGACATTATTAAGCCTCATATGTTAATTGCTGCAAGCAACCTCCAGTGGCGACCAGAATCCAAATCAGGCCTTCTTACTTTATTTGCTGGAGATTTTTCTGTGTTTTCTGCTAGTCCAAAAGAGGGCCACTTTCAAGAGACATTCAACAAAATGAAAAATACTGTTGAGAATATTGACATACTTTGCAATGAAGCAGAAAACAAGCTTATGCATATACTGCATGCAAATGATCCCAAGTGGTCCACCCCAACTAAAGACTGTACTTCAGGGCCGTACACTGCTCAAATCATTCCTGGTACAGGAAACAAGCTTCTGATGTCTTCTCCTAATTGTGAGATATATTATCAAAGTCCTTTATCACTTTGTATGGCCAAAAGGAAGTC TGTTTCCACACCTGTCTCAGCCCAGATGACTTCAAAGTCTTGTAAAGGGGAGAAAGAGATTGATGACCAAAAGAACTGCAAAAAGAGAAGAGCCTTGGATTTCTTGAGTAGACTGCCTTTACCTCCACCTGTTAGTCCCATTTGTACATTTGTTTCTCCGGCTGCACAGAAGGCATTTCAGCCACCAAGGAGTTGTGGCACCAAATACGAAACACCCATAAAGAAAAAAGAACTGAATTCTCCTCAGATGACTCCATTTAAAAAATTCAATGAAATTTCTCTTTTGGAAAGTAATTCAATAGCTGACGAAGAACTTGCATTGATAAATACCCAAGCTCTTTTGTCTGGTTCAACAGGAGAAAAACAATTTATATCTGTCAGTGAATCCACTAGGACTGCTCCCACCAGTTCAGAAGATTATCTCAGACTGAAACGACGTTGTACTACATCTCTGATCAAAGAACAGGAGAGTTCCCAGGCCAGTACGGAAGAATGTGAGAAAAATAAGCAGGACACAATTACAACTAAAAAATATATCTAAGCATTTGCAAAGGCGACAATAAATTATTGACGCTTAACCTTTCCAGTTTATAAGACTGGAATATAATTTCAAACCACACATTAGTACTTATGTTGCACAATGAGAAAAGAAATTAGTTTCAAATTTACCTCAGCGTTTGTGTATCGGGCAAAAATCGTTTTGCCCGATTCCGTATTGGTATACTTTTGCTTCAGTTGCATATCTTAAAACTAAATGTAATTTATTAACTAATCAAGAAAAACATCTTTGGCTGAGCTCGGTGGCTCATGCCTGTAATCCCAACACTTTGAGAAGCTGAGGTGGGAGGAGTGCTTGAGGCCAGGAGTTCAAGACCAGCCTGGGCAACATAGGGAGACCCCCATCTTTACAAAGAAAAAAAAAAGGGGAAAAGAAAATCTTTTAAATCTTTGGATTTGATCACTACAAGTATTATTTTACAAGTGAAATAAACATACC ATTTTCTTTTAGATTGTGTCATTAAATGGAATGAGGTCTCTTAGTACAGTTATTTTGATGCAGATAATTCCTTTTAGTTTAGCTACTATTTTAGGGGATTTTTTTTAGAGGTAACTCACTATGAAATAGTTCTCCTTAATGCAAATATGTTGGTTCTGCTATAGTTCCATCCTGTTCAAAAGTCAGGATGAATATGAAGAGTGGTGTTTCCTTTTGAGCAATTCTTCATCCTTAAGTCAGCATGATTATAAGAAAAATAGAACCCTCAGTGTAACTCTAATTCCTTTTTACTATTCCAGTGTGATCTCTGAAATTAAATTACTTCAACTAAAAATTCAAATACTTTAAATCAGAAGATTTCATAGTTAATTTATTTTTTTTTTCAACAAAATGGTCATCCAAACTCAAACTTGAGAAAATATCTTGCTTTCAAATTGGCACTGATT</TSeq_sequence>\n" + + "</TSeq>\n" + "\n" + "</TSeqSet>")); + + waitForState(report, State.COMPLETED); + + 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/uk/org/taverna/platform/ActivityIT.java ---------------------------------------------------------------------- diff --git a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/ActivityIT.java b/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/ActivityIT.java deleted file mode 100644 index 895633b..0000000 --- a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/ActivityIT.java +++ /dev/null @@ -1,72 +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.net.URI; -import java.util.List; - -import net.sf.taverna.t2.workflowmodel.processor.activity.Activity; - -import org.osgi.framework.ServiceReference; - -import org.apache.taverna.platform.capability.activity.ActivityConfigurationException; -import org.apache.taverna.platform.capability.activity.ActivityNotFoundException; -import org.apache.taverna.platform.capability.activity.ActivityService; -import org.apache.taverna.scufl2.api.configurations.ConfigurationDefinition; - -public class ActivityIT extends PlatformIT { - - public void testGetActivityURIs() { - ServiceReference activityServiceReference = bundleContext.getServiceReference("uk.org.taverna.platform.activity.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("uk.org.taverna.platform.activity.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("uk.org.taverna.platform.activity.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/uk/org/taverna/platform/CommandLineToolIT.java ---------------------------------------------------------------------- diff --git a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/CommandLineToolIT.java b/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/CommandLineToolIT.java deleted file mode 100644 index d0d79d3..0000000 --- a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/CommandLineToolIT.java +++ /dev/null @@ -1,91 +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 net.sf.taverna.t2.commandline.CommandLineTool; - -import org.osgi.framework.ServiceReference; - -import org.apache.taverna.commandline.args.CommandLineArguments; -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("uk.org.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/uk/org/taverna/platform/ExecutionIT.java ---------------------------------------------------------------------- diff --git a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/ExecutionIT.java b/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/ExecutionIT.java deleted file mode 100644 index 3736c5e..0000000 --- a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/ExecutionIT.java +++ /dev/null @@ -1,134 +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.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.capability.activity.ActivityConfigurationException; -import org.apache.taverna.platform.capability.activity.ActivityNotFoundException; -import org.apache.taverna.platform.data.api.Data; -import org.apache.taverna.platform.capability.dispatch.DispatchLayerConfigurationException; -import org.apache.taverna.platform.capability.dispatch.DispatchLayerNotFoundException; -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.configurations.ConfigurationDefinition; -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( - "uk.org.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("uk.org.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/uk/org/taverna/platform/LocalExecutionIT.java ---------------------------------------------------------------------- diff --git a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/LocalExecutionIT.java b/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/LocalExecutionIT.java deleted file mode 100644 index fefa498..0000000 --- a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/LocalExecutionIT.java +++ /dev/null @@ -1,120 +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.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.osgi.framework.ServiceReference; - -import org.apache.taverna.platform.data.api.Data; -import org.apache.taverna.platform.data.api.DataService; -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 DataService dataService; - private Set<ExecutionEnvironment> executionEnvironments; - - protected void setup() throws Exception { - super.setup(); - if (executionService == null) { - ServiceReference[] executionServiceReferences = bundleContext.getServiceReferences( - "uk.org.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("uk.org.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/uk/org/taverna/platform/OSGIFrameworkIT.java ---------------------------------------------------------------------- diff --git a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/OSGIFrameworkIT.java b/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/OSGIFrameworkIT.java deleted file mode 100644 index 38f46c7..0000000 --- a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/OSGIFrameworkIT.java +++ /dev/null @@ -1,93 +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.IOException; - -import org.osgi.framework.Bundle; -import org.springframework.core.io.Resource; -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/uk/org/taverna/platform/PlatformIT.java ---------------------------------------------------------------------- diff --git a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/PlatformIT.java b/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/PlatformIT.java deleted file mode 100644 index 5191f33..0000000 --- a/taverna-platform-integration-tests/src/test/java/uk/org/taverna/platform/PlatformIT.java +++ /dev/null @@ -1,378 +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.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 net.sf.taverna.t2.reference.ErrorDocument; -import net.sf.taverna.t2.reference.StackTraceElementBean; -import net.sf.taverna.t2.security.credentialmanager.CredentialManager; -import net.sf.taverna.t2.security.credentialmanager.MasterPasswordProvider; - -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.data.api.Data; -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; - -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", - "uk.org.taverna.platform, report, 0.1.2-SNAPSHOT", - "uk.org.taverna.platform, data, 0.1.2-SNAPSHOT", - "uk.org.taverna.platform, execution-local, 0.1.2-SNAPSHOT", - "uk.org.taverna.platform, execution-remote, 0.1.2-SNAPSHOT", - "uk.org.taverna.platform, taverna-capability-api, 0.1.2-SNAPSHOT", - "uk.org.taverna.platform, taverna-capability-impl, 0.1.2-SNAPSHOT", - "uk.org.taverna.platform, taverna-execution-api, 0.1.2-SNAPSHOT", - "uk.org.taverna.platform, taverna-execution-impl, 0.1.2-SNAPSHOT", - "uk.org.taverna.platform, taverna-run-api, 0.1.2-SNAPSHOT", - "uk.org.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; - } - -}
