You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2016/05/26 13:43:38 UTC
[42/50] incubator-taverna-language git commit: ConvertToWfdesc
removed in favour of tavlang tool
ConvertToWfdesc removed in favour of tavlang tool
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/commit/f9376783
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/f9376783
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/f9376783
Branch: refs/heads/cwl
Commit: f93767837c2ce3720ee06fb462f6f090968dbf79
Parents: 02b3696
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Mon May 16 11:01:28 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Mon May 16 11:01:28 2016 +0100
----------------------------------------------------------------------
.../taverna/scufl2/wfdesc/ConvertToWfdesc.java | 76 --------
.../scufl2/wfdesc/TestConvertToWfdesc.java | 188 -------------------
2 files changed, 264 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f9376783/taverna-scufl2-wfdesc/src/main/java/org/apache/taverna/scufl2/wfdesc/ConvertToWfdesc.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-wfdesc/src/main/java/org/apache/taverna/scufl2/wfdesc/ConvertToWfdesc.java b/taverna-scufl2-wfdesc/src/main/java/org/apache/taverna/scufl2/wfdesc/ConvertToWfdesc.java
deleted file mode 100644
index fa9f28c..0000000
--- a/taverna-scufl2-wfdesc/src/main/java/org/apache/taverna/scufl2/wfdesc/ConvertToWfdesc.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.taverna.scufl2.wfdesc;
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
-import javax.xml.bind.JAXBException;
-
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Logger;
-import org.apache.log4j.Level;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import org.apache.taverna.scufl2.api.io.WriterException;
-
-
-public class ConvertToWfdesc {
-
- static {
- BasicConfigurator.configure();
- Logger.getRootLogger().setLevel(Level.WARN);
- }
-
- public static void main(String[] args) throws JAXBException, IOException,
- ReaderException, WriterException {
- WorkflowBundleIO io = new WorkflowBundleIO();
- if (Arrays.asList(args).contains("-h") || Arrays.asList(args).contains("--help")) {
- System.out.println("scufl2-to-wfdesc [workflow] ...");
- System.out.println("");
- System.out.println("Converts each of the workflow files to wfdesc.");
- System.out.println("See http://purl.org/wf4ever/model");
- System.out.println("The wfdesc will be stored in a matching filename with ");
- System.out.println("the .wfdesc.ttl extension.");
- System.out.println("If no arguments are given, read from STDIN and write to STDOUT.");
- return;
- }
- if (args.length==0) {
- WorkflowBundle wfBundle = io.readBundle(System.in, null);
- io.writeBundle(wfBundle, System.out,
- "text/vnd.wf4ever.wfdesc+turtle");
- }
- for (String filepath : args) {
- File original = new File(filepath);
- String filename = original.getName();
- filename = filename.replaceFirst("\\..*", "") + ".wfdesc.ttl";
- File wfdesc = new File(original.getParentFile(), filename);
- WorkflowBundle wfBundle = io.readBundle(original, null);
- io.writeBundle(wfBundle, wfdesc,
- "text/vnd.wf4ever.wfdesc+turtle");
- System.out.println("Converted " + original.getPath() + " to " + wfdesc.getPath());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f9376783/taverna-scufl2-wfdesc/src/test/java/org/apache/taverna/scufl2/wfdesc/TestConvertToWfdesc.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-wfdesc/src/test/java/org/apache/taverna/scufl2/wfdesc/TestConvertToWfdesc.java b/taverna-scufl2-wfdesc/src/test/java/org/apache/taverna/scufl2/wfdesc/TestConvertToWfdesc.java
deleted file mode 100644
index 7528457..0000000
--- a/taverna-scufl2-wfdesc/src/test/java/org/apache/taverna/scufl2/wfdesc/TestConvertToWfdesc.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.apache.taverna.scufl2.wfdesc;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestConvertToWfdesc {
- private static final boolean DEBUG = false;
- private static final String HELLOANYONE_T2FLOW = "helloanyone.t2flow";
- private static final String HELLOWORLD_T2FLOW = "helloworld.t2flow";
- private File helloworldT2flow;
- private File helloanyoneT2flow;
- private File helloworldWfdesc;
- private File helloanyoneWfdesc;
- private InputStream origIn;
- private PrintStream origOut;
- private PrintStream origErr;
-
- @Before
- public void copyT2flow() throws IOException {
- File tempdir = File.createTempFile("scufl2-wfdesc", "test");
- tempdir.delete();
- assertTrue(tempdir.mkdir());
- if (DEBUG) {
- System.out.println("Copying to " + tempdir);
- }
-
- helloworldT2flow = new File(tempdir, HELLOWORLD_T2FLOW);
- FileUtils.copyInputStreamToFile(getClass().getResourceAsStream("/" + HELLOWORLD_T2FLOW), helloworldT2flow);
-
- helloanyoneT2flow = new File(tempdir, HELLOANYONE_T2FLOW);
- FileUtils.copyInputStreamToFile(getClass().getResourceAsStream("/" + HELLOANYONE_T2FLOW), helloanyoneT2flow);
-
- helloworldWfdesc = new File(tempdir, "helloworld.wfdesc.ttl");
-
- helloanyoneWfdesc = new File(tempdir, "helloanyone.wfdesc.ttl");
- }
-
- @After
- public void deleteTemp() throws IOException {
- if (DEBUG) {
- return;
- }
- for (File f : new File[] { helloworldT2flow, helloanyoneT2flow,
- helloworldWfdesc, helloanyoneWfdesc,
- helloworldT2flow.getParentFile() }) {
- f.delete();
- }
- }
-
- @Before
- public void origStd() {
- origIn = System.in;
- origOut = System.out;
- origErr = System.err;
- }
-
- @After
- public void restoreStd() {
- System.setIn(origIn);
- System.setOut(origOut);
- System.setErr(origErr);
- }
-
- @Test
- public void help() throws Exception {
- help("-h");
- help("--help");
- }
-
- private void help(String argName) throws Exception {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- PrintStream outBuf = new PrintStream(out);
-
- ByteArrayOutputStream err = new ByteArrayOutputStream();
- PrintStream errBuf = new PrintStream(err);
-
- try {
- System.setOut(outBuf);
- System.setErr(errBuf);
- ConvertToWfdesc.main(new String[]{argName});
- } finally {
- restoreStd();
- }
- out.flush();
- out.close();
- err.flush();
- err.close();
-
- assertEquals(0, err.size());
- String help = out.toString("utf-8");
-// System.out.println(help);
- assertTrue(help.contains("scufl2-to-wfdesc"));
- assertTrue(help.contains("\nIf no arguments are given"));
- }
-
- @Test
- public void stdin() throws Exception {
- byte[] input = IOUtils.toByteArray(getClass().getResourceAsStream("/" + HELLOWORLD_T2FLOW));
- assertTrue(input.length > 0);
- InputStream in = new ByteArrayInputStream(input);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- PrintStream outBuf = new PrintStream(out);
- try {
- System.setIn(in);
- System.setOut(outBuf);
- ConvertToWfdesc.main(new String[]{});
- } finally {
- restoreStd();
- }
- out.flush();
- out.close();
- String turtle = out.toString("utf-8");
- //System.out.println(turtle);
- assertTrue(turtle.contains("Hello_World"));
- assertTrue(turtle.contains("processor/hello/out/value"));
- }
-
- @Test
- public void convert() throws Exception {
- assertFalse(helloworldWfdesc.exists());
- assertFalse(helloanyoneWfdesc.exists());
- ConvertToWfdesc.main(new String[]{helloworldT2flow.getAbsolutePath(), helloanyoneT2flow.getAbsolutePath() });
- assertTrue(helloworldWfdesc.exists());
- assertTrue(helloanyoneWfdesc.exists());
-
- // FIXME: Update test to use Jena
-
-// Repository myRepository = new SailRepository(new MemoryStore());
-// myRepository.initialize();
-// RepositoryConnection con = myRepository.getConnection();
-// con.add(helloworldWfdesc, helloworldWfdesc.toURI().toASCIIString(), RDFFormat.TURTLE);
-//// assertTrue(con.prepareTupleQuery(QueryLanguage.SPARQL,
-// assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL,
-// "PREFIX wfdesc: <http://purl.org/wf4ever/wfdesc#> " +
-// "ASK { " +
-// "?wf a wfdesc:Workflow, wfdesc:Process ;" +
-// " wfdesc:hasOutput ?greeting; " +
-// " wfdesc:hasDataLink ?link; " +
-// " wfdesc:hasSubProcess ?hello . " +
-// "?hello a wfdesc:Process ;" +
-// " wfdesc:hasOutput ?value . " +
-// "?greeting a wfdesc:Output . " +
-// "?value a wfdesc:Output . " +
-// "?link a wfdesc:DataLink ; " +
-// " wfdesc:hasSource ?value ; " +
-// " wfdesc:hasSink ?greeting . " +
-// "}").evaluate());
-
- }
-
-
-
-}