Commit | Line | Data |
---|---|---|
13201b83 | 1 | /******************************************************************************* |
45055c6d | 2 | * Copyright (c) 2013, 2015 Ericsson |
13201b83 MK |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
45055c6d | 13 | package org.eclipse.tracecompass.tmf.core.tests.parsers.custom; |
eb8ea213 MK |
14 | |
15 | import static org.junit.Assert.fail; | |
16 | ||
17 | import java.io.File; | |
18 | import java.util.ArrayList; | |
19 | import java.util.Collection; | |
20 | ||
21 | import org.eclipse.core.runtime.IStatus; | |
22 | import org.junit.Test; | |
23 | import org.junit.runner.RunWith; | |
24 | import org.junit.runners.Parameterized; | |
25 | import org.junit.runners.Parameterized.Parameters; | |
26 | ||
27 | /** | |
28 | * Well formed XML | |
29 | * @author Matthew Khouzam | |
30 | * | |
31 | */ | |
32 | @RunWith(Parameterized.class) | |
33 | public class CustomXmlTraceValidTest extends CustomXmlTraceTest { | |
34 | ||
45055c6d | 35 | private final static String pathname = "testfiles/xml/valid"; |
eb8ea213 MK |
36 | |
37 | ||
38 | /** | |
39 | * This should create the parameters to launch the project | |
40 | * | |
41 | * @return the path of the parameters | |
42 | */ | |
43 | @Parameters(name = "{index}: path {0}") | |
44 | public static Collection<Object[]> getFiles() { | |
45 | File[] validFiles = (new File(pathname)).listFiles(); | |
ab410d88 | 46 | Collection<Object[]> params = new ArrayList<>(); |
eb8ea213 MK |
47 | for (File f : validFiles) { |
48 | Object[] arr = new Object[] { f.getAbsolutePath() }; | |
49 | params.add(arr); | |
50 | } | |
51 | return params; | |
52 | } | |
53 | ||
54 | /** | |
55 | * Test all the invalid xml files | |
56 | */ | |
57 | @Test | |
58 | public void testValid() { | |
59 | IStatus valid = getTrace().validate(null, getPath()); | |
60 | if (IStatus.OK != valid.getSeverity()) { | |
61 | fail(valid.toString()); | |
62 | } | |
63 | } | |
64 | ||
65 | /** | |
66 | * ctor | |
67 | * | |
68 | * @param filePath | |
69 | * the path | |
70 | */ | |
71 | public CustomXmlTraceValidTest(String filePath) { | |
72 | this.setPath(filePath); | |
73 | } | |
74 | ||
75 | } |