tmf: improve validation for custom parsers
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui.tests / src / org / eclipse / linuxtools / tmf / ui / tests / trace / CustomXmlTraceValidTest.java
1 package org.eclipse.linuxtools.tmf.ui.tests.trace;
2
3 import static org.junit.Assert.fail;
4
5 import java.io.File;
6 import java.util.ArrayList;
7 import java.util.Collection;
8
9 import org.eclipse.core.runtime.IStatus;
10 import org.junit.Test;
11 import org.junit.runner.RunWith;
12 import org.junit.runners.Parameterized;
13 import org.junit.runners.Parameterized.Parameters;
14
15 /**
16 * Well formed XML
17 * @author Matthew Khouzam
18 *
19 */
20 @RunWith(Parameterized.class)
21 public class CustomXmlTraceValidTest extends CustomXmlTraceTest {
22
23 private final static String pathname = "tracesets/xml/valid";
24
25
26 /**
27 * This should create the parameters to launch the project
28 *
29 * @return the path of the parameters
30 */
31 @Parameters(name = "{index}: path {0}")
32 public static Collection<Object[]> getFiles() {
33 File[] validFiles = (new File(pathname)).listFiles();
34 Collection<Object[]> params = new ArrayList<Object[]>();
35 for (File f : validFiles) {
36 Object[] arr = new Object[] { f.getAbsolutePath() };
37 params.add(arr);
38 }
39 return params;
40 }
41
42 /**
43 * Test all the invalid xml files
44 */
45 @Test
46 public void testValid() {
47 IStatus valid = getTrace().validate(null, getPath());
48 if (IStatus.OK != valid.getSeverity()) {
49 fail(valid.toString());
50 }
51 }
52
53 /**
54 * ctor
55 *
56 * @param filePath
57 * the path
58 */
59 public CustomXmlTraceValidTest(String filePath) {
60 this.setPath(filePath);
61 }
62
63 }
This page took 0.034877 seconds and 6 git commands to generate.