lttng: Port unit tests to JUnit4
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 25 Jan 2013 20:05:20 +0000 (15:05 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 31 Jan 2013 16:50:39 +0000 (11:50 -0500)
Refs bug 393449.

Change-Id: I84d3f62d0e1dd1b8bd1d0ad00f3347cc86df6ad2
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/10056
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>

33 files changed:
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/ActivatorTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/AllTests.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/AllTests.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/BaseEventInfoTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ChannelInfoTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/DomainInfoTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/EventInfoTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/FieldInfoTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ProbeEventInfoTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/SessionInfoTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/TraceInfoTest.java
org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/UstProviderInfoTest.java
org.eclipse.linuxtools.lttng2.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/AllTests.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CtfKernelStateInputTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/TestAll.java
org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/ActivatorTest.java
org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/AllTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/ActivatorTest.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelNoProvidersTest.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java

index 1d87f386d7690513dba4e19d73e8c58074996b0f..4882f03c8f4dbc0075a4d749716dd7049b2384b4 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,61 +8,26 @@
  *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  *******************************************************************************/
 
 package org.eclipse.linuxtools.lttng2.core.tests;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertTrue;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
- * <b><u>ActivatorTest</u></b>
- * <p>
- * Test suite for the Activator class
- * <p>
+ * Test stubs for the Activator.
  */
-@SuppressWarnings("javadoc")
-public class ActivatorTest extends TestCase {
-
-    // ------------------------------------------------------------------------
-    // JUnit
-    // ------------------------------------------------------------------------
-
-    @BeforeClass
-    public static void setUpBeforeClass() {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() {
-    }
-
-    /**
-     * @throws java.lang.Exception
-     */
-    @Before
-    @Override
-    public void setUp() throws Exception {
-    }
-
-    /**
-     * @throws java.lang.Exception
-     */
-    @After
-    @Override
-    public void tearDown() throws Exception {
-    }
+public class ActivatorTest {
 
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.lttng2.core.Activator#Activator()}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.core.Activator#Activator()}.
      */
     @Test
     public void testActivator() {
@@ -70,7 +35,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.lttng2.core.Activator#getDefault()}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.core.Activator#getDefault()}.
      */
     @Test
     public void testGetDefault() {
@@ -78,7 +43,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.lttng2.core.Activator#start(org.osgi.framework.BundleContext)}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.core.Activator#start(org.osgi.framework.BundleContext)}.
      */
     @Test
     public void testStartBundleContext() {
@@ -86,7 +51,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.lttng2.core.Activator#stop(org.osgi.framework.BundleContext)}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.core.Activator#stop(org.osgi.framework.BundleContext)}.
      */
     @Test
     public void testStopBundleContext() {
index 3f837202904cf9c8fb725f81c6f0af65fb0d42cc..6248314ea853b7d8ed5879d9caf31b6bd8e11427 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,29 +8,22 @@
  *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  *******************************************************************************/
 
 package org.eclipse.linuxtools.lttng2.core.tests;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
- * <b><u>AllTests</u></b>
- * <p>
+ * Run all the tests in the lttng2.core plugin.
  */
-@SuppressWarnings("javadoc")
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    ActivatorTest.class,
+    org.eclipse.linuxtools.lttng2.core.tests.control.model.impl.AllTests.class
+})
 public class AllTests {
 
-    public static Test suite() {
-        TestSuite suite = new TestSuite(AllTests.class.getName());
-        // $JUnit-BEGIN$
-
-        // Plug-in
-        suite.addTestSuite(ActivatorTest.class);
-        suite.addTest(org.eclipse.linuxtools.lttng2.core.tests.control.model.impl.AllTests.suite());
-
-        // $JUnit-END$
-        return suite;
-    }
 }
index e502b828582a12177fda42524ab38fb6d9680d7f..fdbf937756a3cb35d14a1abd305eb67d39da9c0b 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,29 +8,29 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  *******************************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
-@SuppressWarnings("javadoc")
+/**
+ * Runner for the LTTng2.core unit tests
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    BaseEventInfoTest.class,
+    ChannelInfoTest.class,
+    DomainInfoTest.class,
+    EventInfoTest.class,
+    FieldInfoTest.class,
+    ProbeEventInfoTest.class,
+    SessionInfoTest.class,
+    TraceInfoTest.class,
+    UstProviderInfoTest.class
+})
 public class AllTests {
 
-    public static Test suite() {
-
-        TestSuite suite = new TestSuite(AllTests.class.getName());
-        //$JUnit-BEGIN$
-        suite.addTestSuite(FieldInfoTest.class);
-        suite.addTestSuite(BaseEventInfoTest.class);
-        suite.addTestSuite(DomainInfoTest.class);
-        suite.addTestSuite(EventInfoTest.class);
-        suite.addTestSuite(ProbeEventInfoTest.class);
-        suite.addTestSuite(ChannelInfoTest.class);
-        suite.addTestSuite(SessionInfoTest.class);
-        suite.addTestSuite(TraceInfoTest.class);
-        suite.addTestSuite(UstProviderInfoTest.class);
-        //$JUnit-END$
-        return suite;
-    }
 }
index 352a8ffab1c4c0d1a78c3b1d5cc476547d73e595..3004974f064fa573a33929c3fefd8715b18ae6c0 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,30 +8,36 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
+import static org.junit.Assert.*;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
+ * The class <code>BaseEventInfoTest</code> contains test for the class
+ * <code>{@link BaseEventInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class BaseEventInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class BaseEventInfoTest {
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IBaseEventInfo fEventInfo1 = null;
     private IBaseEventInfo fEventInfo2 = null;
 
@@ -40,36 +46,22 @@ public class BaseEventInfoTest extends TestCase {
     // ------------------------------------------------------------------------
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception if the initialization fails for some reason
-     *
      */
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fEventInfo1 = factory.getBaseEventInfo1();
         fEventInfo2 = factory.getBaseEventInfo2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() throws Exception {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
      * Run the BaseEventInfo() constructor test.
-     *
      */
+    @Test
     public void testBaseEventInfo() {
         BaseEventInfo fixture = new BaseEventInfo("event");
         assertNotNull(fixture);
@@ -92,6 +84,7 @@ public class BaseEventInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventInfoCopy() {
         BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo1);
 
@@ -112,6 +105,7 @@ public class BaseEventInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventCopy2() {
         try {
             BaseEventInfo info = null;
@@ -125,10 +119,8 @@ public class BaseEventInfoTest extends TestCase {
 
     /**
      * Run the TraceEventType getEventType() method test.
-     *
-     * @throws Exception
-     *
      */
+    @Test
     public void testGetEventType_1() {
         BaseEventInfo fixture = new BaseEventInfo("event");
         fixture.setEventType("unknown");
@@ -176,8 +168,8 @@ public class BaseEventInfoTest extends TestCase {
 
     /**
      * Run the void setEventType(TraceEventType) method test.
-     *
      */
+    @Test
     public void testSetEventType_2() {
         BaseEventInfo fixture = new BaseEventInfo("event");
         fixture.setEventType(TraceEventType.TRACEPOINT);
@@ -220,8 +212,8 @@ public class BaseEventInfoTest extends TestCase {
     /**
      * Run the void setLogLevel(TraceLogLevel) method test.
      * Run the TraceLogLevel getLogLevel() method test
-     *
      */
+    @Test
     public void testSetLogLevel1() {
         BaseEventInfo fixture = new BaseEventInfo("event");
         fixture.setEventType(TraceEventType.TRACEPOINT);
@@ -248,8 +240,8 @@ public class BaseEventInfoTest extends TestCase {
     /**
      * Run the void setLogLevel(String) method test.
      * Run the TraceLogLevel getLogLevel() method test
-     *
      */
+    @Test
     public void testSetLogLevel2() {
         BaseEventInfo fixture = new BaseEventInfo("event");
         fixture.setEventType(TraceEventType.TRACEPOINT);
@@ -408,6 +400,7 @@ public class BaseEventInfoTest extends TestCase {
     /**
      * test filter expression
      */
+    @Test
      public void testSetFields() {
          BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2);
          info.setFilterExpression("stringfield==test");
@@ -418,6 +411,7 @@ public class BaseEventInfoTest extends TestCase {
    /**
     * test add field
     */
+    @Test
     public void testAddField() {
         BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2);
 
@@ -438,6 +432,7 @@ public class BaseEventInfoTest extends TestCase {
     /**
      * test set fields
      */
+    @Test
     public void testFields() {
         BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2);
 
@@ -466,8 +461,8 @@ public class BaseEventInfoTest extends TestCase {
 
     /**
      * Run the String toString() method test.
-     *
      */
+    @Test
     public void testToString_1() {
         BaseEventInfo fixture = new BaseEventInfo("event");
         fixture.setName("testName");
@@ -484,6 +479,10 @@ public class BaseEventInfoTest extends TestCase {
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Test the .equals() method.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fEventInfo1.equals(fEventInfo1));
         assertTrue("equals", fEventInfo2.equals(fEventInfo2));
@@ -492,6 +491,10 @@ public class BaseEventInfoTest extends TestCase {
         assertTrue("equals", !fEventInfo2.equals(fEventInfo1));
     }
 
+    /**
+     * Test the .equals() method.
+     */
+    @Test
     public void testEqualsSymmetry() {
         BaseEventInfo info1 = new BaseEventInfo((BaseEventInfo)fEventInfo1);
         BaseEventInfo info2 = new BaseEventInfo((BaseEventInfo)fEventInfo2);
@@ -503,6 +506,10 @@ public class BaseEventInfoTest extends TestCase {
         assertTrue("equals", fEventInfo2.equals(info2));
     }
 
+    /**
+     * Test the .equals() method.
+     */
+    @Test
     public void testEqualsTransivity() {
         BaseEventInfo info1 = new BaseEventInfo((BaseEventInfo)fEventInfo1);
         BaseEventInfo info2 = new BaseEventInfo((BaseEventInfo)fEventInfo1);
@@ -513,6 +520,10 @@ public class BaseEventInfoTest extends TestCase {
         assertTrue("equals", info1.equals(info3));
     }
 
+    /**
+     * Test the .equals() method.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fEventInfo1.equals(null));
         assertTrue("equals", !fEventInfo2.equals(null));
@@ -522,6 +533,10 @@ public class BaseEventInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Test the hashCode() method.
+     */
+    @Test
     public void testHashCode() {
         BaseEventInfo info1 = new BaseEventInfo((BaseEventInfo)fEventInfo1);
         BaseEventInfo info2 = new BaseEventInfo((BaseEventInfo)fEventInfo2);
index 2c0d7c0aaf71f39eecfe1233240460ffdd7adba3..dec59c20895cc56ed6c243b18857e6a2b5822bed 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,29 +8,35 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
+import static org.junit.Assert.*;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link ChannelInfo}</code>.
- *
+ * The class <code>ChannelInfoTest</code> contains tests for the class
+ * <code>{@link ChannelInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class ChannelInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class ChannelInfoTest {
+
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IChannelInfo fChannelInfo1 = null;
     private IChannelInfo fChannelInfo2 = null;
 
@@ -40,29 +46,14 @@ public class ChannelInfoTest extends TestCase {
 
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
      */
-    @Override
+    @Before
     public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fChannelInfo1 = factory.getChannel1();
         fChannelInfo2 = factory.getChannel2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
@@ -73,8 +64,8 @@ public class ChannelInfoTest extends TestCase {
 
     /**
      * Run the ChannelInfo() constructor test.
-     *
      */
+    @Test
     public void testChannelInfo() {
         ChannelInfo result = new ChannelInfo("test");
         assertNotNull(result);
@@ -89,6 +80,10 @@ public class ChannelInfoTest extends TestCase {
         assertEquals(0, result.getSwitchTimer());
     }
 
+    /**
+     * Test copy constructor.
+     */
+    @Test
     public void testChannelInfoCopy() {
         ChannelInfo channelInfo = new ChannelInfo((ChannelInfo)fChannelInfo1);
 
@@ -108,6 +103,10 @@ public class ChannelInfoTest extends TestCase {
         }
     }
 
+    /**
+     * Test copy constructor with a null value.
+     */
+    @Test
     public void testChannelCopy2() {
         try {
             ChannelInfo channel = null;
@@ -121,8 +120,8 @@ public class ChannelInfoTest extends TestCase {
 
     /**
      * Run the IEventInfo[] getEvents() method test.
-     *
      */
+    @Test
     public void testAddAndGetEvents_1() {
         ChannelInfo fixture = new ChannelInfo("test");
         fixture.setSwitchTimer(1L);
@@ -148,8 +147,8 @@ public class ChannelInfoTest extends TestCase {
 
     /**
      * Run the long getNumberOfSubBuffers() method test.
-     *
      */
+    @Test
     public void testGetAndSetters() {
         ChannelInfo fixture = new ChannelInfo("test");
         fixture.setSwitchTimer(2L);
@@ -214,8 +213,8 @@ public class ChannelInfoTest extends TestCase {
 
     /**
      * Run the void setEvents(List<IEventInfo>) method test.
-     *
      */
+    @Test
     public void testSetEvents_1() {
         ChannelInfo fixture = new ChannelInfo("test");
         fixture.setSwitchTimer(1L);
@@ -245,6 +244,10 @@ public class ChannelInfoTest extends TestCase {
         }
     }
 
+    /**
+     * Run the String toString() method test.
+     */
+    @Test
     public void testToString_1() {
         ChannelInfo fixture = new ChannelInfo("channel");
         fixture.setSwitchTimer(1L);
@@ -262,9 +265,9 @@ public class ChannelInfoTest extends TestCase {
     }
 
     /**
-     * Run the String toString() method test.
-     *
+     * Run another String toString() method test.
      */
+    @Test
     public void testToString_2() {
         String result = fChannelInfo1.toString();
 
@@ -276,6 +279,10 @@ public class ChannelInfoTest extends TestCase {
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fChannelInfo1.equals(fChannelInfo1));
         assertTrue("equals", fChannelInfo2.equals(fChannelInfo2));
@@ -284,6 +291,10 @@ public class ChannelInfoTest extends TestCase {
         assertTrue("equals", !fChannelInfo2.equals(fChannelInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         ChannelInfo event1 = new ChannelInfo((ChannelInfo)fChannelInfo1);
         ChannelInfo event2 = new ChannelInfo((ChannelInfo)fChannelInfo2);
@@ -295,6 +306,10 @@ public class ChannelInfoTest extends TestCase {
         assertTrue("equals", fChannelInfo2.equals(event2));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         ChannelInfo channel1 = new ChannelInfo((ChannelInfo)fChannelInfo1);
         ChannelInfo channel2 = new ChannelInfo((ChannelInfo)fChannelInfo1);
@@ -305,6 +320,10 @@ public class ChannelInfoTest extends TestCase {
         assertTrue("equals", channel1.equals(channel3));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fChannelInfo1.equals(null));
         assertTrue("equals", !fChannelInfo2.equals(null));
@@ -314,6 +333,10 @@ public class ChannelInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         ChannelInfo channel1 = new ChannelInfo((ChannelInfo)fChannelInfo1);
         ChannelInfo channel2 = new ChannelInfo((ChannelInfo)fChannelInfo2);
index 9f213b87f2622472104faf74679759b5aa2d5412..f1df153ab834b935cdd621541ba460e492a37731 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,27 +8,33 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
+import static org.junit.Assert.*;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IDomainInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.DomainInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link DomainInfo}</code>.
- *
+ * The class <code>ChannelInfoTest</code> contains tests for the class
+ * <code>{@link DomainInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class DomainInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class DomainInfoTest {
+
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IDomainInfo fDomainInfo1 = null;
     private IDomainInfo fDomainInfo2 = null;
     private IChannelInfo fChannelInfo1 = null;
@@ -40,12 +46,8 @@ public class DomainInfoTest extends TestCase {
 
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
      */
-    @Override
+    @Before
     public void setUp() {
         // Get test instances from the factory
         ModelImplFactory factory = new ModelImplFactory();
@@ -55,17 +57,6 @@ public class DomainInfoTest extends TestCase {
         fDomainInfo2 =  factory.getDomainInfo2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
@@ -76,8 +67,8 @@ public class DomainInfoTest extends TestCase {
 
     /**
      * Run the ChannelInfo() constructor test.
-     *
      */
+    @Test
     public void testDomainInfo() {
         DomainInfo result = new DomainInfo("test");
         assertNotNull(result);
@@ -86,6 +77,10 @@ public class DomainInfoTest extends TestCase {
         assertEquals(0, result.getChannels().length);
     }
 
+    /**
+     * Test the copy constructor.
+     */
+    @Test
     public void testDomainInfoCopy() {
         DomainInfo channelInfo = new DomainInfo((DomainInfo)fDomainInfo1);
         IChannelInfo[] orignalEvents = fDomainInfo1.getChannels();
@@ -95,6 +90,10 @@ public class DomainInfoTest extends TestCase {
         }
     }
 
+    /**
+     * Test the copy constructor.
+     */
+    @Test
     public void testDomainlCopy2() {
         try {
             DomainInfo domain = null;
@@ -108,8 +107,8 @@ public class DomainInfoTest extends TestCase {
 
     /**
      * Run the long getNumberOfSubBuffers() method test.
-     *
      */
+    @Test
     public void testGetAndSetters() {
 
         // Note that addChannel() has been executed in setUp()
@@ -130,6 +129,10 @@ public class DomainInfoTest extends TestCase {
         assertEquals(fChannelInfo2, result[1]);
     }
 
+    /**
+     * Run the String toString() method test.
+     */
+    @Test
     public void testToString_1() {
         DomainInfo fixture = new DomainInfo("domain");
 
@@ -140,8 +143,8 @@ public class DomainInfoTest extends TestCase {
 
     /**
      * Run the String toString() method test.
-     *
      */
+    @Test
     public void testToString_2() {
         String result = fDomainInfo1.toString();
 
@@ -152,6 +155,10 @@ public class DomainInfoTest extends TestCase {
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fDomainInfo1.equals(fDomainInfo1));
         assertTrue("equals", fDomainInfo2.equals(fDomainInfo2));
@@ -160,6 +167,10 @@ public class DomainInfoTest extends TestCase {
         assertTrue("equals", !fDomainInfo2.equals(fDomainInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         DomainInfo event1 = new DomainInfo((DomainInfo)fDomainInfo1);
         DomainInfo event2 = new DomainInfo((DomainInfo)fDomainInfo2);
@@ -171,6 +182,10 @@ public class DomainInfoTest extends TestCase {
         assertTrue("equals", fDomainInfo2.equals(event2));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         DomainInfo channel1 = new DomainInfo((DomainInfo)fDomainInfo1);
         DomainInfo channel2 = new DomainInfo((DomainInfo)fDomainInfo1);
@@ -181,6 +196,10 @@ public class DomainInfoTest extends TestCase {
         assertTrue("equals", channel1.equals(channel3));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fDomainInfo1.equals(null));
         assertTrue("equals", !fDomainInfo2.equals(null));
@@ -190,6 +209,10 @@ public class DomainInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         DomainInfo channel1 = new DomainInfo((DomainInfo)fDomainInfo1);
         DomainInfo channel2 = new DomainInfo((DomainInfo)fDomainInfo2);
index 10ac5932d93ff6186bee878fb105e2912aacca97..2466c5440798597859d28bfbd8a266812ba8ad00 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,62 +8,59 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
+ * The class <code>EventInfoTest</code> contains test for the class
+ * <code>{@link EventInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class EventInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class EventInfoTest {
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IEventInfo fEventInfo1 = null;
     private IEventInfo fEventInfo2 = null;
 
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
+
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception if the initialization fails for some reason
-     *
      */
-    @Override
-    public void setUp() throws Exception {
+    @Before
+    public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fEventInfo1 = factory.getEventInfo1();
         fEventInfo2 = factory.getEventInfo2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() throws Exception {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
      * Run the BaseEventInfo() constructor test.
-     *
      */
+    @Test
     public void testBaseEventInfo() {
         EventInfo fixture = new EventInfo("event");
         assertNotNull(fixture);
@@ -87,6 +84,7 @@ public class EventInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventInfoCopy() {
         EventInfo info = new EventInfo((EventInfo)fEventInfo1);
 
@@ -98,6 +96,7 @@ public class EventInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventCopy2() {
         try {
             EventInfo info = null;
@@ -112,6 +111,7 @@ public class EventInfoTest extends TestCase {
     /**
      *  Getter/Setter tests
      */
+    @Test
     public void testGetAndSetter() {
         EventInfo fixture = new EventInfo("event");
 
@@ -193,6 +193,7 @@ public class EventInfoTest extends TestCase {
     /**
      * Run the String toString() method test.
      */
+    @Test
     public void testToString_1() {
         EventInfo fixture = new EventInfo("event");
         fixture.setName("testName");
@@ -207,6 +208,11 @@ public class EventInfoTest extends TestCase {
     // ------------------------------------------------------------------------
     // equals
     // ------------------------------------------------------------------------
+
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fEventInfo1.equals(fEventInfo1));
         assertTrue("equals", fEventInfo2.equals(fEventInfo2));
@@ -215,6 +221,10 @@ public class EventInfoTest extends TestCase {
         assertTrue("equals", !fEventInfo2.equals(fEventInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         EventInfo info1 = new EventInfo((EventInfo)fEventInfo1);
         EventInfo info2 = new EventInfo((EventInfo)fEventInfo2);
@@ -226,6 +236,10 @@ public class EventInfoTest extends TestCase {
         assertTrue("equals", fEventInfo2.equals(info2));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         EventInfo info1 = new EventInfo((EventInfo)fEventInfo1);
         EventInfo info2 = new EventInfo((EventInfo)fEventInfo1);
@@ -236,6 +250,10 @@ public class EventInfoTest extends TestCase {
         assertTrue("equals", info1.equals(info3));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fEventInfo1.equals(null));
         assertTrue("equals", !fEventInfo2.equals(null));
@@ -245,6 +263,10 @@ public class EventInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         EventInfo info1 = new EventInfo((EventInfo)fEventInfo1);
         EventInfo info2 = new EventInfo((EventInfo)fEventInfo2);
index 9e391b2c6c987246d7f5f5dfd57b1a4fd30fc382..3e2a7a334f97d81e7fe3873287cea397bc4e7bdd 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,61 +8,54 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
 
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>FieldInfoTest</code> contains test for the class <code>{@link FieldInfo}</code>.
+ * The class <code>FieldInfoTest</code> contains test for the class
+ * <code>{@link FieldInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class FieldInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class FieldInfoTest {
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IFieldInfo fFieldInfo1 = null;
     private IFieldInfo fFieldInfo2 = null;
 
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
+
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception if the initialization fails for some reason
-     *
      */
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fFieldInfo1 = factory.getFieldInfo1();
         fFieldInfo2 = factory.getFieldInfo2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() throws Exception {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
      * Run the BaseEventInfo() constructor test.
-     *
      */
+    @Test
     public void testFiledInfo() {
         FieldInfo fixture = new FieldInfo("field");
         assertNotNull(fixture);
@@ -74,6 +67,7 @@ public class FieldInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventInfoCopy() {
         FieldInfo info = new FieldInfo((FieldInfo)fFieldInfo1);
 
@@ -84,6 +78,7 @@ public class FieldInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventCopy2() {
         try {
             FieldInfo info = null;
@@ -97,10 +92,8 @@ public class FieldInfoTest extends TestCase {
 
     /**
      * Run the TraceEventType getEventType() method test.
-     *
-     * @throws Exception
-     *
      */
+    @Test
     public void testSetFieldType() {
         FieldInfo info = new FieldInfo((FieldInfo)fFieldInfo1);
 
@@ -108,6 +101,10 @@ public class FieldInfoTest extends TestCase {
         assertEquals("string", info.getFieldType());
     }
 
+    /**
+     * Run the toString() method test.
+     */
+    @Test
     public void testToString() {
         String result = fFieldInfo1.toString();
 
@@ -119,6 +116,10 @@ public class FieldInfoTest extends TestCase {
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fFieldInfo1.equals(fFieldInfo1));
         assertTrue("equals", fFieldInfo2.equals(fFieldInfo2));
@@ -127,6 +128,10 @@ public class FieldInfoTest extends TestCase {
         assertTrue("equals", !fFieldInfo2.equals(fFieldInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         FieldInfo info1 = new FieldInfo((FieldInfo)fFieldInfo1);
         FieldInfo info2 = new FieldInfo((FieldInfo)fFieldInfo2);
@@ -138,6 +143,10 @@ public class FieldInfoTest extends TestCase {
         assertTrue("equals", fFieldInfo2.equals(info2));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         FieldInfo info1 = new FieldInfo((FieldInfo)fFieldInfo1);
         FieldInfo info2 = new FieldInfo((FieldInfo)fFieldInfo1);
@@ -148,6 +157,10 @@ public class FieldInfoTest extends TestCase {
         assertTrue("equals", info1.equals(info3));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fFieldInfo1.equals(null));
         assertTrue("equals", !fFieldInfo2.equals(null));
@@ -157,6 +170,10 @@ public class FieldInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testHashCode() {
         FieldInfo info1 = new FieldInfo((FieldInfo)fFieldInfo1);
         FieldInfo info2 = new FieldInfo((FieldInfo)fFieldInfo2);
index 5f8babb9a59dc8423b5ac0407262e7bd2a64a0ab..0c6e5c13dd2c98313e9cb0774c1962aff6cc14e7 100644 (file)
@@ -9,6 +9,7 @@
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
  *******************************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
index 63c0b34b01a9ee91880e595d68c29f34a16708c3..3f8811c2f3aca233f00294ef34ae149a472b54f6 100644 (file)
@@ -8,25 +8,31 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
 
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IProbeEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ProbeEventInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
+ * The class <code>ProbEventInfoTest</code> contains test for the class
+ * <code>{@link ProbeEventInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class ProbeEventInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class ProbeEventInfoTest {
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IProbeEventInfo fEventInfo1 = null;
     private IProbeEventInfo fEventInfo2 = null;
 
@@ -35,35 +41,22 @@ public class ProbeEventInfoTest extends TestCase {
     // ------------------------------------------------------------------------
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception if the initialization fails for some reason
-     *
      */
-    @Override
-    public void setUp() throws Exception {
+    @Before
+    public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fEventInfo1 = factory.getProbeEventInfo1();
         fEventInfo2 = factory.getProbeEventInfo2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() throws Exception {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
      * Run the BaseEventInfo() constructor test.
-     *
      */
+    @Test
     public void testBaseEventInfo() {
         ProbeEventInfo fixture = new ProbeEventInfo("event");
         assertNotNull(fixture);
@@ -90,6 +83,7 @@ public class ProbeEventInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventInfoCopy() {
         ProbeEventInfo info = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
 
@@ -104,6 +98,7 @@ public class ProbeEventInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventCopy2() {
         try {
             ProbeEventInfo info = null;
@@ -118,6 +113,7 @@ public class ProbeEventInfoTest extends TestCase {
     /**
      *  Getter/Setter tests
      */
+    @Test
     public void testGetAndSetter() {
         ProbeEventInfo fixture = new ProbeEventInfo("event");
 
@@ -143,6 +139,7 @@ public class ProbeEventInfoTest extends TestCase {
     /**
      * Run the String toString() method test.
      */
+    @Test
     public void testToString_1() {
         assertEquals("[ProbeEventInfo([EventInfo([BaseEventInfo([TraceInfo(Name=probeEvent1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)],fAddress=0xc1231234)]", fEventInfo1.toString());
         assertEquals("[ProbeEventInfo([EventInfo([BaseEventInfo([TraceInfo(Name=probeEvent2)],type=UNKNOWN,level=TRACE_DEBUG)],State=DISABLED)],fOffset=0x100,fSymbol=init_post)]", fEventInfo2.toString());
@@ -151,6 +148,11 @@ public class ProbeEventInfoTest extends TestCase {
     // ------------------------------------------------------------------------
     // equals
     // ------------------------------------------------------------------------
+
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fEventInfo1.equals(fEventInfo1));
         assertTrue("equals", fEventInfo2.equals(fEventInfo2));
@@ -159,6 +161,10 @@ public class ProbeEventInfoTest extends TestCase {
         assertTrue("equals", !fEventInfo2.equals(fEventInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         ProbeEventInfo info1 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
         ProbeEventInfo info2 = new ProbeEventInfo((ProbeEventInfo)fEventInfo2);
@@ -170,6 +176,10 @@ public class ProbeEventInfoTest extends TestCase {
         assertTrue("equals", fEventInfo2.equals(info2));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         ProbeEventInfo info1 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
         ProbeEventInfo info2 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
@@ -180,6 +190,10 @@ public class ProbeEventInfoTest extends TestCase {
         assertTrue("equals", info1.equals(info3));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fEventInfo1.equals(null));
         assertTrue("equals", !fEventInfo2.equals(null));
@@ -189,6 +203,10 @@ public class ProbeEventInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         ProbeEventInfo info1 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
         ProbeEventInfo info2 = new ProbeEventInfo((ProbeEventInfo)fEventInfo2);
index bfa65991055e26f452ce5219790209860ec4a3e5..ecab6559d4ab42033eae9750a1dad98a6ea0632f 100644 (file)
@@ -8,28 +8,34 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
+import static org.junit.Assert.*;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IDomainInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.SessionInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link SessionInfo}</code>.
- *
+ * The class <code>ChannelInfoTest</code> contains tests for the class
+ * <code>{@link SessionInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class SessionInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class SessionInfoTest {
+
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private ISessionInfo fSessionInfo1 = null;
     private ISessionInfo fSessionInfo2 = null;
 
@@ -42,12 +48,8 @@ public class SessionInfoTest extends TestCase {
 
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
      */
-    @Override
+    @Before
     public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fSessionInfo1 = factory.getSessionInfo1();
@@ -56,17 +58,6 @@ public class SessionInfoTest extends TestCase {
         fDomainInfo2 = factory.getDomainInfo2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
@@ -77,8 +68,8 @@ public class SessionInfoTest extends TestCase {
 
     /**
      * Run the ChannelInfo() constructor test.
-     *
      */
+    @Test
     public void testSessionInfo() {
         ISessionInfo result = new SessionInfo("test");
         assertNotNull(result);
@@ -93,6 +84,10 @@ public class SessionInfoTest extends TestCase {
         assertEquals(0, result.getDomains().length);
     }
 
+    /**
+     * Test copy constructor.
+     */
+    @Test
     public void testSessionInfoCopy() {
         SessionInfo sessionInfo = new SessionInfo((SessionInfo)fSessionInfo1);
 
@@ -107,6 +102,10 @@ public class SessionInfoTest extends TestCase {
         }
     }
 
+    /**
+     * Test copy constructor.
+     */
+    @Test
     public void testSessionCopy2() {
         try {
             SessionInfo session = null;
@@ -120,8 +119,8 @@ public class SessionInfoTest extends TestCase {
 
     /**
      * Run the long getNumberOfSubBuffers() method test.
-     *
      */
+    @Test
     public void testGetAndSetters() {
 
         // Note that addDomain() has been executed in setUp()
@@ -181,6 +180,10 @@ public class SessionInfoTest extends TestCase {
         assertEquals(0, state.ordinal());
     }
 
+    /**
+     * Run the String toString() method test.
+     */
+    @Test
     public void testToString_1() {
         ISessionInfo fixture = new SessionInfo("sessionName");
 
@@ -192,8 +195,8 @@ public class SessionInfoTest extends TestCase {
 
     /**
      * Run the String toString() method test.
-     *
      */
+    @Test
     public void testToString_2() {
         String result = fSessionInfo1.toString();
 
@@ -205,6 +208,10 @@ public class SessionInfoTest extends TestCase {
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the {@link SessionInfo#equals} method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fSessionInfo1.equals(fSessionInfo1));
         assertTrue("equals", fSessionInfo2.equals(fSessionInfo2));
@@ -213,6 +220,10 @@ public class SessionInfoTest extends TestCase {
         assertTrue("equals", !fSessionInfo2.equals(fSessionInfo1));
     }
 
+    /**
+     * Run the {@link SessionInfo#equals} method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         SessionInfo event1 = new SessionInfo((SessionInfo)fSessionInfo1);
         SessionInfo event2 = new SessionInfo((SessionInfo)fSessionInfo2);
@@ -224,6 +235,10 @@ public class SessionInfoTest extends TestCase {
         assertTrue("equals", fSessionInfo2.equals(event2));
     }
 
+    /**
+     * Run the {@link SessionInfo#equals} method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         SessionInfo channel1 = new SessionInfo((SessionInfo)fSessionInfo1);
         SessionInfo channel2 = new SessionInfo((SessionInfo)fSessionInfo1);
@@ -234,6 +249,10 @@ public class SessionInfoTest extends TestCase {
         assertTrue("equals", channel1.equals(channel3));
     }
 
+    /**
+     * Run the {@link SessionInfo#equals} method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fSessionInfo1.equals(null));
         assertTrue("equals", !fSessionInfo2.equals(null));
@@ -243,6 +262,10 @@ public class SessionInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the {@link SessionInfo#hashCode} method test.
+     */
+    @Test
     public void testHashCode() {
         SessionInfo channel1 = new SessionInfo((SessionInfo)fSessionInfo1);
         SessionInfo channel2 = new SessionInfo((SessionInfo)fSessionInfo2);
@@ -252,4 +275,5 @@ public class SessionInfoTest extends TestCase {
 
         assertTrue("hashCode", fSessionInfo1.hashCode() != channel2.hashCode());
         assertTrue("hashCode", fSessionInfo2.hashCode() != channel1.hashCode());
-    }}
\ No newline at end of file
+    }
+}
\ No newline at end of file
index e60169c11719d226b6791f3bd51514077f848800..48e60a1a6cf784feb105d46aac0e2312a7b75bf9 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,23 +8,29 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
 
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.ITraceInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>TraceInfoTest</code> contains test for the class <code>{@link TraceInfo}</code>.
+ * The class <code>TraceInfoTest</code> contains test for the class
+ * <code>{@link TraceInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class TraceInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class TraceInfoTest {
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private ITraceInfo fTraceInfo1 = null;
     private ITraceInfo fTraceInfo2 = null;
 
@@ -32,36 +38,24 @@ public class TraceInfoTest extends TestCase {
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
+
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception if the initialization fails for some reason
-     *
      */
-    @Override
-    public void setUp() throws Exception {
+    @Before
+    public void setUp() {
         fTraceInfo1 = new TraceInfo("event1");
         fTraceInfo2 = new TraceInfo("event2");
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() throws Exception {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
      * Run the BaseEventInfo() constructor test.
-     *
      */
+    @Test
     public void testTraceInfo() {
         TraceInfo fixture = new TraceInfo("event");
         assertNotNull(fixture);
@@ -72,6 +66,7 @@ public class TraceInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testTraceInfo2() {
         try {
             String name = null;
@@ -86,6 +81,7 @@ public class TraceInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testTraceInfoCopy() {
         TraceInfo info = new TraceInfo((TraceInfo)fTraceInfo1);
 
@@ -95,6 +91,7 @@ public class TraceInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testTraceCopy2() {
         try {
             TraceInfo info = null;
@@ -108,8 +105,8 @@ public class TraceInfoTest extends TestCase {
 
     /**
      * Run the void setEventType(String) method test.
-     *
      */
+    @Test
     public void testSetName() {
         TraceInfo fixture = new TraceInfo("event");
         fixture.setName("newName");
@@ -118,8 +115,8 @@ public class TraceInfoTest extends TestCase {
 
     /**
      * Run the String toString() method test.
-     *
      */
+    @Test
     public void testToString_1() {
         String result = fTraceInfo1.toString();
 
@@ -131,6 +128,10 @@ public class TraceInfoTest extends TestCase {
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fTraceInfo1.equals(fTraceInfo1));
         assertTrue("equals", fTraceInfo2.equals(fTraceInfo2));
@@ -139,6 +140,10 @@ public class TraceInfoTest extends TestCase {
         assertTrue("equals", !fTraceInfo2.equals(fTraceInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         TraceInfo info1 = new TraceInfo((TraceInfo)fTraceInfo1);
         TraceInfo info2 = new TraceInfo((TraceInfo)fTraceInfo2);
@@ -149,7 +154,10 @@ public class TraceInfoTest extends TestCase {
         assertTrue("equals", info2.equals(fTraceInfo2));
         assertTrue("equals", fTraceInfo2.equals(info2));
     }
-
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         TraceInfo info1 = new TraceInfo((TraceInfo)fTraceInfo1);
         TraceInfo info2 = new TraceInfo((TraceInfo)fTraceInfo1);
@@ -159,7 +167,10 @@ public class TraceInfoTest extends TestCase {
         assertTrue("equals", info2.equals(info3));
         assertTrue("equals", info1.equals(info3));
     }
-
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fTraceInfo1.equals(null));
         assertTrue("equals", !fTraceInfo2.equals(null));
@@ -169,6 +180,10 @@ public class TraceInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         TraceInfo info1 = new TraceInfo((TraceInfo)fTraceInfo1);
         TraceInfo info2 = new TraceInfo((TraceInfo)fTraceInfo2);
index de0facfaf2bc32f148c81811544f163948b9d1c2..a95e3ab9aa4e3bda426d013f12ed99d45537a6d4 100644 (file)
@@ -8,28 +8,34 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
+import static org.junit.Assert.*;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.UstProviderInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link UstProviderInfo}</code>.
- *
+ * The class <code>ChannelInfoTest</code> contains tests for the class
+ * <code>{@link UstProviderInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class UstProviderInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class UstProviderInfoTest {
+
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IUstProviderInfo fUstProviderInfo1 = null;
     private IUstProviderInfo fUstProviderInfo2 = null;
 
@@ -42,12 +48,8 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
      */
-    @Override
+    @Before
     public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fUstProviderInfo1 = factory.getUstProviderInfo1();
@@ -56,17 +58,6 @@ public class UstProviderInfoTest extends TestCase {
         fEventInfo2 = factory.getBaseEventInfo2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
@@ -77,8 +68,8 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Run the UstProviderInfo() constructor test.
-     *
      */
+    @Test
     public void testUstProviderInfo() {
         IUstProviderInfo result = new UstProviderInfo("test");
         assertNotNull(result);
@@ -88,6 +79,10 @@ public class UstProviderInfoTest extends TestCase {
         assertEquals(0, result.getEvents().length);
     }
 
+    /**
+     * Test the copy constructor.
+     */
+    @Test
     public void testUstProviderInfoCopy() {
         IUstProviderInfo providerInf = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
 
@@ -102,6 +97,10 @@ public class UstProviderInfoTest extends TestCase {
         }
     }
 
+    /**
+     * Test the copy constructor.
+     */
+    @Test
     public void testUstProviderCopy2() {
         try {
             UstProviderInfo providerInfo = null;
@@ -115,8 +114,8 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Run the IEventInfo[] getEvents() method test.
-     *
      */
+    @Test
     public void testGetAndSetters() {
         IUstProviderInfo fixture = new UstProviderInfo("test");
         fixture.setPid(2468);
@@ -138,8 +137,8 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Run the void setEvents(List<IBaseEventInfo>) method test.
-     *
      */
+    @Test
     public void testSetEvents_1() {
         UstProviderInfo fixture = new UstProviderInfo("test");
         fixture.setPid(2468);
@@ -157,6 +156,10 @@ public class UstProviderInfoTest extends TestCase {
         }
     }
 
+    /**
+     * Run the String toString() method test.
+     */
+    @Test
     public void testToString_1() {
         UstProviderInfo fixture = new UstProviderInfo("test");
         fixture.setPid(2468);
@@ -167,20 +170,24 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Run the String toString() method test.
-     *
      */
+    @Test
     public void testToString_2() {
         String result = fUstProviderInfo2.toString();
         assertEquals("[EventInfo([TraceInfo(Name=myUST2)],PID=2345,Events=[BaseEventInfo([TraceInfo(Name=event1)]," +
-                       "type=UNKNOWN,level=TRACE_DEBUG,Fields=[FieldInfo([TraceInfo(Name=intfield)],type=int[FieldInfo" +
-                       "([TraceInfo(Name=stringfield)],type=string,Filter=intField==10)][BaseEventInfo([TraceInfo(Name=event2)]," +
-                       "type=TRACEPOINT,level=TRACE_DEBUG)])]", result);
+                "type=UNKNOWN,level=TRACE_DEBUG,Fields=[FieldInfo([TraceInfo(Name=intfield)],type=int[FieldInfo" +
+                "([TraceInfo(Name=stringfield)],type=string,Filter=intField==10)][BaseEventInfo([TraceInfo(Name=event2)]," +
+                "type=TRACEPOINT,level=TRACE_DEBUG)])]", result);
     }
 
     // ------------------------------------------------------------------------
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fUstProviderInfo1.equals(fUstProviderInfo1));
         assertTrue("equals", fUstProviderInfo2.equals(fUstProviderInfo2));
@@ -189,6 +196,10 @@ public class UstProviderInfoTest extends TestCase {
         assertTrue("equals", !fUstProviderInfo2.equals(fUstProviderInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         UstProviderInfo event1 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
         UstProviderInfo event2 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo2);
@@ -200,6 +211,10 @@ public class UstProviderInfoTest extends TestCase {
         assertTrue("equals", fUstProviderInfo2.equals(event2));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         UstProviderInfo UstProvider1 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
         UstProviderInfo UstProvider2 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
@@ -210,6 +225,10 @@ public class UstProviderInfoTest extends TestCase {
         assertTrue("equals", UstProvider1.equals(UstProvider3));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fUstProviderInfo1.equals(null));
         assertTrue("equals", !fUstProviderInfo2.equals(null));
@@ -219,6 +238,10 @@ public class UstProviderInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         UstProviderInfo UstProvider1 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
         UstProviderInfo UstProvider2 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo2);
index 3e262861030555007cf0147ccf395e64a1de306e..8e0491dd0fabc61284cc7cb853b5f5b028676c67 100644 (file)
@@ -9,6 +9,6 @@ Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.core.Activator
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.core.runtime
-Export-Package: org.eclipse.linuxtools.internal.lttng2.core;x-internal:=true,
+Export-Package: org.eclipse.linuxtools.internal.lttng2.core;x-friends:="org.eclipse.linuxtools.lttng2.core.tests",
  org.eclipse.linuxtools.internal.lttng2.core.control.model;x-friends:="org.eclipse.linuxtools.lttng2.ui",
  org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;x-friends:="org.eclipse.linuxtools.lttng2.ui"
index 93d97234ff109b4d6237e15b134ca792230a93d7..c7ed8c897d71c6c0b1a2212ceafb82f7b8eb8563 100644 (file)
@@ -16,8 +16,7 @@ import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
 /**
- * <b><u>AllTests</u></b>
- * <p>
+ * Runner for the lttng2.kernel unit tests.
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
index c7723096e2e8a6aef86950c7ecaefd66f2454f75..518d0d9c72b182af5f0bf35745c00d01efeb23cc 100644 (file)
@@ -17,32 +17,33 @@ import static org.junit.Assert.assertEquals;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateInput;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.statesystem.IStateChangeInput;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
  * Tests for the LTTng 2.0 kernel state provider
  *
- * @author alexmont
- *
+ * @author Alexandre Montplaisir
  */
-@SuppressWarnings("javadoc")
 public class CtfKernelStateInputTest {
 
     static IStateChangeInput input;
 
+    /**
+     * Set-up.
+     *
+     * @throws TmfTraceException
+     *             If we can't find the test traces
+     */
     @BeforeClass
     public static void initialize() throws TmfTraceException {
         input = new CtfKernelStateInput(CtfTestFiles.getTestTrace());
 
     }
 
-    @AfterClass
-    public static void cleanup() {
-        //
-    }
-
+    /**
+     * Test loading the state provider.
+     */
     @Test
     public void testOpening() {
         long testStartTime;
@@ -50,12 +51,4 @@ public class CtfKernelStateInputTest {
         assertEquals(testStartTime, CtfTestFiles.startTime);
     }
 
-    //FIXME re-enable once we offer history-less state systems again
-//    @Test
-//    public void testRunning() {
-//        StateSystem ss = new StateSystem();
-//        input.assignTargetStateSystem(ss);
-//        input.run();
-//    }
-
 }
index a0f6817f4b4093d9ab0f62c31ca24ecdb5414cbe..dc7bf950f4b33df0552e10715bd9bce3c08db40d 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -16,12 +16,7 @@ import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
 /**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
+ * Runner for the LTTng kernel state system tests.
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
index 295f0e180af32dc57ffd103b6700eff294fc0840..5634a3c46a942f58fe74f486ee9051a80093f17c 100644 (file)
 
 package org.eclipse.linuxtools.lttng2.kernel.ui.tests;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertTrue;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
- * <b><u>ActivatorTest</u></b>
- * <p>
  * Test suite for the Activator class
- * <p>
  */
-@SuppressWarnings("javadoc")
-public class ActivatorTest extends TestCase {
-
-    // ------------------------------------------------------------------------
-    // JUnit
-    // ------------------------------------------------------------------------
-
-    @BeforeClass
-    public static void setUpBeforeClass() {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() {
-    }
-
-    /**
-     * @throws java.lang.Exception
-     */
-    @Before
-    @Override
-    public void setUp() throws Exception {
-    }
-
-    /**
-     * @throws java.lang.Exception
-     */
-    @After
-    @Override
-    public void tearDown() throws Exception {
-    }
+public class ActivatorTest {
 
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.lttng2.kernel.ui.Activator#Activator()}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator#Activator()}.
      */
     @Test
     public void testActivator() {
@@ -70,7 +34,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.lttng2.kernel.ui.Activator#getDefault()}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator#getDefault()}.
      */
     @Test
     public void testGetDefault() {
@@ -78,7 +42,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.lttng2.kernel.ui.Activator#start(org.osgi.framework.BundleContext)}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator#start}.
      */
     @Test
     public void testStartBundleContext() {
@@ -86,7 +50,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.lttng2.kernel.ui.Activator#stop(org.osgi.framework.BundleContext)}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator#stop}.
      */
     @Test
     public void testStopBundleContext() {
index b9a41090801781010fc466248773eaa1e46fd479..f37fdf03f035649219440cd0c1ef6707b2ca4c9b 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,28 +8,21 @@
  *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  *******************************************************************************/
 
 package org.eclipse.linuxtools.lttng2.kernel.ui.tests;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
- * <b><u>AllTests</u></b>
- * <p>
+ * Run the lttng2.ui unit tests.
  */
-@SuppressWarnings("javadoc")
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    ActivatorTest.class,
+})
 public class AllTests {
 
-    public static Test suite() {
-        TestSuite suite = new TestSuite(AllTests.class.getName());
-        // $JUnit-BEGIN$
-
-        // Plug-in
-        suite.addTestSuite(ActivatorTest.class);
-
-        // $JUnit-END$
-        return suite;
-    }
 }
index 058fc71f9f2523fa2bde2bf315f2d37f7cd45b3d..39089cfe5c0bc238224a8c0ded2ba52737a31aa1 100644 (file)
 
 package org.eclipse.linuxtools.lttng2.ui.tests;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertTrue;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
- * <b><u>ActivatorTest</u></b>
- * <p>
  * Test suite for the Activator class
- * <p>
  */
-@SuppressWarnings("javadoc")
-public class ActivatorTest extends TestCase {
-
-    // ------------------------------------------------------------------------
-    // JUnit
-    // ------------------------------------------------------------------------
-
-    @BeforeClass
-    public static void setUpBeforeClass() {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() {
-    }
-
-    /**
-     * @throws java.lang.Exception
-     */
-    @Before
-    @Override
-    public void setUp() throws Exception {
-    }
-
-    /**
-     * @throws java.lang.Exception
-     */
-    @After
-    @Override
-    public void tearDown() throws Exception {
-    }
+public class ActivatorTest {
 
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.ui.Activator#Activator()}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.ui.Activator#Activator}.
      */
     @Test
     public void testActivator() {
@@ -70,7 +34,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.ui.Activator#getDefault()}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.ui.Activator#getDefault}.
      */
     @Test
     public void testGetDefault() {
@@ -78,7 +42,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.ui.Activator#start(org.osgi.framework.BundleContext)}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.ui.Activator#start}.
      */
     @Test
     public void testStartBundleContext() {
@@ -86,7 +50,7 @@ public class ActivatorTest extends TestCase {
     }
 
     /**
-     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.ui.Activator#stop(org.osgi.framework.BundleContext)}.
+     * Test method for {@link org.eclipse.linuxtools.internal.lttng2.ui.Activator#stop}.
      */
     @Test
     public void testStopBundleContext() {
index e34a1be6051abd9fface2a95b311c745a1de6fab..bf338e73fcca5e4ca3a595b60befaa2669dc4a2a 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,30 +8,23 @@
  *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  *******************************************************************************/
 
 package org.eclipse.linuxtools.lttng2.ui.tests;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
- * <b><u>AllTests</u></b>
- * <p>
+ * Runner for the lttng2.ui unit tests.
  */
-@SuppressWarnings("javadoc")
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    ActivatorTest.class,
+    org.eclipse.linuxtools.lttng2.ui.tests.control.model.component.AllTests.class,
+    org.eclipse.linuxtools.lttng2.ui.tests.control.service.AllTests.class
+})
 public class AllTests {
 
-    public static Test suite() {
-        TestSuite suite = new TestSuite(AllTests.class.getName());
-        // $JUnit-BEGIN$
-
-        // Plug-in
-        suite.addTestSuite(ActivatorTest.class);
-        suite.addTest(org.eclipse.linuxtools.lttng2.ui.tests.control.service.AllTests.suite());
-        suite.addTest(org.eclipse.linuxtools.lttng2.ui.tests.control.model.component.AllTests.suite());
-
-        // $JUnit-END$
-        return suite;
-    }
 }
index c255963ffac8e1e551299c430b6ddf55c68a4000..922b8ba54bef056b275ffb94b4fc768f2bec1d04 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,28 +8,28 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  *******************************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
-@SuppressWarnings("javadoc")
+/**
+ * Runner for the control.model.component unit tests.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TraceControlComponentTest.class,
+    TraceControlKernelProviderTests.class,
+    TraceControlKernelSessionTests.class,
+    TraceControlPropertiesTest.class,
+    TraceControlTreeModelNoProvidersTest.class,
+    TraceControlTreeModelTest.class,
+    TraceControlUstProviderTests.class,
+    TraceControlUstSessionTests.class
+})
 public class AllTests {
 
-    public static Test suite() {
-
-        TestSuite suite = new TestSuite(AllTests.class.getName());
-        //$JUnit-BEGIN$
-        suite.addTestSuite(TraceControlComponentTest.class);
-        suite.addTestSuite(TraceControlTreeModelTest.class);
-        suite.addTestSuite(TraceControlTreeModelNoProvidersTest.class);
-        suite.addTestSuite(TraceControlKernelProviderTests.class);
-        suite.addTestSuite(TraceControlUstProviderTests.class);
-        suite.addTestSuite(TraceControlKernelSessionTests.class);
-        suite.addTestSuite(TraceControlUstSessionTests.class);
-        suite.addTestSuite(TraceControlPropertiesTest.class);
-        //$JUnit-END$
-        return new ModelImplTestSetup(suite);
-    }
 }
index d25c80baa8673a9a4c9fb7e98f26ec7be43c325c..234f711b256af9750654fb13dafa6cb98a1b7243 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,16 +8,16 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
+import static org.junit.Assert.*;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
 import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
@@ -31,63 +31,19 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngCont
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>TraceControlComponentTest</code> contains tests for the class <code>{@link TraceControlComponent}</code>.
- *
+ * The class <code>TraceControlComponentTest</code> contains tests for the class
+ * <code>{@link TraceControlComponent}</code>.
  */
 @SuppressWarnings("nls")
-public class TraceControlComponentTest extends TestCase {
-
-    // ------------------------------------------------------------------------
-    // Test data
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns test setup used when executing test case stand-alone.
-     * @return Test setup class
-     */
-    public static Test suite() {
-        return new ModelImplTestSetup(new TestSuite(TraceControlComponentTest.class));
-    }
-
-    // ------------------------------------------------------------------------
-    // Housekeeping
-    // ------------------------------------------------------------------------
-
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
-     */
-    @Override
-    @Before
-    public void setUp() throws Exception {
-    }
-
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     */
-    @Override
-    @After
-    public void tearDown()  throws Exception {
-    }
+public class TraceControlComponentTest {
 
     /**
      * Run the TraceControlComponent(String) constructor test.
      */
+    @Test
     public void testTraceControlComponent_1() {
 
         String name = "node";
@@ -106,6 +62,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the TraceControlComponent(String,ITraceControlComponent) constructor test.
      */
+    @Test
     public void testTraceControlComponent_2() {
         String name = "node";
 
@@ -123,6 +80,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void addChild(ITraceControlComponent) method test.
      */
+    @Test
     public void testAddAndGetChild1() {
         TraceControlComponent fixture = new TraceControlComponent("node", new TraceControlRoot());
         fixture.setToolTip("This is the test node");
@@ -138,6 +96,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void addChild(ITraceControlComponent) method test.
      */
+    @Test
     public void testAddAndGetChild2() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -150,6 +109,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void addComponentListener(ITraceControlComponentChangedListener) method test.
      */
+    @Test
     public void testAddComponentListener_1() {
         TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null);
         fixture.setToolTip("");
@@ -171,6 +131,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the boolean containsChild(String) method test.
      */
+    @Test
     public void testContainsChild_1() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -185,6 +146,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the boolean containsChild(String) method test.
      */
+    @Test
     public void testContainsChild_2() {
         TraceControlComponent fixture = new TraceControlComponent("name", new TraceControlRoot());
         fixture.setToolTip("");
@@ -199,6 +161,7 @@ public class TraceControlComponentTest extends TestCase {
      * Run the void fireCompenentRemoved(ITraceControlComponent,ITraceControlComponent) method test.
      * Run the void fireCompenentChanged(ITraceControlComponent) method test
      */
+    @Test
     public void testFireCompenentUpdated() {
         ITraceControlComponent parent = new TraceControlRoot();
 
@@ -232,6 +195,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the Object getAdapter(Class) method test.
      */
+    @Test
     public void testGetAdapter() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -246,6 +210,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the ITraceControlComponent[] getChildren() method test.
      */
+    @Test
     public void testGetChildren_1() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -271,6 +236,7 @@ public class TraceControlComponentTest extends TestCase {
      * @throws ExecutionException
      *             Would fail the test
      */
+    @Test
     public void testGetAndSetControlService_1() throws ExecutionException {
 
         TraceControlComponent parent = new TraceControlComponent("parent") {
@@ -311,6 +277,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the Image getImage() method test.
      */
+    @Test
     public void testGetImage_1() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -326,6 +293,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the boolean hasChildren() method test.
      */
+    @Test
     public void testHasChildren_1() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -339,6 +307,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the boolean hasChildren() method test.
      */
+    @Test
     public void testHasChildren_2() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -351,6 +320,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void removeAllChildren() method test.
      */
+    @Test
     public void testRemoveAllChildren_2() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -365,6 +335,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void removeChild(ITraceControlComponent) method test.
      */
+    @Test
     public void testRemoveChild_1() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -378,6 +349,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void removeChild(ITraceControlComponent) method test.
      */
+    @Test
     public void testRemoveChild_2() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -391,6 +363,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void removeComponentListener(ITraceControlComponentChangedListener) method test.
      */
+    @Test
     public void testRemoveComponentListener_1() {
         TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null);
         fixture.setToolTip("");
@@ -415,6 +388,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void removeComponentListener(ITraceControlComponentChangedListener) method test.
      */
+    @Test
     public void testRemoveComponentListener_2() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -428,6 +402,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void setChildren(List<ITraceControlComponent>)/ITraceControlComponent[] getChildren() method test.
      */
+    @Test
     public void testGetAndSetChildren() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -446,6 +421,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void String getName()/setName(String) method tests.
      */
+    @Test
     public void testGetAndSetName() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -460,6 +436,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void ITraceControlComponent getParent()/setParent(ITraceControlComponent) method tests.
      */
+    @Test
     public void testGetAndSetParent() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("");
@@ -479,6 +456,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void TargetNodeState getTargetNodeState()/etTargetNodeState(TargetNodeState) method tests.
      */
+    @Test
     public void testGetAndSetTargetNodeState_1() {
         TraceControlComponent parent = new TraceControlComponent("parent") {
             private TargetNodeState fState;
@@ -539,6 +517,7 @@ public class TraceControlComponentTest extends TestCase {
     /**
      * Run the void setToolTip(String) method test.
      */
+    @Test
     public void testGetSndSetToolTip() {
         TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
         fixture.setToolTip("This is a tooltip");
index 26db1586d52af781d3092520dc216b22ffd723d8..b4e97a022a5b7112ff5cf52361c16304f926bddc 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,16 +8,18 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.net.URL;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
@@ -44,40 +46,31 @@ import org.eclipse.rse.core.model.ISystemProfile;
 import org.eclipse.rse.core.model.ISystemRegistry;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Test;
 import org.osgi.framework.FrameworkUtil;
 
 /**
- * The class <code>TraceControlKernelProviderTests</code> contains UST provider handling
- * test cases.
+ * The class <code>TraceControlKernelProviderTests</code> contains UST provider
+ * handling test cases.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class TraceControlKernelProviderTests extends TestCase {
+@SuppressWarnings("nls")
+public class TraceControlKernelProviderTests {
 
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
+
     private static final String TEST_STREAM = "CreateTreeTest.cfg";
     private static final String SCEN_SCENARIO1_TEST = "Scenario1";
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private TraceControlTestFacility fFacility;
     private TestRemoteSystemProxy fProxy;
     private String fTestFile;
 
-    // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns test setup used when executing test case stand-alone.
-     * @return Test setup class
-     */
-    public static Test suite() {
-        return new ModelImplTestSetup(new TestSuite(TraceControlKernelProviderTests.class));
-    }
-
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
@@ -87,9 +80,7 @@ public class TraceControlKernelProviderTests extends TestCase {
      *
      * @throws Exception
      *         if the initialization fails for some reason
-     *
      */
-    @Override
     @Before
     public void setUp() throws Exception {
         fFacility = TraceControlTestFacility.getInstance();
@@ -101,23 +92,21 @@ public class TraceControlKernelProviderTests extends TestCase {
 
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
      */
-    @Override
     @After
-    public void tearDown() throws Exception {
+    public void tearDown() {
         fFacility.waitForJobs();
     }
 
     /**
      * Run the TraceControlComponent.
+     *
+     * @throws Exception
+     *             Would fail the test
      */
+    @Test
     public void testKernelProviderTree() throws Exception {
 
-
         fProxy.setTestFile(fTestFile);
         fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
 
index 6000c30fa4c30a6890de0ea1f72810e580d99727..b60f0f55d5ebec32e61026cc3d974650524440f6 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,18 +8,22 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
@@ -48,41 +52,31 @@ import org.eclipse.rse.core.model.ISystemProfile;
 import org.eclipse.rse.core.model.ISystemRegistry;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Test;
 import org.osgi.framework.FrameworkUtil;
 
 /**
- * The class <code>TraceControlKernelSessionTests</code> contains Kernel session/channel/event
- * handling test cases.
+ * The class <code>TraceControlKernelSessionTests</code> contains Kernel
+ * session/channel/event handling test cases.
  */
-
-@SuppressWarnings({"nls", "javadoc"})
-public class TraceControlKernelSessionTests extends TestCase {
+@SuppressWarnings("nls")
+public class TraceControlKernelSessionTests {
 
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
+
     private static final String TEST_STREAM = "CreateTreeTest.cfg";
     private static final String SCEN_SCENARIO3_TEST = "Scenario3";
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private TraceControlTestFacility fFacility;
     private TestRemoteSystemProxy fProxy;
     private String fTestFile;
 
-    // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns test setup used when executing test case stand-alone.
-     * @return Test setup class
-     */
-    public static Test suite() {
-        return new ModelImplTestSetup(new TestSuite(TraceControlKernelSessionTests.class));
-    }
-
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
@@ -92,9 +86,7 @@ public class TraceControlKernelSessionTests extends TestCase {
      *
      * @throws Exception
      *         if the initialization fails for some reason
-     *
      */
-    @Override
     @Before
     public void setUp() throws Exception {
         fFacility = TraceControlTestFacility.getInstance();
@@ -106,20 +98,19 @@ public class TraceControlKernelSessionTests extends TestCase {
 
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
      */
-    @Override
     @After
-    public void tearDown()  throws Exception {
+    public void tearDown() {
         fFacility.waitForJobs();
     }
 
     /**
      * Run the TraceControlComponent.
+     *
+     * @throws Exception
+     *             Would fail the test
      */
+    @Test
     public void testTraceSessionTree() throws Exception {
 
         fProxy.setTestFile(fTestFile);
index 4d2dc7ab37cf512ea953d13af93f3a5bdd0cf94e..15b1984452689eee0e44463dabc97fe1a8fae59e 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,16 +8,16 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
+import static org.junit.Assert.*;
+
 import java.io.File;
 import java.net.URL;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo;
@@ -52,67 +52,33 @@ import org.eclipse.rse.core.model.ISystemProfile;
 import org.eclipse.rse.core.model.ISystemRegistry;
 import org.eclipse.ui.views.properties.IPropertySource;
 import org.junit.After;
-import org.junit.Before;
+import org.junit.Test;
 import org.osgi.framework.FrameworkUtil;
 
-
 /**
- * The class <code>TraceControlPropertiesTest</code> contains tests for the all property class</code>.
- *
+ * The class <code>TraceControlPropertiesTest</code> contains tests for the all
+ * property class</code>.
  */
 @SuppressWarnings("nls")
-public class TraceControlPropertiesTest extends TestCase {
+public class TraceControlPropertiesTest {
 
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
+
     private static final String DIRECTORY   = "testfiles";
     private static final String TEST_STREAM = "ListInfoTest.cfg";
     private static final String SCEN_LIST_INFO_TEST = "ListInfoTest";
 
-
-    // ------------------------------------------------------------------------
-    // Test data
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns test setup used when executing test case stand-alone.
-     * @return Test setup class
-     */
-    public static Test suite() {
-        return new ModelImplTestSetup(new TestSuite(TraceControlPropertiesTest.class));
-    }
-
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
 
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
-     */
-    @Override
-    @Before
-    public void setUp() throws Exception {
-    }
-
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
      */
-    @Override
     @After
-    public void tearDown() throws Exception {
+    public void tearDown() {
         TraceControlTestFacility.getInstance().waitForJobs();
     }
 
@@ -122,6 +88,7 @@ public class TraceControlPropertiesTest extends TestCase {
      * @throws Exception
      *             This will fail the test
      */
+    @Test
     public void testComponentProperties() throws Exception {
 
         TestRemoteSystemProxy proxy = new TestRemoteSystemProxy();
index e03b8eea40d23cb8fae5dcfd9129a8c1a4ba7e9b..410cf890d93daec45b804b6f95cae8e16492a62c 100644 (file)
@@ -9,6 +9,7 @@
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
  *******************************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
 import org.eclipse.core.commands.ExecutionException;
index 70095241e04299ea37980a82711916ae8c30910a..4ee059472702e6934af158270186646324f68b4a 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,16 +8,20 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.net.URL;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
@@ -36,15 +40,16 @@ import org.eclipse.rse.core.model.ISystemRegistry;
 import org.eclipse.swt.graphics.Image;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Test;
 import org.osgi.framework.FrameworkUtil;
 
 /**
  * The class <code>TraceControlTreeModelNoProvidersTest</code> verifies that the
- * Tracer Control can handle the case where no kernel provider and only UST provider
- * are available.
+ * Tracer Control can handle the case where no kernel provider and only UST
+ * provider are available.
  */
 @SuppressWarnings("nls")
-public class TraceControlTreeModelNoProvidersTest extends TestCase {
+public class TraceControlTreeModelNoProvidersTest {
 
     // ------------------------------------------------------------------------
     // Constants
@@ -61,18 +66,6 @@ public class TraceControlTreeModelNoProvidersTest extends TestCase {
     private TestRemoteSystemProxy fProxy;
     private String fTestFile;
 
-    // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns test setup used when executing test case stand-alone.
-     * @return Test setup class
-     */
-    public static Test suite() {
-        return new ModelImplTestSetup(new TestSuite(TraceControlTreeModelNoProvidersTest.class));
-    }
-
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
@@ -82,9 +75,7 @@ public class TraceControlTreeModelNoProvidersTest extends TestCase {
      *
      * @throws Exception
      *         if the initialization fails for some reason
-     *
      */
-    @Override
     @Before
     public void setUp() throws Exception {
         fProxy = new TestRemoteSystemProxy();
@@ -95,14 +86,9 @@ public class TraceControlTreeModelNoProvidersTest extends TestCase {
 
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
      */
-    @Override
     @After
-    public void tearDown()  throws Exception {
+    public void tearDown()  {
         TraceControlTestFacility.getInstance().waitForJobs();
     }
 
@@ -112,6 +98,7 @@ public class TraceControlTreeModelNoProvidersTest extends TestCase {
      * @throws Exception
      *             This will fail the test
      */
+    @Test
     public void testTraceControlComponents() throws Exception {
 
         fProxy.setTestFile(fTestFile);
index 73b3a80e1964773230e07c092b318f982ccca3db..2cb7c3b85037c6bf91f94458713ddae937cd3a9f 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,16 +8,21 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.net.URL;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
@@ -47,13 +52,15 @@ import org.eclipse.rse.core.model.ISystemRegistry;
 import org.eclipse.swt.graphics.Image;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Test;
 import org.osgi.framework.FrameworkUtil;
 
 /**
- * The class <code>TraceControlTreeModelTest</code> contains tests for the tree component classes.
+ * The class <code>TraceControlTreeModelTest</code> contains tests for the tree
+ * component classes.
  */
 @SuppressWarnings("nls")
-public class TraceControlTreeModelTest extends TestCase {
+public class TraceControlTreeModelTest {
 
     // ------------------------------------------------------------------------
     // Constants
@@ -70,18 +77,6 @@ public class TraceControlTreeModelTest extends TestCase {
     private TestRemoteSystemProxy fProxy;
     private String fTestFile;
 
-    // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns test setup used when executing test case stand-alone.
-     * @return Test setup class
-     */
-    public static Test suite() {
-        return new ModelImplTestSetup(new TestSuite(TraceControlTreeModelTest.class));
-    }
-
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
@@ -91,9 +86,7 @@ public class TraceControlTreeModelTest extends TestCase {
      *
      * @throws Exception
      *         if the initialization fails for some reason
-     *
      */
-    @Override
     @Before
     public void setUp() throws Exception {
         fProxy = new TestRemoteSystemProxy();
@@ -104,14 +97,9 @@ public class TraceControlTreeModelTest extends TestCase {
 
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
      */
-    @Override
     @After
-    public void tearDown()  throws Exception {
+    public void tearDown() {
         TraceControlTestFacility.getInstance().waitForJobs();
     }
 
@@ -121,6 +109,7 @@ public class TraceControlTreeModelTest extends TestCase {
      * @throws Exception
      *             This will fail the test
      */
+    @Test
     public void testTraceControlComponents() throws Exception {
 
         fProxy.setTestFile(fTestFile);
index e519a57d3538e5e841261f26aeb6fceaee19dda9..7072500e2580b7c88801b403d02b1d7536e52c30 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,16 +8,16 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
+import static org.junit.Assert.*;
+
 import java.io.File;
 import java.net.URL;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
@@ -45,40 +45,31 @@ import org.eclipse.rse.core.model.ISystemProfile;
 import org.eclipse.rse.core.model.ISystemRegistry;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Test;
 import org.osgi.framework.FrameworkUtil;
 
 /**
- * The class <code>TraceControlUstProviderTests</code> contains UST provider handling
- * test cases.
+ * The class <code>TraceControlUstProviderTests</code> contains UST provider
+ * handling test cases.
  */
 @SuppressWarnings("nls")
-public class TraceControlUstProviderTests extends TestCase {
+public class TraceControlUstProviderTests {
 
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
+
     private static final String TEST_STREAM = "CreateTreeTest.cfg";
     private static final String SCEN_SCENARIO2_TEST = "Scenario2";
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private TraceControlTestFacility fFacility;
     private TestRemoteSystemProxy fProxy;
     private String fTestFile;
 
-    // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns test setup used when executing test case stand-alone.
-     * @return Test setup class
-     */
-    public static Test suite() {
-        return new ModelImplTestSetup(new TestSuite(TraceControlUstProviderTests.class));
-    }
-
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
@@ -88,9 +79,7 @@ public class TraceControlUstProviderTests extends TestCase {
      *
      * @throws Exception
      *         if the initialization fails for some reason
-     *
      */
-    @Override
     @Before
     public void setUp() throws Exception {
         fFacility = TraceControlTestFacility.getInstance();
@@ -102,14 +91,9 @@ public class TraceControlUstProviderTests extends TestCase {
 
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
      */
-    @Override
     @After
-    public void tearDown() throws Exception {
+    public void tearDown() {
         fFacility.waitForJobs();
     }
 
@@ -119,6 +103,7 @@ public class TraceControlUstProviderTests extends TestCase {
      * @throws Exception
      *             This will fail the test
      */
+    @Test
     public void testUstProviderTree() throws Exception {
 
         fProxy.setTestFile(fTestFile);
index 9856aa8ac0e6b6d5d1eb93b561bfe4e494424a86..ff46051714607ffc968baf08f09dd400d84bd6a8 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,18 +8,18 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
 
+import static org.junit.Assert.*;
+
 import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
@@ -47,40 +47,31 @@ import org.eclipse.rse.core.model.ISystemProfile;
 import org.eclipse.rse.core.model.ISystemRegistry;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Test;
 import org.osgi.framework.FrameworkUtil;
 
 /**
- * The class <code>TraceControlUstSessionTests</code> contains UST session/channel/event
- * handling test cases.
+ * The class <code>TraceControlUstSessionTests</code> contains UST
+ * session/channel/event handling test cases.
  */
 @SuppressWarnings("nls")
-public class TraceControlUstSessionTests extends TestCase {
+public class TraceControlUstSessionTests {
 
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
+
     private static final String TEST_STREAM = "CreateTreeTest.cfg";
     private static final String SCEN_SCENARIO4_TEST = "Scenario4";
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private TraceControlTestFacility fFacility;
     private TestRemoteSystemProxy fProxy;
     private String fTestFile;
 
-    // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns test setup used when executing test case stand-alone.
-     * @return Test setup class
-     */
-    public static Test suite() {
-        return new ModelImplTestSetup(new TestSuite(TraceControlUstSessionTests.class));
-    }
-
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
@@ -90,9 +81,7 @@ public class TraceControlUstSessionTests extends TestCase {
      *
      * @throws Exception
      *         if the initialization fails for some reason
-     *
      */
-    @Override
     @Before
     public void setUp() throws Exception {
         fFacility = TraceControlTestFacility.getInstance();
@@ -104,14 +93,9 @@ public class TraceControlUstSessionTests extends TestCase {
 
     /**
      * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
      */
-    @Override
     @After
-    public void tearDown()  throws Exception {
+    public void tearDown() {
         fFacility.waitForJobs();
     }
 
@@ -121,6 +105,7 @@ public class TraceControlUstSessionTests extends TestCase {
      * @throws Exception
      *             This will fail the test
      */
+    @Test
     public void testTraceSessionTree() throws Exception {
 
         fProxy.setTestFile(fTestFile);
index 7ad5ed2c168ae1dd105442f6b7f774b69d1c7ead..57d397c871bb157d0a7f6cd0a19b29df29cdd279 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,20 +8,21 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  *******************************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.service;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
-@SuppressWarnings("javadoc")
+/**
+ * Runner for the control.service unit tests.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    LTTngControlServiceTest.class
+})
 public class AllTests {
 
-    public static Test suite() {
-        TestSuite suite = new TestSuite(AllTests.class.getName());
-        //$JUnit-BEGIN$
-        suite.addTestSuite(LTTngControlServiceTest.class);
-        //$JUnit-END$
-        return suite;
-    }
 }
index 167dd7ef7f1ee853a2a0d4cfba5e9a34acaf66d7..d13c2ecdb390b9cad7a463cba9faeea0e3da6866 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,9 +8,13 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.ui.tests.control.service;
 
+import static org.junit.Assert.*;
+
 import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
@@ -18,8 +22,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import junit.framework.TestCase;
-
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.NullProgressMonitor;
@@ -42,12 +44,16 @@ import org.eclipse.linuxtools.internal.lttng2.stubs.shells.LTTngToolsFileShell;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlService;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlServiceFactory;
+import org.junit.Before;
+import org.junit.Test;
 import org.osgi.framework.FrameworkUtil;
+
 /**
- * The class <code>LTTngControlServiceTest</code> contains test for the class <code>{@link  LTTngControlService}</code>.
+ * The class <code>LTTngControlServiceTest</code> contains test for the class
+ * <code>{@link  LTTngControlService}</code>.
  */
 @SuppressWarnings({"nls", "javadoc"})
-public class LTTngControlServiceTest extends TestCase {
+public class LTTngControlServiceTest {
 
     private static final String DIRECTORY   = "testfiles";
     private static final String TEST_STREAM = "LTTngServiceTest.cfg";
@@ -81,28 +87,24 @@ public class LTTngControlServiceTest extends TestCase {
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private CommandShellFactory fShellFactory;
     private String fTestfile;
     private LTTngToolsFileShell fShell;
     private ILttngControlService fService;
 
-
-   // ------------------------------------------------------------------------
-    // Static methods
-    // ------------------------------------------------------------------------
-
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
+
     /**
      * Perform pre-test initialization.
      *
-     * @throws Exception if the initialization fails for some reason
-     *
+     * @throws Exception
+     *             if the initialization fails for some reason
      */
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         fShellFactory = CommandShellFactory.getInstance();
 
         URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
@@ -114,20 +116,11 @@ public class LTTngControlServiceTest extends TestCase {
         fService = new LTTngControlService(fShell);
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() throws Exception {
-    }
-
     // ------------------------------------------------------------------------
     // Test Cases
     // ------------------------------------------------------------------------
 
+    @Test
     public void testVersion() {
         try {
             fShell.setScenario(SCEN_LTTNG_VERSION);
@@ -139,6 +132,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testVersionWithPrompt() {
         try {
             fShell.setScenario(SCEN_LTTNG_VERSION_WITH_PROMPT);
@@ -150,6 +144,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testUnsupportedVersion() {
         try {
             fShell.setScenario(SCEN_LTTNG_UNSUPPORTED_VERSION);
@@ -160,6 +155,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testNoVersion() {
         try {
             fShell.setScenario(SCEN_LTTNG_NO_VERSION);
@@ -170,6 +166,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testLttngNotInstalled() {
         try {
             fShell.setScenario(SCEN_LTTNG_NOT_INSTALLED);
@@ -180,6 +177,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testGetSessionNames1() {
         try {
             fShell.setScenario(SCEN_NO_SESSION_AVAILABLE);
@@ -193,6 +191,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testGetSessionNames2() {
         try {
             fShell.setScenario(SCEN_GET_SESSION_NAMES1);
@@ -208,6 +207,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testGetSessionNotExist() {
         try {
             fShell.setScenario(SCEN_GET_SESSION_NAME_NOT_EXIST);
@@ -219,6 +219,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testGetSessionNameGarbage() {
         try {
             fShell.setScenario(SCEN_GET_SESSION_GARBAGE_OUT);
@@ -232,6 +233,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testGetSession1() {
         try {
             fShell.setScenario(SCEN_GET_SESSION1);
@@ -379,6 +381,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testGetKernelProviderNoKernel1() {
         try {
             fShell.setScenario(SCEN_LIST_WITH_NO_KERNEL1);
@@ -393,6 +396,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testGetKernelProviderNoKernel2() {
         try {
             fShell.setScenario(SCEN_LIST_WITH_NO_KERNEL2);
@@ -407,7 +411,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
-
+    @Test
     public void testGetUstProvider() {
         try {
             fShell.setScenario(SCEN_GET_UST_PROVIDER1);
@@ -462,6 +466,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testUstProvider2() {
         try {
             fShell.setScenario(SCEN_GET_UST_PROVIDER2);
@@ -475,6 +480,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testGetUstProvider3() {
         try {
             fShell.setScenario(SCEN_GET_UST_PROVIDER3);
@@ -551,6 +557,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testCreateSession() {
         try {
             fShell.setScenario(SCEN_CREATE_SESSION1);
@@ -566,6 +573,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testCreateSessionWithPrompt() {
         try {
             // First line has the shell prompt before the command output
@@ -584,7 +592,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
-
+    @Test
     public void testCreateSessionVariants() {
 
         fShell.setScenario(SCEN_CREATE_SESSION_VARIANTS);
@@ -635,6 +643,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testDestroySession() {
         try {
             fShell.setScenario(SCEN_DESTROY_SESSION1);
@@ -644,6 +653,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testCreateChannel() {
         try {
 
@@ -682,6 +692,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testDisableChannel() {
         try {
 
@@ -704,6 +715,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testEnableChannel() {
         try {
 
@@ -739,6 +751,7 @@ public class LTTngControlServiceTest extends TestCase {
 //        }
 //    }
 
+    @Test
     public void testEnableEvents() {
         try {
             // 1) session name, channel = null, 3 event names, kernel
@@ -777,6 +790,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testEnableSyscalls() {
         try {
             // 1) session name, channel = null, 3 event names, kernel
@@ -796,6 +810,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testDynamicProbe() {
         try {
             // 1) session name, channel = null, 3 event names, kernel
@@ -819,6 +834,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testEnableLogLevel() {
         try {
             // 1) session name, channel = null, 3 event names, kernel
@@ -842,6 +858,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testAddContext() {
         try {
             // 1) session name, channel = null, 3 event names, kernel
@@ -883,6 +900,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testAddContextFailure() {
 
         // 1) session name, channel = null, 3 event names, kernel
@@ -908,6 +926,7 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testCalibrate() {
         try {
             fShell.setScenario(SCEN_CALIBRATE_HANDLING);
@@ -918,8 +937,8 @@ public class LTTngControlServiceTest extends TestCase {
         }
     }
 
+    @Test
     public void testCalibrateFailure() {
-
         try {
             fShell.setScenario(SCEN_CALIBRATE_HANDLING);
             fService.calibrate(false, new NullProgressMonitor());
This page took 0.093218 seconds and 5 git commands to generate.