You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2019/04/02 08:22:59 UTC
[ignite] branch master updated: IGNITE-11411 Remove tearDown,
setUp from JUnit3TestLegacySupport (#6227)
This is an automated email from the ASF dual-hosted git repository.
av pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 0ce456d IGNITE-11411 Remove tearDown, setUp from JUnit3TestLegacySupport (#6227)
0ce456d is described below
commit 0ce456d5afede67a2f84d4745a8fde3fd590aa5c
Author: Ivan Fedotov <va...@gmail.com>
AuthorDate: Tue Apr 2 11:22:50 2019 +0300
IGNITE-11411 Remove tearDown, setUp from JUnit3TestLegacySupport (#6227)
---
.../cache/CacheGetRemoveSkipStoreTest.java | 4 +-
.../processors/cache/CacheRemoveAllSelfTest.java | 4 +-
.../cache/GridCacheVariableTopologySelfTest.java | 4 +-
...IgniteCacheInvokeReadThroughSingleNodeTest.java | 4 +-
.../cache/IgniteCacheInvokeReadThroughTest.java | 4 +-
.../IgniteCacheReadThroughEvictionSelfTest.java | 4 +-
.../GridCacheMultiNodeLockAbstractTest.java | 4 +-
.../GridCacheNodeFailureAbstractTest.java | 9 +-
.../IgniteTxRemoveTimeoutObjectsTest.java | 4 +-
.../near/GridCachePartitionedEventSelfTest.java | 4 +-
.../transactions/TxRollbackAsyncNearCacheTest.java | 4 +-
.../tcp/GridTcpCommunicationSpiLanLoadTest.java | 2 -
.../spi/discovery/AbstractDiscoverySelfTest.java | 2 -
.../testframework/junits/GridAbstractTest.java | 206 +++++++++++----------
.../junits/JUnit3TestLegacySupport.java | 33 +---
.../junits/common/GridCommonAbstractTest.java | 4 +-
.../junits/spi/GridSpiAbstractTest.java | 12 +-
.../util/mbeans/GridMBeanDisableSelfTest.java | 8 +-
18 files changed, 140 insertions(+), 176 deletions(-)
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetRemoveSkipStoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetRemoveSkipStoreTest.java
index a4e8969..5d010bc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetRemoveSkipStoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetRemoveSkipStoreTest.java
@@ -83,10 +83,10 @@ public class CacheGetRemoveSkipStoreTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override public void beforeTest() throws Exception {
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
- super.setUp();
+ super.beforeTest();
}
/** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
index 27cab8f..92d681d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
@@ -33,10 +33,10 @@ import org.apache.ignite.testframework.MvccFeatureChecker;
*/
public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest {
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10082", MvccFeatureChecker.forcedMvcc());
- super.setUp();
+ super.beforeTest();
}
/** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
index e37027d..7e0281f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
@@ -50,10 +50,10 @@ public class GridCacheVariableTopologySelfTest extends GridCommonAbstractTest {
private static final Random RAND = new Random();
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7388", MvccFeatureChecker.forcedMvcc());
- super.setUp();
+ super.beforeTest();
}
/** Constructs test. */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
index 74f07ce..836e2e2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
@@ -33,10 +33,10 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
*/
public class IgniteCacheInvokeReadThroughSingleNodeTest extends IgniteCacheInvokeReadThroughAbstractTest {
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
- super.setUp();
+ super.beforeTest();
}
/** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
index cfa90e6..4fac5a8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
@@ -32,10 +32,10 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
*/
public class IgniteCacheInvokeReadThroughTest extends IgniteCacheInvokeReadThroughAbstractTest {
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
- super.setUp();
+ super.beforeTest();
}
/** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java
index 2e96026..a349e7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java
@@ -50,10 +50,10 @@ public class IgniteCacheReadThroughEvictionSelfTest extends IgniteCacheConfigVar
private static final int KEYS = 100;
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
- super.setUp();
+ super.beforeTest();
}
/** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
index 8b96419..50b4aa6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
@@ -60,11 +60,11 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
private static Collection<IgnitePredicate<Event>> lsnrs = new ArrayList<>();
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
- super.setUp();
+ super.beforeTest();
}
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
index 47116c4..2f5c822 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
@@ -71,13 +71,6 @@ public abstract class GridCacheNodeFailureAbstractTest extends GridCommonAbstrac
/** Grid instances. */
private static final List<Ignite> IGNITEs = new ArrayList<>();
- /** {@inheritDoc} */
- @Override public void setUp() throws Exception {
- MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
-
- super.setUp();
- }
-
/**
* Start grid by default.
*/
@@ -113,6 +106,8 @@ public abstract class GridCacheNodeFailureAbstractTest extends GridCommonAbstrac
* @throws Exception If failed.
*/
@Override protected void beforeTest() throws Exception {
+ MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
for (int i = 0; i < GRID_CNT; i++) {
if (Ignition.state(IGNITEs.get(i).name()) == STOPPED) {
info("Restarting grid: " + i);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxRemoveTimeoutObjectsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxRemoveTimeoutObjectsTest.java
index 4c04ed9..da30dd0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxRemoveTimeoutObjectsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxRemoveTimeoutObjectsTest.java
@@ -59,13 +59,13 @@ public class IgniteTxRemoveTimeoutObjectsTest extends GridCacheAbstractSelfTest
}
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7388", MvccFeatureChecker.forcedMvcc());
if (nearEnabled())
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
- super.setUp();
+ super.beforeTest();
}
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java
index 1bb0995..008508c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java
@@ -32,10 +32,10 @@ import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
*/
public class GridCachePartitionedEventSelfTest extends GridCacheEventAbstractTest {
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
- super.setUp();
+ super.beforeTest();
}
/** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java
index 034a9b6..99fd542 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java
@@ -29,9 +29,9 @@ public class TxRollbackAsyncNearCacheTest extends TxRollbackAsyncTest {
}
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
- super.setUp();
+ super.beforeTest();
}
}
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiLanLoadTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiLanLoadTest.java
index 19f8d16..b4bc2e9 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiLanLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiLanLoadTest.java
@@ -272,8 +272,6 @@ public class GridTcpCommunicationSpiLanLoadTest extends GridSpiAbstractTest<TcpC
spi.spiStop();
spiRsrc.stopThreads();
-
- tearDown();
}
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
index bd3bf6c..eeb3db8 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
@@ -531,8 +531,6 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
httpAdaptors.clear();
spiStartTime = 0;
-
- tearDown();
}
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 6b878c5..8c059b2 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -182,7 +182,7 @@ public abstract class GridAbstractTest extends JUnit3TestLegacySupport {
@Override public void evaluate() throws Throwable {
assert getName() != null : "getName returned null";
- runTestCase(base);
+ runTest(base);
}
};
@@ -541,44 +541,6 @@ public abstract class GridAbstractTest extends JUnit3TestLegacySupport {
U.resolveWorkDirectory(U.defaultWorkDirectory(), "binary_meta", true);
}
- /**
- * {@inheritDoc}
- * <p>
- * Do not annotate with Before in overriding methods.</p>
- * @deprecated This method is deprecated. Instead of invoking or overriding it, it is recommended to make your own
- * method with {@code @Before} annotation.
- */
- @Deprecated
- @Override protected void setUp() throws Exception {
- stopGridErr = false;
-
- clsLdr = Thread.currentThread().getContextClassLoader();
-
- // Change it to the class one.
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- // Clear log throttle.
- LT.clear();
-
- info(">>> Starting test: " + testDescription() + " <<<");
-
- try {
- beforeTest();
- }
- catch (Exception | Error t) {
- try {
- tearDown();
- }
- catch (Exception e) {
- log.error("Failed to tear down test after exception was thrown in beforeTest (will ignore)", e);
- }
-
- throw t;
- }
-
- ts = System.currentTimeMillis();
- }
-
/** */
private void beforeFirstTest() throws Exception {
sharedStaticIpFinder = new TcpDiscoveryVmIpFinder(true);
@@ -1791,33 +1753,6 @@ public abstract class GridAbstractTest extends JUnit3TestLegacySupport {
}
}
- /**
- * {@inheritDoc}
- * <p>
- * Do not annotate with After in overriding methods.</p>
- * @deprecated This method is deprecated. Instead of invoking or overriding it, it is recommended to make your own
- * method with {@code @After} annotation.
- */
- @Deprecated
- @Override protected void tearDown() throws Exception {
- long dur = System.currentTimeMillis() - ts;
-
- info(">>> Stopping test: " + testDescription() + " in " + dur + " ms <<<");
-
- try {
- afterTest();
- }
- finally {
- serializedObj.clear();
-
- Thread.currentThread().setContextClassLoader(clsLdr);
-
- clsLdr = null;
-
- cleanReferences();
- }
- }
-
/** */
private void afterLastTest() throws Exception {
info(">>> Stopping test class: " + testClassDescription() + " <<<");
@@ -2096,60 +2031,131 @@ public abstract class GridAbstractTest extends JUnit3TestLegacySupport {
return new IgniteTestResources(cfg);
}
- /** {@inheritDoc} */
- @Override void runTest(Statement testRoutine) throws Throwable {
- final AtomicReference<Throwable> ex = new AtomicReference<>();
+ /** Runs test with the provided scenario. */
+ private void runTest(Statement testRoutine) throws Throwable {
+ setUp();
+
+ try {
+ final AtomicReference<Throwable> ex = new AtomicReference<>();
- Thread runner = new IgniteThread(getTestIgniteInstanceName(), "test-runner", new Runnable() {
- @Override public void run() {
- try {
- testRoutine.evaluate();
- }
- catch (Throwable e) {
- IgniteClosure<Throwable, Throwable> hnd = errorHandler();
+ Thread runner = new IgniteThread(getTestIgniteInstanceName(), "test-runner", new Runnable() {
+ @Override public void run() {
+ try {
+ testRoutine.evaluate();
+ }
+ catch (Throwable e) {
+ IgniteClosure<Throwable, Throwable> hnd = errorHandler();
- ex.set(hnd != null ? hnd.apply(e) : e);
+ ex.set(hnd != null ? hnd.apply(e) : e);
+ }
}
- }
- });
+ });
- runner.start();
+ runner.start();
- runner.join(isDebug() ? 0 : getTestTimeout());
+ runner.join(isDebug() ? 0 : getTestTimeout());
- if (runner.isAlive()) {
- U.error(log,
- "Test has been timed out and will be interrupted (threads dump will be taken before interruption) [" +
- "test=" + getName() + ", timeout=" + getTestTimeout() + ']');
+ if (runner.isAlive()) {
+ U.error(log,
+ "Test has been timed out and will be interrupted (threads dump will be taken before interruption) [" +
+ "test=" + getName() + ", timeout=" + getTestTimeout() + ']');
- List<Ignite> nodes = IgnitionEx.allGridsx();
+ List<Ignite> nodes = IgnitionEx.allGridsx();
- for (Ignite node : nodes)
- ((IgniteKernal)node).dumpDebugInfo();
+ for (Ignite node : nodes)
+ ((IgniteKernal)node).dumpDebugInfo();
- // We dump threads to stdout, because we can loose logs in case
- // the build is cancelled on TeamCity.
- U.dumpThreads(null);
+ // We dump threads to stdout, because we can loose logs in case
+ // the build is cancelled on TeamCity.
+ U.dumpThreads(null);
- U.dumpThreads(log);
+ U.dumpThreads(log);
- U.interrupt(runner);
+ U.interrupt(runner);
- U.join(runner, log);
+ U.join(runner, log);
- throw new TimeoutException("Test has been timed out [test=" + getName() + ", timeout=" +
- getTestTimeout() + ']');
+ throw new TimeoutException("Test has been timed out [test=" + getName() + ", timeout=" +
+ getTestTimeout() + ']');
+ }
+
+ Throwable t = ex.get();
+
+ if (t != null) {
+ U.error(log, "Test failed.", t);
+
+ throw t;
+ }
+
+ assert !stopGridErr : "Error occurred on grid stop (see log for more details).";
+ }
+ finally {
+ try {
+ tearDown();
+ }
+ catch (Exception e) {
+ log.error("Failed to execute tear down after test (will ignore)", e);
+ }
}
+ }
- Throwable t = ex.get();
+ /**
+ * Runs before each test.
+ *
+ * @throws Exception If failed.
+ */
+ private void setUp() throws Exception {
+ stopGridErr = false;
+
+ clsLdr = Thread.currentThread().getContextClassLoader();
- if (t != null) {
- U.error(log, "Test failed.", t);
+ // Change it to the class one.
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ // Clear log throttle.
+ LT.clear();
+
+ info(">>> Starting test: " + testDescription() + " <<<");
+
+ try {
+ beforeTest();
+ }
+ catch (Exception | Error t) {
+ try {
+ tearDown();
+ }
+ catch (Exception e) {
+ log.error("Failed to tear down test after exception was thrown in beforeTest (will ignore)", e);
+ }
throw t;
}
- assert !stopGridErr : "Error occurred on grid stop (see log for more details).";
+ ts = System.currentTimeMillis();
+ }
+
+ /**
+ * Runs after each test.
+ *
+ * @throws Exception If failed.
+ */
+ private void tearDown() throws Exception {
+ long dur = System.currentTimeMillis() - ts;
+
+ info(">>> Stopping test: " + testDescription() + " in " + dur + " ms <<<");
+
+ try {
+ afterTest();
+ }
+ finally {
+ serializedObj.clear();
+
+ Thread.currentThread().setContextClassLoader(clsLdr);
+
+ clsLdr = null;
+
+ cleanReferences();
+ }
}
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnit3TestLegacySupport.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnit3TestLegacySupport.java
index 5e492fd..a5ded51 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnit3TestLegacySupport.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnit3TestLegacySupport.java
@@ -28,7 +28,7 @@ import org.junit.runners.model.Statement;
*/
@SuppressWarnings({"TransientFieldInNonSerializableClass", "ExtendsUtilityClass"})
@Deprecated
-public abstract class JUnit3TestLegacySupport extends JUnitAssertAware {
+public class JUnit3TestLegacySupport extends JUnitAssertAware {
/**
* Supports obtaining test name for JUnit4 framework in a way that makes it available for legacy methods invoked
* from {@code runTest(Statement)}.
@@ -44,37 +44,6 @@ public abstract class JUnit3TestLegacySupport extends JUnitAssertAware {
return nameRule.getMethodName();
}
- /** This method is called before a test is executed. */
- abstract void setUp() throws Exception;
-
- /** Runs test code in between {@code setUp} and {@code tearDown}. */
- abstract void runTest(Statement testRoutine) throws Throwable;
-
- /** This method is called after a test is executed. */
- abstract void tearDown() throws Exception;
-
- /**
- * Runs the bare test sequence like in JUnit 3 class TestCase.
- *
- * @throws Throwable if any exception is thrown
- */
- protected final void runTestCase(Statement testRoutine) throws Throwable {
- Throwable e = null;
- setUp();
- try {
- runTest(testRoutine);
- } catch (Throwable running) {
- e = running;
- } finally {
- try {
- tearDown();
- } catch (Throwable tearingDown) {
- if (e == null) e = tearingDown;
- }
- }
- if (e != null) throw e;
- }
-
/**
* Called before execution of every test method in class.
* <p>
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 58f8712..6267730 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -503,7 +503,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
}
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
// Disable SSL hostname verifier.
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
@Override public boolean verify(String s, SSLSession sslSes) {
@@ -511,7 +511,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
}
});
- super.setUp();
+ super.beforeTest();
}
/** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
index d6741dd..0a007bc 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
@@ -145,17 +145,15 @@ public abstract class GridSpiAbstractTest<T extends IgniteSpi> extends GridAbstr
tests.put(getClass(), new TestData<T>());
}
- /**
- * @throws Exception If failed.
- */
- @Override public final void setUp() throws Exception {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
// Need to change classloader here, although it also handled in the parent class
// the current test initialisation procedure doesn't allow us to setUp the parent first.
cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- super.setUp();
+ super.beforeTest();
}
/** */
@@ -506,8 +504,8 @@ public abstract class GridSpiAbstractTest<T extends IgniteSpi> extends GridAbstr
/**
* @throws Exception If failed.
*/
- @Override public final void tearDown() throws Exception {
- super.tearDown();
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
Thread.currentThread().setContextClassLoader(cl);
}
diff --git a/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanDisableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanDisableSelfTest.java
index 23e7507..500d7bb 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanDisableSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanDisableSelfTest.java
@@ -34,17 +34,17 @@ import org.junit.Test;
*/
public class GridMBeanDisableSelfTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
- @Override public void setUp() throws Exception {
+ @Override protected void beforeTest() throws Exception {
IgniteUtils.IGNITE_MBEANS_DISABLED = true;
- super.setUp();
+ super.beforeTest();
}
/** {@inheritDoc} */
- @Override public void tearDown() throws Exception {
+ @Override protected void afterTest() throws Exception {
IgniteUtils.IGNITE_MBEANS_DISABLED = false;
- super.tearDown();
+ super.afterTest();
}
/**