ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [05/41] ignite git commit: ignite-613: test is reworked. However, the replicated iterator is broken. This functionality must be fixed before unmuting the test.
Date Mon, 14 Sep 2015 23:12:46 GMT
ignite-613: test is reworked. However, the replicated iterator is broken. This functionality
must be fixed before unmuting the test.


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

Branch: refs/heads/ignite-1400
Commit: b8be85d5dcacfef1e1f04d9f132f8012239825ce
Parents: b5d8545
Author: Denis Magda <dmagda@gridgain.com>
Authored: Fri Sep 11 10:39:38 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Fri Sep 11 10:39:38 2015 +0300

----------------------------------------------------------------------
 .../IgniteCacheReplicatedQuerySelfTest.java     | 49 +++++++-------------
 1 file changed, 16 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b8be85d5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
index d0cce4a..9c52f92 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
@@ -46,6 +46,7 @@ import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.typedef.F;
@@ -355,52 +356,36 @@ public class IgniteCacheReplicatedQuerySelfTest extends IgniteCacheAbstractQuery
     }
 
     /**
-     * TODO: IGNITE-613.
-     *
      * @throws Exception If failed.
      */
     public void testNodeLeft() throws Exception {
-        // Test works long and fails after. Should be enabled after fix.
         fail("https://issues.apache.org/jira/browse/IGNITE-613");
-        
+
+        Ignite g = startGrid("client");
+
         try {
-            Ignite g = startGrid();
+            assertTrue(g.configuration().isClientMode());
 
             IgniteCache<Integer, Integer> cache = g.cache(null);
 
             for (int i = 0; i < 1000; i++)
                 cache.put(i, i);
 
-            QueryCursor<Cache.Entry<Integer, Integer>> q =
-                cache.query(new SqlQuery<Integer, Integer>(Integer.class, "_key >=
0 order by _key"));
-
-            assertEquals(0, (int) q.iterator().next().getKey());
-
-            final ConcurrentMap<UUID, Map<Long, GridFutureAdapter<GridCloseableIterator<
-                IgniteBiTuple<Integer, Integer>>>>> map =
-                U.field(((IgniteKernal)grid(0)).internalCache().context().queries(), "qryIters");
-
-            // fut.nextX() does not guarantee the request has completed on remote node
-            // (we could receive page from local one), so we need to wait.
-            assertTrue(GridTestUtils.waitForCondition(new PA() {
-                @Override public boolean apply() {
-                    return map.size() == 1;
-                }
-            }, getTestTimeout()));
-
-            Map<Long, GridFutureAdapter<GridCloseableIterator<IgniteBiTuple<Integer,
Integer>>>> futs =
-                map.get(g.cluster().localNode().id());
+            // Client cache should be empty.
+            assertEquals(0, cache.localSize());
 
-            assertEquals(1, futs.size());
+            QueryCursor<Cache.Entry<Integer, Integer>> q =
+                cache.query(new SqlQuery<Integer, Integer>(Integer.class, "_key >=
0 order by _key").setPageSize(10));
 
-            GridCloseableIterator<IgniteBiTuple<Integer, Integer>> iter =
-                (GridCloseableIterator<IgniteBiTuple<Integer, Integer>>)((IgniteInternalFuture)F.first(futs.values()).get()).get();
+            assertEquals(0, (int)q.iterator().next().getKey());
 
-            ResultSet rs = U.field(iter, "data");
+            ConcurrentMap<UUID, ConcurrentMap<Long, ?>> map = U.field(((IgniteH2Indexing)U.field(U.field(
+                grid(0).context(), "qryProc"), "idx")).mapQueryExecutor(), "qryRess");
 
-            assertFalse(rs.isClosed());
+            assertEquals(1, map.size());
 
             final UUID nodeId = g.cluster().localNode().id();
+
             final CountDownLatch latch = new CountDownLatch(1);
 
             grid(0).events().localListen(new IgnitePredicate<Event>() {
@@ -412,16 +397,14 @@ public class IgniteCacheReplicatedQuerySelfTest extends IgniteCacheAbstractQuery
                 }
             }, EVT_NODE_LEFT);
 
-            stopGrid();
+            stopGrid("client");
 
             latch.await();
 
             assertEquals(0, map.size());
-            assertTrue(rs.isClosed());
         }
         finally {
-            // Ensure that additional node is stopped.
-            stopGrid();
+            stopGrid("client");
         }
     }
 


Mime
View raw message