old test cases deleted

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/18447f7d
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/tree/18447f7d
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/diff/18447f7d

Branch: refs/heads/cwl-browse
Commit: 18447f7de78a22984e4aa7243f811c2330a16949
Parents: 0d2640d
Author: ThilinaManamgoda <[email protected]>
Authored: Fri Aug 12 04:30:48 2016 +0530
Committer: ThilinaManamgoda <[email protected]>
Committed: Fri Aug 12 04:30:48 2016 +0530

----------------------------------------------------------------------
 .../taverna/cwl/utilities/CWLUtil2Test.java     | 113 -----------
 .../taverna/cwl/utilities/CWLUtilTest.java      | 187 ++++++++-----------
 2 files changed, 73 insertions(+), 227 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/18447f7d/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtil2Test.java
----------------------------------------------------------------------
diff --git 
a/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtil2Test.java
 
b/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtil2Test.java
deleted file mode 100644
index 3984712..0000000
--- 
a/taverna-cwl-utilities/src/test/java/org/apache/taverna/cwl/utilities/CWLUtil2Test.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.apache.taverna.cwl.utilities;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Map;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
-
-@RunWith(JUnitParamsRunner.class)
-
-public class CWLUtil2Test {
-
-       
-       
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="extractDescriptionResources")
-       
-       public void extractDescriptionTest(CWLUtil cwlUtil,String 
expected,JsonNode input ) {
-               PortDetail detail = new PortDetail();
-
-               cwlUtil.extractDescription(input, detail);
-               assertEquals(expected, detail.getDescription());
-
-
-       }
-       @Test
-       @Parameters(source=CWLUtilTestResource.class,method="processResources")
-       public void processTest(Map<String, Integer> expected,Map<String, 
Integer> actual) {
-
-               for (Map.Entry<String, Integer> input : expected.entrySet()) {
-                       assertEquals(input.getValue(), 
actual.get(input.getKey()));
-               }
-                       
-       }
-       
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="isValidArrayTypeTrueResources")
-       public void isValidArrayTypeTrueTest(CWLUtil cwlUtil,String input) {
-
-                       
-                       assertTrue(cwlUtil.isValidArrayType(input));
-       }
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="isValidArrayTypeFalseResources")
-       public void isValidArrayTypeFalseTest(CWLUtil cwlUtil,String input) {
-
-                       
-                       assertTrue(!cwlUtil.isValidArrayType(input));
-                       
-       }
-       
-       
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="isValidDataTypeTrueResources")
-       public void isValidDataTypeTrueTest(CWLUtil cwlUtil,ArrayNode node) {
-                       
-                       assertTrue(cwlUtil.isValidDataType(node));
-       }
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="isValidDataTypeFalseResources")
-       public void isValidDataTypeFalseTest(CWLUtil cwlUtil,ArrayNode node ) {
-                       
-                       assertTrue(!cwlUtil.isValidDataType(node));
-       }
-       
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="processNameSpaceResources")
-       public void processNameSpaceTest(CWLUtil cwlUtil,String tag, String 
format,int size) {
-               JsonNode nameSpace = cwlUtil.getNameSpace();
-
-               assertEquals(size, nameSpace.size());
-               assertTrue(nameSpace.has(tag));
-               assertEquals(format, nameSpace.get(tag).asText());
-       }
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="extractLabelResources")
-       public void extractLabelTest(CWLUtil cwlUtil,JsonNode input,String 
expected) {
-               PortDetail detail = new PortDetail();
-
-               cwlUtil.extractLabel(input, detail);
-               assertEquals(expected, detail.getLabel());
-
-       }
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="figureOutFormatsResources")
-       public void figureOutFormatsTest(CWLUtil cwlUtil,String 
format,PortDetail detail,String expected, int index) {
-               
-               cwlUtil.figureOutFormats(format, detail);
-               assertEquals(expected, detail.getFormat().get(index));
-       }
-       @Test
-       
@Parameters(source=CWLUtilTestResource.class,method="processDetailsResources")
-       public void processDetailsTest(CWLUtil cwlUtil,Map<String, PortDetail> 
expected) {
-
-                Map<String, PortDetail> actual=cwlUtil.processInputDetails();
-                for (Map.Entry<String, PortDetail> input : 
expected.entrySet()) {
-                        PortDetail expectedDetail=input.getValue();
-                        PortDetail actualDetail =actual.get(input.getKey());
-                               assertEquals(expectedDetail.getFormat(), 
actualDetail.getFormat());
-                               assertEquals(expectedDetail.getLabel(), 
actualDetail.getLabel());
-                               assertEquals(expectedDetail.getDescription(), 
actualDetail.getDescription());
-                       }
-               
-       }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/18447f7d/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 1564072..dd5d8b8 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
@@ -1,154 +1,113 @@
-/*******************************************************************************
- *  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.
- 
*******************************************************************************/
 package org.apache.taverna.cwl.utilities;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Map;
 
-
-import org.junit.BeforeClass;
 import org.junit.Test;
-import org.yaml.snakeyaml.Yaml;
+import org.junit.runner.RunWith;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 
-public class CWLUtilTest {
-       static JsonNode cwlFile;
-       static CWLUtil  cwlUtil;
-       static JsonNode input;
-
-       @BeforeClass
-       public  static void setUp() throws Exception {
-               Yaml reader = new Yaml();
-               ObjectMapper mapper = new  ObjectMapper();
-               cwlFile = 
mapper.valueToTree(reader.load(CWLUtilTest.class.getResourceAsStream("/customtool1.cwl")));
 
-       
-               cwlUtil = new CWLUtil(cwlFile);
-               input =  cwlFile.get("inputs").get(0);
-       }
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
 
-       @Test
-       public void processNameSpaceTest() {
-               JsonNode nameSpace = cwlUtil.getNameSpace();
+@RunWith(JUnitParamsRunner.class)
 
-               assertEquals(1, nameSpace.size());
-               assertTrue(nameSpace.has("edam"));
-               assertEquals("http://edamontology.org/";, 
nameSpace.get("edam").asText());
-       }
+public class CWLUtilTest {
 
+       
+       
        @Test
-       public void extractLabelTest() {
+       
@Parameters(source=CWLUtilTestResource.class,method="extractDescriptionResources")
+       
+       public void extractDescriptionTest(CWLUtil cwlUtil,String 
expected,JsonNode input ) {
                PortDetail detail = new PortDetail();
 
-               cwlUtil.extractLabel(null, detail);
-               assertEquals(null, detail.getLabel());
+               cwlUtil.extractDescription(input, detail);
+               assertEquals(expected, detail.getDescription());
 
-               cwlUtil.extractLabel(input, detail);
-               assertEquals("input 1 testing label", detail.getLabel());
 
        }
-
        @Test
-       public void extractDescriptionTest() {
-               PortDetail detail = new PortDetail();
-
-               cwlUtil.extractDescription(null, detail);
-               assertEquals(null, detail.getDescription());
-
-               cwlUtil.extractDescription(input, detail);
-               assertEquals("this is a short description of input 1", 
detail.getDescription());
+       @Parameters(source=CWLUtilTestResource.class,method="processResources")
+       public void processTest(Map<String, Integer> expected,Map<String, 
Integer> actual) {
 
+               for (Map.Entry<String, Integer> input : expected.entrySet()) {
+                       assertEquals(input.getValue(), 
actual.get(input.getKey()));
+               }
+                       
        }
-
+       
        @Test
-       public void figureOutFormatsTest() {
-               PortDetail detail = new PortDetail();
-               detail.setFormat(new ArrayList<String>());
-               cwlUtil.figureOutFormats("edam:1245", detail);
-               assertEquals("http://edamontology.org/1245";, 
detail.getFormat().get(0));
-
-               cwlUtil.figureOutFormats("$formatExpression", detail);
-               assertEquals("$formatExpression", detail.getFormat().get(1));
-
-               // format that doesn't defined in the name space
+       
@Parameters(source=CWLUtilTestResource.class,method="isValidArrayTypeTrueResources")
+       public void isValidArrayTypeTrueTest(CWLUtil cwlUtil,String input) {
 
-               cwlUtil.figureOutFormats("formatkey: not Defined", detail);
-               assertEquals("formatkey: not Defined", 
detail.getFormat().get(2));
+                       
+                       assertTrue(cwlUtil.isValidArrayType(input));
        }
-
        @Test
-       public void processTest() {
-
-               Map<String, Integer> actual = cwlUtil.process( 
cwlFile.get("inputs"));
+       
@Parameters(source=CWLUtilTestResource.class,method="isValidArrayTypeFalseResources")
+       public void isValidArrayTypeFalseTest(CWLUtil cwlUtil,String input) {
 
-               HashMap<String, Integer> expected = new HashMap<>();
-               expected.put("input_1", 0);
-               expected.put("input_2", 1);
-               expected.put("input_3", 0);
-               for (Map.Entry<String, Integer> input : expected.entrySet()) {
-                       assertEquals(input.getValue(), 
actual.get(input.getKey()));
-               }
-               
-               actual = cwlUtil.process((cwlFile.get("outputs")));
-               expected = new HashMap<>();
-               expected.put("output_1", 0);
-               expected.put("output_2", 0);
-               for (Map.Entry<String, Integer> input : expected.entrySet()) {
-                       assertEquals(input.getValue(), 
actual.get(input.getKey()));
-               }
+                       
+                       assertTrue(!cwlUtil.isValidArrayType(input));
+                       
        }
+       
+       
        @Test
-       public void isValidDataTypeTest() {
-
-                       ObjectMapper mapper = new ObjectMapper();
-                       ArrayNode node = mapper.createArrayNode();
-                       node.add("int");
-                       node.add("null");
-                       node.add("float");
-                       node.add("string");
-                       node.add("double");
-                       node.add("int");
-                       node.add("file");
-                       node.add("boolean");
-                       node.add("directory");
+       
@Parameters(source=CWLUtilTestResource.class,method="isValidDataTypeTrueResources")
+       public void isValidDataTypeTrueTest(CWLUtil cwlUtil,ArrayNode node) {
                        
                        assertTrue(cwlUtil.isValidDataType(node));
-                       assertTrue(!cwlUtil.isValidDataType(null));
-                       node.add("blah blah");
+       }
+       @Test
+       
@Parameters(source=CWLUtilTestResource.class,method="isValidDataTypeFalseResources")
+       public void isValidDataTypeFalseTest(CWLUtil cwlUtil,ArrayNode node ) {
+                       
                        assertTrue(!cwlUtil.isValidDataType(node));
        }
        
        @Test
-       public void isValidArrayTypeTest() {
+       
@Parameters(source=CWLUtilTestResource.class,method="processNameSpaceResources")
+       public void processNameSpaceTest(CWLUtil cwlUtil,String tag, String 
format,int size) {
+               JsonNode nameSpace = cwlUtil.getNameSpace();
 
-                       String validType="int[]";
-                       String wrongType="blah[]";
-                       String wrongType2="int []";
-                       
-                       assertTrue(cwlUtil.isValidArrayType(validType));
-                       assertTrue(!cwlUtil.isValidArrayType(wrongType));
-                       assertTrue(!cwlUtil.isValidArrayType(wrongType2));
-                       assertTrue(!cwlUtil.isValidArrayType(null));
-                       
+               assertEquals(size, nameSpace.size());
+               assertTrue(nameSpace.has(tag));
+               assertEquals(format, nameSpace.get(tag).asText());
+       }
+       @Test
+       
@Parameters(source=CWLUtilTestResource.class,method="extractLabelResources")
+       public void extractLabelTest(CWLUtil cwlUtil,JsonNode input,String 
expected) {
+               PortDetail detail = new PortDetail();
+
+               cwlUtil.extractLabel(input, detail);
+               assertEquals(expected, detail.getLabel());
+
+       }
+       @Test
+       
@Parameters(source=CWLUtilTestResource.class,method="figureOutFormatsResources")
+       public void figureOutFormatsTest(CWLUtil cwlUtil,String 
format,PortDetail detail,String expected, int index) {
+               
+               cwlUtil.figureOutFormats(format, detail);
+               assertEquals(expected, detail.getFormat().get(index));
+       }
+       @Test
+       
@Parameters(source=CWLUtilTestResource.class,method="processDetailsResources")
+       public void processDetailsTest(CWLUtil cwlUtil,Map<String, PortDetail> 
expected) {
+
+                Map<String, PortDetail> actual=cwlUtil.processInputDetails();
+                for (Map.Entry<String, PortDetail> input : 
expected.entrySet()) {
+                        PortDetail expectedDetail=input.getValue();
+                        PortDetail actualDetail =actual.get(input.getKey());
+                               assertEquals(expectedDetail.getFormat(), 
actualDetail.getFormat());
+                               assertEquals(expectedDetail.getLabel(), 
actualDetail.getLabel());
+                               assertEquals(expectedDetail.getDescription(), 
actualDetail.getDescription());
+                       }
+               
        }
 }

Reply via email to