# ignite-sprint-4 added restart tests for atomic cache

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

Branch: refs/heads/ignite-218
Commit: d7c1f20b6495e57597d1eb1afae7bf0c7ca9a9e7
Parents: 8388ef2
Author: sboikov <sboi...@gridgain.com>
Authored: Mon Apr 13 14:50:35 2015 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Mon Apr 13 14:57:04 2015 +0300

----------------------------------------------------------------------
 .../GridCacheAtomicPutAllFailoverSelfTest.java  | 32 -------------------
 ...IgniteCacheAtomicPutAllFailoverSelfTest.java | 32 +++++++++++++++++++
 .../GridCacheAbstractNodeRestartSelfTest.java   | 23 +++++++++-----
 .../IgniteCacheAtomicNodeRestartTest.java       | 33 ++++++++++++++++++++
 .../GridCachePartitionedNodeRestartTest.java    |  1 +
 .../GridCacheReplicatedNodeRestartSelfTest.java |  2 ++
 ...acheAtomicReplicatedNodeRestartSelfTest.java | 32 +++++++++++++++++++
 .../testsuites/IgniteCacheRestartTestSuite.java | 17 +++++-----
 8 files changed, 125 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7c1f20b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicPutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicPutAllFailoverSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicPutAllFailoverSelfTest.java
deleted file mode 100644
index 39277c5..0000000
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicPutAllFailoverSelfTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 static org.apache.ignite.cache.CacheAtomicityMode.*;
-
-/**
- *
- */
-public class GridCacheAtomicPutAllFailoverSelfTest extends 
GridCachePutAllFailoverSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7c1f20b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPutAllFailoverSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPutAllFailoverSelfTest.java
new file mode 100644
index 0000000..668c52d
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPutAllFailoverSelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ *
+ */
+public class IgniteCacheAtomicPutAllFailoverSelfTest extends 
GridCachePutAllFailoverSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7c1f20b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
index f2352db..17d6e42 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
@@ -32,6 +32,7 @@ import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
 import static org.apache.ignite.configuration.CacheConfiguration.*;
 import static org.apache.ignite.cache.CacheRebalanceMode.*;
 import static org.apache.ignite.transactions.TransactionConcurrency.*;
@@ -131,6 +132,13 @@ public abstract class GridCacheAbstractNodeRestartSelfTest 
extends GridCommonAbs
         idx = -1;
     }
 
+    /**
+     * @return Cache atomicity mode.
+     */
+    protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+
     /** {@inheritDoc} */
     @Override protected long getTestTimeout() {
         return TEST_TIMEOUT;
@@ -504,7 +512,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest 
extends GridCommonAbs
                                 try {
                                     cache.put(key, Integer.toString(key));
                                 }
-                                catch (TransactionRollbackException | 
ClusterTopologyException |CacheException ignored) {
+                                catch (TransactionRollbackException | 
ClusterTopologyException | CacheException ignored) {
                                     // It is ok if primary node leaves grid.
                                 }
 
@@ -585,6 +593,9 @@ public abstract class GridCacheAbstractNodeRestartSelfTest 
extends GridCommonAbs
      * @throws Exception If failed.
      */
     public void checkRestartWithTx(long duration, int putThreads, int 
restartThreads) throws Throwable {
+        if (atomicityMode() == ATOMIC)
+            return;
+
         final long endTime = System.currentTimeMillis() + duration;
 
         final AtomicReference<Throwable> err = new AtomicReference<>();
@@ -652,13 +663,6 @@ public abstract class GridCacheAbstractNodeRestartSelfTest 
extends GridCommonAbs
 
                                         tx.commit();
                                     }
-                                    catch (ClusterTopologyException | 
CacheException e) {
-                                        if (e instanceof CacheException
-                                            && !(e.getCause() instanceof 
ClusterTopologyException))
-                                            throw e;
-
-                                        // It is ok if primary node leaves 
grid.
-                                    }
                                 }
                                 catch (ClusterTopologyException | 
CacheException e) {
                                     if (e instanceof CacheException
@@ -743,6 +747,9 @@ public abstract class GridCacheAbstractNodeRestartSelfTest 
extends GridCommonAbs
      * @throws Exception If failed.
      */
     public void checkRestartWithTxPutAll(long duration, int putThreads, int 
restartThreads) throws Throwable {
+        if (atomicityMode() == ATOMIC)
+            return;
+
         final long endTime = System.currentTimeMillis() + duration;
 
         final AtomicReference<Throwable> err = new AtomicReference<>();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7c1f20b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java
new file mode 100644
index 0000000..1c4e616
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.distributed;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ *
+ */
+public class IgniteCacheAtomicNodeRestartTest extends 
GridCachePartitionedNodeRestartTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7c1f20b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
index 8faf657..8a2b19a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
@@ -38,6 +38,7 @@ public class GridCachePartitionedNodeRestartTest extends 
GridCacheAbstractNodeRe
         CacheConfiguration cc = defaultCacheConfiguration();
 
         cc.setName(CACHE_NAME);
+        cc.setAtomicityMode(atomicityMode());
         cc.setCacheMode(PARTITIONED);
         cc.setWriteSynchronizationMode(FULL_ASYNC);
         cc.setNearConfiguration(null);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7c1f20b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
index 9cc1517..aa32559 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
@@ -34,6 +34,8 @@ public class GridCacheReplicatedNodeRestartSelfTest extends 
GridCacheAbstractNod
 
         CacheConfiguration cc = defaultCacheConfiguration();
 
+        cc.setAtomicityMode(atomicityMode());
+
         cc.setName(CACHE_NAME);
 
         cc.setCacheMode(REPLICATED);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7c1f20b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java
new file mode 100644
index 0000000..f556023
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.distributed.replicated;
+
+import org.apache.ignite.cache.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ *
+ */
+public class IgniteCacheAtomicReplicatedNodeRestartSelfTest extends 
GridCacheReplicatedNodeRestartSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7c1f20b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index c5716e4..f972c5a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -19,7 +19,9 @@ package org.apache.ignite.testsuites;
 
 import junit.framework.*;
 import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
 
 /**
  * In-Memory Data Grid stability test suite on changing topology.
@@ -32,18 +34,19 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("Cache Restart Test Suite");
 
-        // Common restart tests.
         // TODO: GG-7419: Enable when fixed.
-//        suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
-//        
suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
-
+        // suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
+        // 
suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
         // TODO: uncomment when fix GG-1969
-//        suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
+        // suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
+
+        suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);
+        
suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class);
 
         suite.addTestSuite(GridCachePartitionedTxSalvageSelfTest.class);
 
-        suite.addTestSuite(GridCacheAtomicPutAllFailoverSelfTest.class);
-//        suite.addTestSuite(GridCachePutAllFailoverSelfTest.class); TODO 
IGNITE-157
+        suite.addTestSuite(IgniteCacheAtomicPutAllFailoverSelfTest.class);
+        // suite.addTestSuite(GridCachePutAllFailoverSelfTest.class); TODO 
IGNITE-157
 
         return suite;
     }

Reply via email to