Commit | Line | Data |
---|---|---|
eb8ea213 MK |
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 | * Malformed xml test, dangerous errors | |
17 | * @author Matthew Khouzam | |
18 | * | |
19 | */ | |
20 | @RunWith(Parameterized.class) | |
21 | public class CustomXmlTraceBadlyFormedTest extends CustomXmlTraceTest { | |
22 | ||
23 | private final static String pathname = "tracesets/xml/malformed"; | |
24 | ||
25 | /** | |
26 | * This should create the parameters to launch the project | |
27 | * | |
28 | * @return the path of the parameters | |
29 | */ | |
30 | @Parameters(name = "{index}: path {0}") | |
31 | public static Collection<Object[]> getFiles() { | |
32 | File[] malformedFiles = (new File(pathname)).listFiles(); | |
33 | Collection<Object[]> params = new ArrayList<Object[]>(); | |
34 | for (File f : malformedFiles) { | |
35 | Object[] arr = new Object[] { f.getAbsolutePath() }; | |
36 | params.add(arr); | |
37 | } | |
38 | return params; | |
39 | } | |
40 | ||
41 | /** | |
42 | * Test all the invalid xml files | |
43 | */ | |
44 | @Test | |
45 | public void testBadlyFormed() { | |
46 | IStatus valid = getTrace().validate(null, getPath()); | |
47 | if (IStatus.ERROR != valid.getSeverity()) { | |
48 | fail(valid.toString()); | |
49 | } | |
50 | } | |
51 | ||
52 | /** | |
53 | * ctor | |
54 | * | |
55 | * @param filePath | |
56 | * the path | |
57 | */ | |
58 | public CustomXmlTraceBadlyFormedTest(String filePath) { | |
59 | this.setPath(filePath); | |
60 | } | |
61 | ||
62 | } |