Skip to content

Commit 31f252e

Browse files
committed
tests to confirm fixes for previously reported errors.
1 parent b8a954d commit 31f252e

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package org.w3id.cwl.cwl1_2.utils;
2+
3+
import org.w3id.cwl.cwl1_2.Process;
4+
import org.w3id.cwl.cwl1_2.SchemaDefRequirement;
5+
import org.w3id.cwl.cwl1_2.CWLVersion;
6+
import org.w3id.cwl.cwl1_2.InlineJavascriptRequirement;
7+
import org.w3id.cwl.cwl1_2.InputRecordSchema;
8+
9+
import java.net.URISyntaxException;
10+
import java.util.List;
11+
12+
import org.junit.Assert;
13+
import org.junit.Test;
14+
15+
public class RequirementsClassTest {
16+
Process doc;
17+
18+
public RequirementsClassTest() throws URISyntaxException {
19+
super();
20+
this.doc = (Process) RootLoader
21+
.loadDocument(java.nio.file.Paths.get(getClass().getResource("valid_writable-dir-docker.cwl").toURI()));
22+
}
23+
24+
@Test
25+
public void className() {
26+
Assert.assertEquals(doc.getClass().getSimpleName(), "CommandLineToolImpl");
27+
}
28+
29+
@Test
30+
public void version() {
31+
java.util.Optional<CWLVersion> version = doc.getCwlVersion();
32+
Assert.assertTrue(version.isPresent());
33+
Assert.assertEquals(CWLVersion.V1_2, version.get());
34+
}
35+
36+
@Test
37+
public void hints() {
38+
java.util.Optional<java.util.List<Object>> hints = doc.getHints();
39+
Assert.assertTrue(hints.isPresent());
40+
java.util.List<Object> hintList = hints.get();
41+
Assert.assertEquals(hintList.size(), 1);
42+
}
43+
44+
@Test
45+
public void reqs() {
46+
java.util.Optional<java.util.List<Object>> reqs = doc.getRequirements();
47+
Assert.assertTrue(reqs.isPresent());
48+
java.util.List<Object> reqList = reqs.get();
49+
Assert.assertEquals(reqList.size(), 2);
50+
InlineJavascriptRequirement reqOne = (InlineJavascriptRequirement) reqList.get(0);
51+
Assert.assertEquals(reqOne.getClass().getSimpleName(), "InlineJavascriptRequirementImpl");
52+
Assert.assertNotEquals(reqList.get(1).getClass().getSimpleName(), "InlineJavascriptRequirementImpl");
53+
}
54+
55+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package org.w3id.cwl.cwl1_2.utils;
2+
import org.w3id.cwl.cwl1_2.Process;
3+
import org.w3id.cwl.cwl1_2.SchemaDefRequirement;
4+
import org.w3id.cwl.cwl1_2.InputRecordSchema;
5+
6+
import java.util.List;
7+
8+
import org.junit.Assert;
9+
10+
public class SchemaDefTest {
11+
12+
@org.junit.Test
13+
public void testvalid_anon_enum_inside_array_inside_schemadef() throws Exception {
14+
java.net.URL url = getClass().getResource("valid_anon_enum_inside_array_inside_schemadef.cwl");
15+
java.nio.file.Path resPath = java.nio.file.Paths.get(url.toURI());
16+
Process doc = (Process) RootLoader.loadDocument(resPath);
17+
java.util.Optional<java.util.List<Object>> reqs = doc.getRequirements();
18+
Assert.assertTrue(reqs.isPresent());
19+
java.util.List<Object> reqList = reqs.get();
20+
Assert.assertEquals(reqList.size(), 1);
21+
SchemaDefRequirement schemaReq = (SchemaDefRequirement) reqList.get(0);
22+
List<Object> schemaTypes = schemaReq.getTypes();
23+
for (Object schemaType: schemaTypes) {
24+
Assert.assertTrue(schemaType instanceof InputRecordSchema);
25+
}
26+
27+
}
28+
29+
@org.junit.Test
30+
public void testvalid_record_sd_secondaryFiles() throws Exception {
31+
java.net.URL url = getClass().getResource("valid_record-sd-secondaryFiles.cwl");
32+
java.nio.file.Path resPath = java.nio.file.Paths.get(url.toURI());
33+
Process doc = (Process) RootLoader.loadDocument(resPath);
34+
java.util.Optional<java.util.List<Object>> reqs = doc.getRequirements();
35+
Assert.assertTrue(reqs.isPresent());
36+
java.util.List<Object> reqList = reqs.get();
37+
Assert.assertEquals(reqList.size(), 1);
38+
SchemaDefRequirement schemaReq = (SchemaDefRequirement) reqList.get(0);
39+
List<Object> schemaTypes = schemaReq.getTypes();
40+
for (Object schemaType: schemaTypes) {
41+
Assert.assertTrue(schemaType instanceof InputRecordSchema);
42+
}
43+
44+
}
45+
46+
}
47+

0 commit comments

Comments
 (0)