ignite-446

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

Branch: refs/heads/ignite-646
Commit: e1db6fbe5f6272e8d0727cc2b8a8a7b48b7fb158
Parents: 29091c3
Author: avinogradov <avinogra...@gridgain.com>
Authored: Thu Apr 23 13:36:27 2015 +0300
Committer: avinogradov <avinogra...@gridgain.com>
Committed: Thu Apr 23 13:36:27 2015 +0300

----------------------------------------------------------------------
 .../cache/IgniteExcangeFutureHistoryTest.java   | 74 ++++++++++++++++++++
 .../ignite/testsuites/IgniteCacheTestSuite.java |  2 +
 2 files changed, 76 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1db6fbe/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExcangeFutureHistoryTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExcangeFutureHistoryTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExcangeFutureHistoryTest.java
new file mode 100644
index 0000000..ba5198c
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExcangeFutureHistoryTest.java
@@ -0,0 +1,74 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
+
+import java.util.*;
+
+/**
+ * Checks that top value at {@link 
GridCachePartitionExchangeManager#exchangeFutures()} is the newest one.
+ */
+public class IgniteExcangeFutureHistoryTest extends IgniteCacheAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+        return CacheAtomicWriteOrderMode.PRIMARY;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+
+    /** Checks reverse order of exchangeFutures. */
+    public void testExchangeFutures() throws Exception {
+        GridCachePartitionExchangeManager mgr = 
((IgniteKernal)grid(0)).internalCache().context().shared().exchange();
+
+        for (int i = 1; i <= 10; i++) {
+            startGrid(i);
+
+            List<GridDhtPartitionsExchangeFuture> futs = mgr.exchangeFutures();
+
+            List<GridDhtPartitionsExchangeFuture> sortedFuts = new 
ArrayList<>(futs);
+
+            Collections.sort(sortedFuts, Collections.reverseOrder());
+
+            for (int j = 0; j < futs.size(); j++) {
+                assert futs.get(j).equals(sortedFuts.get(j));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1db6fbe/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index cf76229..805f717 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -443,6 +443,8 @@ public class IgniteCacheTestSuite extends TestSuite {
 
         suite.addTestSuite(IgniteInternalCacheTypesTest.class);
 
+        suite.addTestSuite(IgniteExcangeFutureHistoryTest.class);
+
         return suite;
     }
 }

Reply via email to