Tmf: Rework test trace stub for non-ctf traces
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 12 Sep 2013 19:42:34 +0000 (15:42 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 26 Sep 2013 14:23:17 +0000 (10:23 -0400)
Change-Id: Ica47ed67824ea77d975c683fd0794ef6e6840d35
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/16423
Tested-by: Hudson CI
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/TmfTestTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/event/TmfEventTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedEventRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointIndexTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointIndexTest2.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentCheckpointIndexTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfEventProviderStub.java

diff --git a/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/TmfTestTrace.java b/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/TmfTestTrace.java
new file mode 100644 (file)
index 0000000..6d571f0
--- /dev/null
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2013 É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
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.shared;
+
+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.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+
+/**
+ * Wrapper, imitating the {@link CtfTmfTestTrace} class for the non-ctf traces
+ *
+ * @author Geneviève Bastien
+ */
+public enum TmfTestTrace {
+    /** A test */
+    A_TEST_10K("A-Test-10K"),
+    /** A second trace */
+    A_TEST_10K2("A-Test-10K-2"),
+    /** A third trace */
+    E_TEST_10K("E-Test-10K"),
+    /** A fourth trace */
+    O_TEST_10K("O-Test-10K"),
+    /** And oh! a fifth trace */
+    R_TEST_10K("R-Test-10K");
+
+
+    private final String fPath;
+    private final String fDirectory = "testfiles";
+    private ITmfTrace fTrace = null;
+
+    private TmfTestTrace(String file) {
+        fPath = file;
+    }
+
+    /**
+     * Get the path of the trace
+     *
+     * @return The path of this trace
+     */
+    public String getPath() {
+        return fPath;
+    }
+
+    /**
+     * Get the full path of the trace
+     *
+     * @return The full path of the trace
+     */
+    public String getFullPath() {
+        return fDirectory + File.separator + fPath;
+    }
+
+    /**
+     * Return a ITmfTrace object of this test trace. It will be already
+     * initTrace()'ed.
+     *
+     * @return A {@link ITmfTrace} reference to this trace
+     */
+    public ITmfTrace getTrace() {
+        if (fTrace == null) {
+            TmfTraceStub trace = null;
+            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(fDirectory + File.separator + fPath), null);
+            try {
+                File test = new File(FileLocator.toFileURL(location).toURI());
+                trace = new TmfTraceStub(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
+
+            } catch (URISyntaxException e) {
+                throw new RuntimeException(e);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            } catch (TmfTraceException e) {
+                throw new RuntimeException(e);
+            } finally {
+                if (trace != null) {
+                    trace.dispose();
+                }
+            }
+            fTrace = trace;
+        }
+        return fTrace;
+    }
+}
index 5a22bc6b36e25cbbcf10b90c4c71a8ef89aebfed..088a8acc0c99eec77082acd5fca2e1d186a0bd8d 100644 (file)
@@ -36,6 +36,7 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
@@ -88,13 +89,9 @@ public class TmfEventTest {
     // ------------------------------------------------------------------------
 
     private static TmfTraceStub openTrace() {
-        final String DIRECTORY = "testfiles";
-        final String TEST_STREAM = "A-Test-10K";
-        final String path = DIRECTORY + File.separator + TEST_STREAM;
-
         TmfTraceStub trace = null;
         try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
+            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TmfTestTrace.A_TEST_10K.getFullPath()), null);
             final File test = new File(FileLocator.toFileURL(location).toURI());
             trace = new TmfTraceStub(test.toURI().getPath(), 500, false);
         } catch (final TmfTraceException e) {
index 55b457f9a7852c050d2e7575653d4c9b8edb054e..672a5b0ecd715a8f924930e3aabc4e231f74b32e 100644 (file)
@@ -38,6 +38,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.tests.stubs.request.TmfEventRequestStub;
@@ -436,8 +437,7 @@ public class TmfCoalescedEventRequestTest {
     // Coalescing
     // ------------------------------------------------------------------------
 
-    private static final String DIRECTORY = "testfiles";
-    private static final String TEST_STREAM = "A-Test-10K";
+    private static final TmfTestTrace TEST_TRACE = TmfTestTrace.A_TEST_10K;
     private static final int NB_EVENTS = 5000;
     private static final int BLOCK_SIZE = 100;
 
@@ -533,7 +533,7 @@ public class TmfCoalescedEventRequestTest {
 
     public void runCoalescedRequest(long startIndex) throws InterruptedException {
 
-        fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+        fTrace = setupTrace(TEST_TRACE.getFullPath());
 
         TmfSignalManager.register(this);
         TmfTestTriggerSignal signal = new TmfTestTriggerSignal(this, startIndex, false);
@@ -580,7 +580,7 @@ public class TmfCoalescedEventRequestTest {
     @Test
     public void testCancelCoalescedRequest() throws InterruptedException {
 
-        fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+        fTrace = setupTrace(TEST_TRACE.getFullPath());
 
         TmfSignalManager.register(this);
         TmfTestTriggerSignal signal = new TmfTestTriggerSignal(this, 0, true);
index c727241a7bc7204e148bddd97ea939b4725ed85b..26cbb04f0f315309d55790b4b77f424bc8da383f 100644 (file)
@@ -28,6 +28,7 @@ import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
@@ -49,8 +50,6 @@ public class TmfCheckpointIndexTest {
     // Variables
     // ------------------------------------------------------------------------
 
-    private static final String    DIRECTORY   = "testfiles";
-    private static final String    TEST_STREAM = "A-Test-10K";
     private static final int       BLOCK_SIZE  = 100;
     private static final int       NB_EVENTS   = 10000;
     private static TestTrace       fTrace      = null;
@@ -62,7 +61,7 @@ public class TmfCheckpointIndexTest {
 
     @Before
     public void setUp() {
-        setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+        setupTrace(TmfTestTrace.A_TEST_10K.getFullPath());
     }
 
     @After
index fd150ca45a3544430e99044855775852c45b6ed9..4f82f36cac65ba927a56895a9f1a462348131681 100644 (file)
@@ -28,6 +28,7 @@ import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
@@ -49,10 +50,6 @@ public class TmfCheckpointIndexTest2 {
     // Variables
     // ------------------------------------------------------------------------
 
-    private static final String    DIRECTORY   = "testfiles";
-    // Trace has 3 events at t=101 at rank 99, 100, 101
-    // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
-    private static final String    TEST_STREAM = "A-Test-10K-2";
     private static final int       BLOCK_SIZE  = 100;
     private static final int       NB_EVENTS   = 702;
     private static TestTrace       fTrace      = null;
@@ -64,7 +61,9 @@ public class TmfCheckpointIndexTest2 {
 
     @Before
     public void setUp() {
-        setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+        // Trace has 3 events at t=101 at rank 99, 100, 101
+        // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
+        setupTrace(TmfTestTrace.A_TEST_10K2.getFullPath());
     }
 
     @After
index 1ca14b0d58f91b1676861a5e52357e20a2c4e013..1e74b555f508a1061d2a48736fd4f70e7b2ba4ad 100644 (file)
@@ -28,6 +28,7 @@ import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
@@ -50,10 +51,9 @@ public class TmfExperimentCheckpointIndexTest {
     // Attributes
     // ------------------------------------------------------------------------
 
-    private static final String DIRECTORY    = "testfiles";
-    private static final String TEST_STREAM1 = "O-Test-10K";
-    private static final String TEST_STREAM2 = "E-Test-10K";
     private static final String EXPERIMENT   = "MyExperiment";
+    private static final TmfTestTrace TEST_TRACE1   = TmfTestTrace.O_TEST_10K;
+    private static final TmfTestTrace TEST_TRACE2   = TmfTestTrace.E_TEST_10K;
     private static int          NB_EVENTS    = 20000;
     private static int          BLOCK_SIZE   = 1000;
 
@@ -82,16 +82,14 @@ public class TmfExperimentCheckpointIndexTest {
     }
 
     private static void setupTraces() {
-        final String path1 = DIRECTORY + File.separator + TEST_STREAM1;
-        final String path2 = DIRECTORY + File.separator + TEST_STREAM2;
 
         fTestTraces = new ITmfTrace[2];
         try {
-            URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null);
+            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);
             fTestTraces[0] = trace1;
-            location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null);
+            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);
             fTestTraces[1] = trace2;
@@ -141,11 +139,11 @@ public class TmfExperimentCheckpointIndexTest {
     public void testGrowingIndex() {
         ITmfTrace[] testTraces = new TmfTraceStub[2];
         try {
-            URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM1), null);
+            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);
             testTraces[0] = trace1;
-            location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM2), null);
+            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);
             testTraces[1] = trace2;
index 15e06d87fcbbe66ee5e020fd6a352e0a26f2e61a..312e69e02521a9a85d19ae1854f0fd58715896e9 100644 (file)
@@ -38,6 +38,7 @@ import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
@@ -60,8 +61,6 @@ public class TmfExperimentTest {
     // Attributes
     // ------------------------------------------------------------------------
 
-    private static final String DIRECTORY   = "testfiles";
-    private static final String TEST_STREAM = "A-Test-10K";
     private static final String EXPERIMENT  = "MyExperiment";
     private static int          NB_EVENTS   = 10000;
     private static int          BLOCK_SIZE  = 1000;
@@ -105,7 +104,7 @@ public class TmfExperimentTest {
 
     @Before
     public void setUp() {
-        setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+        setupTrace(TmfTestTrace.A_TEST_10K.getFullPath());
         setupExperiment();
     }
 
index 44a3d3abbc6b581c0d4ee563f897a5de5300cd20..d1af4ae909fdc1396ae1b2092a1050974f85e7f5 100644 (file)
@@ -34,6 +34,7 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
@@ -57,9 +58,6 @@ public class TmfMultiTraceExperimentTest {
     // ------------------------------------------------------------------------
 
     private static final long   DEFAULT_INITIAL_OFFSET_VALUE = (1L * 100 * 1000 * 1000); // .1sec
-    private static final String DIRECTORY    = "testfiles";
-    private static final String TEST_STREAM1 = "O-Test-10K";
-    private static final String TEST_STREAM2 = "E-Test-10K";
     private static final String EXPERIMENT   = "MyExperiment";
     private static int          NB_EVENTS    = 20000;
     private static int          BLOCK_SIZE   = 1000;
@@ -85,17 +83,15 @@ public class TmfMultiTraceExperimentTest {
     }
 
     private static ITmfTrace[] setupTraces() {
-        final String path1 = DIRECTORY + File.separator + TEST_STREAM1;
-        final String path2 = DIRECTORY + File.separator + TEST_STREAM2;
         try {
             ITmfTrace[] traces = new ITmfTrace[2];
 
-            URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null);
+            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);
             traces[0] = trace1;
 
-            location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null);
+            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);
             traces[1] = trace2;
index e3b027792bc9bf170cee09c2f9f883a9281d9a08..971393f5b808b6bbab40135f7609a9dc7c6e22f4 100644 (file)
@@ -38,6 +38,7 @@ import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
@@ -61,9 +62,8 @@ public class TmfTraceTest {
     // Variables
     // ------------------------------------------------------------------------
 
+    private static final TmfTestTrace TEST_TRACE = TmfTestTrace.A_TEST_10K;
     private static final long   DEFAULT_INITIAL_OFFSET_VALUE = (1L * 100 * 1000 * 1000); // .1sec
-    private static final String DIRECTORY   = "testfiles";
-    private static final String TEST_STREAM = "A-Test-10K";
     private static final int    BLOCK_SIZE  = 500;
     private static final int    NB_EVENTS   = 10000;
     private static TmfTraceStub fTrace      = null;
@@ -76,7 +76,7 @@ public class TmfTraceTest {
 
     @Before
     public void setUp() {
-        fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+        fTrace = setupTrace(TEST_TRACE.getFullPath());
     }
 
     @After
@@ -114,7 +114,7 @@ public class TmfTraceTest {
     @Test
     public void testStandardConstructor() throws TmfTraceException {
         try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+            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());
             trace.indexTrace(true);
@@ -124,7 +124,7 @@ public class TmfTraceTest {
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
+            assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
 
             assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
             assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
@@ -142,7 +142,7 @@ public class TmfTraceTest {
     @Test
     public void testStandardConstructorCacheSize() throws TmfTraceException {
         try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+            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(), 0);
             trace.indexTrace(true);
@@ -152,7 +152,7 @@ public class TmfTraceTest {
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
+            assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
 
             assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
             assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
@@ -167,7 +167,7 @@ public class TmfTraceTest {
         }
 
         try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+            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(), BLOCK_SIZE);
             trace.indexTrace(true);
@@ -177,7 +177,7 @@ public class TmfTraceTest {
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
+            assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
 
             assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
             assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
@@ -195,7 +195,7 @@ public class TmfTraceTest {
     @Test
     public void testFullConstructor() throws TmfTraceException {
         try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+            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(), BLOCK_SIZE, null);
             trace.indexTrace(true);
@@ -205,7 +205,7 @@ public class TmfTraceTest {
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
+            assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
 
             assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
             assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
@@ -224,7 +224,7 @@ public class TmfTraceTest {
     public void testLiveTraceConstructor() throws TmfTraceException {
         final long interval = 100;
         try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+            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(), BLOCK_SIZE, interval);
             trace.indexTrace(true);
@@ -234,7 +234,7 @@ public class TmfTraceTest {
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", interval, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
+            assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
 
             assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
             assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
@@ -252,7 +252,7 @@ public class TmfTraceTest {
     @Test
     public void testCopyConstructor() throws TmfTraceException {
         try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+            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(), BLOCK_SIZE, new TmfCheckpointIndexer(null));
             TmfTraceStub trace = new TmfTraceStub(original);
@@ -263,7 +263,7 @@ public class TmfTraceTest {
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
             assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-            assertEquals("getName", TEST_STREAM, trace.getName());
+            assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
 
             assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
             assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
@@ -380,7 +380,7 @@ public class TmfTraceTest {
         assertEquals("getEndTime",     Long.MIN_VALUE, trace.getEndTime().getValue());
 
         // Validate
-        final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+        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());
 
@@ -400,7 +400,7 @@ public class TmfTraceTest {
         assertNull  ("getResource", trace.getResource());
         assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-        assertEquals("getName", TEST_STREAM, trace.getName());
+        assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
 
         assertEquals("getNbEvents",    NB_EVENTS, trace.getNbEvents());
         assertEquals("getRange-start", 1,         trace.getTimeRange().getStartTime().getValue());
@@ -1407,7 +1407,7 @@ public class TmfTraceTest {
         assertNull  ("getResource", fTrace.getResource());
         assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
         assertEquals("getStreamingInterval", 0, fTrace.getStreamingInterval());
-        assertEquals("getName", TEST_STREAM, fTrace.getName());
+        assertEquals("getName", TEST_TRACE.getPath(), fTrace.getName());
 
         assertEquals("getNbEvents",    NB_EVENTS, fTrace.getNbEvents());
         assertEquals("getRange-start", 1,         fTrace.getTimeRange().getStartTime().getValue());
@@ -1432,7 +1432,7 @@ public class TmfTraceTest {
         TmfTraceStub trace = null;
         File testfile = null;
         try {
-            final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+            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());
             // verify initial values
index bbcee8a8a94bdeb0a3d877ec07d02a9db893235b..743232c4b737be82589e61e6f4bb59673a789ba6 100644 (file)
@@ -25,6 +25,7 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
 import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
 
@@ -36,9 +37,6 @@ import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
 @SuppressWarnings("javadoc")
 public class TmfEventProviderStub extends TmfEventProvider {
 
-    private static final String DIRECTORY   = "testfiles";
-    private static final String TEST_STREAM = "A-Test-10K";
-
     private TmfTraceStub fTrace;
 
     public TmfEventProviderStub(final String path) throws IOException {
@@ -55,7 +53,7 @@ public class TmfEventProviderStub extends TmfEventProvider {
     }
 
     public TmfEventProviderStub() throws IOException {
-        this(DIRECTORY + File.separator + TEST_STREAM);
+        this(TmfTestTrace.A_TEST_10K.getFullPath());
     }
 
     @Override
This page took 0.036755 seconds and 5 git commands to generate.