org.eclipse.tracecompass.tmf.core.tests.event.lookup.AllTests.class,
org.eclipse.tracecompass.tmf.core.tests.filter.AllTests.class,
org.eclipse.tracecompass.tmf.core.tests.model.AllTests.class,
+ org.eclipse.tracecompass.tmf.core.tests.parsers.custom.AllTests.class,
org.eclipse.tracecompass.tmf.core.tests.request.AllTests.class,
org.eclipse.tracecompass.tmf.core.tests.signal.AllTests.class,
org.eclipse.tracecompass.tmf.core.tests.statesystem.AllTests.class,
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 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:
+ * Marc-Andre Laperle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.tests.parsers.custom;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfEventParser;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.TmfBTreeTraceIndexer;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpointIndex;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Common test code for custom trace indexes
+ *
+ * @author Marc-Andre Laperle
+ */
+public abstract class AbstractCustomTraceIndexTest {
+
+ /**
+ * Time format use for event creation
+ */
+ protected static final String TIMESTAMP_FORMAT = "dd/MM/yyyy HH:mm:ss:SSS";
+ /**
+ * Block size used for the indexer
+ */
+ protected static final int BLOCK_SIZE = 100;
+ /**
+ * The total number of events in the generated trace
+ */
+ protected static final int NB_EVENTS = 10000;
+ private static final long MILLISECOND_TO_NANOSECOND = 1000000;
+ private TestTrace fTrace = null;
+
+ /**
+ * A common test indexer for custom trace index tests
+ */
+ protected static class TestIndexer extends TmfBTreeTraceIndexer {
+
+ /**
+ * Constructs a new test indexer
+ *
+ * @param trace the trace
+ * @param interval the checkpoint interval
+ */
+ public TestIndexer(ITmfTrace trace, int interval) {
+ super(trace, interval);
+ }
+
+ /**
+ * Get the index
+ *
+ * @return the index
+ */
+ public ITmfCheckpointIndex getCheckpoints() {
+ return getTraceIndex();
+ }
+ }
+
+ interface TestTrace extends ITmfTrace {
+ TestIndexer getIndexer();
+ }
+
+ /**
+ * Setup the test
+ *
+ * @throws Exception when error occurs
+ */
+ @Before
+ public void setUp() throws Exception {
+ setupTrace();
+ }
+
+ private synchronized void setupTrace() throws Exception {
+ File traceDirectory = new File(getTraceDirectory());
+ if (traceDirectory.exists()) {
+ traceDirectory.delete();
+ }
+ traceDirectory.mkdir();
+ if (fTrace == null) {
+ fTrace = createTrace();
+ fTrace.indexTrace(true);
+ }
+ }
+
+ /**
+ * Create a test trace, varies between tests
+ *
+ * @return the test trace
+ * @throws Exception when error occurs
+ */
+ abstract protected TestTrace createTrace() throws Exception;
+ /**
+ * Return the trace directory for the generated trace
+ *
+ * @return the trace directory for the generated trace
+ */
+ abstract protected String getTraceDirectory();
+
+ /**
+ * Tear down the test
+ */
+ @After
+ public void tearDown() {
+ String directory = TmfTraceManager.getSupplementaryFileDir(fTrace);
+ try {
+ fTrace.dispose();
+ fTrace = null;
+ } finally {
+ File dir = new File(directory);
+ if (dir.exists()) {
+ File[] files = dir.listFiles();
+ for (File file : files) {
+ file.delete();
+ }
+ dir.delete();
+ }
+
+ File trace = new File(getTraceDirectory());
+ if (trace.exists()) {
+ trace.delete();
+ }
+ }
+
+ }
+
+ /**
+ * Test the content of the index after building the full index
+ */
+ @Test
+ public void testTmfTraceIndexing() {
+ verifyIndexContent();
+ }
+
+ private void verifyIndexContent() {
+ long endTime = (NB_EVENTS - 1) * MILLISECOND_TO_NANOSECOND;
+ assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
+ assertEquals("getTraceSize", NB_EVENTS, fTrace.getNbEvents());
+ assertEquals("getRange-start", 0, fTrace.getTimeRange().getStartTime().getValue());
+ assertEquals("getRange-end", endTime, fTrace.getTimeRange().getEndTime().getValue());
+ assertEquals("getStartTime", 0, fTrace.getStartTime().getValue());
+ assertEquals("getEndTime", endTime, fTrace.getEndTime().getValue());
+
+ ITmfCheckpointIndex checkpoints = fTrace.getIndexer().getCheckpoints();
+ int pageSize = fTrace.getCacheSize();
+ assertTrue("Checkpoints exist", checkpoints != null);
+ assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
+
+ // Validate that each checkpoint points to the right event
+ for (int i = 0; i < checkpoints.size(); i++) {
+ ITmfCheckpoint checkpoint = checkpoints.get(i);
+ TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
+ ITmfEvent event = ((ITmfEventParser)fTrace).parseEvent(context);
+ assertTrue(context.getRank() == i * pageSize);
+ assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp()) == 0));
+ }
+ }
+
+ /**
+ * Test that a fully built index has the same content when reloaded from disk
+ *
+ * @throws Exception when error occurs
+ */
+ @Test
+ public void testReopenIndex() throws Exception {
+ fTrace.dispose();
+ fTrace = createTrace();
+ assertFalse(fTrace.getIndexer().getCheckpoints().isCreatedFromScratch());
+ fTrace.indexTrace(true);
+
+ verifyIndexContent();
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 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.core.tests.parsers.custom;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for custom parsers
+ * @author Matthew Khouzam
+ *
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CustomXmlTraceInvalidTest.class,
+ CustomXmlTraceBadlyFormedTest.class,
+ CustomXmlTraceValidTest.class,
+ CustomXmlIndexTest.class,
+ CustomTxtIndexTest.class
+})
+public class AllTests {
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2015 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:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Adapted for TMF Trace Model 1.0
+ * Alexandre Montplaisir - Port to JUnit4
+ * Marc-Andre Laperle - Adapted to CustomTxtTrace
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.tests.parsers.custom;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTrace;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
+
+/**
+ * Test suite for indexing using a CustomTxtTrace.
+ *
+ * @author Marc-Andre Laperle
+ */
+public class CustomTxtIndexTest extends AbstractCustomTraceIndexTest {
+
+ private static final String TRACE_DIRECTORY = TmfTraceManager.getTemporaryDirPath() + File.separator + "dummyTxtTrace";
+ private static final String TRACE_PATH = TRACE_DIRECTORY + File.separator + "test.txt";
+ private static final String DEFINITION_PATH = "testfiles" + File.separator + "txt" + File.separator + "testTxtDefinition.xml";
+
+ private static CustomTxtTraceDefinition createDefinition() {
+ CustomTxtTraceDefinition[] definitions = CustomTxtTraceDefinition.loadAll(new File(DEFINITION_PATH).toString());
+ return definitions[0];
+ }
+
+ @Override
+ protected String getTraceDirectory() {
+ return TRACE_DIRECTORY;
+ }
+
+ @Override
+ protected TestTrace createTrace() throws Exception {
+ CustomTxtTraceDefinition definition = createDefinition();
+ final File file = new File(TRACE_PATH);
+ try (BufferedWriter writer = new BufferedWriter(new FileWriter(file));) {
+ for (int i = 0; i < NB_EVENTS; ++i) {
+ SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT);
+ String eventStr = f.format(new Date(i)) + " hello world\n";
+ writer.write(eventStr);
+ }
+ }
+
+ return new TestTxtTrace(file.toString(), definition, BLOCK_SIZE);
+ }
+
+ private class TestTxtTrace extends CustomTxtTrace implements TestTrace {
+ public TestTxtTrace(String path, CustomTxtTraceDefinition createDefinition, int blockSize) throws TmfTraceException {
+ super(null, createDefinition, path, blockSize);
+ }
+
+ @Override
+ protected ITmfTraceIndexer createIndexer(int interval) {
+ return new TestIndexer(this, interval);
+ }
+
+ @Override
+ public TestIndexer getIndexer() {
+ return (TestIndexer) super.getIndexer();
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2015 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:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Adapted for TMF Trace Model 1.0
+ * Alexandre Montplaisir - Port to JUnit4
+ * Marc-Andre Laperle - Adapted to CustomXmlTrace
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.tests.parsers.custom;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
+
+/**
+ * Test suite for indexing using a CustomXmlTrace.
+ *
+ * @author Marc-Andre Laperle
+ */
+public class CustomXmlIndexTest extends AbstractCustomTraceIndexTest {
+
+ private static final String TRACE_DIRECTORY = TmfTraceManager.getTemporaryDirPath() + File.separator + "dummyXmlTrace";
+ private static final String TRACE_PATH = TRACE_DIRECTORY + File.separator + "test.xml";
+ private static final String DEFINITION_PATH = "testfiles" + File.separator + "xml" + File.separator + "testDefinition.xml";
+
+ private static CustomXmlTraceDefinition createDefinition() {
+ CustomXmlTraceDefinition[] definitions = CustomXmlTraceDefinition.loadAll(new File(DEFINITION_PATH).toString());
+ return definitions[0];
+ }
+
+ @Override
+ protected String getTraceDirectory() {
+ return TRACE_DIRECTORY;
+ }
+
+ @Override
+ protected TestTrace createTrace() throws Exception {
+ CustomXmlTraceDefinition definition = createDefinition();
+ final File file = new File(TRACE_PATH);
+ try (BufferedWriter writer = new BufferedWriter(new FileWriter(file));) {
+ writer.write("<trace>");
+ for (int i = 0; i < NB_EVENTS; ++i) {
+ SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT);
+ String eventStr = "<element time=\"" + f.format(new Date(i)) + "\">message</element>\n";
+ writer.write(eventStr);
+ }
+ writer.write("</trace>");
+ }
+
+ return new TestXmlTrace(file.toString(), definition, BLOCK_SIZE);
+ }
+
+ private class TestXmlTrace extends CustomXmlTrace implements TestTrace {
+ public TestXmlTrace(String path, CustomXmlTraceDefinition createDefinition, int blockSize) throws TmfTraceException {
+ super(null, createDefinition, path, blockSize);
+ }
+
+ @Override
+ protected ITmfTraceIndexer createIndexer(int interval) {
+ return new TestIndexer(this, interval);
+ }
+
+ @Override
+ public TestIndexer getIndexer() {
+ return (TestIndexer) super.getIndexer();
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 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.core.tests.parsers.custom;
+
+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.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Malformed xml test, dangerous errors
+ * @author Matthew Khouzam
+ *
+ */
+@RunWith(Parameterized.class)
+public class CustomXmlTraceBadlyFormedTest extends CustomXmlTraceTest {
+
+ private final static String pathname = "testfiles/xml/malformed";
+
+ /**
+ * 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[] malformedFiles = (new File(pathname)).listFiles();
+ Collection<Object[]> params = new ArrayList<>();
+ for (File f : malformedFiles) {
+ Object[] arr = new Object[] { f.getAbsolutePath() };
+ params.add(arr);
+ }
+ return params;
+ }
+
+ /**
+ * Test all the invalid xml files
+ */
+ @Test
+ public void testBadlyFormed() {
+ IStatus invalid = getTrace().validate(null, getPath());
+ // Validation doesn't check for syntax errors. It returns a confidence
+ // of 0 and status OK if it is a text file for malformed xml files.
+ if ((IStatus.ERROR == invalid.getSeverity() ||
+ ((IStatus.OK == invalid.getSeverity() && (invalid instanceof TraceValidationStatus) && ((TraceValidationStatus) invalid).getConfidence() == 0)))) {
+ return;
+ }
+ fail(getPath());
+ }
+
+ /**
+ * ctor
+ *
+ * @param filePath
+ * the path
+ */
+ public CustomXmlTraceBadlyFormedTest(String filePath) {
+ this.setPath(filePath);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 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.core.tests.parsers.custom;
+
+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.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
+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 = "testfiles/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());
+
+ // Validation doesn't check for syntax errors. It returns a confidence
+ // of 0 and status OK if it is a text file for invalid xml files.
+ if ((IStatus.ERROR == invalid.getSeverity() ||
+ ((IStatus.OK == invalid.getSeverity() && (invalid instanceof TraceValidationStatus) && ((TraceValidationStatus) invalid).getConfidence() == 0)))) {
+ return;
+ }
+
+ fail(getPath());
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 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.core.tests.parsers.custom;
+
+import java.io.File;
+
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
+import org.junit.Before;
+
+/**
+ * Abstract test parent
+ *
+ * @author Matthew Khouzam
+ *
+ */
+public abstract class CustomXmlTraceTest {
+
+ private static final String DEFINITION_PATH = "testfiles" + File.separator + "xml" + File.separator + "testDefinition.xml";
+
+ private CustomXmlTraceDefinition cxtd;
+ /**
+ * The trace to use to "validate" the xml files
+ */
+ private CustomXmlTrace t;
+ /**
+ * The path of the trace
+ */
+ private String path;
+
+
+ /**
+ * set up directories
+ */
+ @Before
+ public void init() {
+ cxtd = createDefinition();
+ t = new CustomXmlTrace(cxtd);
+ }
+
+
+ /**
+ * @return the trace
+ */
+ public CustomXmlTrace getTrace() {
+ return t;
+ }
+
+
+ /**
+ * @return the path
+ */
+ public String getPath() {
+ return path;
+ }
+
+
+ /**
+ * @param path the path to set
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ private static CustomXmlTraceDefinition createDefinition() {
+ CustomXmlTraceDefinition[] definitions = CustomXmlTraceDefinition.loadAll(new File(DEFINITION_PATH).toString());
+ return definitions[0];
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 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.core.tests.parsers.custom;
+
+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;
+
+/**
+ * Well formed XML
+ * @author Matthew Khouzam
+ *
+ */
+@RunWith(Parameterized.class)
+public class CustomXmlTraceValidTest extends CustomXmlTraceTest {
+
+ private final static String pathname = "testfiles/xml/valid";
+
+
+ /**
+ * 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[] validFiles = (new File(pathname)).listFiles();
+ Collection<Object[]> params = new ArrayList<>();
+ for (File f : validFiles) {
+ Object[] arr = new Object[] { f.getAbsolutePath() };
+ params.add(arr);
+ }
+ return params;
+ }
+
+ /**
+ * Test all the invalid xml files
+ */
+ @Test
+ public void testValid() {
+ IStatus valid = getTrace().validate(null, getPath());
+ if (IStatus.OK != valid.getSeverity()) {
+ fail(valid.toString());
+ }
+ }
+
+ /**
+ * ctor
+ *
+ * @param filePath
+ * the path
+ */
+ public CustomXmlTraceValidTest(String filePath) {
+ this.setPath(filePath);
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<CustomTxtTraceDefinitionList>
+<Definition name="testtxt">
+<TimeStampOutputFormat>dd/MM/yyyy HH:mm:ss:SSS</TimeStampOutputFormat>
+<InputLine>
+<Cardinality max="2147483647" min="0"/>
+<RegEx>(\S*\s\S*) (.*\S)</RegEx>
+<InputData action="0" format="dd/MM/yyyy HH:mm:ss:SSS" name="Time Stamp"/>
+<InputData action="0" format="" name="Message"/>
+</InputLine>
+<OutputColumn name="Time Stamp"/>
+<OutputColumn name="Message"/>
+</Definition>
+</CustomTxtTraceDefinitionList>
--- /dev/null
+<doc>\r
+</doc\r
--- /dev/null
+This is text\r
--- /dev/null
+<do/c></do/c>\r
--- /dev/null
+<doc></doc name="goose">
--- /dev/null
+<doc><doc2></doc></doc2>
--- /dev/null
+<doc><book>Harry Potter</livre></doc>
--- /dev/null
+<doc><book>Harry Potter</book>A wizard did it</author></doc2>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<CustomXMLTraceDefinitionList>
+<Definition name="myxml">
+<TimeStampOutputFormat>HH:mm:ss:SSS</TimeStampOutputFormat>
+<InputElement name="trace">
+<InputElement logentry="true" name="element">
+<InputData action="0" format="" name="Message"/>
+<Attribute name="time">
+<InputData action="0" format="dd/MM/yyyy HH:mm:ss:SSS" name="Time Stamp"/>
+</Attribute>
+</InputElement>
+</InputElement>
+<OutputColumn name="Time Stamp"/>
+<OutputColumn name="Message"/>
+</Definition>
+</CustomXMLTraceDefinitionList>
--- /dev/null
+<doc></doc>
--- /dev/null
+<doc attrib=""></doc>
--- /dev/null
+<doc attrib=""><elem/></doc>
import org.eclipse.core.runtime.Path;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.ui.tests.TmfUITestPlugin;
import org.junit.runner.RunWith;
import org.osgi.framework.Bundle;
public class TestRefreshCustomTextTrace extends TestRefreshTextTrace {
private static final String TRACE_LOCATION = TmfTraceManager.getTemporaryDirPath() + File.separator + "test.txt";
- private static final String DEFINITION_PATH = "tracesets" + File.separator + "txt" + File.separator + "testTxtDefinition.xml";
+ private static final String DEFINITION_PATH = "testfiles" + File.separator + "txt" + File.separator + "testTxtDefinition.xml";
private static final String TRACE_TYPE_CUSTOM_TEXT = "custom.txt.trace:Custom Text:testtxt";
private static final String TIMESTAMP_FORMAT = "dd/MM/yyyy HH:mm:ss:SSS";
}
private static void createDefinition() throws URISyntaxException, IOException {
- File file = getBundleFile(TmfUITestPlugin.getDefault().getBundle(), new Path(DEFINITION_PATH));
+ File file = getBundleFile(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DEFINITION_PATH));
CustomTxtTraceDefinition[] definitions = CustomTxtTraceDefinition.loadAll(file.toString());
for (CustomTxtTraceDefinition text : definitions) {
text.save();
plugin.properties,\
plugin.xml,\
about.html,\
- tracesets/txt/testTxtDefinition.xml
+ tracesets/
src.includes = about.html
additional.bundles = org.eclipse.jdt.annotation
jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
org.eclipse.tracecompass.tmf.ui.tests.histogram.AllTests.class,
org.eclipse.tracecompass.tmf.ui.tests.project.model.AllTests.class,
org.eclipse.tracecompass.tmf.ui.tests.statistics.AllTests.class,
- org.eclipse.tracecompass.tmf.ui.tests.trace.AllTests.class,
org.eclipse.tracecompass.tmf.ui.tests.views.uml2sd.dialogs.AllTests.class,
org.eclipse.tracecompass.tmf.ui.tests.views.uml2sd.load.AllTests.class,
org.eclipse.tracecompass.tmf.ui.tests.views.uml2sd.loader.AllTests.class
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 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:
- * Marc-Andre Laperle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ui.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfEventParser;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.TmfBTreeTraceIndexer;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpointIndex;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Common test code for custom trace indexes
- *
- * @author Marc-Andre Laperle
- */
-public abstract class AbstractCustomTraceIndexTest {
-
- /**
- * Time format use for event creation
- */
- protected static final String TIMESTAMP_FORMAT = "dd/MM/yyyy HH:mm:ss:SSS";
- /**
- * Block size used for the indexer
- */
- protected static final int BLOCK_SIZE = 100;
- /**
- * The total number of events in the generated trace
- */
- protected static final int NB_EVENTS = 10000;
- private static final long MILLISECOND_TO_NANOSECOND = 1000000;
- private TestTrace fTrace = null;
-
- /**
- * A common test indexer for custom trace index tests
- */
- protected static class TestIndexer extends TmfBTreeTraceIndexer {
-
- /**
- * Constructs a new test indexer
- *
- * @param trace the trace
- * @param interval the checkpoint interval
- */
- public TestIndexer(ITmfTrace trace, int interval) {
- super(trace, interval);
- }
-
- /**
- * Get the index
- *
- * @return the index
- */
- public ITmfCheckpointIndex getCheckpoints() {
- return getTraceIndex();
- }
- }
-
- interface TestTrace extends ITmfTrace {
- TestIndexer getIndexer();
- }
-
- /**
- * Setup the test
- *
- * @throws Exception when error occurs
- */
- @Before
- public void setUp() throws Exception {
- setupTrace();
- }
-
- private synchronized void setupTrace() throws Exception {
- File traceDirectory = new File(getTraceDirectory());
- if (traceDirectory.exists()) {
- traceDirectory.delete();
- }
- traceDirectory.mkdir();
- if (fTrace == null) {
- fTrace = createTrace();
- fTrace.indexTrace(true);
- }
- }
-
- /**
- * Create a test trace, varies between tests
- *
- * @return the test trace
- * @throws Exception when error occurs
- */
- abstract protected TestTrace createTrace() throws Exception;
- /**
- * Return the trace directory for the generated trace
- *
- * @return the trace directory for the generated trace
- */
- abstract protected String getTraceDirectory();
-
- /**
- * Tear down the test
- */
- @After
- public void tearDown() {
- String directory = TmfTraceManager.getSupplementaryFileDir(fTrace);
- try {
- fTrace.dispose();
- fTrace = null;
- } finally {
- File dir = new File(directory);
- if (dir.exists()) {
- File[] files = dir.listFiles();
- for (File file : files) {
- file.delete();
- }
- dir.delete();
- }
-
- File trace = new File(getTraceDirectory());
- if (trace.exists()) {
- trace.delete();
- }
- }
-
- }
-
- /**
- * Test the content of the index after building the full index
- */
- @Test
- public void testTmfTraceIndexing() {
- verifyIndexContent();
- }
-
- private void verifyIndexContent() {
- long endTime = (NB_EVENTS - 1) * MILLISECOND_TO_NANOSECOND;
- assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
- assertEquals("getTraceSize", NB_EVENTS, fTrace.getNbEvents());
- assertEquals("getRange-start", 0, fTrace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", endTime, fTrace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 0, fTrace.getStartTime().getValue());
- assertEquals("getEndTime", endTime, fTrace.getEndTime().getValue());
-
- ITmfCheckpointIndex checkpoints = fTrace.getIndexer().getCheckpoints();
- int pageSize = fTrace.getCacheSize();
- assertTrue("Checkpoints exist", checkpoints != null);
- assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
-
- // Validate that each checkpoint points to the right event
- for (int i = 0; i < checkpoints.size(); i++) {
- ITmfCheckpoint checkpoint = checkpoints.get(i);
- TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
- ITmfEvent event = ((ITmfEventParser)fTrace).parseEvent(context);
- assertTrue(context.getRank() == i * pageSize);
- assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp()) == 0));
- }
- }
-
- /**
- * Test that a fully built index has the same content when reloaded from disk
- *
- * @throws Exception when error occurs
- */
- @Test
- public void testReopenIndex() throws Exception {
- fTrace.dispose();
- fTrace = createTrace();
- assertFalse(fTrace.getIndexer().getCheckpoints().isCreatedFromScratch());
- fTrace.indexTrace(true);
-
- verifyIndexContent();
- }
-}
+++ /dev/null
-/*******************************************************************************
- * 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 org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite for custom parsers
- * @author Matthew Khouzam
- *
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CustomXmlTraceInvalidTest.class,
- CustomXmlTraceBadlyFormedTest.class,
- CustomXmlTraceValidTest.class,
- CustomXmlIndexTest.class,
- CustomTxtIndexTest.class
-})
-public class AllTests {
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 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:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Adapted for TMF Trace Model 1.0
- * Alexandre Montplaisir - Port to JUnit4
- * Marc-Andre Laperle - Adapted to CustomTxtTrace
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ui.tests.trace;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTrace;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
-
-/**
- * Test suite for indexing using a CustomTxtTrace.
- *
- * @author Marc-Andre Laperle
- */
-public class CustomTxtIndexTest extends AbstractCustomTraceIndexTest {
-
- private static final String TRACE_DIRECTORY = TmfTraceManager.getTemporaryDirPath() + File.separator + "dummyTxtTrace";
- private static final String TRACE_PATH = TRACE_DIRECTORY + File.separator + "test.txt";
- private static final String DEFINITION_PATH = "tracesets" + File.separator + "txt" + File.separator + "testTxtDefinition.xml";
-
- private static CustomTxtTraceDefinition createDefinition() {
- CustomTxtTraceDefinition[] definitions = CustomTxtTraceDefinition.loadAll(new File(DEFINITION_PATH).toString());
- return definitions[0];
- }
-
- @Override
- protected String getTraceDirectory() {
- return TRACE_DIRECTORY;
- }
-
- @Override
- protected TestTrace createTrace() throws Exception {
- CustomTxtTraceDefinition definition = createDefinition();
- final File file = new File(TRACE_PATH);
- try (BufferedWriter writer = new BufferedWriter(new FileWriter(file));) {
- for (int i = 0; i < NB_EVENTS; ++i) {
- SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT);
- String eventStr = f.format(new Date(i)) + " hello world\n";
- writer.write(eventStr);
- }
- }
-
- return new TestTxtTrace(file.toString(), definition, BLOCK_SIZE);
- }
-
- private class TestTxtTrace extends CustomTxtTrace implements TestTrace {
- public TestTxtTrace(String path, CustomTxtTraceDefinition createDefinition, int blockSize) throws TmfTraceException {
- super(null, createDefinition, path, blockSize);
- }
-
- @Override
- protected ITmfTraceIndexer createIndexer(int interval) {
- return new TestIndexer(this, interval);
- }
-
- @Override
- public TestIndexer getIndexer() {
- return (TestIndexer) super.getIndexer();
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 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:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Adapted for TMF Trace Model 1.0
- * Alexandre Montplaisir - Port to JUnit4
- * Marc-Andre Laperle - Adapted to CustomXmlTrace
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ui.tests.trace;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
-
-/**
- * Test suite for indexing using a CustomXmlTrace.
- *
- * @author Marc-Andre Laperle
- */
-public class CustomXmlIndexTest extends AbstractCustomTraceIndexTest {
-
- private static final String TRACE_DIRECTORY = TmfTraceManager.getTemporaryDirPath() + File.separator + "dummyXmlTrace";
- private static final String TRACE_PATH = TRACE_DIRECTORY + File.separator + "test.xml";
- private static final String DEFINITION_PATH = "tracesets" + File.separator + "xml" + File.separator + "testDefinition.xml";
-
- private static CustomXmlTraceDefinition createDefinition() {
- CustomXmlTraceDefinition[] definitions = CustomXmlTraceDefinition.loadAll(new File(DEFINITION_PATH).toString());
- return definitions[0];
- }
-
- @Override
- protected String getTraceDirectory() {
- return TRACE_DIRECTORY;
- }
-
- @Override
- protected TestTrace createTrace() throws Exception {
- CustomXmlTraceDefinition definition = createDefinition();
- final File file = new File(TRACE_PATH);
- try (BufferedWriter writer = new BufferedWriter(new FileWriter(file));) {
- writer.write("<trace>");
- for (int i = 0; i < NB_EVENTS; ++i) {
- SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT);
- String eventStr = "<element time=\"" + f.format(new Date(i)) + "\">message</element>\n";
- writer.write(eventStr);
- }
- writer.write("</trace>");
- }
-
- return new TestXmlTrace(file.toString(), definition, BLOCK_SIZE);
- }
-
- private class TestXmlTrace extends CustomXmlTrace implements TestTrace {
- public TestXmlTrace(String path, CustomXmlTraceDefinition createDefinition, int blockSize) throws TmfTraceException {
- super(null, createDefinition, path, blockSize);
- }
-
- @Override
- protected ITmfTraceIndexer createIndexer(int interval) {
- return new TestIndexer(this, interval);
- }
-
- @Override
- public TestIndexer getIndexer() {
- return (TestIndexer) super.getIndexer();
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 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.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * Malformed xml test, dangerous errors
- * @author Matthew Khouzam
- *
- */
-@RunWith(Parameterized.class)
-public class CustomXmlTraceBadlyFormedTest extends CustomXmlTraceTest {
-
- private final static String pathname = "tracesets/xml/malformed";
-
- /**
- * 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[] malformedFiles = (new File(pathname)).listFiles();
- Collection<Object[]> params = new ArrayList<>();
- for (File f : malformedFiles) {
- Object[] arr = new Object[] { f.getAbsolutePath() };
- params.add(arr);
- }
- return params;
- }
-
- /**
- * Test all the invalid xml files
- */
- @Test
- public void testBadlyFormed() {
- IStatus invalid = getTrace().validate(null, getPath());
- // Validation doesn't check for syntax errors. It returns a confidence
- // of 0 and status OK if it is a text file for malformed xml files.
- if ((IStatus.ERROR == invalid.getSeverity() ||
- ((IStatus.OK == invalid.getSeverity() && (invalid instanceof TraceValidationStatus) && ((TraceValidationStatus) invalid).getConfidence() == 0)))) {
- return;
- }
- fail(getPath());
- }
-
- /**
- * ctor
- *
- * @param filePath
- * the path
- */
- public CustomXmlTraceBadlyFormedTest(String filePath) {
- this.setPath(filePath);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 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.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
-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());
-
- // Validation doesn't check for syntax errors. It returns a confidence
- // of 0 and status OK if it is a text file for invalid xml files.
- if ((IStatus.ERROR == invalid.getSeverity() ||
- ((IStatus.OK == invalid.getSeverity() && (invalid instanceof TraceValidationStatus) && ((TraceValidationStatus) invalid).getConfidence() == 0)))) {
- return;
- }
-
- fail(getPath());
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 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 java.io.File;
-
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
-import org.junit.Before;
-
-/**
- * Abstract test parent
- *
- * @author Matthew Khouzam
- *
- */
-public abstract class CustomXmlTraceTest {
-
- private static final String DEFINITION_PATH = "tracesets" + File.separator + "xml" + File.separator + "testDefinition.xml";
-
- private CustomXmlTraceDefinition cxtd;
- /**
- * The trace to use to "validate" the xml files
- */
- private CustomXmlTrace t;
- /**
- * The path of the trace
- */
- private String path;
-
-
- /**
- * set up directories
- */
- @Before
- public void init() {
- cxtd = createDefinition();
- t = new CustomXmlTrace(cxtd);
- }
-
-
- /**
- * @return the trace
- */
- public CustomXmlTrace getTrace() {
- return t;
- }
-
-
- /**
- * @return the path
- */
- public String getPath() {
- return path;
- }
-
-
- /**
- * @param path the path to set
- */
- public void setPath(String path) {
- this.path = path;
- }
-
- private static CustomXmlTraceDefinition createDefinition() {
- CustomXmlTraceDefinition[] definitions = CustomXmlTraceDefinition.loadAll(new File(DEFINITION_PATH).toString());
- return definitions[0];
- }
-}
+++ /dev/null
-/*******************************************************************************
- * 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;
-
-/**
- * Well formed XML
- * @author Matthew Khouzam
- *
- */
-@RunWith(Parameterized.class)
-public class CustomXmlTraceValidTest extends CustomXmlTraceTest {
-
- private final static String pathname = "tracesets/xml/valid";
-
-
- /**
- * 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[] validFiles = (new File(pathname)).listFiles();
- Collection<Object[]> params = new ArrayList<>();
- for (File f : validFiles) {
- Object[] arr = new Object[] { f.getAbsolutePath() };
- params.add(arr);
- }
- return params;
- }
-
- /**
- * Test all the invalid xml files
- */
- @Test
- public void testValid() {
- IStatus valid = getTrace().validate(null, getPath());
- if (IStatus.OK != valid.getSeverity()) {
- fail(valid.toString());
- }
- }
-
- /**
- * ctor
- *
- * @param filePath
- * the path
- */
- public CustomXmlTraceValidTest(String filePath) {
- this.setPath(filePath);
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<CustomTxtTraceDefinitionList>
-<Definition name="testtxt">
-<TimeStampOutputFormat>dd/MM/yyyy HH:mm:ss:SSS</TimeStampOutputFormat>
-<InputLine>
-<Cardinality max="2147483647" min="0"/>
-<RegEx>(\S*\s\S*) (.*\S)</RegEx>
-<InputData action="0" format="dd/MM/yyyy HH:mm:ss:SSS" name="Time Stamp"/>
-<InputData action="0" format="" name="Message"/>
-</InputLine>
-<OutputColumn name="Time Stamp"/>
-<OutputColumn name="Message"/>
-</Definition>
-</CustomTxtTraceDefinitionList>
+++ /dev/null
-<doc>\r
-</doc\r
+++ /dev/null
-This is text\r
+++ /dev/null
-<do/c></do/c>\r
+++ /dev/null
-<doc></doc name="goose">
+++ /dev/null
-<doc><doc2></doc></doc2>
+++ /dev/null
-<doc><book>Harry Potter</livre></doc>
+++ /dev/null
-<doc><book>Harry Potter</book>A wizard did it</author></doc2>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<CustomXMLTraceDefinitionList>
-<Definition name="myxml">
-<TimeStampOutputFormat>HH:mm:ss:SSS</TimeStampOutputFormat>
-<InputElement name="trace">
-<InputElement logentry="true" name="element">
-<InputData action="0" format="" name="Message"/>
-<Attribute name="time">
-<InputData action="0" format="dd/MM/yyyy HH:mm:ss:SSS" name="Time Stamp"/>
-</Attribute>
-</InputElement>
-</InputElement>
-<OutputColumn name="Time Stamp"/>
-<OutputColumn name="Message"/>
-</Definition>
-</CustomXMLTraceDefinitionList>
+++ /dev/null
-<doc></doc>
+++ /dev/null
-<doc attrib=""></doc>
+++ /dev/null
-<doc attrib=""><elem/></doc>