diff options
Diffstat (limited to 'tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/trace/CustomXmlTraceInvalidTest.java')
-rw-r--r-- | tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/trace/CustomXmlTraceInvalidTest.java | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/trace/CustomXmlTraceInvalidTest.java b/tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/trace/CustomXmlTraceInvalidTest.java new file mode 100644 index 0000000000..dbfc3a2874 --- /dev/null +++ b/tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/trace/CustomXmlTraceInvalidTest.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Ericsson + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v1.0 which + * accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Khouzam - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.tracecompass.tmf.ui.tests.trace; + +import static org.junit.Assert.fail; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.core.runtime.IStatus; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * Invalid Xml files, random errors + * + * @author Matthew Khouzam + * + */ +@RunWith(Parameterized.class) +public class CustomXmlTraceInvalidTest extends CustomXmlTraceTest{ + + private final static String pathname = "tracesets/xml/invalid"; + + /** + * This should create the parameters to launch the project + * + * @return the path of the parameters + */ + @Parameters(name = "{index}: path {0}") + public static Collection<Object[]> getFiles() { + File[] invalidFiles = (new File(pathname)).listFiles(); + Collection<Object[]> params = new ArrayList<>(); + for (File f : invalidFiles) { + Object[] arr = new Object[] { f.getAbsolutePath() }; + params.add(arr); + } + return params; + } + + /** + * ctor + * + * @param filePath + * the path + */ + public CustomXmlTraceInvalidTest(String filePath) { + setPath(filePath); + } + + /** + * Test all the invalid xml files + */ + @Test + public void testInvalid() { + IStatus invalid = getTrace().validate(null, getPath()); + if (IStatus.ERROR != invalid.getSeverity()) { + fail(getPath()); + } + } + +} |