You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/09 17:49:19 UTC
incubator-ignite git commit: #sberb-25: add test for removeAll with
Transactional Timeout.
Repository: incubator-ignite
Updated Branches:
refs/heads/sberb-25 [created] fad3df783
#sberb-25: add test for removeAll with Transactional Timeout.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fad3df78
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fad3df78
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fad3df78
Branch: refs/heads/sberb-25
Commit: fad3df783839e4001737ee34ed0863f0b7708d46
Parents: 638dd31
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Jun 9 18:46:41 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Jun 9 18:46:41 2015 +0300
----------------------------------------------------------------------
.../distributed/IgniteRemoveAllTimeoutTest.java | 83 ++++++++++++++++++++
1 file changed, 83 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fad3df78/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteRemoveAllTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteRemoveAllTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteRemoveAllTimeoutTest.java
new file mode 100644
index 0000000..744be27
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteRemoveAllTimeoutTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.apache.ignite.transactions.*;
+
+/**
+ * Test remove all with timeout.
+ */
+public class IgniteRemoveAllTimeoutTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ TransactionConfiguration tcfg = new TransactionConfiguration();
+ tcfg.setDefaultTxTimeout(10);
+ cfg.setTransactionConfiguration(tcfg);
+ cfg.setCacheConfiguration(ccfg);
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrid(0);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllTransactional() throws Exception {
+ IgniteCache<String, String> cache = grid(0).cache(null);
+
+ try (Transaction tx = grid(0).transactions().txStart
+ (TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ, 1000, 1000)) {
+ for (int i = 0; i < 100; ++i)
+ cache.put("key" + i, "val" + i);
+
+ tx.commit();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemoveAllTransactional() throws Exception {
+ IgniteCache<String, String> cache = grid(0).cache(null);
+
+ for (int i = 0; i < 100; ++i)
+ cache.put("key" + i, "val" + i);
+
+ try (Transaction tx = grid(0).transactions().txStart
+ (TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ, 1000, 1000)) {
+ cache.removeAll();
+
+ tx.commit();
+ }
+ }
+}