-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathGCBaseTest.java
More file actions
74 lines (62 loc) · 2.65 KB
/
GCBaseTest.java
File metadata and controls
74 lines (62 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.asascience.ncsos;
import org.junit.Assert;
import org.jdom.Element;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@RunWith(Parameterized.class)
public class GCBaseTest extends NcSOSTest {
private static HashMap<String,String> kvp = new HashMap<String, String>();
private static String outputDir;
private static String exampleDir;
private Element currentFile;
public GCBaseTest(Element file, String testLabel){
this.currentFile = file;
//discard testLabel
}
public static void setUpClass() throws Exception {
NcSOSTest.setUpClass();
// Modify the outputs
outputDir = baseOutputDir + NcSOSTest.systemSeparator + "GetCapabilities" + NcSOSTest.systemSeparator;
exampleDir = baseExampleDir + NcSOSTest.systemSeparator + "GetCapabilities" + NcSOSTest.systemSeparator;
// Create output directories if they don't exist
new File(outputDir).mkdirs();
new File(exampleDir).mkdirs();
kvp.put("request", "GetCapabilities");
kvp.put("service", "SOS");
}
// Create the parameters for the test constructor
@Parameters(name = "{index}: {1}")
public static Collection<Object[]> testCases() throws Exception {
setUpClass();
Object[][] data = new Object[fileElements.size()][2];
int curIndex = 0;
for (Element e : fileElements) {
data[curIndex][0] = e;
//include test label
data[curIndex][1] = getTestLabel(e);
curIndex++;
}
return Arrays.asList(data);
}
@Test
public void testAll() {
HashMap<String,String> pairs = (HashMap<String,String>) kvp.clone();
File file = new File("resources" + systemSeparator + "datasets" + systemSeparator + this.currentFile.getAttributeValue("path"));
String feature = this.currentFile.getAttributeValue("feature");
String output = new File(outputDir + systemSeparator + file.getName() + ".xml").getAbsolutePath();
System.out.println("------ " + file + " (" + feature + ") ------");
Element result = NcSOSTest.makeTestRequest(file.getAbsolutePath(), output, pairs);
if (currentFile.getAttributeValue("feature").equalsIgnoreCase("point")) {
// NcSOS does not support POINT features at this time!
Assert.assertTrue(NcSOSTest.isException(result));
} else {
Assert.assertFalse(NcSOSTest.isException(result));
}
}
}