ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [25/50] [abbrv] incubator-ignite git commit: ignite-53: merge from ignite-1
Date Wed, 21 Jan 2015 09:34:15 GMT
ignite-53: merge from ignite-1


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

Branch: refs/heads/ignite-99
Commit: 05b329528598a99ac5d87623a9a304edcd11c408
Parents: ae4cbca 1a2e7d4
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Mon Jan 19 13:42:54 2015 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Mon Jan 19 13:42:54 2015 +0300

----------------------------------------------------------------------
 LICENSE.txt                                     | 202 ++++++++++++++
 apache-2.0.txt                                  | 202 --------------
 .../java/org/apache/ignite/IgniteCache.java     |   4 +-
 .../processors/cache/IgniteCacheProxy.java      |  76 +++++-
 .../ignite/portables/PortableRawReader.java     |   2 +-
 .../grid/dotnet/GridDotNetConfiguration.java    |  14 +-
 .../dotnet/GridDotNetPortableConfiguration.java |  28 +-
 .../GridDotNetPortableTypeConfiguration.java    |  15 +-
 .../org/gridgain/grid/kernal/GridGainEx.java    |  76 ++++--
 .../grid/kernal/GridNodeAttributes.java         |   5 +-
 .../processors/cache/CacheInvokeEntry.java      |  14 +
 .../processors/cache/GridCacheAdapter.java      |  18 +-
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../processors/cache/GridCacheEntryImpl.java    |   2 +-
 .../processors/cache/GridCacheMapEntry.java     |  17 +-
 .../GridCacheContinuousQueryAdapter.java        |  13 +-
 .../GridCacheContinuousQueryFilterEx.java       |  32 +++
 .../GridCacheContinuousQueryHandler.java        |  17 +-
 .../GridCacheContinuousQueryHandlerV3.java      |  61 +++++
 .../GridCacheContinuousQueryHandlerV4.java      |  61 +++++
 .../GridCacheContinuousQueryListener.java       |   5 +
 .../GridCacheContinuousQueryManager.java        |  55 +++-
 .../cache/transactions/IgniteTxAdapter.java     |  22 +-
 .../interop/GridInteropProcessorAdapter.java    |   3 -
 .../tcp/GridCacheDhtLockBackupSelfTest.java     |  18 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java | 271 ++++---------------
 .../cache/GridCacheBasicApiAbstractTest.java    |  91 ++++---
 .../GridCacheFinishPartitionsSelfTest.java      |  22 +-
 .../GridCacheGroupLockAbstractSelfTest.java     |  24 +-
 .../cache/GridCacheNestedTxAbstractTest.java    |  28 +-
 .../GridCacheOffHeapTieredAbstractSelfTest.java |  38 +--
 .../distributed/GridCacheLockAbstractTest.java  |  40 +--
 .../GridCacheMultiNodeLockAbstractTest.java     | 144 +++++++---
 .../dht/GridCacheColocatedDebugTest.java        |  26 +-
 ...dCachePartitionedTopologyChangeSelfTest.java |   8 +-
 .../near/GridCacheNearMultiNodeSelfTest.java    |  16 +-
 .../near/GridCacheNearOneNodeSelfTest.java      |  39 +--
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |  42 ---
 .../near/GridCacheNearReadersSelfTest.java      |  14 +-
 ...titionedExplicitLockNodeFailureSelfTest.java |   1 +
 .../near/GridCachePartitionedLockSelfTest.java  |  11 +-
 .../GridCacheEvictionLockUnlockSelfTest.java    |   7 +-
 .../cache/local/GridCacheLocalLockSelfTest.java |  36 +--
 .../GridCacheLocalMultithreadedSelfTest.java    |  42 +--
 .../ggfs/GridGgfsMetaManagerSelfTest.java       |   6 +-
 45 files changed, 1036 insertions(+), 834 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/05b32952/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/05b32952/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index a44acd1,2fb802b..9e4a368
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@@ -5251,128 -5076,15 +5077,141 @@@ public abstract class GridCacheAbstract
      }
  
      /**
 +     * @throws Exception If failed.
 +     */
 +    public void testIgniteCacheIterator() throws Exception {
 +        IgniteCache<String, Integer> cache = jcache(0);
 +
 +        assertFalse(cache.iterator().hasNext());
 +
 +        final int SIZE = 100;
 +
 +        Map<String, Integer> entries = new HashMap<>();
 +
 +        for (int i = 0; i < SIZE; ++i) {
 +            cache.put(Integer.toString(i), i);
 +
 +            entries.put(Integer.toString(i), i);
 +        }
 +
 +        checkIteratorHasNext();
 +
 +        checkIteratorCache(entries);
 +
 +        checkIteratorRemove(cache, entries);
 +
 +    }
 +
 +    /**
 +     * If hasNext() is called repeatedly, it should return the same result.
 +     */
 +    private void checkIteratorHasNext() {
 +        Iterator<Cache.Entry<String, Integer>> iter = jcache(0).iterator();
 +
 +        assertEquals(iter.hasNext(), iter.hasNext());
 +
 +        while (iter.hasNext())
 +            iter.next();
 +
 +        assertFalse(iter.hasNext());
 +    }
 +
 +    /**
 +     * @param cache Cache.
 +     * @param entries Expected entries in the cache.
 +     */
 +    private void checkIteratorRemove(IgniteCache<String, Integer> cache, Map<String,
Integer> entries) {
 +        // Check that we can remove element.
 +        String rmvKey = Integer.toString(5);
 +
 +        removeCacheIterator(cache, rmvKey);
 +
 +        entries.remove(rmvKey);
 +
 +        assertFalse(cache.containsKey(rmvKey));
 +        assertNull(cache.get(rmvKey));
 +
 +        checkIteratorCache(entries);
 +
 +        // Check that we cannot call Iterator.remove() without next().
 +        final Iterator<Cache.Entry<String, Integer>> iter = jcache(0).iterator();
 +
 +        assertTrue(iter.hasNext());
 +
 +        iter.next();
 +
 +        iter.remove();
 +
 +        GridTestUtils.assertThrows(log, new Callable<Object>() {
 +            @Override public Void call() throws Exception {
 +                iter.remove();
 +
 +                return null;
 +            }
 +        }, IllegalStateException.class, null);
 +    }
 +
 +    /**
 +     * @param cache Cache.
 +     * @param key Key to remove.
 +     */
 +    private void removeCacheIterator(IgniteCache<String, Integer> cache, String key)
{
 +        Iterator<Cache.Entry<String, Integer>> iter = cache.iterator();
 +
 +        int delCnt = 0;
 +
 +        while (iter.hasNext()) {
 +            Cache.Entry<String, Integer> cur = iter.next();
 +
 +            if (cur.getKey().equals(key)) {
 +                iter.remove();
 +
 +                delCnt++;
 +            }
 +        }
 +
 +        assertEquals(1, delCnt);
 +    }
 +
 +    /**
 +     * @param entries Expected entries in the cache.
 +     */
 +    private void checkIteratorCache(Map<String, Integer> entries) {
 +        for (int i = 0; i < gridCount(); ++i)
 +            checkIteratorCache(jcache(i), entries);
 +    }
 +
 +    /**
 +     * @param cache Cache.
 +     * @param entries Expected entries in the cache.
 +     */
 +    private void checkIteratorCache(IgniteCache<String, Integer> cache, Map<String,
Integer> entries) {
 +        Iterator<Cache.Entry<String, Integer>> iter = cache.iterator();
 +
 +        int cnt = 0;
 +
 +        while (iter.hasNext()) {
 +            Cache.Entry<String, Integer> cur = iter.next();
 +
 +            assertTrue(entries.containsKey(cur.getKey()));
 +            assertEquals(entries.get(cur.getKey()), cur.getValue());
 +
 +            cnt++;
 +        }
 +
 +        assertEquals(entries.size(), cnt);
 +    }
++
++    /**
+      * @param cache Cache.
+      * @param cnt Keys count.
+      * @return Collection of keys for which given cache is primary.
+      * @throws IgniteCheckedException If failed.
+      */
+     protected List<String> primaryKeysForCache(IgniteCache<String, Integer>
cache, int cnt)
+         throws IgniteCheckedException {
+         GridCacheProjection<String, Integer> prj = GridTestUtils.getFieldValue(cache,
"delegate");
+ 
+         return primaryKeysForCache(prj, cnt);
+     }
  }


Mime
View raw message