IGNITE-7708 Debug

Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d08d0073
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d08d0073
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d08d0073

Branch: refs/heads/ignite-7708
Commit: d08d0073dfb12d3793f70e020e9be2a3c88e8c66
Parents: b121a9f
Author: Alexey Goncharuk <alexey.goncha...@gmail.com>
Authored: Tue Apr 17 18:24:36 2018 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Tue Apr 17 18:24:36 2018 +0300

----------------------------------------------------------------------
 .../testframework/junits/GridAbstractTest.java  | 22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d08d0073/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
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 2bd4ba1..1b72306 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
@@ -612,7 +612,7 @@ public abstract class GridAbstractTest extends TestCase {
             catch (Exception | Error t) {
                 t.printStackTrace();
 
-                
getTestCounters().setStopped(getTestCounters().getNumberOfTests() - 1);
+                getTestCounters().setClassInitializationFailedException(t);
 
                 try {
                     tearDown();
@@ -629,6 +629,8 @@ public abstract class GridAbstractTest extends TestCase {
         info(">>> Starting test: " + testDescription() + " <<<");
 
         try {
+            getTestCounters().checkClassInitialized();
+
             beforeTest();
         }
         catch (Exception | Error t) {
@@ -1687,7 +1689,9 @@ public abstract class GridAbstractTest extends TestCase {
         finally {
             serializedObj.clear();
 
-            if (isLastTest()) {
+            boolean lastTest = isLastTest();
+
+            if (lastTest) {
                 info(">>> Stopping test class: " + testClassDescription() + " 
<<<");
 
                 TestCounters counters = getTestCounters();
@@ -1725,7 +1729,7 @@ public abstract class GridAbstractTest extends TestCase {
 
             cleanReferences();
 
-           if (isLastTest() && isSafeTopology() && stopGridErr)
+           if (lastTest && isSafeTopology() && stopGridErr)
                throw new RuntimeException("Not all Ignite instances has been 
stopped. Please, see log for details.");
         }
     }
@@ -2403,7 +2407,7 @@ public abstract class GridAbstractTest extends TestCase {
         private boolean reset;
 
         /** */
-        private Exception clsInitFailEx;
+        private Throwable clsInitFailEx;
 
         /** */
         private IgniteTestResources rsrcs;
@@ -2476,11 +2480,19 @@ public abstract class GridAbstractTest extends TestCase 
{
         /**
          * @param clsInitFailEx Class initialization failed exception.
          */
-        public void setClassInitializationFailedException(Exception 
clsInitFailEx) {
+        public void setClassInitializationFailedException(Throwable 
clsInitFailEx) {
             this.clsInitFailEx = clsInitFailEx;
         }
 
         /**
+         * @throws IgniteCheckedException If test class initialization failed.
+         */
+        public void checkClassInitialized() throws IgniteCheckedException {
+            if (clsInitFailEx != null)
+                throw new IgniteCheckedException("Test class initialization 
failed", clsInitFailEx);
+        }
+
+        /**
          * @param stopped Stopped flag.
          */
         public void setStopped(int stopped) {

Reply via email to