tmf: Clean up the ctfAdaptor unit tests
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 15 Jun 2012 14:48:19 +0000 (10:48 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 19 Jun 2012 18:28:00 +0000 (14:28 -0400)
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
12 files changed:
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/CtfLocationTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.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/CtfTmfEventTypeTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTimestampTest.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/TestAll.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestParams.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/RequestBenchmark.java

index af4e75a557ce4dea3cbdfa5aef60bbd712a84dac..4b59579ffe90cb141a4de9b14ac6dcf1fd6f8788 100644 (file)
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertEquals;
@@ -15,61 +28,94 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * The class <code>CtfIteratorTest</code> contains tests for the class <code>{@link CtfIterator}</code>.
+ * The class <code>CtfIteratorTest</code> contains tests for the class
+ * <code>{@link CtfIterator}</code>.
  *
- * @generatedBy CodePro at 03/05/12 2:29 PM
  * @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
  */
-@SuppressWarnings("static-method")
 public class CtfIteratorTest {
+
+    private CtfIterator fixture;
+
     /**
-     * Run the CtfIterator(CtfTmfTrace) constructor test.
+     * Launch the test.
      *
-     * @throws Exception
+     * @param args
+     *            the command line arguments
+     */
+    public static void main(String[] args) {
+        new org.junit.runner.JUnitCore().run(CtfIteratorTest.class);
+    }
+
+    /**
+     * Perform pre-test initialization.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @throws TmfTraceException
+     *             If the test trace is not found
+     */
+    @Before
+    public void setUp() throws TmfTraceException {
+        fixture = new CtfIterator(createTrace());
+        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
+        ctfLocation.setLocation(Long.valueOf(1));
+        fixture.setLocation(ctfLocation);
+        fixture.increaseRank();
+    }
+
+    /**
+     * Perform post-test clean-up.
+     */
+    @After
+    public void tearDown() {
+        fixture.dispose();
+    }
+
+
+    private static CtfTmfTrace createTrace() throws TmfTraceException {
+        return TestParams.createTrace();
+    }
+
+    /**
+     * Run the CtfIterator(CtfTmfTrace) constructor on a non init'ed trace.
+     *
+     * @throws TmfTraceException
+     *             If the test trace is not found
      */
     @Test
-    public void testCtfIterator_1()
-        throws Exception {
+    public void testCtfIterator_noinit() throws TmfTraceException {
         CtfTmfTrace trace = createTrace();
         CtfIterator result = new CtfIterator(trace);
         assertNotNull(result);
     }
 
     /**
-     * Run the CtfIterator(CtfTmfTrace) constructor test.
-     *
-     * @throws Exception
+     * Run the CtfIterator(CtfTmfTrace) constructor on an init'ed trace.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @throws TmfTraceException
+     *             If the test trace is not found
      */
     @Test
-    public void testCtfIterator_2()
-        throws Exception {
+    public void testCtfIterator_init() throws TmfTraceException {
         CtfTmfTrace trace = createTrace();
         trace.init("test"); //$NON-NLS-1$
-
         CtfIterator result = new CtfIterator(trace);
 
         assertNotNull(result);
     }
 
     /**
-     * Run the CtfIterator(CtfTmfTrace,long,long) constructor test.
+     * Run the CtfIterator(CtfTmfTrace,long,long) constructor test, which
+     * specifies an initial position for the iterator.
      *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @throws TmfTraceException
+     *             If the test trace is not found
      */
     @Test
-    public void testCtfIterator_3()
-        throws Exception {
+    public void testCtfIterator_position() throws TmfTraceException {
         CtfTmfTrace trace = createTrace();
         long timestampValue = 1L;
         long rank = 1L;
-
         CtfIterator result = new CtfIterator(trace, timestampValue, rank);
 
         assertNotNull(result);
@@ -78,61 +124,18 @@ public class CtfIteratorTest {
 
     /**
      * Run the boolean advance() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testAdvance_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
-        boolean result = fixture.advance();
-        assertTrue(result);
-    }
-
-    /**
-     * Run the boolean advance() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testAdvance_2()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
+    public void testAdvance() {
         boolean result = fixture.advance();
-
         assertTrue(result);
     }
 
     /**
      * Run the CtfIterator clone() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testClone_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
+    public void testClone() {
         CtfIterator result = fixture.clone();
         assertNotNull(result);
     }
@@ -140,111 +143,26 @@ public class CtfIteratorTest {
     /**
      * Run the int compareTo(CtfIterator) method test.
      *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-
-    @Test
-    public void testCompareTo_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-        CtfIterator o = new CtfIterator(createTrace());
-
-        int result = fixture.compareTo(o);
-
-        assertEquals(1L, result);
-    }
-
-    /**
-     * @return
      * @throws TmfTraceException
-     */
-    private CtfTmfTrace createTrace() throws TmfTraceException {
-        return TestParams.createTrace();
-    }
-
-    /**
-     * Run the int compareTo(CtfIterator) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     *             If the test trace is not found
      */
     @Test
-    public void testCompareTo_2()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
+    public void testCompareTo() throws TmfTraceException {
         CtfIterator o = new CtfIterator(createTrace());
-
         int result = fixture.compareTo(o);
 
-        assertEquals(1, result);
-    }
-
-    /**
-     * Run the int compareTo(CtfIterator) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testCompareTo_3()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-        CtfIterator o = new CtfIterator(createTrace());
-
-        int result = fixture.compareTo(o);
-        assertEquals(1, result);
-    }
-
-    /**
-     * Run the void dispose() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testDispose_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
-        fixture.dispose();
+        assertEquals(1L, result);
     }
 
     /**
-     * Run the boolean equals(Object) method test.
-     *
-     * @throws Exception
+     * Run the boolean equals(Object) method test. Compare with another iterator
+     * on the same trace.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @throws TmfTraceException
+     *             If the test trace is not found
      */
     @Test
-    public void testEquals_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
+    public void testEquals_other() throws TmfTraceException {
         CtfIterator obj = new CtfIterator(createTrace());
         CtfLocation ctfLocation1 = new CtfLocation(Long.valueOf(1));
         ctfLocation1.setLocation(Long.valueOf(1));
@@ -252,49 +170,15 @@ public class CtfIteratorTest {
         obj.increaseRank();
 
         boolean result = fixture.equals(obj);
-
         assertTrue(result);
     }
 
     /**
-     * Run the boolean equals(Object) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Run the boolean equals(Object) method test. Compare with an empty object.
      */
     @Test
-    public void testEquals_2()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
+    public void testEquals_empty() {
         Object obj = new Object();
-
-        boolean result = fixture.equals(obj);
-
-        assertFalse(result);
-    }
-
-    /**
-     * Run the boolean equals(Object) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testEquals_3()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-        Object obj = new Object();
-
         boolean result = fixture.equals(obj);
 
         assertFalse(result);
@@ -302,209 +186,54 @@ public class CtfIteratorTest {
 
     /**
      * Run the CtfTmfTrace getCtfTmfTrace() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetCtfTmfTrace_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
+    public void testGetCtfTmfTrace() {
         CtfTmfTrace result = fixture.getCtfTmfTrace();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
         assertNotNull(result);
     }
 
     /**
      * Run the CtfTmfEvent getCurrentEvent() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetCurrentEvent_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
+    public void testGetCurrentEvent() {
         CtfTmfEvent result = fixture.getCurrentEvent();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the CtfTmfEvent getCurrentEvent() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testGetCurrentEvent_2()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
-        CtfTmfEvent result = fixture.getCurrentEvent();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
         assertNotNull(result);
     }
 
     /**
      * Run the CtfLocation getLocation() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetLocation_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
+    public void testGetLocation() {
         CtfLocation result = fixture.getLocation();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
         assertNotNull(result);
     }
 
     /**
      * Run the long getRank() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetRank_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
+    public void testGetRank() {
         long result = fixture.getRank();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
         assertEquals(1L, result);
     }
 
     /**
      * Run the boolean hasValidRank() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testHasValidRank_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
+    public void testHasValidRank() {
         boolean result = fixture.hasValidRank();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
-        assertTrue(result);
-    }
-
-    /**
-     * Run the boolean hasValidRank() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testHasValidRank_2()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
-        boolean result = fixture.hasValidRank();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
         assertTrue(result);
     }
 
     /**
      * Run the int hashCode() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testHashCode_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
+    public void testHashCode() {
         int result = fixture.hashCode();
         int result2 = fixture.hashCode();
         assertEquals(result, result2);
@@ -512,152 +241,29 @@ public class CtfIteratorTest {
 
     /**
      * Run the void increaseRank() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testIncreaseRank_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
-
-        fixture.increaseRank();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
-    }
-
-    /**
-     * Run the boolean seek(long) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testSeek_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
+    public void testIncreaseRank() {
         fixture.increaseRank();
-        long timestamp = 1L;
-
-        boolean result = fixture.seek(timestamp);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
-        assertTrue(result);
     }
 
     /**
      * Run the boolean seek(long) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testSeek_2()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
+    public void testSeek() {
         long timestamp = 1L;
-
         boolean result = fixture.seek(timestamp);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
         assertTrue(result);
     }
 
-
     /**
      * Run the void setLocation(ITmfLocation<?>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testSetLocation_1()
-        throws Exception {
-        CtfIterator fixture = new CtfIterator(createTrace());
-        CtfLocation ctfLocation = new CtfLocation(Long.valueOf(1));
-        ctfLocation.setLocation(Long.valueOf(1));
-        fixture.setLocation(ctfLocation);
-        fixture.increaseRank();
+    public void testSetLocation() {
         CtfLocation location = new CtfLocation(Long.valueOf(1));
         location.setLocation(Long.valueOf(1));
-
         fixture.setLocation(location);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    java.lang.NullPointerException
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
-        //       at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
-    }
-
-
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Before
-    public void setUp()
-        throws Exception {
-        // add additional set up code here
-    }
-
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @After
-    public void tearDown()
-        throws Exception {
-        // Add additional tear down code here
-    }
-
-    /**
-     * Launch the test.
-     *
-     * @param args the command line arguments
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(CtfIteratorTest.class);
     }
-}
\ No newline at end of file
+}
index 5b0fe7a49fe90bff2cbddd3e2a79e19928319c13..6f337cb81b394395f3057f0f35c2ced514512ade 100644 (file)
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertEquals;
@@ -11,75 +24,86 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * The class <code>CtfLocationTest</code> contains tests for the class <code>{@link CtfLocation}</code>.
+ * The class <code>CtfLocationTest</code> contains tests for the class
+ * <code>{@link CtfLocation}</code>.
  *
- * @generatedBy CodePro at 03/05/12 2:29 PM
  * @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
  */
 public class CtfLocationTest {
+
+    private CtfLocation fixture;
+
     /**
-     * Run the CtfLocation(Long) constructor test.
+     * Launch the test.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @param args
+     *            the command line arguments
+     */
+    public static void main(String[] args) {
+        new org.junit.runner.JUnitCore().run(CtfLocationTest.class);
+    }
+
+    /**
+     * Perform pre-test initialization.
+     */
+    @Before
+    public void setUp() {
+        fixture = new CtfLocation(Long.valueOf(1));
+        fixture.setLocation(Long.valueOf(1));
+    }
+
+    /**
+     * Perform post-test clean-up.
+     */
+    @After
+    public void tearDown() {
+        // Add additional tear down code here
+    }
+
+
+    /**
+     * Run the CtfLocation(Long) constructor test.
      */
     @Test
-    public void testCtfLocation_1() {
+    public void testCtfLocation_long() {
         Long location = Long.valueOf(1);
-
         CtfLocation result = new CtfLocation(location);
 
-        // add additional test code here
         assertNotNull(result);
         assertEquals(Long.valueOf(1), result.getLocation());
     }
 
     /**
      * Run the CtfLocation(ITmfTimestamp) constructor test.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testCtfLocation_2() {
+    public void testCtfLocation_timestamp() {
         ITmfTimestamp timestamp = new TmfTimestamp();
-
         CtfLocation result = new CtfLocation(timestamp);
 
-        // add additional test code here
         assertNotNull(result);
         assertEquals(new Long(0L), result.getLocation());
     }
 
     /**
      * Run the CtfLocation clone() method test.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testClone_1() {
-        CtfLocation fixture = new CtfLocation(Long.valueOf(1));
-        fixture.setLocation(Long.valueOf(1));
-
+    public void testClone() {
         CtfLocation result = fixture.clone();
 
-        // add additional test code here
         assertNotNull(result);
         assertEquals(Long.valueOf(1), result.getLocation());
     }
 
     /**
      * Run the Long getLocation() method test.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetLocation_1() {
-        CtfLocation fixture = new CtfLocation(Long.valueOf(1));
-        fixture.setLocation(Long.valueOf(1));
-
+    public void testGetLocation() {
         Long result = fixture.getLocation();
 
-        // add additional test code here
         assertNotNull(result);
         assertEquals("1", result.toString()); //$NON-NLS-1$
         assertEquals((byte) 1, result.byteValue());
@@ -92,60 +116,28 @@ public class CtfLocationTest {
 
     /**
      * Run the void setLocation(Long) method test.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testSetLocation_1() {
-        CtfLocation fixture = new CtfLocation(Long.valueOf(1));
-        fixture.setLocation(Long.valueOf(1));
+    public void testSetLocation() {
         Long location = Long.valueOf(1);
-
         fixture.setLocation(location);
-
-        // add additional test code here
-    }
-
-    @Test
-    public void testToString1(){
-        CtfLocation fixture = new CtfLocation(new Long(1337L));
-        assertEquals("CtfLocation: 1337",fixture.toString()); //$NON-NLS-1$
-    }
-
-    @Test
-    public void testToString2(){
-        CtfLocation fixture = new CtfLocation(new Long(-1L));
-        assertEquals("CtfLocation: INVALID",fixture.toString()); //$NON-NLS-1$
     }
 
     /**
-     * Perform pre-test initialization.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Test the toString() method with a valid location.
      */
-    @Before
-    public void setUp() {
-        // add additional set up code here
-    }
-
-    /**
-     * Perform post-test clean-up.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @After
-    public void tearDown() {
-        // Add additional tear down code here
+    @Test
+    public void testToString_valid(){
+        CtfLocation fixture2 = new CtfLocation(new Long(1337L));
+        assertEquals("CtfLocation: 1337",fixture2.toString()); //$NON-NLS-1$
     }
 
     /**
-     * Launch the test.
-     *
-     * @param args the command line arguments
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Test the toString() method with an invalid location.
      */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(CtfLocationTest.class);
+    @Test
+    public void testToString_invalid(){
+        CtfLocation fixture2 = new CtfLocation(new Long(-1L));
+        assertEquals("CtfLocation: INVALID",fixture2.toString()); //$NON-NLS-1$
     }
-}
\ No newline at end of file
+}
index 13a527fa976554e82055fdfbc1221f6e0c69017e..af474c4ea9733afc8c35a6143a663456e749c8f2 100644 (file)
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertEquals;
@@ -10,107 +23,64 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * The class <code>CtfTmfContentTest</code> contains tests for the class <code>{@link CtfTmfContent}</code>.
+ * The class <code>CtfTmfContentTest</code> contains tests for the class
+ * <code>{@link CtfTmfContent}</code>.
  *
- * @generatedBy CodePro at 03/05/12 2:29 PM
  * @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
  */
 public class CtfTmfContentTest {
-    /**
-     * Run the CtfTmfContent(String,ITmfEventField[]) constructor test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testCtfTmfContent_1()
-        throws Exception {
-        String name = ""; //$NON-NLS-1$
-        ITmfEventField[] fields = new ITmfEventField[] {};
-
-        CtfTmfContent result = new CtfTmfContent(name, fields);
-
-        // add additional test code here
-        assertNotNull(result);
-        assertEquals("", result.toString()); //$NON-NLS-1$
-        assertEquals("", result.getName()); //$NON-NLS-1$
-        assertEquals(null, result.getValue());
-    }
 
-    /**
-     * Run the String toString() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testToString_1()
-        throws Exception {
-        CtfTmfContent fixture = new CtfTmfContent("", new ITmfEventField[] {}); //$NON-NLS-1$
-
-        String result = fixture.toString();
-
-        // add additional test code here
-        assertEquals("", result); //$NON-NLS-1$
-    }
+    private CtfTmfContent fixture;
 
     /**
-     * Run the String toString() method test.
-     *
-     * @throws Exception
+     * Launch the test.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @param args
+     *            the command line arguments
      */
-    @Test
-    public void testToString_2()
-        throws Exception {
-        CtfTmfContent fixture = new CtfTmfContent("", new ITmfEventField[] {}); //$NON-NLS-1$
-
-        String result = fixture.toString();
-
-        // add additional test code here
-        assertEquals("", result); //$NON-NLS-1$
+    public static void main(String[] args) {
+        new org.junit.runner.JUnitCore().run(CtfTmfContentTest.class);
     }
 
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Before
-    public void setUp()
-        throws Exception {
-        // add additional set up code here
+    public void setUp() {
+        fixture = new CtfTmfContent("", new ITmfEventField[] {}); //$NON-NLS-1$
     }
 
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @After
-    public void tearDown()
-        throws Exception {
+    public void tearDown() {
         // Add additional tear down code here
     }
 
+
     /**
-     * Launch the test.
-     *
-     * @param args the command line arguments
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Run the CtfTmfContent(String,ITmfEventField[]) constructor test.
      */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(CtfTmfContentTest.class);
+    @Test
+    public void testCtfTmfContent() {
+        String name = ""; //$NON-NLS-1$
+        ITmfEventField[] fields = new ITmfEventField[] {};
+        CtfTmfContent result = new CtfTmfContent(name, fields);
+
+        assertNotNull(result);
+        assertEquals("", result.toString()); //$NON-NLS-1$
+        assertEquals("", result.getName()); //$NON-NLS-1$
+        assertEquals(null, result.getValue());
+    }
+
+    /**
+     * Run the String toString() method test.
+     */
+    @Test
+    public void testToString() {
+        String result = fixture.toString();
+        assertEquals("", result); //$NON-NLS-1$
     }
-}
\ No newline at end of file
+}
index b2093c0d14a57998560f2765f12f47249194d0d7..21acfd03519752e6f5f60c005353798de87dc957 100644 (file)
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertEquals;
@@ -25,9 +38,8 @@ import org.junit.Test;
  * The class <code>CtfTmfEventFieldTest</code> contains tests for the class
  * <code>{@link CtfTmfEventField}</code>.
  *
- * @generatedBy CodePro at 03/05/12 2:29 PM
  * @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
  */
 public class CtfTmfEventFieldTest {
 
@@ -40,40 +52,85 @@ public class CtfTmfEventFieldTest {
     private static final String INT = "int"; //$NON-NLS-1$
     private static final String NAME = "test"; //$NON-NLS-1$
 
+    private StructDefinition fixture;
+
     /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     * Launch the test.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @param args
+     *            the command line arguments
+     */
+    public static void main(String[] args) {
+        new org.junit.runner.JUnitCore().run(CtfTmfEventFieldTest.class);
+    }
+
+    /**
+     * Perform pre-test initialization.
+     */
+    @Before
+    public void setUp() {
+        StructDeclaration sDec = new StructDeclaration(1l);
+        StringDeclaration strDec = new StringDeclaration();
+        IntegerDeclaration intDec = new IntegerDeclaration(8, false, 8,
+                ByteOrder.BIG_ENDIAN, Encoding.NONE, null, 8);
+        FloatDeclaration flDec = new FloatDeclaration(8, 24,
+                ByteOrder.BIG_ENDIAN, 8);
+        ArrayDeclaration arrDec = new ArrayDeclaration(2, intDec);
+        SequenceDeclaration seqDec = new SequenceDeclaration(LEN, intDec);
+        sDec.addField(INT, intDec);
+        sDec.addField(LEN, intDec);
+        sDec.addField(FLOAT, flDec);
+        sDec.addField(STR, strDec);
+        sDec.addField(ARRAY, arrDec);
+        sDec.addField(SEQ, seqDec);
+        fixture = sDec.createDefinition(fixture, ROOT);
+        int capacity = 1024;
+        java.nio.ByteBuffer bb = java.nio.ByteBuffer.allocateDirect(capacity);
+        for (int i = 0; i < capacity; i++) {
+            bb.put((byte) 2);
+        }
+        bb.position(20);
+        bb.put((byte) 0);
+        bb.position(0);
+        fixture.read(new BitBuffer(bb));
+    }
+
+    /**
+     * Perform post-test clean-up.
+     */
+    @After
+    public void tearDown() {
+        // Add additional tear down code here
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
      */
     @Test
-    public void testParseField_1() {
-        FloatDefinition fieldDef = (FloatDefinition) fixture
-                .lookupDefinition(FLOAT);
+    public void testParseField_float() {
+        FloatDefinition fieldDef;
+        fieldDef = (FloatDefinition) fixture.lookupDefinition(FLOAT);
         CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, "_"+NAME); //$NON-NLS-1$
-        String result2 =CtfTmfEventField.copyFrom(result).toString();
+        String result2 = CtfTmfEventField.copyFrom(result).toString();
         assertEquals( result2, "test=9.551467814359616E-38"); //$NON-NLS-1$
     }
 
     /**
      * Run the CtfTmfEventField parseField(Definition,String) method test.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testParseField_2() {
-        CtfTmfEventField result = CtfTmfEventField.parseField(
-                fixture.lookupArray(ARRAY), NAME);
-        String result2 =CtfTmfEventField.copyFrom(result).toString();
+    public void testParseField_array() {
+        CtfTmfEventField result;
+        result = CtfTmfEventField.parseField(fixture.lookupArray(ARRAY), NAME);
+        String result2 = CtfTmfEventField.copyFrom(result).toString();
         assertEquals( result2, "test={ 2, 2}"); //$NON-NLS-1$
     }
 
     /**
      * Run the CtfTmfEventField parseField(Definition,String) method test.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testParseField_3() {
+    public void testParseField_int() {
         Definition fieldDef = fixture.lookupDefinition(INT);
         CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
         String result2 =CtfTmfEventField.copyFrom(result).toString();
@@ -82,11 +139,9 @@ public class CtfTmfEventFieldTest {
 
     /**
      * Run the CtfTmfEventField parseField(Definition,String) method test.
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testParseField_4() {
+    public void testParseField_sequence() {
         Definition fieldDef = fixture.lookupDefinition(SEQ);
         CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
         String result2 =CtfTmfEventField.copyFrom(result).toString();
@@ -95,87 +150,22 @@ public class CtfTmfEventFieldTest {
 
     /**
      * Run the CtfTmfEventField parseField(Definition,String) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testParseField_5() {
+    public void testParseField_string() {
         Definition fieldDef = fixture.lookupDefinition(STR);
         CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
         String result2 =CtfTmfEventField.copyFrom(result).toString();
         assertEquals( result2, "test=\ 2\ 2\ 2\ 2\ 2\ 2\ 2\ 2\ 2\ 2\ 2\ 2\ 2\ 2"); //$NON-NLS-1$
     }
 
+    /**
+     * Test the clone() method.
+     */
     @Test
     public void testClone() {
         Definition fieldDef = fixture.lookupDefinition(STR);
         CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
         assertNotNull(result.clone());
     }
-
-
-    StructDefinition fixture;
-
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *             if the initialization fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Before
-    public void setUp() throws Exception {
-        StructDeclaration sDec = new StructDeclaration(1l);
-        StringDeclaration strDec = new StringDeclaration();
-        IntegerDeclaration intDec = new IntegerDeclaration(8, false, 8,
-                ByteOrder.BIG_ENDIAN, Encoding.NONE, null, 8);
-        FloatDeclaration flDec = new FloatDeclaration(8, 24,
-                ByteOrder.BIG_ENDIAN, 8);
-        ArrayDeclaration arrDec = new ArrayDeclaration(2, intDec);
-        SequenceDeclaration seqDec = new SequenceDeclaration(LEN, intDec);
-        sDec.addField(INT, intDec);
-        sDec.addField(LEN, intDec);
-        sDec.addField(FLOAT, flDec);
-        sDec.addField(STR, strDec);
-        sDec.addField(ARRAY, arrDec);
-        sDec.addField(SEQ, seqDec);
-        fixture = sDec.createDefinition(fixture, ROOT);
-        int capacity = 1024;
-        java.nio.ByteBuffer bb = java.nio.ByteBuffer.allocateDirect(capacity);
-        for (int i = 0; i < capacity; i++) {
-            bb.put((byte) 2);
-        }
-        bb.position(20);
-        bb.put((byte) 0);
-        bb.position(0);
-        fixture.read(new BitBuffer(bb));
-    }
-
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *             if the clean-up fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @After
-    public void tearDown() throws Exception {
-        // Add additional tear down code here
-    }
-
-    /**
-     * Launch the test.
-     *
-     * @param args
-     *            the command line arguments
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(CtfTmfEventFieldTest.class);
-    }
-}
\ No newline at end of file
+}
index ddbc8ddf0fed25bfd8c4cacd9cddaa6750ee3bba..a121ab1d9b6d392a16c9381d79809bf94966deb5 100644 (file)
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertArrayEquals;
@@ -15,8 +28,8 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * The class <code>CTFEventTest</code> contains tests for the class
- * <code>{@link CTFEvent}</code>.
+ * The class <code>CtfTmfEventTest</code> contains tests for the class
+ * <code>{@link CtfTmfEvent}</code>.
  *
  * @author ematkho
  * @version $Revision: 1.0 $
@@ -38,7 +51,8 @@ public class CtfTmfEventTest {
     /**
      * Perform pre-test initialization.
      *
-     * @throws FileNotFoundException
+     * @throws TmfTraceException
+     *             If the test trace is not found
      */
     @Before
     public void setUp() throws TmfTraceException {
@@ -140,6 +154,9 @@ public class CtfTmfEventTest {
         assertEquals(-1L, result);
     }
 
+    /**
+     * Test the clone method
+     */
     @Test
     public void testClone() {
         CtfTmfEvent other = CtfTmfEvent.getNullEvent().clone();
@@ -174,8 +191,11 @@ public class CtfTmfEventTest {
         assertEquals(-1L, result);
     }
 
+    /**
+     * Test the getters for the channel name, reference, source and type.
+     */
     @Test
-    public void testRankTraceRefSourceType() {
+    public void testGetters() {
         long rank = fixture.getRank();
         CtfTmfTrace trace = fixture.getTrace();
         String channelName = fixture.getChannelName();
@@ -190,6 +210,9 @@ public class CtfTmfEventTest {
         assertEquals(type.toString(), "lttng_statedump_vm_map"); //$NON-NLS-1$
     }
 
+    /**
+     * Test the toString() method
+     */
     @Test
     public void testToString() {
         String s = fixture.getContent().toString();
index 6b197da287577f6460e716abae847554082edd98..4a7baf31879d63729638e1f04282f79e7caf5de1 100644 (file)
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertEquals;
@@ -11,89 +24,65 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * The class <code>CtfTmfEventTypeTest</code> contains tests for the class <code>{@link CtfTmfEventType}</code>.
+ * The class <code>CtfTmfEventTypeTest</code> contains tests for the class
+ * <code>{@link CtfTmfEventType}</code>.
  *
- * @generatedBy CodePro at 03/05/12 2:29 PM
  * @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
  */
 public class CtfTmfEventTypeTest {
-    /**
-     * Run the CtfTmfEventType(String,String,ITmfEventField) constructor test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testCtfTmfEventType_1() {
-//        String contextId = ""; //$NON-NLS-1$
-        String eventName = ""; //$NON-NLS-1$
-        ITmfEventField content = new TmfEventField("", new ITmfEventField[] {}); //$NON-NLS-1$
-
-        CtfTmfEventType result = new CtfTmfEventType( eventName, content);
-
-        // add additional test code here
-        assertNotNull(result);
-        assertEquals("", result.toString()); //$NON-NLS-1$
-        assertEquals("", result.getName()); //$NON-NLS-1$
-        assertEquals("Ctf Event", result.getContext()); //$NON-NLS-1$
-    }
 
     /**
-     * Run the String toString() method test.
-     *
-     * @throws Exception
+     * Launch the test.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @param args the command line arguments
      */
-    @Test
-    public void testToString_1()
-        throws Exception {
-        CtfTmfEventType fixture = new CtfTmfEventType("", new TmfEventField("", new ITmfEventField[] {})); //$NON-NLS-1$ //$NON-NLS-2$
-
-        String result = fixture.toString();
-
-        // add additional test code here
-        assertEquals("", result); //$NON-NLS-1$
+    public static void main(String[] args) {
+        new org.junit.runner.JUnitCore().run(CtfTmfEventTypeTest.class);
     }
 
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Before
-    public void setUp()
-        throws Exception {
+    public void setUp() {
         // add additional set up code here
     }
 
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @After
-    public void tearDown()
-        throws Exception {
+    public void tearDown() {
         // Add additional tear down code here
     }
 
+
     /**
-     * Launch the test.
-     *
-     * @param args the command line arguments
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Run the CtfTmfEventType(String,String,ITmfEventField) constructor test.
      */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(CtfTmfEventTypeTest.class);
+    @Test
+    public void testCtfTmfEventType() {
+        String eventName = ""; //$NON-NLS-1$
+        ITmfEventField content = new TmfEventField("", new ITmfEventField[] {}); //$NON-NLS-1$
+        CtfTmfEventType result = new CtfTmfEventType( eventName, content);
+
+        assertNotNull(result);
+        assertEquals("", result.toString()); //$NON-NLS-1$
+        assertEquals("", result.getName()); //$NON-NLS-1$
+        assertEquals("Ctf Event", result.getContext()); //$NON-NLS-1$
+    }
+
+    /**
+     * Run the String toString() method test.
+     */
+    @Test
+    public void testToString() {
+        ITmfEventField emptyField = new TmfEventField("", new ITmfEventField[] {}); //$NON-NLS-1$
+        CtfTmfEventType fixture = new CtfTmfEventType("", emptyField); //$NON-NLS-1$
+
+        String result = fixture.toString();
+
+        assertEquals("", result); //$NON-NLS-1$
     }
 }
\ No newline at end of file
index 805e91f3ba660f01b3ec32ab778dbcce62bac55a..fa74315fafe42ad800f14a04321b9a78bcea67d3 100644 (file)
@@ -1,7 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp.TimestampType;
@@ -12,180 +27,92 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * The class <code>CtfTmfTimestampTest</code> contains tests for the class <code>{@link CtfTmfTimestamp}</code>.
+ * The class <code>CtfTmfTimestampTest</code> contains tests for the class
+ * <code>{@link CtfTmfTimestamp}</code>.
  *
- * @generatedBy CodePro at 03/05/12 2:29 PM
  * @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
  */
 public class CtfTmfTimestampTest {
-    /**
-     * Run the CtfTmfTimestamp(long) constructor test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testCtfTmfTimestamp()
-        throws Exception {
-        long timestamp = 1L;
-
-        CtfTmfTimestamp result = new CtfTmfTimestamp(timestamp);
-        result.setType(TimestampType.NANOS);
-
-        // add additional test code here
-        assertNotNull(result);
-        assertEquals("1 ns", result.toString()); //$NON-NLS-1$
-        assertEquals(0, result.getPrecision());
-        assertEquals(-9, result.getScale());
-        assertEquals(1L, result.getValue());
-    }
 
+    private CtfTmfTimestamp fixture;
 
     /**
-     * Run the boolean equals(Object) method test.
-     *
-     * @throws Exception
+     * Launch the test.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @param args the command line arguments
      */
-    @Test
-    public void testEquals_1()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
-        CtfTmfTimestamp obj = new CtfTmfTimestamp(1L);
-        obj.setType(CtfTmfTimestamp.TimestampType.DAY);
-
-        boolean result = fixture.equals(obj);
-
-        // add additional test code here
-        assertEquals(true, result);
+    public static void main(String[] args) {
+        new org.junit.runner.JUnitCore().run(CtfTmfTimestampTest.class);
     }
 
     /**
-     * Run the boolean equals(Object) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Perform pre-test initialization.
      */
-    @Test
-    public void testEquals_2()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
+    @Before
+    public void setUp() {
+        fixture = new CtfTmfTimestamp(1L);
         fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
-        Object obj = new Object();
-
-        boolean result = fixture.equals(obj);
-
-        // add additional test code here
-        assertEquals(false, result);
     }
 
     /**
-     * Run the boolean equals(Object) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Perform post-test clean-up.
      */
-    @Test
-    public void testEquals_3()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
-        Object obj = new Object();
-
-        boolean result = fixture.equals(obj);
-
-        // add additional test code here
-        assertEquals(false, result);
+    @After
+    public void tearDown() {
+        // Add additional tear down code here
     }
 
+
     /**
-     * Run the boolean equals(Object) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Run the CtfTmfTimestamp(long) constructor test.
      */
     @Test
-    public void testEquals_4()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
-        CtfTmfTimestamp obj = new CtfTmfTimestamp(1L);
-        obj.setType(CtfTmfTimestamp.TimestampType.DAY);
+    public void testCtfTmfTimestamp() {
+        long timestamp = 1L;
 
-        boolean result = fixture.equals(obj);
+        CtfTmfTimestamp result = new CtfTmfTimestamp(timestamp);
+        result.setType(TimestampType.NANOS);
 
-        // add additional test code here
-        assertEquals(true, result);
+        assertNotNull(result);
+        assertEquals("1 ns", result.toString()); //$NON-NLS-1$
+        assertEquals(0, result.getPrecision());
+        assertEquals(-9, result.getScale());
+        assertEquals(1L, result.getValue());
     }
 
+
     /**
-     * Run the boolean equals(Object) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Run the boolean equals(Object) method test with another identical object.
      */
     @Test
-    public void testEquals_5()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
+    public void testEquals_same() {
         CtfTmfTimestamp obj = new CtfTmfTimestamp(1L);
         obj.setType(CtfTmfTimestamp.TimestampType.DAY);
 
         boolean result = fixture.equals(obj);
-
-        // add additional test code here
-        assertEquals(true, result);
+        assertTrue(result);
     }
 
     /**
-     * Run the ITmfTimestamp getDelta(ITmfTimestamp) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Run the boolean equals(Object) method test, with an empty object.
      */
     @Test
-    public void testGetDelta_1()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
-        ITmfTimestamp ts = new TmfTimestamp();
-
-        ITmfTimestamp result = fixture.getDelta(ts);
+    public void testEquals_empty() {
+        Object obj = new Object();
 
-        // add additional test code here
-        assertNotNull(result);
-        assertEquals(0, result.getPrecision());
-        assertEquals(-9, result.getScale());
-        assertEquals(1L, result.getValue());
+        boolean result = fixture.equals(obj);
+        assertFalse(result);
     }
 
     /**
      * Run the ITmfTimestamp getDelta(ITmfTimestamp) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetDelta_2()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
+    public void testGetDelta() {
         ITmfTimestamp ts = new TmfTimestamp();
-
         ITmfTimestamp result = fixture.getDelta(ts);
 
-        // add additional test code here
         assertNotNull(result);
         assertEquals(0, result.getPrecision());
         assertEquals(-9, result.getScale());
@@ -194,20 +121,11 @@ public class CtfTmfTimestampTest {
 
     /**
      * Run the CtfTmfTimestamp.TimestampType getType() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetType_1()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
-
+    public void testGetType() {
         CtfTmfTimestamp.TimestampType result = fixture.getType();
 
-        // add additional test code here
         assertNotNull(result);
         assertEquals("DAY", result.name()); //$NON-NLS-1$
         assertEquals("DAY", result.toString()); //$NON-NLS-1$
@@ -216,173 +134,68 @@ public class CtfTmfTimestampTest {
 
     /**
      * Run the int hashCode() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testHashCode_1()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
-
+    public void testHashCode() {
         int result = fixture.hashCode();
-
-        // add additional test code here
         assertEquals(1012115, result);
     }
 
     /**
      * Run the int hashCode() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testHashCode_2()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
+    public void testHashCode_nullType() {
         fixture.setType(null);
-
         int result = fixture.hashCode();
-
-        // add additional test code here
         assertEquals(944663, result);
     }
 
     /**
      * Run the void setType(TimestampType) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testSetType_1()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
+    public void testSetType() {
         CtfTmfTimestamp.TimestampType value = CtfTmfTimestamp.TimestampType.DAY;
-
         fixture.setType(value);
-
-        // add additional test code here
     }
 
     /**
      * Run the String toString() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testToString_1()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
+    public void testToString_ns() {
         fixture.setType(CtfTmfTimestamp.TimestampType.NANOS);
-
         String result = fixture.toString();
-
-        // add additional test code here
         assertEquals("1 ns", result); //$NON-NLS-1$
     }
 
     /**
      * Run the String toString() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testToString_2()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
+    public void testToString_s() {
         fixture.setType(CtfTmfTimestamp.TimestampType.SECONDS);
-
         String result = fixture.toString();
-
-        // add additional test code here
         assertEquals("1.0E-9 s", result); //$NON-NLS-1$
     }
 
     /**
      * Run the String toString() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testToString_3()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
-        fixture.setType(CtfTmfTimestamp.TimestampType.DAY);
-
+    public void testToString_day() {
         String result = fixture.toString();
-
-        // add additional test code here
         assertEquals("19:00:00.000000001", result); //$NON-NLS-1$
     }
 
     /**
      * Run the String toString() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testToString_4()
-        throws Exception {
-        CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L);
+    public void testToString_full() {
         fixture.setType(CtfTmfTimestamp.TimestampType.FULL_DATE);
-
         String result = fixture.toString();
-
-        // add additional test code here
         assertEquals("1969-12-31 19:00:00.000000001", result); //$NON-NLS-1$
     }
-
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Before
-    public void setUp()
-        throws Exception {
-        // add additional set up code here
-    }
-
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @After
-    public void tearDown()
-        throws Exception {
-        // Add additional tear down code here
-    }
-
-    /**
-     * Launch the test.
-     *
-     * @param args the command line arguments
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(CtfTmfTimestampTest.class);
-    }
 }
\ No newline at end of file
index a509ea07cb7046d5a8435af5b5ce75c494c4b0dd..ac7617260fcc93b6907eb6a349c8f8ec702a12d9 100644 (file)
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertEquals;
@@ -24,149 +37,131 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * The class <code>CtfTmfTraceTest</code> contains tests for the class <code>{@link CtfTmfTrace}</code>.
+ * The class <code>CtfTmfTraceTest</code> contains tests for the class
+ * <code>{@link CtfTmfTrace}</code>.
  *
- * @generatedBy CodePro at 03/05/12 2:29 PM
  * @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
  */
 public class CtfTmfTraceTest {
+
     private static final String PATH = TestParams.getPath();
 
+    private CtfTmfTrace fixture;
+
     /**
-     * Run the CtfTmfTrace() constructor test.
+     * Launch the test.
      *
-     * @throws Exception
+     * @param args
+     *            the command line arguments
+     */
+    public static void main(String[] args) {
+        new org.junit.runner.JUnitCore().run(CtfTmfTraceTest.class);
+    }
+
+    /**
+     * Perform pre-test initialization.
      *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @throws TmfTraceException
+     *             If the test trace is not found
      */
-    @Test
-    public void testCtfTmfTrace_1()
-        throws Exception {
+    @Before
+    public void setUp() throws TmfTraceException {
+        fixture = new CtfTmfTrace();
+        fixture.initTrace((IResource) null, PATH, CtfTmfEvent.class);
+    }
 
+    /**
+     * Perform post-test clean-up.
+     */
+    @After
+    public void tearDown() {
+        fixture.dispose();
+    }
+
+    /**
+     * Run the CtfTmfTrace() constructor test.
+     */
+    @Test
+    public void testCtfTmfTrace() {
         CtfTmfTrace result = new CtfTmfTrace();
 
-        // add additional test code here
         assertNotNull(result);
-        assertEquals(null, result.getEventType());
+        assertNull(result.getEventType());
         assertEquals(1000, result.getCacheSize());
         assertEquals(0L, result.getNbEvents());
         assertEquals(0L, result.getStreamingInterval());
-        assertEquals(null, result.getStateSystem());
-        assertEquals(null, result.getResource());
+        assertNull(result.getStateSystem());
+        assertNull(result.getResource());
         assertEquals(1000, result.getQueueSize());
-        assertEquals(null, result.getType());
+        assertNull(result.getType());
     }
 
+    /**
+     * Test the parseEvent() method
+     */
     @Test
-    public void testParseEvent() throws TmfTraceException{
-        CtfTmfTrace fixture = initTrace();
+    public void testParseEvent() {
         ITmfContext ctx = fixture.seekEvent(0);
         fixture.getNext(ctx);
         CtfTmfEvent event = fixture.parseEvent(ctx);
         assertNotNull(event);
     }
 
-    /**
-     * @return
-     * @throws TmfTraceException
-     */
-    private static CtfTmfTrace initTrace() throws TmfTraceException {
-        CtfTmfTrace fixture = new CtfTmfTrace();
-        fixture.initTrace((IResource) null, PATH, CtfTmfEvent.class);
-        return fixture;
-    }
     /**
      * Run the void broadcast(TmfSignal) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testBroadcast_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testBroadcast() {
         TmfSignal signal = new TmfEndSynchSignal(1);
-
         fixture.broadcast(signal);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
     }
 
 
     /**
      * Run the void dispose() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testDispose_1()
-        throws Exception {
-        CtfTmfTrace fixture = new CtfTmfTrace();
-
-        fixture.dispose();
+    public void testDispose() {
+        CtfTmfTrace emptyFixture = new CtfTmfTrace();
+        emptyFixture.dispose();
 
     }
 
     /**
      * Run the int getCacheSize() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetCacheSize_1()
-        throws Exception {
-        CtfTmfTrace fixture = new CtfTmfTrace();
-
-        int result = fixture.getCacheSize();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
+    public void testGetCacheSize() {
+        CtfTmfTrace emptyFixture = new CtfTmfTrace();
+        int result = emptyFixture.getCacheSize();
         assertEquals(1000, result);
     }
 
     /**
      * Run the ITmfLocation<Comparable> getCurrentLocation() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetCurrentLocation_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetCurrentLocation() {
         CtfLocation result = (CtfLocation) fixture.getCurrentLocation();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNull(result);
     }
 
+    /**
+     * Test the seekEvent() method with a null location.
+     */
     @Test
-    public void testSeekEventLoc_1() throws TmfTraceException {
-        CtfTmfTrace fixture = initTrace();
+    public void testSeekEventLoc_null() {
         CtfLocation loc = null;
         fixture.seekEvent(loc);
         assertNotNull(fixture);
     }
 
+    /**
+     * Test the seekEvent() method with a location from a timestamp.
+     */
     @Test
-    public void testSeekEventLoc_2() throws TmfTraceException {
-        CtfTmfTrace fixture = initTrace();
+    public void testSeekEventLoc_timetamp(){
         CtfLocation loc = new CtfLocation(new CtfTmfTimestamp(0L));
         fixture.seekEvent(loc);
         assertNotNull(fixture);
@@ -175,743 +170,202 @@ public class CtfTmfTraceTest {
 
     /**
      * Run the ITmfTimestamp getEndTime() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetEndTime_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testGetEndTime() {
         ITmfTimestamp result = fixture.getEndTime();
         assertNotNull(result);
     }
 
     /**
      * Run the String[] getEnvNames() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetEnvNames_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetEnvNames() {
         String[] result = fixture.getEnvNames();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the String getEnvValue(String) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetEnvValue_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testGetEnvValue() {
         String key = "tracer_name"; //$NON-NLS-1$
-
         String result = fixture.getEnvValue(key);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertEquals("\"lttng-modules\"",result); //$NON-NLS-1$
     }
 
     /**
      * Run the Class<CtfTmfEvent> getEventType() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetEventType_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetEventType() {
         Class<CtfTmfEvent> result = fixture.getEventType();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the double getLocationRatio(ITmfLocation<?>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetLocationRatio_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testGetLocationRatio() {
         CtfLocation location = new CtfLocation(Long.valueOf(1));
         location.setLocation(Long.valueOf(1));
-
         double result = fixture.getLocationRatio(location);
 
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertEquals(Double.NEGATIVE_INFINITY, result, 0.1);
     }
 
     /**
      * Run the String getName() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testGetName_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
-        String result = fixture.getName();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the String getName() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testGetName_2()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
-        String result = fixture.getName();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the String getName() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetName_3()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetName() {
         String result = fixture.getName();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the int getNbEnvVars() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetNbEnvVars_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetNbEnvVars() {
         int result = fixture.getNbEnvVars();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertEquals(8, result);
     }
 
     /**
      * Run the long getNbEvents() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetNbEvents_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetNbEvents() {
         long result = fixture.getNbEvents();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertEquals(0L, result);
     }
 
     /**
      * Run the CtfTmfEvent getNext(ITmfContext) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetNext_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testGetNext() {
         ITmfContext context = fixture.seekEvent(0);
-
         CtfTmfEvent result = fixture.getNext(context);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the String getPath() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetPath_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetPath() {
         String result = fixture.getPath();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the IResource getResource() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetResource_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetResource() {
         IResource result = fixture.getResource();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNull(result);
     }
 
     /**
      * Run the ITmfTimestamp getStartTime() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetStartTime_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetStartTime() {
         ITmfTimestamp result = fixture.getStartTime();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the IStateSystemQuerier getStateSystem() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetStateSystem_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testGetStateSystem() {
         IStateSystemQuerier result = fixture.getStateSystem();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNull(result);
     }
 
     /**
      * Run the long getStreamingInterval() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetStreamingInterval_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetStreamingInterval() {
         long result = fixture.getStreamingInterval();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertEquals(0L, result);
     }
 
     /**
      * Run the TmfTimeRange getTimeRange() method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testGetTimeRange_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
+    public void testGetTimeRange() {
         TmfTimeRange result = fixture.getTimeRange();
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
-    /**
-     * Run the void initTrace(IResource,String,Class<CtfTmfEvent>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testInitTrace_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
-        IResource resource = null;
-        String path = PATH;
-        Class<CtfTmfEvent> eventType = CtfTmfEvent.class;
-
-        fixture.initTrace(resource, path, eventType);
-
-        assertNotNull(fixture);
-    }
-
-    /**
-     * Run the void initTrace(IResource,String,Class<CtfTmfEvent>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testInitTrace_2()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-        IResource resource = null;
-        String path = PATH;
-        Class<CtfTmfEvent> eventType = CtfTmfEvent.class;
-
-        fixture.initTrace(resource, path, eventType);
-
-        assertNotNull(fixture);
-    }
-
-    /**
-     * Run the void initTrace(IResource,String,Class<CtfTmfEvent>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testInitTrace_3()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-        IResource resource = null;
-        String path = PATH;
-        Class<CtfTmfEvent> eventType = CtfTmfEvent.class;
-
-        fixture.initTrace(resource, path, eventType);
-
-        assertNotNull(fixture);
-    }
-
-    /**
-     * Run the void initTrace(IResource,String,Class<CtfTmfEvent>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testInitTrace_4()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-
-        IResource resource = null;
-        String path = PATH;
-        Class<CtfTmfEvent> eventType = CtfTmfEvent.class;
-
-        fixture.initTrace(resource, path, eventType);
-
-        assertNotNull(fixture);
-    }
-
-    /**
-     * Run the void initTrace(IResource,String,Class<CtfTmfEvent>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testInitTrace_5()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-        IResource resource = null;
-        String path = PATH;
-        Class<CtfTmfEvent> eventType = CtfTmfEvent.class;
-
-        fixture.initTrace(resource, path, eventType);
-
-        assertNotNull(fixture);
-    }
-
-    /**
-     * Run the void initTrace(IResource,String,Class<CtfTmfEvent>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testInitTrace_6()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-        IResource resource = null;
-        String path = PATH;
-        Class<CtfTmfEvent> eventType = CtfTmfEvent.class;
-
-        fixture.initTrace(resource, path, eventType);
-
-        assertNotNull(fixture);
-    }
-
-    /**
-     * Run the void initTrace(IResource,String,Class<CtfTmfEvent>) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testInitTrace_7()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-        IResource resource = null;
-        String path = PATH;
-        Class<CtfTmfEvent> eventType = CtfTmfEvent.class;
-
-        fixture.initTrace(resource, path, eventType);
-
-        assertNotNull(fixture);
-    }
-
     /**
      * Run the CtfTmfEvent readNextEvent(ITmfContext) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testReadNextEvent_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testReadNextEvent() {
         ITmfContext context = fixture.seekEvent(0);
-
         CtfTmfEvent result = fixture.getNext(context);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the ITmfContext seekEvent(double) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testSeekEvent_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testSeekEvent_ratio() {
         double ratio = 0.99;
-
         ITmfContext result = fixture.seekEvent(ratio);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the ITmfContext seekEvent(long) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testSeekEvent_2()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testSeekEvent_rank() {
         long rank = 1L;
-
         ITmfContext result = fixture.seekEvent(rank);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
     /**
      * Run the ITmfContext seekEvent(ITmfTimestamp) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testSeekEvent_3()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testSeekEvent_timestamp() {
         ITmfTimestamp timestamp = new TmfTimestamp();
-
         ITmfContext result = fixture.seekEvent(timestamp);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertNotNull(result);
     }
 
-//    /**
-//     * Run the ITmfContext seekEvent(ITmfLocation<?>) method test.
-//     *
-//     * @throws Exception
-//     *
-//     * @generatedBy CodePro at 03/05/12 2:29 PM
-//     */
-//    @Test
-//    public void testSeekEvent_4()
-//        throws Exception {
-//        CtfTmfTrace fixture = initTrace();
-//        fixture.setStartTime(new TmfTimestamp());
-//        CtfIterator ctfIterator = new CtfIterator(new CtfTmfTrace());
-//        CtfLocation ctfLocation = new CtfLocation(new Long(1L));
-//        ctfLocation.setLocation(new Long(1L));
-//        ctfIterator.setLocation(ctfLocation);
-//        fixture.iterator = ctfIterator;
-//        fixture.ss = new StateHistorySystem(new HistoryTreeBackend(new File(PATH)), true);
-//        fixture.startSynch(new TmfStartSynchSignal(1));
-//        fixture.fNbEvents = 1L;
-//        ITmfLocation<Comparable> location = new CtfLocation(new Long(1L));
-//
-//        ITmfContext result = fixture.seekEvent(location);
-//
-//        // add additional test code here
-//        // An unexpected exception was thrown in user code while executing this test:
-//        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-//        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
-//        assertNotNull(result);
-//    }
-//
-//    /**
-//     * Run the ITmfContext seekEvent(ITmfLocation<?>) method test.
-//     *
-//     * @throws Exception
-//     *
-//     * @generatedBy CodePro at 03/05/12 2:29 PM
-//     */
-//    @Test
-//    public void testSeekEvent_5()
-//        throws Exception {
-//        CtfTmfTrace fixture = initTrace();
-//        CtfIterator ctfIterator = new CtfIterator(new CtfTmfTrace());
-//        CtfLocation ctfLocation = new CtfLocation(new Long(1L));
-//        ITmfContext result = fixture.seekEvent(ctfLocation);
-//        assertNotNull(result);
-//    }
-
-
-
-    /**
-     * Run the boolean validate(IProject,String) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Test
-    public void testValidate_1()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-        IProject project = null;
-        String path = PATH;
-
-        boolean result = fixture.validate(project, path);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
-        assertTrue(result);
-    }
-
     /**
-     * Run the boolean validate(IProject,String) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * Run the ITmfContext seekEvent(ITmfLocation<?>) method test.
      */
     @Test
-    public void testValidate_2()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
-        IProject project = null;
-        String path = PATH;
-
-        boolean result = fixture.validate(project, path);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
-        assertTrue(result);
+    public void testSeekEvent_location() {
+        CtfLocation ctfLocation = new CtfLocation(new Long(1L));
+        ITmfContext result = fixture.seekEvent(ctfLocation);
+        assertNotNull(result);
     }
 
     /**
      * Run the boolean validate(IProject,String) method test.
-     *
-     * @throws Exception
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
      */
     @Test
-    public void testValidate_3()
-        throws Exception {
-        CtfTmfTrace fixture = initTrace();
+    public void testValidate() {
         IProject project = null;
         String path = PATH;
-
         boolean result = fixture.validate(project, path);
-
-        // add additional test code here
-        // An unexpected exception was thrown in user code while executing this test:
-        //    org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory
-        //       at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98)
         assertTrue(result);
     }
-
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @Before
-    public void setUp()
-        throws Exception {
-        // add additional set up code here
-    }
-
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    @After
-    public void tearDown()
-        throws Exception {
-        // Add additional tear down code here
-    }
-
-    /**
-     * Launch the test.
-     *
-     * @param args the command line arguments
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
-     */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(CtfTmfTraceTest.class);
-    }
 }
index 7b424eb9f98dad8f9af93312b0eb78641a391991..cc8e4b3d75eeca01070e7e4effcfe8d7a30e39bd 100644 (file)
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import org.junit.runner.JUnitCore;
@@ -9,29 +22,27 @@ import org.junit.runners.Suite;
  * of the tests within its package as well as within any subpackages of its
  * package.
  *
- * @generatedBy CodePro at 03/05/12 2:29 PM
  * @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
-    CtfTmfContentTest.class,
-    CtfTmfTimestampTest.class,
-    CtfTmfEventFieldTest.class,
-    CtfTmfEventTypeTest.class,
     CtfIteratorTest.class,
     CtfLocationTest.class,
-    CtfTmfTraceTest.class,
+    CtfTmfContentTest.class,
+    CtfTmfEventFieldTest.class,
     CtfTmfEventTest.class,
+    CtfTmfEventTypeTest.class,
+    CtfTmfTimestampTest.class,
+    CtfTmfTraceTest.class
 })
 public class TestAll {
 
     /**
      * Launch the test.
      *
-     * @param args the command line arguments
-     *
-     * @generatedBy CodePro at 03/05/12 2:29 PM
+     * @param args
+     *            the command line arguments
      */
     public static void main(String[] args) {
         JUnitCore.runClasses(new Class[] { TestAll.class });
index f2c346dbaf1dc1ba14eb6be99786f2404a1e34b4..c2bf932672d28a623f856fdd2a2d52bacf66e1f0 100644 (file)
@@ -1,3 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ *   Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import java.io.File;
@@ -6,11 +18,13 @@ import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 
-
-public abstract class TestParams {
+/**
+ * This is the set up for the trace files to be used with the ctfAdaptor tests.
+ */
+abstract class TestParams {
 
     /* Path to test traces */
-    private static final String testTracePath1 = "testfiles/kernel"; //$NON-NLS-1$
+    private static final String testTracePath1 = "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel"; //$NON-NLS-1$
     private static CtfTmfTrace testTrace1 = null;
 
     private static final File emptyFile = new File(""); //$NON-NLS-1$
index 201166ff7c90c2270dd859fa38154a124617f56f..7c92ca4d095e33f0e8932487b278de2c6b2490f4 100644 (file)
@@ -9,6 +9,7 @@
  * Contributors:
  *   Matthew Khouzam - Initial API and implementation
  *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor.headless;
 
 import java.util.Vector;
@@ -18,14 +19,20 @@ import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 
+/**
+ * Test and benchmark reading a CTF LTTng kernel trace.
+ *
+ * @author Matthew Khouzam
+ */
 public class Benchmark {
 
     /**
-     * @param args
+     * Run the benchmark.
+     *
+     * @param args The command-line arguments
      */
-    @SuppressWarnings("nls")
     public static void main(final String[] args) {
-        final String TRACE_PATH = "testfiles/kernel";
+        final String TRACE_PATH = "testfiles/kernel"; //$NON-NLS-1$
         final int NUM_LOOPS = 100;
 
         // Change this to enable text output
@@ -61,9 +68,9 @@ public class Benchmark {
                     nbEvent++;
                     if (USE_TEXT) {
 
-                        System.out.println("Event " + traceReader.getRank() + " Time "
-                                + current.getTimestamp().toString() + " type " + current.getEventName()
-                                + " on CPU " + current.getSource() + " " + current.getContent().toString()) ;
+                        System.out.println("Event " + traceReader.getRank() + " Time " //$NON-NLS-1$ //$NON-NLS-2$
+                                + current.getTimestamp().toString() + " type " + current.getEventName() //$NON-NLS-1$
+                                + " on CPU " + current.getSource() + " " + current.getContent().toString()) ; //$NON-NLS-1$ //$NON-NLS-2$
                     }
                     traceReader.advance();
                     current = traceReader.getCurrentEvent();
@@ -74,16 +81,16 @@ public class Benchmark {
             final double time = (stop - start) / (double) nbEvent;
             benchs.add(time);
         }
-        System.out.println("");
+        System.out.println(""); //$NON-NLS-1$
         double avg = 0;
         for (final Double val : benchs) {
             avg += val;
         }
         avg /= benchs.size();
-        System.out.println("Time to read = " + avg + " events/ns");
+        System.out.println("Time to read = " + avg + " events/ns"); //$NON-NLS-1$ //$NON-NLS-2$
         for (final Double val : benchs) {
             System.out.print(val);
-            System.out.print(", ");
+            System.out.print(", "); //$NON-NLS-1$
         }
 
     }
index 45064e5e1b2c3075db39815961de12212ad68759..57a7c7fbc97a34c06044855c90d7334b035ce4d5 100644 (file)
@@ -7,14 +7,15 @@
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *   William Bourque (wbourque@gmail.com) - Initial API and implementation
+ *   William Bourque <wbourque@gmail.com> - Initial API and implementation
+ *   Matthew Khouzam - Update to CtfTmf trace and events
  *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor.headless;
 
 import java.util.Vector;
 
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
@@ -22,63 +23,61 @@ import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
 
-@SuppressWarnings("nls")
+/**
+ * Benchmark the event request subsystem of TMF.
+ */
 public class RequestBenchmark extends TmfEventRequest<CtfTmfEvent> {
 
     @SuppressWarnings("unchecked")
-    public RequestBenchmark(final Class<? extends ITmfEvent> dataType,
+    private RequestBenchmark(final Class<? extends ITmfEvent> dataType,
             final TmfTimeRange range, final int nbRequested) {
         super((Class<CtfTmfEvent>) dataType, range, nbRequested, 1);
     }
 
     // Path of the trace
-    public static final String TRACE_PATH = "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel";
-
-    // *** Change this to run several time over the same trace
-    public static final int NB_OF_PASS = 100;
+    private static final String TRACE_PATH = "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel"; //$NON-NLS-1$
 
-    // *** Change this to true to parse all the events in the trace
-    // Otherwise, events are just read
-    public final boolean PARSE_EVENTS = true;
+    // Change this to run several time over the same trace
+    private static final int NB_OF_PASS = 100;
 
     // Work variables
-    static int nbEvent = 0;
-    static int nbPassDone = 0;
-    static TmfExperiment<CtfTmfEvent> fExperiment = null;
-    static Vector<Double> benchs = new Vector<Double>();
-
+    private static int nbEvent = 0;
+    private static TmfExperiment<CtfTmfEvent> fExperiment = null;
+    private static Vector<Double> benchs = new Vector<Double>();
+
+    /**
+     * Run the benchmark
+     *
+     * @param args
+     *            The command-line arguments
+     */
     public static void main(final String[] args) {
 
         try {
-            // OUr experiment will contains ONE trace
+            /* Our experiment will contains ONE trace */
             @SuppressWarnings("unchecked")
-            final
-            ITmfTrace<CtfTmfEvent>[] traces = new ITmfTrace[1];
+            final ITmfTrace<CtfTmfEvent>[] traces = new ITmfTrace[1];
             traces[0] = new CtfTmfTrace();
             traces[0].initTrace(null, TRACE_PATH, CtfTmfEvent.class);
-            // Create our new experiment
-            fExperiment = new TmfExperiment<CtfTmfEvent>(CtfTmfEvent.class, "Headless", traces);
-
-            // Create a new time range from -infinity to +infinity
-            // That way, we will get "everything" in the trace
-            final CtfTmfTimestamp ts1 = new CtfTmfTimestamp(Long.MIN_VALUE);
-            final CtfTmfTimestamp ts2 = new CtfTmfTimestamp(Long.MAX_VALUE);
-            final TmfTimeRange tmpRange = new TmfTimeRange(ts1, ts2);
+            /* Create our new experiment */
+            fExperiment = new TmfExperiment<CtfTmfEvent>(CtfTmfEvent.class, "Headless", traces); //$NON-NLS-1$
 
-            // We will issue a request for each "pass".
-            // TMF will then process them synchonously
+            /*
+             * We will issue a request for each "pass". TMF will then process
+             * them synchronously.
+             */
             RequestBenchmark request = null;
             for (int x = 0; x < NB_OF_PASS; x++) {
-                request = new RequestBenchmark(CtfTmfEvent.class, tmpRange,
-                        Integer.MAX_VALUE);
+                request = new RequestBenchmark(CtfTmfEvent.class,
+                        TmfTimeRange.ETERNITY, Integer.MAX_VALUE);
                 fExperiment.sendRequest(request);
-                nbPassDone++;
             }
             prev = System.nanoTime();
         } catch (final NullPointerException e) {
-            // Silently dismiss Null pointer exception
-            // The only way to "finish" the threads in TMF is by crashing them
-            // with null
+            /*
+             * Silently dismiss Null pointer exception The only way to "finish"
+             * the threads in TMF is by crashing them with null.
+             */
         } catch (final Exception e) {
             e.printStackTrace();
         }
@@ -106,10 +105,10 @@ public class RequestBenchmark extends TmfEventRequest<CtfTmfEvent> {
         benchs.add(val);
         if (benchs.size() == NB_OF_PASS) {
             try {
-                System.out.println("Nb events : " + nbEvent2);
+                System.out.println("Nb events : " + nbEvent2); //$NON-NLS-1$
 
                 for (final double value : benchs) {
-                    System.out.print(value + ", ");
+                    System.out.print(value + ", "); //$NON-NLS-1$
                 }
                 fExperiment.sendRequest(null);
 
This page took 0.059923 seconds and 5 git commands to generate.