public class AllTests {
public static Test suite() {
- // Create instance of the test facility for the TmfUml2SD test
- Uml2SDTestFacility.getInstance().init(true);
-
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite(TmfUml2SDSyncLoaderExpTest.class);
suite.addTestSuite(TmfUml2SDSyncLoaderFindTest.class);
suite.addTestSuite(TmfUml2SDSyncLoaderFilterTest.class);
//$JUnit-END$
- return suite;
+ return new Uml2SDTestSetup(suite);
}
}
import java.util.List;
+import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.eclipse.linuxtools.tmf.signal.TmfSignalManager;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDAdvancedPagingProvider;
// ------------------------------------------------------------------------
private Uml2SDTestFacility fFacility;
+ // ------------------------------------------------------------------------
+ // Static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns test setup used when executing test case stand-alone.
+ * @return Test setup class
+ */
+ public static Test suite() {
+ return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderExpTest.class));
+ }
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void setUp() throws Exception {
super.setUp();
fFacility = Uml2SDTestFacility.getInstance();
- fFacility.init(false);
// create filter criteria (incl. save)
fFacility.createFilterCriteria();
fFacility.selectExperiment();
@Override
public void tearDown() throws Exception {
- fFacility.dispose();
fFacility = null;
super.tearDown();
}
import java.util.ArrayList;
import java.util.List;
+import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage;
// ------------------------------------------------------------------------
private Uml2SDTestFacility fFacility;
+ // ------------------------------------------------------------------------
+ // Static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns test setup used when executing test case stand-alone.
+ * @return Test setup class
+ */
+ public static Test suite() {
+ return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderFilterTest.class));
+ }
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void setUp() throws Exception {
super.setUp();
fFacility = Uml2SDTestFacility.getInstance();
- fFacility.init(false);
fFacility.selectExperiment();
}
@Override
public void tearDown() throws Exception {
fFacility.disposeExperiment();
- fFacility.dispose();
fFacility = null;
super.tearDown();
}
import java.util.List;
+import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
private Uml2SDTestFacility fFacility;
private Uml2SDSignalValidator fTmfComponent;
+ // ------------------------------------------------------------------------
+ // Static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns test setup used when executing test case stand-alone.
+ * @return Test setup class
+ */
+ public static Test suite() {
+ return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderFindTest.class));
+ }
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void setUp() throws Exception {
super.setUp();
fFacility = Uml2SDTestFacility.getInstance();
- fFacility.init(false);
fFacility.selectExperiment();
}
@Override
public void tearDown() throws Exception {
fFacility.disposeExperiment();
- fFacility.dispose();
fFacility = null;
super.tearDown();
}
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.impl;
+import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
// ------------------------------------------------------------------------
private Uml2SDTestFacility fFacility;
+ // ------------------------------------------------------------------------
+ // Static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns test setup used when executing test case stand-alone.
+ * @return Test setup class
+ */
+ public static Test suite() {
+ return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderPagesTest.class));
+ }
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void setUp() throws Exception {
super.setUp();
fFacility = Uml2SDTestFacility.getInstance();
- fFacility.init(false);
fFacility.selectExperiment();
}
@Override
public void tearDown() throws Exception {
fFacility.disposeExperiment();
- fFacility.dispose();
fFacility = null;
super.tearDown();
}
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.impl;
+import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
// ------------------------------------------------------------------------
private Uml2SDTestFacility fFacility;
private Uml2SDSignalValidator fTmfComponent;
+
+ // ------------------------------------------------------------------------
+ // Static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns test setup used when executing test case stand-alone.
+ * @return Test setup class
+ */
+ public static Test suite() {
+ return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderSignalTest.class));
+ }
// ------------------------------------------------------------------------
// Constructors
public void setUp() throws Exception {
super.setUp();
fFacility = Uml2SDTestFacility.getInstance();
- fFacility.init(false);
fFacility.selectExperiment();
}
@Override
public void tearDown() throws Exception {
fFacility.disposeExperiment();
- fFacility.dispose();
fFacility = null;
super.tearDown();
}
import java.util.List;
+import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
private Uml2SDTestFacility fFacility;
+ // ------------------------------------------------------------------------
+ // Static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns test setup used when executing test case stand-alone.
+ * @return Test setup class
+ */
+ public static Test suite() {
+ return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderTimeTest.class));
+ }
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void setUp() throws Exception {
super.setUp();
fFacility = Uml2SDTestFacility.getInstance();
- fFacility.init(false);
fFacility.selectExperiment();
}
@Override
public void tearDown() throws Exception {
fFacility.disposeExperiment();
- fFacility.dispose();
fFacility = null;
super.tearDown();
}
private TmfExperiment<TmfEvent> fExperiment = null;
private boolean fIsInitialized = false;
- private boolean fIsGlobalTest = false;
// ------------------------------------------------------------------------
// Constructors
/**
* Initial the test facility.
- * @param isGlobal true if multiple test cases are run in sequence (AllTests) or false for a single test case
*/
- public void init(boolean isGlobal) {
+ public void init() {
if (!fIsInitialized) {
- fIsGlobalTest = isGlobal;
fParser = new TmfUml2SDTestTrace();
fTrace = setupTrace(fParser);
* Dispose the resource
*/
public void dispose() {
- if (fIsInitialized && !fIsGlobalTest) {
+ if (fIsInitialized) {
fExperiment.dispose();
// Wait for all Eclipse jobs to finish
* Selects the experiment.
* @param wait true to wait for indexing to finish else false
*/
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public void selectExperiment(boolean wait) {
fTrace = setupTrace(fParser);
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.impl;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+/**
+ * Test setup class for one-time setUp() and tearDown() across test cases.
+ */
+public class Uml2SDTestSetup extends TestSetup {
+
+ public Uml2SDTestSetup(Test test) {
+ super(test);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see junit.extensions.TestSetup#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ Uml2SDTestFacility.getInstance().init();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see junit.extensions.TestSetup#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ Uml2SDTestFacility.getInstance().dispose();
+ }
+
+}