Merge branch 'master' into lttng-luna
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 10 Sep 2013 20:33:19 +0000 (16:33 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 10 Sep 2013 20:47:16 +0000 (16:47 -0400)
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Conflicts:
lttng/org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTraces.java
lttng/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTraces.java

Change-Id: Ic87bd53cb80a36b20e996f3770aca93a53b78e2f

35 files changed:
org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTraces.java [deleted file]
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceCallsitePerformanceTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceReaderTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/MetadataTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/StreamInputReaderTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/StreamInputTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/StreamTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EventDeclarationTest.java
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/VariantDeclarationTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/ExperimentSyncTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/MatchAndSyncTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/headless/BasicStateSystemExample.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/headless/GenerateTestValues.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/LttngKernelStateProviderTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/PartialStateSystemTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemInMemoryTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java
org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTraces.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContextTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/EventContextTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerBenchmark.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfEventsStatisticsTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStateStatisticsTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStatisticsTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceManagerTest.java
org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/project/model/ProjectModelTestData.java
org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/project/model/ProjectModelTraceTest.java

diff --git a/org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTrace.java b/org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTrace.java
new file mode 100644 (file)
index 0000000..b45b6fc
--- /dev/null
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.ctf.core.tests.shared;
+
+import java.io.File;
+
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
+
+/**
+ * Here is the list of the available test traces for the CTF parser.
+ *
+ * Make sure you run the traces/get-traces.xml Ant script (or get-traces.sh
+ * shell script) to download them first!
+ *
+ * @author Alexandre Montplaisir
+ */
+public enum CtfTestTrace {
+    /** Example kernel trace */
+    KERNEL("../org.eclipse.linuxtools.ctf.core.tests/traces/kernel"),
+    /** Another kernel trace */
+    TRACE2("../org.eclipse.linuxtools.ctf.core.tests/traces/trace2"),
+    /** Kernel trace with event contexts */
+    KERNEL_VM("../org.eclipse.linuxtools.ctf.core.tests/traces/kernel_vm"),
+    /** Trace synchronization: source trace */
+    SYNC_SRC("../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_src"),
+    /** Trace synchronization: destination trace */
+    SYNC_DEST("../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_dest");
+
+
+    private final String fPath;
+    private CTFTrace fTrace = null;
+    private CTFTrace fTraceFromFile = null;
+
+    private CtfTestTrace(String path) {
+        fPath = path;
+    }
+
+    /** @return The path to the test trace */
+    public String getPath() {
+        return fPath;
+    }
+
+    /**
+     * Get a CTFTrace instance of a test trace. Make sure
+     * {@link #exists()} before calling this!
+     *
+     * @return The CTFTrace object
+     * @throws CTFReaderException
+     *             If the trace cannot be found.
+     */
+    public CTFTrace getTrace() throws CTFReaderException {
+        if (fTrace == null) {
+            fTrace = new CTFTrace(fPath);
+        }
+        return fTrace;
+    }
+
+    /**
+     * Get a CTFTrace instance created from a File. Make sure
+     * {@link #exists()} before calling this!
+     *
+     * @return The CTFTrace object
+     * @throws CTFReaderException
+     *             If the trace cannot be found.
+     */
+    public CTFTrace getTraceFromFile() throws CTFReaderException {
+        if (fTraceFromFile == null) {
+            fTraceFromFile = new CTFTrace(new File(fPath));
+        }
+        return fTraceFromFile;
+    }
+
+    /**
+     * Check if this test trace actually exists on disk.
+     *
+     * @return If the trace exists
+     */
+    public boolean exists() {
+        try {
+            getTrace();
+        } catch (CTFReaderException e) {
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTraces.java b/org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTraces.java
deleted file mode 100644 (file)
index 9128c73..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.ctf.core.tests.shared;
-
-import java.io.File;
-
-import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
-
-/**
- * Here are the definitions common to all the CTF parser tests.
- *
- * @author alexmont
- */
-public abstract class CtfTestTraces {
-
-    /*
-     * Path to test traces. Make sure you run the traces/get-traces.sh script
-     * first!
-     */
-    private static final String[] testTracePaths = {
-        "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel",
-        "../org.eclipse.linuxtools.ctf.core.tests/traces/trace2",
-        "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel_vm",
-        "../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_src",
-        "../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_dest"
-    };
-
-    private static CTFTrace[] testTraces = new CTFTrace[testTracePaths.length];
-    private static CTFTrace[] testTracesFromFile = new CTFTrace[testTracePaths.length];
-
-    private static final File testTraceFile1 = new File(testTracePaths[0] + "/channel0_0");
-
-    private static final File emptyFile = new File("");
-    private static CTFTrace emptyTrace = null;
-
-    /**
-     * Return an empty file (new File("");)
-     *
-     * @return An empty file
-     */
-    public static File getEmptyFile() {
-        return emptyFile;
-    }
-
-    /**
-     * Return a file in test trace #1 (channel0_0).
-     *
-     * Make sure {@link #tracesExist()} before calling this!
-     *
-     * @return A file in a test trace
-     */
-    public static File getTraceFile(){
-        return testTraceFile1;
-    }
-
-    /**
-     * Return a trace out of an empty file (new CTFTrace("");)
-     *
-     * @return An empty trace
-     */
-    public static CTFTrace getEmptyTrace() {
-        if (emptyTrace == null) {
-            try {
-                emptyTrace = new CTFTrace("");
-            } catch (CTFReaderException e) {
-                /* Should always work... */
-                throw new RuntimeException(e);
-            }
-        }
-        return emptyTrace;
-    }
-
-    /**
-     * Get a CTFTrace reference to the given test trace.
-     *
-     * Make sure {@link #tracesExist()} before calling this!
-     *
-     * @param idx
-     *            The index of the trace among all the available ones
-     * @return Reference to test trace #1
-     * @throws CTFReaderException
-     *             If the trace cannot be found
-     */
-    public static CTFTrace getTestTrace(int idx) throws CTFReaderException {
-        if (testTraces[idx] == null) {
-            testTraces[idx] = new CTFTrace(testTracePaths[idx]);
-        }
-        return testTraces[idx];
-    }
-
-    /**
-     * Get the (string) path to a given test trace.
-     *
-     * You should call {@link #tracesExist()} before calling this if you are
-     * going to use this trace for real.
-     *
-     * @param idx
-     *            The index of the trace among all the available ones
-     * @return The path to the test trace
-     */
-    public static String getTestTracePath(int idx) {
-        return testTracePaths[idx];
-    }
-
-    /**
-     * Same as {@link #getTestTrace}, except the CTFTrace is create from the
-     * File object and not the path.
-     *
-     * Make sure {@link #tracesExist()} before calling this!
-     *
-     * @param idx
-     *            The index of the trace among all the available ones
-     * @return Reference to test trace #1
-     */
-    public static CTFTrace getTestTraceFromFile(int idx) {
-        if (testTracesFromFile[idx] == null) {
-            try {
-                testTracesFromFile[idx] = new CTFTrace(new File(testTracePaths[idx]));
-            } catch (CTFReaderException e) {
-                /* This trace should exist */
-                throw new RuntimeException(e);
-            }
-        }
-        return testTracesFromFile[idx];
-    }
-
-    /**
-     * Check if the test traces are present in the tree. If not, you can get
-     * them by running traces/get-traces.sh or traces/get-traces.xml
-     *
-     * @return True if *all* the test files could be found, false otherwise.
-     */
-    public static boolean tracesExist() {
-        for (int i = 0; i < testTracePaths.length; i++) {
-            if (!traceExists(i)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    private static boolean traceExists(int idx) {
-        if (testTraces[idx] != null) {
-            return true;
-        }
-        try {
-            getTestTrace(idx);
-        } catch (CTFReaderException e) {
-            return false;
-        }
-        return true;
-    }
-}
index 2d11615d42b86cabec93db18afaea404e1b8df64..eec6104caf6c65f2c2bd8471014a682ac102521c 100644 (file)
@@ -19,7 +19,7 @@ import java.util.Random;
 import java.util.TreeSet;
 
 import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.junit.Before;
@@ -32,6 +32,8 @@ import org.junit.Test;
  */
 public class CTFTraceCallsitePerformanceTest {
 
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
     private static final int NUMBER_OF_SEEKS = 100000;
 
     private final String[] callsites = { "Alligator", "Bunny", "Cat",
@@ -73,8 +75,8 @@ public class CTFTraceCallsitePerformanceTest {
     @Before
     public void setup() throws CTFReaderException, SecurityException,
             IllegalArgumentException {
-        assumeTrue(CtfTestTraces.tracesExist());
-        fTrace = new CTFTrace(CtfTestTraces.getTraceFile().getParentFile());
+        assumeTrue(testTrace.exists());
+        fTrace = new CTFTrace(testTrace.getPath());
     }
 
     private void addCallsites(int numCallsites) {
index 4b6b9cd29812566ab684a4b45fa8ec51d20e7eb2..1bc176645d2ecbfdd1e44d101ef170cf03aa8433 100644 (file)
@@ -18,7 +18,7 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
@@ -35,7 +35,7 @@ import org.junit.Test;
 @SuppressWarnings("javadoc")
 public class CTFTraceReaderTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
 
     private CTFTraceReader fixture;
 
@@ -46,8 +46,8 @@ public class CTFTraceReaderTest {
      */
     @Before
     public void setUp() throws CTFReaderException {
-        assumeTrue(CtfTestTraces.tracesExist());
-        fixture = new CTFTraceReader(CtfTestTraces.getTestTrace(TRACE_INDEX));
+        assumeTrue(testTrace.exists());
+        fixture = new CTFTraceReader(testTrace.getTrace());
     }
 
     /**
@@ -58,7 +58,7 @@ public class CTFTraceReaderTest {
      */
     @Test
     public void testOpen_existing() throws CTFReaderException {
-        CTFTrace trace = CtfTestTraces.getTestTrace(TRACE_INDEX);
+        CTFTrace trace = testTrace.getTrace();
 
         CTFTraceReader result = new CTFTraceReader(trace);
         assertNotNull(result);
@@ -155,7 +155,7 @@ public class CTFTraceReaderTest {
      */
     @Test
     public void testEquals() throws CTFReaderException {
-        CTFTraceReader fixture2 = new CTFTraceReader(CtfTestTraces.getTestTrace(TRACE_INDEX));
+        CTFTraceReader fixture2 = new CTFTraceReader(testTrace.getTrace());
         assertEquals(fixture, fixture2);
     }
 
index c0a43790c9531b6a6cde41b5a4833bc39c0d2625..0fd73cb3ed458b77cbc711b051f3456d4fd0a9a3 100644 (file)
@@ -29,7 +29,7 @@ import java.util.UUID;
 import org.eclipse.linuxtools.ctf.core.event.CTFClock;
 import org.eclipse.linuxtools.ctf.core.event.types.Definition;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.eclipse.linuxtools.ctf.core.trace.Stream;
@@ -49,7 +49,7 @@ public class CTFTraceTest {
 
     private static final String METADATA_FILENAME = "metadata";
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
 
     private static final String CTF_VERSION_NUMBER = "1.8";
     private static final String CTF_SUITE_TEST_DIRECTORY = "ctf-testsuite/tests/" + CTF_VERSION_NUMBER;
@@ -61,8 +61,13 @@ public class CTFTraceTest {
      */
     @Before
     public void setUp() {
-        assumeTrue(CtfTestTraces.tracesExist());
-        fixture = CtfTestTraces.getTestTraceFromFile(TRACE_INDEX);
+        assumeTrue(testTrace.exists());
+        try {
+            fixture = testTrace.getTraceFromFile();
+        } catch (CTFReaderException e) {
+            /* If the assumeTrue() call passed, this should not happen. */
+            fail();
+        }
         fixture.setMinor(1L);
         fixture.setUUID(UUID.randomUUID());
         fixture.setPacketHeader(new StructDeclaration(1L));
@@ -75,8 +80,12 @@ public class CTFTraceTest {
      */
     @Test
     public void testOpen_existing() {
-        CTFTrace result = CtfTestTraces.getTestTraceFromFile(TRACE_INDEX);
-        assertNotNull(result.getUUID());
+        try {
+            CTFTrace result = testTrace.getTraceFromFile();
+            assertNotNull(result.getUUID());
+        } catch (CTFReaderException e) {
+            fail();
+        }
     }
 
     /**
@@ -112,7 +121,7 @@ public class CTFTraceTest {
 
         // Add a stream
         try {
-            Stream stream = new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX));
+            Stream stream = new Stream(testTrace.getTrace());
             stream.setId(1234);
             fixture.addStream(stream);
         } catch (CTFReaderException e) {
@@ -260,15 +269,19 @@ public class CTFTraceTest {
      */
     @Test
     public void testPacketHeaderIsSet_invalid() {
-        CTFTrace fixture2 = CtfTestTraces.getTestTraceFromFile(TRACE_INDEX);
-        fixture2.setMinor(1L);
-        fixture2.setUUID(UUID.randomUUID());
-        fixture2.setPacketHeader((StructDeclaration) null); /* it's null here! */
-        fixture2.setMajor(1L);
-        fixture2.setByteOrder(ByteOrder.BIG_ENDIAN);
-
-        boolean result = fixture2.packetHeaderIsSet();
-        assertFalse(result);
+        try {
+            CTFTrace fixture2 = testTrace.getTraceFromFile();
+            fixture2.setMinor(1L);
+            fixture2.setUUID(UUID.randomUUID());
+            fixture2.setPacketHeader((StructDeclaration) null); /* it's null here! */
+            fixture2.setMajor(1L);
+            fixture2.setByteOrder(ByteOrder.BIG_ENDIAN);
+
+            boolean result = fixture2.packetHeaderIsSet();
+            assertFalse(result);
+        } catch (CTFReaderException e) {
+            fail();
+        }
     }
 
     /**
@@ -454,13 +467,14 @@ public class CTFTraceTest {
 
     /**
      * Test for getCallsite(eventName, ip)
+     * @throws CTFReaderException not expected
      */
     @Test
-    public void callsitePosition(){
+    public void callsitePosition() throws CTFReaderException{
         long ip1 = 2;
         long ip2 = 5;
         long ip3 = 7;
-        CTFTrace callsiteTest = CtfTestTraces.getTestTraceFromFile(TRACE_INDEX);
+        CTFTrace callsiteTest = testTrace.getTraceFromFile();
         callsiteTest.addCallsite("testEvent", null, ip1, null, 23);
         callsiteTest.addCallsite("testEvent", null, ip2, null, 50);
         callsiteTest.addCallsite("testEvent", null, ip3, null, 15);
index 87b97025356eadc4c9cea2f44f6b23dbbbdd7ce9..84e88d9be1fe3c8632b18da542c8eefe8558f95a 100644 (file)
@@ -17,7 +17,7 @@ import static org.junit.Assume.assumeTrue;
 
 import java.nio.ByteOrder;
 
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.Metadata;
 import org.junit.Before;
@@ -33,7 +33,7 @@ import org.junit.Test;
 @SuppressWarnings("javadoc")
 public class MetadataTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
 
     private Metadata fixture;
 
@@ -44,8 +44,8 @@ public class MetadataTest {
      */
     @Before
     public void setUp() throws CTFReaderException {
-        assumeTrue(CtfTestTraces.tracesExist());
-        fixture = new Metadata(CtfTestTraces.getTestTrace(TRACE_INDEX));
+        assumeTrue(testTrace.exists());
+        fixture = new Metadata(testTrace.getTrace());
     }
 
     /**
index e9f0823d57ca7a81706cfa1828bc885d0876a37b..d269d013472002e8252845d9021a260ef9232197 100644 (file)
@@ -16,12 +16,13 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
 import java.nio.channels.FileChannel;
 import java.util.Set;
 
 import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.eclipse.linuxtools.ctf.core.trace.Stream;
@@ -41,7 +42,7 @@ import org.junit.Test;
 @SuppressWarnings("javadoc")
 public class StreamInputReaderTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
 
     private StreamInputReader fixture;
 
@@ -59,8 +60,8 @@ public class StreamInputReaderTest {
     }
 
     private static StreamInputReader getStreamInputReader() throws CTFReaderException {
-        assumeTrue(CtfTestTraces.tracesExist());
-        CTFTrace trace = CtfTestTraces.getTestTrace(TRACE_INDEX);
+        assumeTrue(testTrace.exists());
+        CTFTrace trace = testTrace.getTrace();
         Stream s = trace.getStream((long) 0);
         Set<StreamInput> streamInput = s.getStreamInputs();
         StreamInputReader retVal = null;
@@ -95,7 +96,7 @@ public class StreamInputReaderTest {
     @Test(expected = CTFReaderException.class)
     public void testStreamInputReader_invalid() throws CTFReaderException {
         StreamInput streamInput = new StreamInput(
-                new Stream(new CTFTrace("")), (FileChannel) null, CtfTestTraces.getEmptyFile());
+                new Stream(new CTFTrace("")), (FileChannel) null, new File(""));
 
         StreamInputReader result = new StreamInputReader(streamInput);
         assertNotNull(result);
index 94007cf089452b239f36091b03f43b5bf4fa2aa6..f9d0c79a7578bf354ad53139324a71695d915601 100644 (file)
@@ -22,7 +22,7 @@ import java.io.File;
 import java.nio.channels.FileChannel;
 
 import org.eclipse.linuxtools.ctf.core.event.types.Definition;
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.Stream;
 import org.eclipse.linuxtools.ctf.core.trace.StreamInput;
@@ -39,7 +39,7 @@ import org.junit.Test;
 @SuppressWarnings("javadoc")
 public class StreamInputTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
 
     private StreamInput fixture;
 
@@ -50,8 +50,8 @@ public class StreamInputTest {
      */
     @Before
     public void setUp() throws CTFReaderException {
-        assumeTrue(CtfTestTraces.tracesExist());
-        fixture = new StreamInput(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)),
+        assumeTrue(testTrace.exists());
+        fixture = new StreamInput(new Stream(testTrace.getTrace()),
                 (FileChannel) null, createFile());
         fixture.setTimestampEnd(1L);
     }
@@ -137,30 +137,30 @@ public class StreamInputTest {
 
     @Test
     public void testEquals1() throws CTFReaderException{
-        s1 = new StreamInput(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)),
+        s1 = new StreamInput(new Stream(testTrace.getTrace()),
                 (FileChannel) null, createFile());
         assertFalse(s1.equals(null));
     }
 
     @Test
     public void testEquals2() throws CTFReaderException{
-        s1 = new StreamInput(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)),
+        s1 = new StreamInput(new Stream(testTrace.getTrace()),
                 (FileChannel) null, createFile());
         assertFalse(s1.equals(new Long(23L)));
 
     }
     @Test
     public void testEquals3() throws CTFReaderException{
-        s1 = new StreamInput(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)),
+        s1 = new StreamInput(new Stream(testTrace.getTrace()),
                 (FileChannel) null, createFile());
         assertEquals(s1,s1);
 
     }
     @Test
     public void testEquals4() throws CTFReaderException{
-        s1 = new StreamInput(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)),
+        s1 = new StreamInput(new Stream(testTrace.getTrace()),
                 (FileChannel) null, createFile());
-        s2 = new StreamInput(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)),
+        s2 = new StreamInput(new Stream(testTrace.getTrace()),
                 (FileChannel) null, createFile());
         assertEquals(s1,s2);
     }
index 89265db208cd3259eefa4f414c70c742876aff82..4826e6631315c5e65d1d765a78b0d869162e657c 100644 (file)
@@ -15,13 +15,14 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
 import java.nio.channels.FileChannel;
 import java.util.Map;
 import java.util.Set;
 
 import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.eclipse.linuxtools.ctf.core.trace.Stream;
@@ -41,7 +42,7 @@ import org.junit.Test;
 @SuppressWarnings("javadoc")
 public class StreamTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
 
     private Stream fixture;
 
@@ -52,14 +53,14 @@ public class StreamTest {
      */
     @Before
     public void setUp() throws CTFReaderException {
-        assumeTrue(CtfTestTraces.tracesExist());
-        fixture = new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX));
+        assumeTrue(testTrace.exists());
+        fixture = new Stream(testTrace.getTrace());
         fixture.setEventContext(new StructDeclaration(1L));
         fixture.setPacketContext(new StructDeclaration(1L));
         fixture.setEventHeader(new StructDeclaration(1L));
         fixture.setId(1L);
-        fixture.addInput(new StreamInput(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)),
-                (FileChannel) null, CtfTestTraces.getEmptyFile()));
+        fixture.addInput(new StreamInput(new Stream(testTrace.getTrace()),
+                (FileChannel) null, new File("")));
     }
 
     /**
@@ -69,7 +70,7 @@ public class StreamTest {
      */
     @Test
     public void testStream() throws CTFReaderException {
-        CTFTrace trace = CtfTestTraces.getTestTrace(TRACE_INDEX);
+        CTFTrace trace = testTrace.getTrace();
         Stream result = new Stream(trace);
         assertNotNull(result);
     }
index df5aed5fd864a31baccc9308535db4e09872258c..181c15c9b82b4e6dff1b3071ce2f87f484a486e9 100644 (file)
@@ -20,7 +20,7 @@ import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
@@ -39,7 +39,7 @@ import org.junit.Test;
 @SuppressWarnings("javadoc")
 public class EventDeclarationTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
 
     private EventDeclaration fixture;
 
@@ -50,12 +50,12 @@ public class EventDeclarationTest {
      */
     @Before
     public void setUp() throws CTFReaderException {
-        assumeTrue(CtfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         fixture = new EventDeclaration();
         fixture.setContext(new StructDeclaration(1L));
         fixture.setId(1L);
         fixture.setFields(new StructDeclaration(1L));
-        fixture.setStream(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)));
+        fixture.setStream(new Stream(testTrace.getTrace()));
         fixture.setName("");
     }
 
@@ -99,7 +99,7 @@ public class EventDeclarationTest {
         obj.setContext(new StructDeclaration(1L));
         obj.setId(1L);
         obj.setFields(new StructDeclaration(1L));
-        obj.setStream(new Stream(CtfTestTraces.getTestTrace(TRACE_INDEX)));
+        obj.setStream(new Stream(testTrace.getTrace()));
         obj.setName("");
 
         assertTrue(fixture.equals(fixture));
@@ -316,7 +316,7 @@ public class EventDeclarationTest {
      */
     @Test
     public void testEventDefinition() throws CTFReaderException {
-        CTFTrace trace = CtfTestTraces.getTestTrace(TRACE_INDEX);
+        CTFTrace trace = testTrace.getTrace();
         CTFTraceReader tr = new CTFTraceReader(trace);
         tr.advance();
         EventDefinition ed = new EventDefinition(null, null);
index eee99b3dd242e25e0490718a820ae82ab3669c82..dd9126927435887762d4c0f77d40ffbb3c7bed98 100644 (file)
@@ -22,7 +22,7 @@ import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.VariantDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.VariantDefinition;
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.junit.Before;
 import org.junit.Test;
@@ -36,7 +36,7 @@ import org.junit.Test;
  */
 public class VariantDeclarationTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
 
     private VariantDeclaration fixture;
 
@@ -87,13 +87,13 @@ public class VariantDeclarationTest {
     }
 
     private static IDefinitionScope createDefinitionScope() throws CTFReaderException {
-        assumeTrue(CtfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         VariantDeclaration declaration = new VariantDeclaration();
         declaration.setTag("");
         VariantDeclaration variantDeclaration = new VariantDeclaration();
         variantDeclaration.setTag("");
         VariantDefinition variantDefinition = new VariantDefinition(
-                variantDeclaration, CtfTestTraces.getTestTrace(TRACE_INDEX), "");
+                variantDeclaration, testTrace.getTrace(), "");
         IDefinitionScope definitionScope = new StructDefinition(
                 new StructDeclaration(1L), variantDefinition, "");
         String fieldName = "";
index 6267b03c1c3c50688b57b720e2a558ed2f8f5ef5..7f6aef641becda08bb0a2bb5c24efe78fccedd44 100644 (file)
@@ -23,7 +23,7 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.synchronization.ITmfTimestampTransform;
 import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
 import org.eclipse.linuxtools.tmf.core.synchronization.TmfTimestampTransform;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
 import org.junit.After;
@@ -49,8 +49,8 @@ public class ExperimentSyncTest {
      */
     @Before
     public void setUp() {
-        CtfTmfTrace trace1 = CtfTmfTestTraces.getTestTrace(3);
-        CtfTmfTrace trace2 = CtfTmfTestTraces.getTestTrace(4);
+        CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
+        CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();
 
         fTraces = new CtfTmfTrace[2];
         fTraces[0] = trace1;
index b036336b65e18053a26b1f8c0a13ab083a65431b..4d317ea62de311d62764f03b575ff15b1d7856cf 100644 (file)
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMat
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
 import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.Test;
 
 /**
@@ -37,8 +37,8 @@ public class MatchAndSyncTest {
     @Test
     public void testMatching() {
         final String cr = System.getProperty("line.separator");
-        CtfTmfTrace trace1 = CtfTmfTestTraces.getTestTrace(3);
-        CtfTmfTrace trace2 = CtfTmfTestTraces.getTestTrace(4);
+        CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
+        CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();
 
         CtfTmfTrace[] tracearr = new CtfTmfTrace[2];
         tracearr[0] = trace1;
index 9c4d5713138b01534fc4373f3a43505c121bd8fe..b7fcc7b6e866bf3463d56dfddc45940a4548f990 100644 (file)
@@ -26,7 +26,7 @@ import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 
 /**
  * Simple example of how to use the state system using a CTF kernel trace.
@@ -43,7 +43,7 @@ public class BasicStateSystemExample {
         /* Read a trace and build the state system */
         try {
             File newStateFile = new File("/tmp/helloworldctf.ht");
-            ITmfStateProvider input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(1));
+            ITmfStateProvider input = new LttngKernelStateProvider(CtfTmfTestTrace.TRACE2.getTrace());
             ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(newStateFile, input, true);
 
             requestExample(ss);
index 9617a94fe1927801d6325b017e1152c7c180c879..44e71c04ad25cdf0e5d8cf157607bbca5a2498c5 100644 (file)
@@ -23,7 +23,7 @@ import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 
 /**
  * Small program to regenerate the values used in "TestValues.java" from the
@@ -36,7 +36,7 @@ import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
  */
 public class GenerateTestValues {
 
-    private static final int TRACE_INDEX = 1;
+    private static CtfTmfTestTrace testTrace = CtfTmfTestTrace.TRACE2;
     private static final long targetTimestamp = 18670067372290L + 1331649577946812237L;
     private static final String INDENT = "    ";
 
@@ -49,7 +49,7 @@ public class GenerateTestValues {
      *             I'm messing with Exception. Come at me bro!
      */
     public static void main(String[] args) throws Exception {
-        if (!CtfTmfTestTraces.tracesExist()) {
+        if (!testTrace.exists()) {
             System.err.println("Trace files not present.");
             return;
         }
@@ -61,7 +61,7 @@ public class GenerateTestValues {
         PrintWriter writer = new PrintWriter(new FileWriter(logFile), true);
 
         /* Build and query the state system */
-        ITmfStateProvider input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+        ITmfStateProvider input = new LttngKernelStateProvider(testTrace.getTrace());
         ITmfStateSystem ssq = TmfStateSystemFactory.newFullHistory(stateFile, input, true);
         List<ITmfStateInterval> fullState = ssq.queryFullState(targetTimestamp);
 
index c8dcbab6885d3b30dc8e9724a868b43250eca716..a5e48548c0aaa86ef471850ef3a684c374036218 100644 (file)
@@ -17,7 +17,7 @@ import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -28,7 +28,7 @@ import org.junit.Test;
  */
 public class LttngKernelStateProviderTest {
 
-    private final static int TRACE_INDEX = 1;
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.TRACE2;
 
     private static ITmfStateProvider input;
 
@@ -37,8 +37,8 @@ public class LttngKernelStateProviderTest {
      */
     @BeforeClass
     public static void initialize() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
-        input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+        assumeTrue(testTrace.exists());
+        input = new LttngKernelStateProvider(testTrace.getTrace());
 
     }
 
index dda24333aea57f2efabba4c45b41ac110f42f630..4431d99bd18a723677ccd4703e917a8940660fd0 100644 (file)
@@ -20,7 +20,6 @@ import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKer
 import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -36,13 +35,13 @@ public class PartialStateSystemTest extends StateSystemTest {
      */
     @BeforeClass
     public static void initialize() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         File stateFile = null;
         try {
             stateFile = File.createTempFile("test-partial", ".ht");
             stateFile.deleteOnExit();
 
-            input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+            input = new LttngKernelStateProvider(testTrace.getTrace());
             ssq = TmfStateSystemFactory.newPartialHistory(stateFile, input, true);
         } catch (IOException e) {
             e.printStackTrace();
index f50f733b90a8fcecd93ae472a0c5b902abfed303..1dfc4a9f1eb88e947845f0a232fd9a16b21f4d38 100644 (file)
@@ -25,7 +25,6 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -45,12 +44,12 @@ public class StateSystemFullHistoryTest extends StateSystemTest {
      */
     @BeforeClass
     public static void initialize() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         try {
             stateFile = File.createTempFile("test", ".ht");
             stateFileBenchmark = File.createTempFile("test", ".ht.benchmark");
 
-            input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+            input = new LttngKernelStateProvider(testTrace.getTrace());
             ssq = TmfStateSystemFactory.newFullHistory(stateFile, input, true);
         } catch (IOException e) {
             e.printStackTrace();
@@ -73,7 +72,7 @@ public class StateSystemFullHistoryTest extends StateSystemTest {
     @Test
     public void testBuild() {
         try {
-            ITmfStateProvider input2 = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+            ITmfStateProvider input2 = new LttngKernelStateProvider(testTrace.getTrace());
             ITmfStateSystem ssb2 = TmfStateSystemFactory.newFullHistory(stateFileBenchmark, input2, true);
 
             assertEquals(startTime, ssb2.getStartTime());
index f76c5c2015b8d40cd6d05b0cb9429431c231786b..b4bff2f31dd679cc01420f66a691bf84cb0dfee4 100644 (file)
@@ -16,7 +16,6 @@ import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
 import org.junit.BeforeClass;
 
 /**
@@ -31,8 +30,8 @@ public class StateSystemInMemoryTest extends StateSystemTest {
      */
     @BeforeClass
     public static void initialize() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
-        input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+        assumeTrue(testTrace.exists());
+        input = new LttngKernelStateProvider(testTrace.getTrace());
         ssq = TmfStateSystemFactory.newInMemHistory(input, true);
     }
 }
index 487e4b7542c203fa0440933a807d7293f4953b26..a55729bceb180fcfaa046a6a1a247053140afe0c 100644 (file)
@@ -27,6 +27,7 @@ import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.Test;
 
 /**
@@ -38,8 +39,8 @@ import org.junit.Test;
 @SuppressWarnings("javadoc")
 public abstract class StateSystemTest {
 
-    /** Index of the test trace used for these tests */
-    protected static final int TRACE_INDEX = 1;
+    /** Test trace used for these tests */
+    protected static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.TRACE2;
 
     /** Expected start time of the test trace/state history */
     protected static final long startTime = 1331668247314038062L;
diff --git a/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTrace.java b/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTrace.java
new file mode 100644 (file)
index 0000000..6b47f88
--- /dev/null
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.shared;
+
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+
+/**
+ * Available CTF TMF test traces. Kind-of-extends {@link CtfTestTrace}.
+ *
+ * To run tests using these, you first need to run the "get-traces.[xml|sh]"
+ * script located under lttng/org.eclipse.linuxtools.ctf.core.tests/traces/ .
+ *
+ * @author Alexandre Montplaisir
+ */
+public enum CtfTmfTestTrace {
+    /** Example kernel trace */
+    KERNEL,
+    /** Another kernel trace */
+    TRACE2,
+    /** Kernel trace with event contexts */
+    KERNEL_VM,
+    /** Trace synchronization: source trace */
+    SYNC_SRC,
+    /** Trace synchronization: destination trace */
+    SYNC_DEST;
+
+
+    private final String fPath;
+    private CtfTmfTrace fTrace = null;
+
+    private CtfTmfTestTrace() {
+        /* This makes my head spin */
+        fPath = CtfTestTrace.valueOf(this.name()).getPath();
+    }
+
+    /**
+     * @return The path of this trace
+     */
+    public String getPath() {
+        return fPath;
+    }
+
+    /**
+     * Return a CtfTmfTrace object of this test trace. It will be already
+     * initTrace()'ed.
+     *
+     * Make sure you call {@link #exists()} before calling this!
+     *
+     * @return A CtfTmfTrace reference to this trace
+     */
+    public CtfTmfTrace getTrace() {
+        if (fTrace == null) {
+            CtfTmfTrace trace = new CtfTmfTrace();
+            try {
+                trace.initTrace(null, fPath, CtfTmfEvent.class);
+            } catch (TmfTraceException e) {
+                /* Should not happen if tracesExist() passed */
+                throw new RuntimeException(e);
+            }
+            fTrace = trace;
+        }
+        return fTrace;
+    }
+
+    /**
+     * Check if the trace actually exists on disk or not.
+     *
+     * @return If the trace is present
+     */
+    public boolean exists() {
+        return CtfTestTrace.valueOf(this.name()).exists();
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTraces.java b/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTraces.java
deleted file mode 100644 (file)
index 11de9ad..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.shared;
-
-import java.io.File;
-
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-
-/**
- * Definitions used by all tests using CTF-TMF trace files.
- *
- * To run these tests, you will first need to run the "get-traces.sh" script
- * located under lttng/org.eclipse.linuxtools.ctf.core.tests/traces/ .
- *
- * @author Alexandre Montplaisir
- */
-public final class CtfTmfTestTraces {
-
-    private CtfTmfTestTraces() {}
-
-    private static final File emptyFile = new File("");
-    private static CtfTmfTrace emptyTrace = new CtfTmfTrace();
-
-    private static CtfTmfTrace[] testTraces = new CtfTmfTrace[5];
-
-    /**
-     * Get an empty File (new File("");)
-     *
-     * @return An empty file
-     */
-    public static File getEmptyFile() {
-        return emptyFile;
-    }
-
-    /**
-     * Get an empty CtfTmfTrace (new CtfTmfTrace();)
-     *
-     * @return An empty trace
-     */
-    public static CtfTmfTrace getEmptyTrace() {
-        return emptyTrace;
-    }
-
-    /**
-     * Get a reference to the test trace used for the kernel event handler unit
-     * tests.
-     *
-     * Make sure you call {@link #tracesExist()} before calling this!
-     *
-     * @param idx
-     *            The index of the test trace you want
-     * @return A CtfTmfTrace reference to the test trace
-     */
-    public synchronized static CtfTmfTrace getTestTrace(int idx) {
-        if (testTraces[idx] == null) {
-            String tracePath = CtfTestTraces.getTestTracePath(idx);
-            testTraces[idx] = new CtfTmfTrace();
-            try {
-                testTraces[idx].initTrace(null, tracePath, CtfTmfEvent.class);
-            } catch (TmfTraceException e) {
-                /* Should not happen if tracesExist() passed */
-                testTraces[idx] = null;
-                throw new RuntimeException(e);
-            }
-        }
-        return testTraces[idx];
-    }
-
-    // ------------------------------------------------------------------------
-    // Wrappers around direct CtfTestTraces methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Get the (string) path to a given test trace.
-     *
-     * You should call {@link #tracesExist()} before calling this if you are
-     * going to use this trace for real.
-     *
-     * @param idx
-     *            The index of the trace among all the available ones
-     * @return The path to the test trace
-     */
-    public static String getTestTracePath(int idx) {
-        return CtfTestTraces.getTestTracePath(idx);
-    }
-
-    /**
-     * Check if the test traces are present before trying to open them.
-     *
-     * This should be called in unit tests within a asssumeTrue() call, to skip
-     * the test/test-class if the traces are not available.
-     *
-     * @return True if the trace is available, false if not
-     */
-    public static boolean tracesExist() {
-        return CtfTestTraces.tracesExist();
-    }
-
-}
index f5a001c62cb92a25315c3fb94e782c15b7fafc60..10a9be250fa03b685a42a391ff0887b9f220db61 100644 (file)
@@ -24,7 +24,7 @@ import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -38,7 +38,7 @@ import org.junit.Test;
  */
 public class CtfIteratorTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
 
     private CtfIterator fixture;
 
@@ -47,8 +47,8 @@ public class CtfIteratorTest {
      */
     @Before
     public void setUp() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
-        fixture = new CtfIterator(getTrace());
+        assumeTrue(testTrace.exists());
+        fixture = new CtfIterator(testTrace.getTrace());
         CtfLocation ctfLocation = new CtfLocation(new CtfLocationInfo(1, 0));
         fixture.setLocation(ctfLocation);
         fixture.increaseRank();
@@ -64,16 +64,12 @@ public class CtfIteratorTest {
         }
     }
 
-    private static CtfTmfTrace getTrace() {
-        return CtfTmfTestTraces.getTestTrace(TRACE_INDEX);
-    }
-
     /**
      * Run the CtfIterator(CtfTmfTrace) constructor on a non init'ed trace.
      */
     @Test
     public void testCtfIterator_noinit() {
-        CtfTmfTrace trace = getTrace();
+        CtfTmfTrace trace = testTrace.getTrace();
         CtfIterator result = new CtfIterator(trace);
         assertNotNull(result);
     }
@@ -83,7 +79,7 @@ public class CtfIteratorTest {
      */
     @Test
     public void testCtfIterator_init() {
-        CtfTmfTrace trace = getTrace();
+        CtfTmfTrace trace = testTrace.getTrace();
         trace.init("test");
         CtfIterator result = new CtfIterator(trace);
 
@@ -96,7 +92,7 @@ public class CtfIteratorTest {
      */
     @Test
     public void testCtfIterator_position() {
-        CtfTmfTrace trace = getTrace();
+        CtfTmfTrace trace = testTrace.getTrace();
         long timestampValue = 1L;
         long rank = 1L;
         CtfIterator result = new CtfIterator(trace, new CtfLocationInfo(timestampValue, 0), rank);
@@ -128,7 +124,7 @@ public class CtfIteratorTest {
      */
     @Test
     public void testCompareTo() {
-        CtfIterator o = new CtfIterator(getTrace());
+        CtfIterator o = new CtfIterator(testTrace.getTrace());
         int result = fixture.compareTo(o);
 
         assertEquals(1L, result);
@@ -140,7 +136,7 @@ public class CtfIteratorTest {
      */
     @Test
     public void testEquals_other() {
-        CtfIterator obj = new CtfIterator(getTrace());
+        CtfIterator obj = new CtfIterator(testTrace.getTrace());
         CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0));
         obj.setLocation(ctfLocation1);
         obj.increaseRank();
index 528405f8cb8da6c7531b2b348bd93fd795b5c372..ee2a807e06c6648b2afc934990de138f5de6cc44 100644 (file)
@@ -24,7 +24,7 @@ import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfContext;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -36,7 +36,7 @@ import org.junit.Test;
  */
 public class CtfTmfContextTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
     private static final long begin = 1332170682440133097L; /* Trace start time */
     private static final long end = 1332170692664579801L; /* Trace end time */
 
@@ -58,9 +58,9 @@ public class CtfTmfContextTest {
      */
     @Before
     public void setUp() throws TmfTraceException {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         trace = new CtfTmfTrace();
-        String path = CtfTmfTestTraces.getTestTracePath(TRACE_INDEX);
+        String path = testTrace.getPath();
         trace.initTrace((IResource) null, path, CtfTmfEvent.class);
     }
 
index 5278a3978b1f3336a51aab0c2503ab95410c08a4..78332687fab18c802200a617b1b29f881ada9c5e 100644 (file)
@@ -28,7 +28,7 @@ import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventFactory;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -43,7 +43,7 @@ import org.junit.Test;
  */
 public class CtfTmfEventTest {
 
-    private static final int TRACE_INDEX = 0;
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
 
     private static CtfTmfEvent nullEvent;
     private CtfTmfEvent fixture;
@@ -61,8 +61,8 @@ public class CtfTmfEventTest {
      */
     @Before
     public void setUp() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
-        CtfTmfTrace trace = CtfTmfTestTraces.getTestTrace(TRACE_INDEX);
+        assumeTrue(testTrace.exists());
+        CtfTmfTrace trace = testTrace.getTrace();
         CtfIterator tr = new CtfIterator(trace);
         tr.advance();
         fixture = tr.getCurrentEvent();
index 235be8b825e36d7a13ae2e72369093f085e82018..ecf0c126ae762b0fb5f323c7460c55685303bcdf 100644 (file)
@@ -32,7 +32,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
@@ -50,8 +50,7 @@ import org.junit.Test;
  */
 public class CtfTmfTraceTest {
 
-    private static final int TRACE_INDEX = 0;
-    private static final String PATH = CtfTmfTestTraces.getTestTracePath(TRACE_INDEX);
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
 
     private CtfTmfTrace fixture;
 
@@ -63,9 +62,9 @@ public class CtfTmfTraceTest {
      */
     @Before
     public void setUp() throws TmfTraceException {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         fixture = new CtfTmfTrace();
-        fixture.initTrace((IResource) null, PATH, CtfTmfEvent.class);
+        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
     }
 
     /**
@@ -345,8 +344,7 @@ public class CtfTmfTraceTest {
     @Test
     public void testValidate() {
         IProject project = null;
-        String path = PATH;
-        IStatus result = fixture.validate(project, path);
+        IStatus result = fixture.validate(project, testTrace.getPath());
         assertTrue(result.isOK());
     }
 
index d59a5014e070aca548552f46b8008622f30b18d5..975b18a8dd1730544a977e81abfe71c7f4eac2f6 100644 (file)
@@ -22,7 +22,7 @@ import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
@@ -42,8 +42,7 @@ public class EventContextTest {
     // ------------------------------------------------------------------------
 
     /* We use test trace #2, kernel_vm, which has event contexts */
-    private static final int TRACE_INDEX = 2;
-    private static final String PATH = CtfTmfTestTraces.getTestTracePath(TRACE_INDEX);
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL_VM;
 
     private static CtfTmfTrace fixture;
     private static long startTime;
@@ -61,9 +60,9 @@ public class EventContextTest {
      */
     @BeforeClass
     public static void setUp() throws TmfTraceException {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         fixture = new CtfTmfTrace();
-        fixture.initTrace((IResource) null, PATH, CtfTmfEvent.class);
+        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
         fixture.indexTrace(true);
 
         startTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
index bbbb1f4506cd334f63de170e2aecf533a89027e8..e7f1405a5bca28fb464d36f73620d212320c0137 100644 (file)
@@ -18,7 +18,7 @@ import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 
 /**
@@ -38,13 +38,12 @@ public class TmfSchedulerBenchmark {
     private static final int NUM_LOOPS = 10;
     private static final int NANOSECONDS_IN_MILLISECONDS = 1000000;
     private static final int NANOSECONDS_IN_SECONDS = 1000000000;
-    private static final int TRACE_INDEX = 0;
 
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
 
-    private static CtfTmfTrace trace = CtfTmfTestTraces.getTestTrace(TRACE_INDEX);
+    private static CtfTmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();
     private static ForegroundRequest lastForegroundRequest = null;
     private static BackgroundRequest lastBackgroundRequest = null;
 
index 94d57166eda077192ea21b9291337549086e60d0..2672974a56c8218c9960f6f7adc55541cd920575 100644 (file)
@@ -28,7 +28,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.signal.TmfTimeSynchSignal;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
@@ -45,8 +45,7 @@ public class TmfSchedulerTest {
     // Constants
     // ------------------------------------------------------------------------
 
-    private static final int TRACE_INDEX = 0;
-    private static final String PATH = CtfTmfTestTraces.getTestTracePath(TRACE_INDEX);
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
     private static final int NB_EVENTS_TRACE = 695319;
     private static final int NB_EVENTS_TIME_RANGE = 155133;
 
@@ -72,9 +71,9 @@ public class TmfSchedulerTest {
      */
     @Before
     public void setUp() throws TmfTraceException {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         fixture = new CtfTmfTrace();
-        fixture.initTrace((IResource) null, PATH, CtfTmfEvent.class);
+        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
         fixture.indexTrace(true);
         fStartTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
         fEndTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
index 3ce8111bb634f1032ce85b48653f13683ebdd9da..e841a2a1fc09b081f025c0fef770cb9f786adce3 100644 (file)
@@ -15,7 +15,6 @@ package org.eclipse.linuxtools.tmf.core.tests.statistics;
 import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.linuxtools.tmf.core.statistics.TmfEventsStatistics;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
 import org.junit.BeforeClass;
 
 /**
@@ -30,7 +29,7 @@ public class TmfEventsStatisticsTest extends TmfStatisticsTest {
      */
     @BeforeClass
     public static void setUpClass() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
-        backend = new TmfEventsStatistics(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+        assumeTrue(testTrace.exists());
+        backend = new TmfEventsStatistics(testTrace.getTrace());
     }
 }
index a409d46afcd016d42804562da2ac17e6b867c6b5..0f4a166fa7c76e3023d3dd10940730b7770d121a 100644 (file)
@@ -17,10 +17,8 @@ import static org.junit.Assume.assumeTrue;
 import java.io.File;
 import java.io.IOException;
 
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.statistics.TmfStateStatistics;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
 import org.junit.BeforeClass;
 
 /**
@@ -35,12 +33,11 @@ public class TmfStateStatisticsTest extends TmfStatisticsTest {
      */
     @BeforeClass
     public static void setUpClass() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
+        assumeTrue(testTrace.exists());
         try {
             File htFile = File.createTempFile("stats-test", ".ht");
             htFile.deleteOnExit();
-            CtfTmfTrace trace = CtfTmfTestTraces.getTestTrace(TRACE_INDEX);
-            backend = new TmfStateStatistics(trace, htFile);
+            backend = new TmfStateStatistics(testTrace.getTrace(), htFile);
         } catch (TmfTraceException e) {
             e.printStackTrace();
         } catch (IOException e) {
index efcee736d0452b353d6a27a72f0cab97905b429b..138da80d72cef29391fcbee95b25c6c721ff0ad7 100644 (file)
@@ -18,6 +18,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.Test;
 
 /**
@@ -28,8 +29,8 @@ import org.junit.Test;
  */
 public abstract class TmfStatisticsTest {
 
-    /** The index of the test trace used for these tests */
-    protected static final int TRACE_INDEX = 0;
+    /** Test trace used for these tests */
+    protected static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
 
     /** The statistics back-end object */
     protected static ITmfStatistics backend;
index 2b9b1e289aeef6bdef18f40357491b0d157b0982..720486a2fa5cf8cc58891455bf4b27f6a354a1cb 100644 (file)
@@ -28,7 +28,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
@@ -67,9 +67,10 @@ public class TmfTraceManagerTest {
      */
     @BeforeClass
     public static void setUpClass() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
-        trace1 = CtfTmfTestTraces.getTestTrace(1);
-        trace2 = CtfTmfTestTraces.getTestTrace(0);
+        assumeTrue(CtfTmfTestTrace.TRACE2.exists());
+        assumeTrue(CtfTmfTestTrace.KERNEL.exists());
+        trace1 = CtfTmfTestTrace.TRACE2.getTrace();
+        trace2 = CtfTmfTestTrace.KERNEL.getTrace();
 
         trace1.indexTrace(true);
         trace2.indexTrace(true);
index 2aa4c76950b2f3bc7b6c8ce8c462b6fa4446b8e9..8eec93b64395ca6f5465bd251458bbe7ccf6bbfb 100644 (file)
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.tmf.ui.project.model.TmfImportHelper;
 import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentElement;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectElement;
@@ -40,8 +40,7 @@ public class ProjectModelTestData {
     /** Default test project name */
     public static final String PROJECT_NAME = "Test_Project";
 
-    private static final int TRACE_INDEX = 0;
-    private static final String PATH = CtfTmfTestTraces.getTestTracePath(TRACE_INDEX);
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
 
     /**
      * Gets a project element with traces all initialized
@@ -56,7 +55,7 @@ public class ProjectModelTestData {
         IFolder traceFolder = project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME);
 
         /* Create a trace, if it exist, it will be replaced */
-        File file = new File(PATH);
+        File file = new File(testTrace.getPath());
         String path = file.getAbsolutePath();
         final IPath pathString = Path.fromOSString(path);
         IResource linkedTrace = TmfImportHelper.createLink(traceFolder, pathString, pathString.lastSegment());
@@ -79,7 +78,7 @@ public class ProjectModelTestData {
      * @return The trace name
      */
     public static String getTraceName() {
-        File file = new File(PATH);
+        File file = new File(testTrace.getPath());
         String path = file.getAbsolutePath();
         final IPath pathString = Path.fromOSString(path);
         return pathString.lastSegment();
index 0d45af30b3fff0299321a84d1ca5e60faf064fe8..ba3260d7d63bfbbb2cc14c7d7567c90dbfc74cf7 100644 (file)
@@ -19,7 +19,7 @@ import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfOpenTraceHelper;
@@ -41,7 +41,7 @@ public class ProjectModelTraceTest {
      */
     @Before
     public void setUp() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
+        assumeTrue(CtfTmfTestTrace.KERNEL.exists());
         try {
             fixture = ProjectModelTestData.getFilledProject();
         } catch (CoreException e) {
This page took 0.053862 seconds and 5 git commands to generate.