tmf: Fix TmfTestTrace.getFullPath()
authorPatrick Tasse <patrick.tasse@gmail.com>
Thu, 16 Feb 2017 22:13:17 +0000 (17:13 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Tue, 21 Feb 2017 19:36:45 +0000 (14:36 -0500)
Change getFullPath() to return an absolute path and update callers
accordingly. The internal directory is no longer a relative path from
the plug-in installation location, which allows getTrace() to work
properly when called from another plug-in.

Change-Id: I761ce633da8a64e33fe83e062478da566d5c795c
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/91408
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
13 files changed:
tmf/org.eclipse.tracecompass.tmf.core.tests/shared/org/eclipse/tracecompass/tmf/core/tests/shared/TmfTestTrace.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/request/TmfCoalescedEventRequestTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/request/TmfEventRequestIntegrationTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/synchronization/TimeOffsetTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfExperimentTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfTraceTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfTraceUtilsTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/checkpoint/AbstractIndexTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/component/TmfEventProviderStub.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/shared/org/eclipse/tracecompass/tmf/ui/tests/shared/ProjectModelTestData.java

index 71bc101c27152163d1bf51898f729a7a0dc79162..e9d04f8928453e48e884ecee6b404552398c1267 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -45,7 +45,7 @@ public enum TmfTestTrace {
     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) {
@@ -67,7 +67,12 @@ public enum TmfTestTrace {
      * @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);
+        }
     }
 
     /**
@@ -84,13 +89,11 @@ public enum TmfTestTrace {
         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);
         }
 
index 93da77d6a283f65a27dc0bb01b91493cd8796d65..958e4e0b493296081de4de0c4b345d386391c3aa 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -18,15 +18,9 @@ import static org.junit.Assert.assertFalse;
 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;
@@ -37,7 +31,6 @@ import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 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;
@@ -364,15 +357,9 @@ public class TmfCoalescedEventRequestTest {
     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;
index cea13208b0e8d4fcf50ba3acbf8da03467c063db..f45a619f9f1cd42abe704d3d54657804597647df 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -14,14 +14,8 @@ import static org.junit.Assert.assertFalse;
 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;
@@ -30,7 +24,6 @@ import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
 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;
@@ -69,12 +62,10 @@ public class TmfEventRequestIntegrationTest {
     @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");
         }
index 27ae6d3ac4da599b536ccd4b64147cc82d6c7a3a..b6e556b1feb43aa932c40695f8693966aec00e5d 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -15,25 +15,18 @@ package org.eclipse.tracecompass.tmf.core.tests.synchronization;
 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;
@@ -91,10 +84,8 @@ public class TimeOffsetTest {
         }
     }
 
-    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;
     }
@@ -104,7 +95,7 @@ public class TimeOffsetTest {
     // ------------------------------------------------------------------------
 
     @Test
-    public void testNoOffset() throws URISyntaxException, IOException, TmfTraceException {
+    public void testNoOffset() throws TmfTraceException {
         ITmfTrace trace = createAndIndexTrace();
         final TmfContext context = (TmfContext) trace.seekEvent(0);
 
@@ -117,7 +108,7 @@ public class TimeOffsetTest {
     }
 
     @Test
-    public void testPositiveOffset() throws URISyntaxException, IOException, TmfTraceException {
+    public void testPositiveOffset() throws TmfTraceException {
         ITmfTimestampTransform tt = TimestampTransformFactory.createWithOffset(ONE_MS);
         TimestampTransformFactory.setTimestampTransform(fResource, tt);
 
@@ -133,7 +124,7 @@ public class TimeOffsetTest {
     }
 
     @Test
-    public void testNegativeOffset() throws URISyntaxException, IOException, TmfTraceException {
+    public void testNegativeOffset() throws TmfTraceException {
         ITmfTimestampTransform tt = TimestampTransformFactory.createWithOffset(-ONE_MS);
         TimestampTransformFactory.setTimestampTransform(fResource, tt);
 
@@ -149,7 +140,7 @@ public class TimeOffsetTest {
     }
 
     @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);
index 92041fc0510b1f3f1c6c17383f3be83fca17b32a..2b3def3ecea0319c24c7fd8c56ba9639e2af5054 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -21,15 +21,9 @@ import static org.junit.Assert.assertNotNull;
 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;
@@ -46,7 +40,6 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
 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;
@@ -96,16 +89,10 @@ public class TmfExperimentTest {
         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;
index 40b0414f03ae5dd787063b19a989deaae38a813b..ef73ffeb8f9118182bf8c2780050a21cf1bb6eb7 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -21,21 +21,14 @@ import static org.junit.Assert.assertNotNull;
 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;
@@ -88,23 +81,15 @@ public class TmfMultiTraceExperimentTest {
         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];
     }
index 710d9db8ae32429be9716889751f532950f831e3..3ea73d4704c64a1da95f369d01dbf9f74437ce68 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -21,15 +21,9 @@ import static org.junit.Assert.assertNull;
 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;
@@ -40,7 +34,6 @@ 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.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;
@@ -87,17 +80,11 @@ public class TmfTraceTest {
     @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();
         }
     }
 
@@ -114,92 +101,68 @@ public class TmfTraceTest {
 
     @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 {
@@ -292,7 +255,7 @@ public class TmfTraceTest {
     }
 
     @Test
-    public void testInitTrace() throws URISyntaxException, IOException, TmfTraceException, InterruptedException {
+    public void testInitTrace() throws TmfTraceException, InterruptedException {
         // Instantiate an "empty" trace
         final TmfTraceStub trace = new TmfTraceStub();
 
@@ -309,12 +272,10 @@ public class TmfTraceTest {
         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) {
@@ -1376,26 +1337,17 @@ public class TmfTraceTest {
     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();
     }
 
     // ------------------------------------------------------------------------
index 719ef25aaf7b5403b8f756ef33e4966739cb0115..69ee1098eb63a59fc80e49b5852081662380ea97 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -17,14 +17,8 @@ import static org.junit.Assert.assertNotNull;
 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;
@@ -33,7 +27,6 @@ import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
 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;
@@ -97,12 +90,10 @@ public class TmfTraceUtilsTest {
     @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());
         }
     }
index 629b327d414f056725bde3d41d29ee028a0b754f..20eca918330976cb316b312f8eed93797d78847d 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -21,16 +21,11 @@ import static org.junit.Assert.fail;
 
 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;
@@ -216,17 +211,11 @@ public abstract class AbstractIndexTest {
      * @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;
     }
@@ -237,10 +226,6 @@ public abstract class AbstractIndexTest {
                 fTrace = createTrace(path);
             } catch (final TmfTraceException e) {
                 fail(e.getMessage());
-            } catch (final URISyntaxException e) {
-                fail(e.getMessage());
-            } catch (final IOException e) {
-                fail(e.getMessage());
             }
         }
 
index bffb1c6137d1d44edab39d3562f77020230a46fc..3cd66731902d5403c7a3dd007ab96caa97184206 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -19,14 +19,9 @@ 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.tests.trace.indexer.checkpoint.AbstractIndexTest.ITestIndexer;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
@@ -135,16 +130,10 @@ public class TmfCheckpointIndexTest2 {
     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();
             }
         }
 
index dd3af769436c2bdd9962694fc356208651f807da..c5ec982a0bc024e60acfd48837f33aa5514762c1 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -17,16 +17,8 @@ package org.eclipse.tracecompass.tmf.core.tests.trace.indexer.checkpoint;
 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;
@@ -88,20 +80,12 @@ public class TmfExperimentCheckpointIndexTest {
 
         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();
         }
     }
 
@@ -142,20 +126,12 @@ public class TmfExperimentCheckpointIndexTest {
     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);
index 60f0460e1ff85ea88b4b3bf77d7441944e0944c0..9a7201d6ed324f11b13d72e551f4e3d5e6fc5978 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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;
@@ -38,20 +30,16 @@ public class TmfEventProviderStub extends TmfEventProvider {
 
     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());
     }
 
index 436d381de48c4866b4d32e192d0dd8cbef33922f..d895bc9ad2378f7291a149247275933dfd91666f 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * 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
@@ -65,9 +65,7 @@ public class ProjectModelTestData {
         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;
This page took 0.042024 seconds and 5 git commands to generate.