ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [4/5] ignite git commit: ignite-db-x cosmetic refactoring
Date Tue, 31 Jan 2017 15:01:08 GMT
ignite-db-x cosmetic refactoring


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

Branch: refs/heads/ignite-3477
Commit: 9773ea74d8f8827feeea6552509c46c23bf54d76
Parents: 087c406
Author: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Authored: Tue Jan 31 17:58:45 2017 +0300
Committer: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Committed: Tue Jan 31 17:58:45 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/IgniteUtils.java       | 16 +++++++++++
 .../junits/common/GridCommonAbstractTest.java   | 30 +++++++++++++-------
 2 files changed, 35 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9773ea74/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index b077666..1be9f75 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -7961,6 +7961,22 @@ public abstract class IgniteUtils {
     }
 
     /**
+     * Check that field exist.
+     *
+     * @param obj Object.
+     * @param fieldName Field name.
+     * @return Boolean flag.
+     */
+    public static boolean hasField(Object obj, String fieldName){
+        try {
+            field(obj, fieldName);
+
+            return true;
+        }catch (IgniteException e){
+            return false;
+        }
+    }
+    /**
      * Gets object field offset.
      *
      * @param cls Object class.

http://git-wip-us.apache.org/repos/asf/ignite/blob/9773ea74/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
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 1fc105c..48189f7 100644
--- 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
@@ -720,6 +720,8 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
 
         StringBuilder sb = new StringBuilder();
 
+        sb.append("----preload sync futures----\n");
+
         for (Ignite ig : G.allGrids()) {
             IgniteKernal k = ((IgniteKernal)ig);
 
@@ -727,13 +729,15 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
                 .preloader()
                 .syncFuture();
 
-            sb.append("nodeId = ")
+            sb.append("nodeId=")
                 .append(k.context().localNodeId())
-                .append(" preload sync future isDone=")
+                .append(" isDone=")
                 .append(syncFut.isDone())
                 .append("\n");
         }
 
+        sb.append("----rebalance futures----\n");
+
         for (Ignite ig : G.allGrids()) {
             IgniteKernal k = ((IgniteKernal)ig);
 
@@ -742,21 +746,23 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
                 .rebalanceFuture();
 
             try {
-                sb.append("nodeId = ").append(k.context().localNodeId())
-                    .append(" rebalance future isDone=").append(f.isDone())
+                sb.append("nodeId=").append(k.context().localNodeId())
+                    .append(" isDone=").append(f.isDone())
                     .append(" res=").append(f.isDone() ? f.get() : "N/A")
-                    .append(" topVer=").append(U.field(f, "topVer"))
+                    .append(" topVer=")
+                    .append((U.hasField(f, "topVer") ?
+                        U.field(f, "topVer") : "[unknown] may be it is finished future"))
                     .append("\n");
 
                 Map<UUID, T2<Long, Collection<Integer>>> remaining = U.field(f,
"remaining");
 
-                sb.append("remaining:\n");
+                sb.append("remaining:");
 
                 if (remaining.isEmpty())
                     sb.append("empty\n");
                 else
                     for (Map.Entry<UUID, T2<Long, Collection<Integer>>>
e : remaining.entrySet())
-                        sb.append("uuid=").append(e.getKey())
+                        sb.append("\nuuid=").append(e.getKey())
                             .append(" startTime=").append(e.getValue().getKey())
                             .append(" parts=").append(Arrays.toString(e.getValue().getValue().toArray()))
                             .append("\n");
@@ -767,11 +773,13 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
             }
         }
 
+        sb.append("----partition state----\n");
+
         for (Ignite g : G.allGrids()) {
             IgniteKernal g0 = (IgniteKernal)g;
 
-            sb.append("grid=").append(g0.name())
-                .append(" localNodeId=").append(g0.localNode().id())
+            sb.append("localNodeId=").append(g0.localNode().id())
+                .append(" grid=").append(g0.name())
                 .append("\n");
 
             GridDhtPartitionTopology top = dht(cache).topology();
@@ -790,7 +798,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
 
                 for (UUID nodeId : F.nodeIds(g0.context().discovery().allNodes())) {
                     if (!nodeId.equals(g0.localNode().id()))
-                        sb.append(" nodeId=")
+                        sb.append(" nodeId = ")
                             .append(nodeId)
                             .append(" part=")
                             .append(p)
@@ -803,7 +811,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
             sb.append("\n");
         }
 
-        log.info("dump partition state for " + cfg.getName() + ":\n" + sb.toString());
+        log.info("dump partitions state for <" + cfg.getName() + ">:\n" + sb.toString());
     }
 
     /**


Mime
View raw message