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/11 12:26:32 UTC
[4/4] incubator-ignite git commit: #sberb-28: add test to test suite.
#sberb-28: add test to test suite.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9e949c83
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9e949c83
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9e949c83
Branch: refs/heads/sberb-28
Commit: 9e949c83bea1218596a8e864c41d3b4873b55bf5
Parents: beba207
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jun 11 13:26:12 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jun 11 13:26:12 2015 +0300
----------------------------------------------------------------------
.../IgniteStartCacheInTransactionSelfTest.java | 130 +++++++++++++++++++
.../cache/StartCacheInTransactionSelfTest.java | 129 ------------------
.../testsuites/IgniteCacheTestSuite4.java | 2 +
3 files changed, 132 insertions(+), 129 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e949c83/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
new file mode 100644
index 0000000..815b4b9
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.apache.ignite.transactions.*;
+
+import java.util.concurrent.*;
+import java.util.concurrent.locks.*;
+
+/**
+ * Check starting cache in transaction.
+ */
+public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ ccfg.setBackups(1);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrids(2);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartCache() throws Exception {
+ final Ignite ignite = grid(0);
+
+ final String key = "key";
+ final String val = "val";
+
+ try (Transaction tx = ignite.transactions().txStart(
+ TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)){
+ ignite.cache(null).put(key, val);
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ ignite.createCache("NEW_CACHE");
+
+ return null;
+ }
+ }, IgniteException.class, "Cannot start/stop cache within transaction.");
+
+ tx.commit();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStopCache() throws Exception {
+ final Ignite ignite = grid(0);
+
+ final String key = "key";
+ final String val = "val";
+
+ try (Transaction tx = ignite.transactions().txStart(
+ TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)){
+ ignite.cache(null).put(key, val);
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ ignite.destroyCache(null);
+
+ return null;
+ }
+ }, IgniteException.class, "Cannot start/stop cache within transaction.");
+
+ tx.commit();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testLockCache() throws Exception {
+ final Ignite ignite = grid(0);
+
+ final String key = "key";
+
+ Lock lock = ignite.cache(null).lock(key);
+
+ lock.lock();
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ ignite.createCache("NEW_CACHE");
+
+ return null;
+ }
+ }, IgniteException.class, "Cannot start/stop cache within lock.");
+
+ lock.unlock();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e949c83/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/StartCacheInTransactionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/StartCacheInTransactionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/StartCacheInTransactionSelfTest.java
deleted file mode 100644
index 7518a62..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/StartCacheInTransactionSelfTest.java
+++ /dev/null
@@ -1,129 +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.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.apache.ignite.transactions.*;
-
-import java.util.concurrent.*;
-import java.util.concurrent.locks.*;
-
-/**
- * Check starting cache in transaction.
- */
-public class StartCacheInTransactionSelfTest extends GridCommonAbstractTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- CacheConfiguration ccfg = new CacheConfiguration();
-
- ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
- ccfg.setBackups(1);
-
- cfg.setCacheConfiguration(ccfg);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrids(2);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testStartCache() throws Exception {
- final Ignite ignite = grid(0);
-
- final String key = "key";
- final String val = "val";
-
- try (Transaction tx = ignite.transactions().txStart(
- TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)){
- ignite.cache(null).put(key, val);
-
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- ignite.createCache("NEW_CACHE");
-
- return null;
- }
- }, IgniteException.class, "Cannot start/stop cache within transaction.");
-
- tx.commit();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testStopCache() throws Exception {
- final Ignite ignite = grid(0);
-
- final String key = "key";
- final String val = "val";
-
- try (Transaction tx = ignite.transactions().txStart(
- TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)){
- ignite.cache(null).put(key, val);
-
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- ignite.destroyCache(null);
-
- return null;
- }
- }, IgniteException.class, "Cannot start/stop cache within transaction.");
-
- tx.commit();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLockCache() throws Exception {
- final Ignite ignite = grid(0);
-
- final String key = "key";
-
- Lock lock = ignite.cache(null).lock(key);
-
- lock.lock();
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- ignite.createCache("NEW_CACHE");
-
- return null;
- }
- }, IgniteException.class, "Cannot start/stop cache within lock.");
-
- lock.unlock();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e949c83/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index ed9fc9a..2cbb00d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -140,6 +140,8 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(IgniteCacheManyClientsTest.class);
+ suite.addTestSuite(IgniteStartCacheInTransactionSelfTest.class);
+
return suite;
}
}