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/08/21 12:59:38 UTC
[21/50] [abbrv] incubator-taverna-common-activities git commit: moved
CWLFiles content to src/test/resources activity and activity-ui share common
test reources
moved CWLFiles content to src/test/resources
activity and activity-ui share common test reources
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/commit/aa387b34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/tree/aa387b34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/diff/aa387b34
Branch: refs/heads/cwl-browse
Commit: aa387b346b4287113ca21997490084b16b5b42df
Parents: 0cb4858
Author: ThilinaManamgoda <ma...@gmail.com>
Authored: Thu Jul 28 03:23:47 2016 +0530
Committer: ThilinaManamgoda <ma...@gmail.com>
Committed: Thu Jul 28 03:23:47 2016 +0530
----------------------------------------------------------------------
taverna-cwl-activity-ui/pom.xml | 11 +-
.../ui/serviceprovider/CwlServiceProvider.java | 15 ++-
.../taverna/cwl/ui/view/CwlContextualView.java | 1 -
.../src/main/resources/CWLFiles/customtool1.cwl | 72 ------------
.../resources/CWLFiles/customtoolrecord.cwl | 41 -------
.../view/CwlActivityContextViewFactoryTest.java | 25 -----
.../cwl/ui/view/CwlActivityContextViewTest.java | 25 +++++
taverna-cwl-activity/pom.xml | 10 +-
.../src/main/resources/CWLFiles/customtool1.cwl | 72 ------------
.../resources/CWLFiles/customtoolrecord.cwl | 41 -------
.../taverna/cwl/CwlActivityFactoryTest.java | 107 ------------------
.../taverna/cwl/CwlActivityFactoryTest.java | 110 +++++++++++++++++++
.../src/main/resources/CWLFiles/customtool1.cwl | 67 -----------
.../resources/CWLFiles/customtoolrecord.cwl | 41 -------
.../taverna/cwl/utilities/CWLUtilTest.java | 3 +-
.../src/test/resources/customtool1.cwl | 67 +++++++++++
16 files changed, 228 insertions(+), 480 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/pom.xml b/taverna-cwl-activity-ui/pom.xml
index 2ec9c19..0ea2c91 100644
--- a/taverna-cwl-activity-ui/pom.xml
+++ b/taverna-cwl-activity-ui/pom.xml
@@ -95,17 +95,22 @@
later !!! =============================================================== -->
<dependency>
- <groupId>org.apache.taverna.commonactivities</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>taverna-cwl-utilities</artifactId>
<version>${project.version}</version>
- <type>bundle</type>
</dependency>
<dependency>
<artifactId>taverna-cwl-activity</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>taverna-cwl-utilities</artifactId>
+ <version>${project.version}</version>
+ <classifier>tests-sources</classifier>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java
index 56c462f..6a54805 100644
--- a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java
+++ b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java
@@ -69,7 +69,7 @@ public class CwlServiceProvider extends AbstractConfigurableServiceProvider impl
public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
// get the location of the cwl tool from the workbench
- ArrayList<Path> paths = getPath();
+ List<Path> paths = getPath();
for (Path path : paths) {
// figure out the dots in the path ex: /maanadev/../cwltools
@@ -115,7 +115,7 @@ public class CwlServiceProvider extends AbstractConfigurableServiceProvider impl
* @param path
* @param path1 if there is no second path argument this should be set to null
*/
- public void addPath(ArrayList<Path> defaultPaths, String path, String path1) {
+ public void addPath(List<Path> defaultPaths, String path, String path1) {
Path defaultPath;
if (path1 == null)
@@ -127,18 +127,18 @@ public class CwlServiceProvider extends AbstractConfigurableServiceProvider impl
defaultPaths.add(defaultPath);
}
- private ArrayList<Path> getPath() {
+ private List<Path> getPath() {
String userInput = getConfiguration().getJsonAsObjectNode().get("path").asText();
// If user haven't provided a PATH
if (userInput.isEmpty()||userInput==null) {
- ArrayList<Path> defaultPaths = new ArrayList<>();
+ List<Path> defaultPaths = new ArrayList<>();
addPath(defaultPaths, DEFAULT_PATH_1, null);
addPath(defaultPaths, DEFAULT_PATH_2, null);
addPath(defaultPaths, XDF_DATA_HOME, COMMONWL);
return defaultPaths;
}
- return (ArrayList<Path>) Arrays.asList(Paths.get(userInput));
+ return Arrays.asList(Paths.get(userInput));
}
/**
@@ -222,7 +222,10 @@ public class CwlServiceProvider extends AbstractConfigurableServiceProvider impl
public boolean accept(Visitor arg0) {
return false;
}
-
+ /**
+ * Set the Configuration such that when service provider is created user is asked for the PATH
+ * @return
+ */
private static Configuration getDefaultConfiguration() {
Configuration c = new Configuration();
ObjectNode conf = c.getJsonAsObjectNode();
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/view/CwlContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/view/CwlContextualView.java b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/view/CwlContextualView.java
index 43fa557..cdb2c24 100644
--- a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/view/CwlContextualView.java
+++ b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/view/CwlContextualView.java
@@ -68,7 +68,6 @@ public class CwlContextualView extends HTMLBasedActivityContextualView {
private CWLUtil cwlutil;
public CwlContextualView(Activity activity,ColourManager colourManager) {
- //FIXME activty=>CWLActivity
super(activity, colourManager);
this.activity = activity;
this.configurationNode = activity.getConfiguration();
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity-ui/src/main/resources/CWLFiles/customtool1.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/resources/CWLFiles/customtool1.cwl b/taverna-cwl-activity-ui/src/main/resources/CWLFiles/customtool1.cwl
deleted file mode 100644
index b140207..0000000
--- a/taverna-cwl-activity-ui/src/main/resources/CWLFiles/customtool1.cwl
+++ /dev/null
@@ -1,72 +0,0 @@
-################################################################################
-# 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.
-#################################################################################
-
-
-#!/usr/bin/env cwl-runner
-
-class: CommandLineTool
-cwlVersion: cwl:draft-3
-
-$namespaces:
- edam: http://edamontology.org/
-
-inputs:
- - id: input_1
- type: int
- label: input 1 testing label
- description: this is a short description of input 1
- format: edam:format_2323
-
- - id: input_2
- type:
- type: array
- items: int
- label: input 2 testing label
- description: this is a short description of input 2
- format: $expression
-
- - id: input_3
- type: ["null",int]
- label: input 3 testing label
- description: this is a short description of input 3
- format: noNameSpace:testing
-
-outputs:
- - id: output_1
- type: int
- label: output 1 testing label
- description: this is a short description of output 1
- format: just a string
-
- - id: output_2
- type: String
- label: output 2 testing label
- description: this is a short description of output 2
- format: ["edam:format_2323", just a string]
-
-label: This is a short description of the tool
-
-description: |
- This is a much longer description of the tool. This can be displayed in
- the service detail panel. A Command Line Tool is a non-interactive executable
- program that reads some input, performs a computation, and terminates after
- producing some output. Command line programs are a flexible unit of code sharing
- and reuse, unfortunately the syntax and input/output semantics among command
- line programs is extremely heterogeneous. A common layer for describing the
- syntax and semantics of programs can reduce this incidental complexity by providing a consistent way to connect programs together.
-
-basecommand: echo
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity-ui/src/main/resources/CWLFiles/customtoolrecord.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/resources/CWLFiles/customtoolrecord.cwl b/taverna-cwl-activity-ui/src/main/resources/CWLFiles/customtoolrecord.cwl
deleted file mode 100644
index f008bdb..0000000
--- a/taverna-cwl-activity-ui/src/main/resources/CWLFiles/customtoolrecord.cwl
+++ /dev/null
@@ -1,41 +0,0 @@
-################################################################################
-# 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.
-#################################################################################
-
-#!/usr/bin/env cwl-runner
-
-class: CommandLineTool
-cwlVersion: cwl:draft-3
-
-inputs:
- - id: input_1
- type: record
-
- - id: input_2
- type:
- type: array
- items: int
- - id: input_3
- type: String
-
-outputs:
- - id: output_1
- type: int
-
- - id: ouput_2
- type: String
-
-basecommand: echo
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/view/CwlActivityContextViewFactoryTest.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/view/CwlActivityContextViewFactoryTest.java b/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/view/CwlActivityContextViewFactoryTest.java
deleted file mode 100644
index 873dd78..0000000
--- a/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/view/CwlActivityContextViewFactoryTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.apache.taverna.cwl.ui.view;
-
-import static org.junit.Assert.*;
-
-import org.apache.taverna.cwl.CwlDumyActivity;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.workbench.configuration.colour.ColourManager;
-import org.junit.Before;
-import org.junit.Test;
-
-public class CwlActivityContextViewFactoryTest {
-
- @Before
- public void setUp() throws Exception {
- ColourManager colourManager=null;
- CwlDumyActivity activity =new CwlDumyActivity();
- //CwlContextualView contextualView = new CwlContextualView((Activity)activity,colourManager);
- }
-
- @Test
- public void test() {
- fail("Not yet implemented");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/view/CwlActivityContextViewTest.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/view/CwlActivityContextViewTest.java b/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/view/CwlActivityContextViewTest.java
new file mode 100644
index 0000000..90ddcab
--- /dev/null
+++ b/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/view/CwlActivityContextViewTest.java
@@ -0,0 +1,25 @@
+package org.apache.taverna.cwl.ui.view;
+
+import static org.junit.Assert.*;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.junit.Before;
+import org.junit.Test;
+
+public class CwlActivityContextViewTest {
+
+ @Before
+ public void setUp() throws Exception {
+ ColourManager colourManager=null;
+ Activity activity =new Activity();
+// activity.c
+// CwlContextualView contextualView = new CwlContextualView(activity,colourManager);
+ }
+
+ @Test
+ public void test() {
+ fail("Not yet implemented");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity/pom.xml b/taverna-cwl-activity/pom.xml
index 10c6ad6..5a3bc73 100644
--- a/taverna-cwl-activity/pom.xml
+++ b/taverna-cwl-activity/pom.xml
@@ -73,10 +73,16 @@
<dependency>
- <groupId>org.apache.taverna.commonactivities</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>taverna-cwl-utilities</artifactId>
<version>${project.version}</version>
- <type>bundle</type>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>taverna-cwl-utilities</artifactId>
+ <version>${project.version}</version>
+ <classifier>test-sources</classifier>
+ <scope>test</scope>
</dependency>
</dependencies>
<!-- Added these properties to configure new dependencies -->
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity/src/main/resources/CWLFiles/customtool1.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity/src/main/resources/CWLFiles/customtool1.cwl b/taverna-cwl-activity/src/main/resources/CWLFiles/customtool1.cwl
deleted file mode 100644
index b140207..0000000
--- a/taverna-cwl-activity/src/main/resources/CWLFiles/customtool1.cwl
+++ /dev/null
@@ -1,72 +0,0 @@
-################################################################################
-# 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.
-#################################################################################
-
-
-#!/usr/bin/env cwl-runner
-
-class: CommandLineTool
-cwlVersion: cwl:draft-3
-
-$namespaces:
- edam: http://edamontology.org/
-
-inputs:
- - id: input_1
- type: int
- label: input 1 testing label
- description: this is a short description of input 1
- format: edam:format_2323
-
- - id: input_2
- type:
- type: array
- items: int
- label: input 2 testing label
- description: this is a short description of input 2
- format: $expression
-
- - id: input_3
- type: ["null",int]
- label: input 3 testing label
- description: this is a short description of input 3
- format: noNameSpace:testing
-
-outputs:
- - id: output_1
- type: int
- label: output 1 testing label
- description: this is a short description of output 1
- format: just a string
-
- - id: output_2
- type: String
- label: output 2 testing label
- description: this is a short description of output 2
- format: ["edam:format_2323", just a string]
-
-label: This is a short description of the tool
-
-description: |
- This is a much longer description of the tool. This can be displayed in
- the service detail panel. A Command Line Tool is a non-interactive executable
- program that reads some input, performs a computation, and terminates after
- producing some output. Command line programs are a flexible unit of code sharing
- and reuse, unfortunately the syntax and input/output semantics among command
- line programs is extremely heterogeneous. A common layer for describing the
- syntax and semantics of programs can reduce this incidental complexity by providing a consistent way to connect programs together.
-
-basecommand: echo
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity/src/main/resources/CWLFiles/customtoolrecord.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity/src/main/resources/CWLFiles/customtoolrecord.cwl b/taverna-cwl-activity/src/main/resources/CWLFiles/customtoolrecord.cwl
deleted file mode 100644
index f008bdb..0000000
--- a/taverna-cwl-activity/src/main/resources/CWLFiles/customtoolrecord.cwl
+++ /dev/null
@@ -1,41 +0,0 @@
-################################################################################
-# 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.
-#################################################################################
-
-#!/usr/bin/env cwl-runner
-
-class: CommandLineTool
-cwlVersion: cwl:draft-3
-
-inputs:
- - id: input_1
- type: record
-
- - id: input_2
- type:
- type: array
- items: int
- - id: input_3
- type: String
-
-outputs:
- - id: output_1
- type: int
-
- - id: ouput_2
- type: String
-
-basecommand: echo
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity/src/main/test/java/org/apache/taverna/cwl/CwlActivityFactoryTest.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity/src/main/test/java/org/apache/taverna/cwl/CwlActivityFactoryTest.java b/taverna-cwl-activity/src/main/test/java/org/apache/taverna/cwl/CwlActivityFactoryTest.java
deleted file mode 100644
index d423991..0000000
--- a/taverna-cwl-activity/src/main/test/java/org/apache/taverna/cwl/CwlActivityFactoryTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.taverna.cwl;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.workflowmodel.Edits;
-import org.apache.taverna.workflowmodel.impl.EditsImpl;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityConfigurationException;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityInputPort;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityOutputPort;
-import org.junit.Before;
-import org.junit.Test;
-import org.yaml.snakeyaml.Yaml;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class CwlActivityFactoryTest {
- private static Logger logger = Logger.getLogger(CwlActivityFactoryTest.class);
- CwlActivityFactory cwlActivityFactory;
- public static final String CWL_CONF = "cwl_conf";
- private JsonNode root;
-
- @Before
- public void setUp() throws Exception {
- cwlActivityFactory = new CwlActivityFactory();
- Edits edits = new EditsImpl();
- cwlActivityFactory.setEdits(edits);
-
- Yaml reader = new Yaml();
- ObjectMapper mapper = new ObjectMapper();
- ObjectNode cwlFile = null;
- try {
- cwlFile = mapper.valueToTree(
- reader.load(new FileInputStream(getClass().getResource("/CWLFiles/customtool1.cwl").getPath())));
- } catch (IllegalArgumentException | FileNotFoundException e) {
- System.out.println(e);
- }
-
- root = mapper.createObjectNode();
- ((ObjectNode) root).put(CWL_CONF, cwlFile);
- }
-
- @Test
- public void testSchemaJson() {
- ObjectMapper objectMapper = new ObjectMapper();
- try {
- assertEquals(cwlActivityFactory.getActivityConfigurationSchema(),
- objectMapper.readTree(getClass().getResource("/schema.json")));
- } catch (IOException e) {
- logger.error(e);
- }
-
- }
-
- @Test // FIXME
- public void testgetInputPorts() {
- Set<ActivityInputPort> set = null;
- try {
- set = cwlActivityFactory.getInputPorts(root);
- } catch (ActivityConfigurationException e) {
- logger.error(e);
-
- }
- assertEquals(3, set.size());
- Map<String, Integer> expected = new HashMap<>();
- expected.put("input_2", 1);
- expected.put("input_3", 0);
- expected.put("input_1", 0);
- Iterator<ActivityInputPort> itr = set.iterator();
- while (itr.hasNext()) {
- ActivityInputPort input = itr.next();
- int expectedDepth = expected.get(input.getName());
- assertEquals(expectedDepth, input.getDepth());
- }
- }
-
- @Test // FIXME
- public void testgetOutputPorts() {
- Set<ActivityOutputPort> set = null;
- try {
- set = cwlActivityFactory.getOutputPorts(root);
- } catch (ActivityConfigurationException e) {
- logger.error(e);
-
- }
- assertEquals(2, set.size());
- Map<String, Integer> expected = new HashMap<>();
- expected.put("output_1", 0);
- expected.put("output_2", 0);
- Iterator<ActivityOutputPort> itr = set.iterator();
- while (itr.hasNext()) {
- ActivityOutputPort output = itr.next();
- int expectedDepth = expected.get(output.getName());
- assertEquals(expectedDepth, output.getDepth());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-activity/src/test/java/org/apache/taverna/cwl/CwlActivityFactoryTest.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity/src/test/java/org/apache/taverna/cwl/CwlActivityFactoryTest.java b/taverna-cwl-activity/src/test/java/org/apache/taverna/cwl/CwlActivityFactoryTest.java
new file mode 100644
index 0000000..e913dc9
--- /dev/null
+++ b/taverna-cwl-activity/src/test/java/org/apache/taverna/cwl/CwlActivityFactoryTest.java
@@ -0,0 +1,110 @@
+package org.apache.taverna.cwl;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.cwl.utilities.CWLUtilTest;
+import org.apache.taverna.workflowmodel.Edits;
+import org.apache.taverna.workflowmodel.impl.EditsImpl;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityConfigurationException;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityInputPort;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityOutputPort;
+import org.junit.Before;
+import org.junit.Test;
+import org.yaml.snakeyaml.Yaml;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class CwlActivityFactoryTest {
+ private static Logger logger = Logger.getLogger(CwlActivityFactoryTest.class);
+ CwlActivityFactory cwlActivityFactory;
+ public static final String CWL_CONF = "cwl_conf";
+ private JsonNode root;
+
+ @Before
+ public void setUp() throws Exception {
+ cwlActivityFactory = new CwlActivityFactory();
+ Edits edits = new EditsImpl();
+ cwlActivityFactory.setEdits(edits);
+
+ Yaml reader = new Yaml();
+
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode cwlFile = null;
+ try {
+ cwlFile = mapper.valueToTree(
+ reader.load(getClass().getResourceAsStream("/customtool1.cwl")));
+ } catch (IllegalArgumentException e) {
+
+ logger.error(e.getMessage());
+ }
+
+ root = mapper.createObjectNode();
+ ((ObjectNode) root).put(CWL_CONF, cwlFile);
+ }
+
+ @Test
+ public void testSchemaJson() {
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ assertEquals(cwlActivityFactory.getActivityConfigurationSchema(),
+ objectMapper.readTree(getClass().getResource("/schema.json")));
+ } catch (IOException e) {
+ logger.error(e);
+ }
+
+ }
+
+ @Test
+ public void testgetInputPorts() {
+ Set<ActivityInputPort> set = null;
+ try {
+ set = cwlActivityFactory.getInputPorts(root);
+ } catch (ActivityConfigurationException e) {
+ logger.error(e);
+
+ }
+ assertEquals(3, set.size());
+ Map<String, Integer> expected = new HashMap<>();
+ expected.put("input_2", 1);
+ expected.put("input_3", 0);
+ expected.put("input_1", 0);
+ Iterator<ActivityInputPort> itr = set.iterator();
+ while (itr.hasNext()) {
+ ActivityInputPort input = itr.next();
+ int expectedDepth = expected.get(input.getName());
+ assertEquals(expectedDepth, input.getDepth());
+ }
+ }
+
+ @Test
+ public void testgetOutputPorts() {
+ Set<ActivityOutputPort> set = null;
+ try {
+ set = cwlActivityFactory.getOutputPorts(root);
+ } catch (ActivityConfigurationException e) {
+ logger.error(e);
+
+ }
+ assertEquals(2, set.size());
+ Map<String, Integer> expected = new HashMap<>();
+ expected.put("output_1", 0);
+ expected.put("output_2", 0);
+ Iterator<ActivityOutputPort> itr = set.iterator();
+ while (itr.hasNext()) {
+ ActivityOutputPort output = itr.next();
+ int expectedDepth = expected.get(output.getName());
+ assertEquals(expectedDepth, output.getDepth());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-utilities/src/main/resources/CWLFiles/customtool1.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-utilities/src/main/resources/CWLFiles/customtool1.cwl b/taverna-cwl-utilities/src/main/resources/CWLFiles/customtool1.cwl
deleted file mode 100644
index 227ba16..0000000
--- a/taverna-cwl-utilities/src/main/resources/CWLFiles/customtool1.cwl
+++ /dev/null
@@ -1,67 +0,0 @@
-################################################################################
-# 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.
-#################################################################################
-
-
-#!/usr/bin/env cwl-runner
-
-class: CommandLineTool
-cwlVersion: cwl:draft-3
-
-$namespaces:
- edam: http://edamontology.org/
-
-inputs:
- - id: input_1
- type: int
- label: input 1 testing label
- description: this is a short description of input 1
- format: edam:format_2323
-
- - id: input_2
- type:
- type: array
- items: int
- label: input 2 testing label
- description: this is a short description of input 2
- format: $expression
-
- - id: input_3
- type: String
- label: input 3 testing label
- description: this is a short description of input 3
- format: noNameSpace:testing
-
-outputs:
- - id: output_1
- type: int
- label: output 1 testing label
- description: this is a short description of output 1
- format: just a string
-
- - id: output_2
- type: String
- label: output 2 testing label
- description: this is a short description of output 2
- format: ["edam:format_2323", just a string]
-
-label: This is a short description of the tool
-
-description: |
- This is a much longer description of the tool. This can be displayed in
- the service detail panel
-
-basecommand: echo
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-utilities/src/main/resources/CWLFiles/customtoolrecord.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-utilities/src/main/resources/CWLFiles/customtoolrecord.cwl b/taverna-cwl-utilities/src/main/resources/CWLFiles/customtoolrecord.cwl
deleted file mode 100644
index f008bdb..0000000
--- a/taverna-cwl-utilities/src/main/resources/CWLFiles/customtoolrecord.cwl
+++ /dev/null
@@ -1,41 +0,0 @@
-################################################################################
-# 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.
-#################################################################################
-
-#!/usr/bin/env cwl-runner
-
-class: CommandLineTool
-cwlVersion: cwl:draft-3
-
-inputs:
- - id: input_1
- type: record
-
- - id: input_2
- type:
- type: array
- items: int
- - id: input_3
- type: String
-
-outputs:
- - id: output_1
- type: int
-
- - id: ouput_2
- type: String
-
-basecommand: echo
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtilTest.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtilTest.java b/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtilTest.java
index 8a94747..b484ea9 100644
--- a/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtilTest.java
+++ b/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtilTest.java
@@ -19,7 +19,6 @@ package org.apache.taverna.cwl.utilities;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@@ -41,7 +40,7 @@ public class CWLUtilTest {
public void setUp() throws Exception {
Yaml reader = new Yaml();
ObjectMapper mapper = new ObjectMapper();
- cwlFile = mapper.valueToTree(reader.load(new FileInputStream(CWLUtilTest.class.getResource("/CWLFiles/customtool1.cwl").getPath())));
+ cwlFile = mapper.valueToTree(reader.load(getClass().getResourceAsStream("/customtool1.cwl")));
cwlUtil = new CWLUtil(cwlFile);
input = cwlFile.get("inputs").get(0);
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/aa387b34/taverna-cwl-utilities/src/test/resources/customtool1.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-utilities/src/test/resources/customtool1.cwl b/taverna-cwl-utilities/src/test/resources/customtool1.cwl
new file mode 100644
index 0000000..227ba16
--- /dev/null
+++ b/taverna-cwl-utilities/src/test/resources/customtool1.cwl
@@ -0,0 +1,67 @@
+################################################################################
+# 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.
+#################################################################################
+
+
+#!/usr/bin/env cwl-runner
+
+class: CommandLineTool
+cwlVersion: cwl:draft-3
+
+$namespaces:
+ edam: http://edamontology.org/
+
+inputs:
+ - id: input_1
+ type: int
+ label: input 1 testing label
+ description: this is a short description of input 1
+ format: edam:format_2323
+
+ - id: input_2
+ type:
+ type: array
+ items: int
+ label: input 2 testing label
+ description: this is a short description of input 2
+ format: $expression
+
+ - id: input_3
+ type: String
+ label: input 3 testing label
+ description: this is a short description of input 3
+ format: noNameSpace:testing
+
+outputs:
+ - id: output_1
+ type: int
+ label: output 1 testing label
+ description: this is a short description of output 1
+ format: just a string
+
+ - id: output_2
+ type: String
+ label: output 2 testing label
+ description: this is a short description of output 2
+ format: ["edam:format_2323", just a string]
+
+label: This is a short description of the tool
+
+description: |
+ This is a much longer description of the tool. This can be displayed in
+ the service detail panel
+
+basecommand: echo