/*******************************************************************************
- * Copyright (c) 2011-2014 Ericsson
+ * Copyright (c) 2011, 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
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
/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * 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
* 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;
/**
}
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", NB_EVENTS - 1, fTrace.getTimeRange().getEndTime().getValue());
+ assertEquals("getRange-end", endTime, fTrace.getTimeRange().getEndTime().getValue());
assertEquals("getStartTime", 0, fTrace.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS - 1, fTrace.getEndTime().getValue());
+ assertEquals("getEndTime", endTime, fTrace.getEndTime().getValue());
ITmfCheckpointIndex checkpoints = fTrace.getIndexer().getCheckpoints();
int pageSize = fTrace.getCacheSize();
/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * 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
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;
*/
@Test
public void testBadlyFormed() {
- IStatus valid = getTrace().validate(null, getPath());
- if (IStatus.ERROR != valid.getSeverity()) {
- fail(valid.toString());
+ 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());
}
/**
/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * 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
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;
@Test
public void testInvalid() {
IStatus invalid = getTrace().validate(null, getPath());
- if (IStatus.ERROR != invalid.getSeverity()) {
- fail(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());
}
}
/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * 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
package org.eclipse.tracecompass.tmf.ui.tests.trace;
-import java.util.ArrayList;
+import java.io.File;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlInputElement;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
import org.junit.Before;
*
*/
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
*/
@Before
public void init() {
- cxtd = new CustomXmlTraceDefinition(CustomXmlTraceDefinition.CUSTOM_XML_CATEGORY, "test", new CustomXmlInputElement(), new ArrayList<OutputColumn>(), "s");
+ cxtd = createDefinition();
t = new CustomXmlTrace(cxtd);
}
this.path = path;
}
+ private static CustomXmlTraceDefinition createDefinition() {
+ CustomXmlTraceDefinition[] definitions = CustomXmlTraceDefinition.loadAll(new File(DEFINITION_PATH).toString());
+ return definitions[0];
+ }
}