/*******************************************************************************
- * Copyright (c) 2013, 2014 École Polytechnique de Montréal
+ * Copyright (c) 2013, 2017 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
R_TEST_10K("R-Test-10K");
private final @NonNull String fPath;
- private final String fDirectory = "../../tmf/org.eclipse.tracecompass.tmf.core.tests/testfiles";
+ private final String fDirectory = "testfiles";
private ITmfTrace fTrace = null;
private TmfTestTrace(@NonNull String file) {
* @return The full path of the trace
*/
public String getFullPath() {
- return fDirectory + File.separator + fPath;
+ URL resource = TmfCoreTestPlugin.getDefault().getBundle().getResource(fDirectory + File.separator + fPath);
+ try {
+ return FileLocator.toFileURL(resource).toURI().getPath();
+ } catch (URISyntaxException | IOException e) {
+ throw new IllegalStateException(e);
+ }
}
/**
if (fTrace != null) {
fTrace.dispose();
}
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(fDirectory + File.separator + fPath), null);
try {
- File test = new File(FileLocator.toFileURL(location).toURI());
- ITmfTrace trace = new TmfTraceStub(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
+ ITmfTrace trace = new TmfTraceStub(getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
fTrace = trace;
return trace;
- } catch (URISyntaxException | IOException | TmfTraceException e) {
+ } catch (TmfTraceException e) {
throw new IllegalStateException(e);
}
/*******************************************************************************
- * Copyright (c) 2009, 2015 Ericsson
+ * Copyright (c) 2009, 2017 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 static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.util.IllformedLocaleException;
import java.util.Vector;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.tracecompass.internal.tmf.core.component.TmfProviderManager;
import org.eclipse.tracecompass.internal.tmf.core.request.TmfCoalescedEventRequest;
import org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignal;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
private synchronized TmfTraceStub setupTrace(String path) {
if (fTrace == null) {
try {
- URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
- File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStub(test.getPath(), 500, false, null);
+ fTrace = new TmfTraceStub(path, 500, false, null);
} catch (TmfTraceException e) {
e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
}
}
return fTrace;
/*******************************************************************************
- * Copyright (c) 2016 École Polytechnique de Montréal
+ * Copyright (c) 2016, 2017 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.util.concurrent.TimeUnit;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.tmf.core.component.TmfProviderManager;
import org.eclipse.tracecompass.internal.tmf.core.request.TmfCoalescedEventRequest;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
@BeforeClass
public static void setUp() {
try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStub(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
+ fTrace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
TmfSignalManager.deregister(fTrace);
fTrace.indexTrace(true);
- } catch (final TmfTraceException | URISyntaxException | IOException e) {
+ } catch (final TmfTraceException e) {
e.printStackTrace();
fail("Error setting up test trace");
}
/*******************************************************************************
- * Copyright (c) 2014 Ericsson
+ * Copyright (c) 2014, 2017 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 static org.junit.Assert.assertEquals;
import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
}
}
- private ITmfTrace createAndIndexTrace() throws URISyntaxException, IOException, TmfTraceException {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(fResource, testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
+ private ITmfTrace createAndIndexTrace() throws TmfTraceException {
+ TmfTraceStub trace = new TmfTraceStub(fResource, TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
trace.indexTrace(true);
return trace;
}
// ------------------------------------------------------------------------
@Test
- public void testNoOffset() throws URISyntaxException, IOException, TmfTraceException {
+ public void testNoOffset() throws TmfTraceException {
ITmfTrace trace = createAndIndexTrace();
final TmfContext context = (TmfContext) trace.seekEvent(0);
}
@Test
- public void testPositiveOffset() throws URISyntaxException, IOException, TmfTraceException {
+ public void testPositiveOffset() throws TmfTraceException {
ITmfTimestampTransform tt = TimestampTransformFactory.createWithOffset(ONE_MS);
TimestampTransformFactory.setTimestampTransform(fResource, tt);
}
@Test
- public void testNegativeOffset() throws URISyntaxException, IOException, TmfTraceException {
+ public void testNegativeOffset() throws TmfTraceException {
ITmfTimestampTransform tt = TimestampTransformFactory.createWithOffset(-ONE_MS);
TimestampTransformFactory.setTimestampTransform(fResource, tt);
}
@Test
- public void testClearOffset() throws URISyntaxException, IOException, TmfTraceException {
+ public void testClearOffset() throws TmfTraceException {
ITmfTimestampTransform tt = TimestampTransformFactory.createWithOffset(ONE_MS);
TimestampTransformFactory.setTimestampTransform(fResource, tt);
TimestampTransformFactory.setTimestampTransform(fResource, null);
/*******************************************************************************
- * Copyright (c) 2009, 2014 Ericsson
+ * Copyright (c) 2009, 2017 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 static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.util.Map;
import java.util.Vector;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.tmf.core.component.TmfProviderManager;
import org.eclipse.tracecompass.internal.tmf.core.synchronization.SyncAlgorithmFullyIncremental;
import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
import org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm;
import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
if (fTestTraces == null) {
fTestTraces = new ITmfTrace[1];
try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
- final File test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace = new TmfTraceStub(test.getPath(), 0, true, null);
+ final TmfTraceStub trace = new TmfTraceStub(path, 0, true, null);
fTestTraces[0] = trace;
} catch (final TmfTraceException e) {
e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
}
}
return fTestTraces;
/*******************************************************************************
- * Copyright (c) 2009, 2014 Ericsson
+ * Copyright (c) 2009, 2017 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 static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.util.Vector;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentContext;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
try {
ITmfTrace[] traces = new ITmfTrace[2];
- URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TmfTestTrace.O_TEST_10K.getFullPath()), null);
- File test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true, null);
+ final TmfTraceStub trace1 = new TmfTraceStub(TmfTestTrace.O_TEST_10K.getFullPath(), 0, true, null);
traces[0] = trace1;
- location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TmfTestTrace.E_TEST_10K.getFullPath()), null);
- test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true, null);
+ final TmfTraceStub trace2 = new TmfTraceStub(TmfTestTrace.E_TEST_10K.getFullPath(), 0, true, null);
traces[1] = trace2;
return traces;
} catch (final TmfTraceException e) {
e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
}
return new ITmfTrace[0];
}
/*******************************************************************************
- * Copyright (c) 2009, 2014 Ericsson
+ * Copyright (c) 2009, 2017 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 static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.util.Vector;
import java.util.concurrent.TimeUnit;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.tracecompass.internal.tmf.core.component.TmfProviderManager;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider;
import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
@Before
public void setUp() {
try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStub(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
+ fTrace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
TmfSignalManager.deregister(fTrace);
fTrace.indexTrace(true);
} catch (final TmfTraceException e) {
e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
}
}
@Test
public void testFullConstructor() throws TmfTraceException {
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
- trace.indexTrace(true);
-
- assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
- assertNull("getResource", trace.getResource());
- assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
- assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
- assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
- assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
-
- assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
- assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, trace.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
+ TmfTraceStub trace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
+ trace.indexTrace(true);
- trace.dispose();
- } catch (final URISyntaxException e) {
- fail("URISyntaxException");
- } catch (final IOException e) {
- fail("IOException");
- }
+ assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
+ assertNull("getResource", trace.getResource());
+ assertEquals("getPath", TEST_TRACE.getFullPath(), trace.getPath());
+ assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+ assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
+ assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
+
+ assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
+ assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
+ assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
+ assertEquals("getStartTime", 1, trace.getStartTime().getValue());
+ assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
+
+ trace.dispose();
}
@Test
public void testLiveTraceConstructor() throws TmfTraceException {
final long interval = 100;
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, interval);
- trace.indexTrace(true);
-
- assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
- assertNull("getResource", trace.getResource());
- assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
- assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
- assertEquals("getStreamingInterval", interval, trace.getStreamingInterval());
- assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
-
- assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
- assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, trace.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
+ TmfTraceStub trace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, interval);
+ trace.indexTrace(true);
- trace.dispose();
- } catch (final URISyntaxException e) {
- fail("URISyntaxException");
- } catch (final IOException e) {
- fail("IOException");
- }
+ assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
+ assertNull("getResource", trace.getResource());
+ assertEquals("getPath", TEST_TRACE.getFullPath(), trace.getPath());
+ assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+ assertEquals("getStreamingInterval", interval, trace.getStreamingInterval());
+ assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
+
+ assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
+ assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
+ assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
+ assertEquals("getStartTime", 1, trace.getStartTime().getValue());
+ assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
+
+ trace.dispose();
}
@Test
public void testCopyConstructor() throws TmfTraceException {
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub original = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
- TmfTraceStub trace = new TmfTraceStub(original);
- trace.indexTrace(true);
-
- assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
- assertNull("getResource", trace.getResource());
- assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
- assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
- assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
- assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
-
- assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
- assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, trace.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
-
- original.dispose();
- trace.dispose();
- } catch (final URISyntaxException e) {
- fail("URISyntaxException");
- } catch (final IOException e) {
- fail("IOException");
- }
+ TmfTraceStub original = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
+ TmfTraceStub trace = new TmfTraceStub(original);
+ trace.indexTrace(true);
+
+ assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
+ assertNull("getResource", trace.getResource());
+ assertEquals("getPath", TEST_TRACE.getFullPath(), trace.getPath());
+ assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+ assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
+ assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
+
+ assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
+ assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
+ assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
+ assertEquals("getStartTime", 1, trace.getStartTime().getValue());
+ assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
+
+ original.dispose();
+ trace.dispose();
// Test the copy of a null trace
try {
}
@Test
- public void testInitTrace() throws URISyntaxException, IOException, TmfTraceException, InterruptedException {
+ public void testInitTrace() throws TmfTraceException, InterruptedException {
// Instantiate an "empty" trace
final TmfTraceStub trace = new TmfTraceStub();
assertEquals("getEndTime", Long.MIN_VALUE, trace.getEndTime().getValue());
// Validate
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- final File testfile = new File(FileLocator.toFileURL(location).toURI());
- assertTrue("validate", trace.validate(null, testfile.getPath()).isOK());
+ assertTrue("validate", trace.validate(null, TEST_TRACE.getFullPath()).isOK());
// InitTrace and wait for indexing completion...
- trace.initTrace(null, testfile.toURI().getPath(), ITmfEvent.class);
+ trace.initTrace(null, TEST_TRACE.getFullPath(), ITmfEvent.class);
trace.indexTrace(true);
int nbSecs = 0;
while (trace.getNbEvents() < NB_EVENTS && nbSecs < 10) {
public void testCurrentTimeValues() throws TmfTraceException {
TmfTraceStub trace = null;
- File testfile = null;
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- testfile = new File(FileLocator.toFileURL(location).toURI());
- trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
- // verify initial values
- ITmfTimestamp defaultInitRange = TmfTimestamp.fromNanos(DEFAULT_INITIAL_OFFSET_VALUE);
- assertEquals("getInitialRangeOffset", defaultInitRange, trace.getInitialRangeOffset());
- trace.setInitialRangeOffset(TmfTimestamp.fromMillis(5));
- trace.indexTrace(true);
-
- ITmfTimestamp initRange = TmfTimestamp.fromMillis(5);
- assertEquals("getInitialRangeOffset", initRange, trace.getInitialRangeOffset());
+ trace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
+ // verify initial values
+ ITmfTimestamp defaultInitRange = TmfTimestamp.fromNanos(DEFAULT_INITIAL_OFFSET_VALUE);
+ assertEquals("getInitialRangeOffset", defaultInitRange, trace.getInitialRangeOffset());
+ trace.setInitialRangeOffset(TmfTimestamp.fromMillis(5));
+ trace.indexTrace(true);
- trace.dispose();
- } catch (final URISyntaxException e) {
- fail("URISyntaxException");
- } catch (final IOException e) {
- fail("IOException");
- }
+ ITmfTimestamp initRange = TmfTimestamp.fromMillis(5);
+ assertEquals("getInitialRangeOffset", initRange, trace.getInitialRangeOffset());
+
+ trace.dispose();
}
// ------------------------------------------------------------------------
/*******************************************************************************
- * Copyright (c) 2014 Ericsson
+ * Copyright (c) 2014, 2017 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 static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.util.Collection;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
@Before
public void setUp() {
try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE.getFullPath()), null);
- final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStubWithAspects(test.toURI().getPath());
+ fTrace = new TmfTraceStubWithAspects(TEST_TRACE.getFullPath());
TmfSignalManager.deregister(fTrace);
fTrace.indexTrace(true);
- } catch (final TmfTraceException | URISyntaxException | IOException e) {
+ } catch (final TmfTraceException e) {
fail(e.getMessage());
}
}
/*******************************************************************************
- * Copyright (c) 2009, 2015 Ericsson
+ * Copyright (c) 2009, 2017 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.io.File;
import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
* @param path
* the path
* @return the created trace
- * @throws URISyntaxException
- * when error occurs
- * @throws IOException
- * when error occurs
* @throws TmfTraceException
* when error occurs
*/
- protected TestTrace createTrace(final String path) throws URISyntaxException, IOException, TmfTraceException {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
- final File test = new File(FileLocator.toFileURL(location).toURI());
- TestTrace trace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
+ protected TestTrace createTrace(final String path) throws TmfTraceException {
+ TestTrace trace = new TestTrace(path, BLOCK_SIZE);
trace.indexTrace(true);
return trace;
}
fTrace = createTrace(path);
} catch (final TmfTraceException e) {
fail(e.getMessage());
- } catch (final URISyntaxException e) {
- fail(e.getMessage());
- } catch (final IOException e) {
- fail(e.getMessage());
}
}
/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
+ * Copyright (c) 2012, 2017 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.io.File;
import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.tests.trace.indexer.checkpoint.AbstractIndexTest.ITestIndexer;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
private synchronized void setupTrace(final String path) {
if (fTrace == null) {
try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
- final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
+ fTrace = new TestTrace(path, BLOCK_SIZE);
fTrace.indexTrace(true);
} catch (final TmfTraceException e) {
e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
}
}
/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
+ * Copyright (c) 2012, 2017 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 static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
fTestTraces = new ITmfTrace[2];
try {
- URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE1.getFullPath()), null);
- File test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true, null);
+ final TmfTraceStub trace1 = new TmfTraceStub(TEST_TRACE1.getFullPath(), 0, true, null);
fTestTraces[0] = trace1;
- location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE2.getFullPath()), null);
- test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true, null);
+ final TmfTraceStub trace2 = new TmfTraceStub(TEST_TRACE2.getFullPath(), 0, true, null);
fTestTraces[1] = trace2;
} catch (final TmfTraceException e) {
e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
}
}
public void testGrowingIndex() {
ITmfTrace[] testTraces = new TmfTraceStub[2];
try {
- URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE1.getFullPath()), null);
- File test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, false, null);
+ final TmfTraceStub trace1 = new TmfTraceStub(TEST_TRACE1.getFullPath(), 0, false, null);
testTraces[0] = trace1;
- location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TEST_TRACE2.getFullPath()), null);
- test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, false, null);
+ final TmfTraceStub trace2 = new TmfTraceStub(TEST_TRACE2.getFullPath(), 0, false, null);
testTraces[1] = trace2;
} catch (final TmfTraceException e) {
e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
}
TmfExperimentStub experiment = new TmfExperimentStub(EXPERIMENT, testTraces, BLOCK_SIZE);
/*******************************************************************************
- * Copyright (c) 2009, 2015 Ericsson
+ * Copyright (c) 2009, 2017 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.tests.stubs.component;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
import org.eclipse.tracecompass.tmf.core.component.TmfEventProvider;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
import org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub;
private TmfTraceStub fTrace;
- public TmfEventProviderStub(final String path) throws IOException {
+ public TmfEventProviderStub(final String path) {
super(path, ITmfEvent.class);
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
try {
- final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStub(test.getPath(), 0, true, null);
+ fTrace = new TmfTraceStub(path, 0, true, null);
} catch (final TmfTraceException e) {
e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
}
}
- public TmfEventProviderStub() throws IOException {
+ public TmfEventProviderStub() {
this(TmfTestTrace.A_TEST_10K.getFullPath());
}
/*******************************************************************************
- * Copyright (c) 2013, 2014 École Polytechnique de Montréal
+ * Copyright (c) 2013, 2017 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
IFolder traceFolder = project.getFolder(TmfTracesFolder.TRACES_FOLDER_NAME);
/* Create a trace, if it exist, it will be replaced */
- File file = new File(testTrace.getFullPath());
- String path = file.getAbsolutePath();
- final IPath pathString = Path.fromOSString(path);
+ final IPath pathString = new Path(testTrace.getFullPath());
IResource linkedTrace = TmfImportHelper.createLink(traceFolder, pathString, pathString.lastSegment());
if (!(linkedTrace != null && linkedTrace.exists())) {
return null;