# sprint-2 added test for IGNITE-285
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/90e0560f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/90e0560f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/90e0560f Branch: refs/heads/ignite-275 Commit: 90e0560f2da7efe2c13168bd9474c18278fd57bc Parents: 8e54ccd Author: sboikov <sboi...@gridgain.com> Authored: Tue Feb 17 15:43:42 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Tue Feb 17 15:43:42 2015 +0300 ---------------------------------------------------------------------- .../near/IgniteCacheNearReadCommittedTest.java | 68 ++++++++++++++++++++ .../ignite/testsuites/IgniteCacheTestSuite.java | 3 + 2 files changed, 71 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/90e0560f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java new file mode 100644 index 0000000..8de0509 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java @@ -0,0 +1,68 @@ +/* + * 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.near; + +import org.apache.ignite.*; +import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.transactions.*; + +import static org.apache.ignite.cache.CacheMode.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; + +/** + * + */ +public class IgniteCacheNearReadCommittedTest extends GridCacheAbstractSelfTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 2; + } + + /** {@inheritDoc} */ + @Override protected CacheDistributionMode distributionMode() { + return CacheDistributionMode.NEAR_PARTITIONED; + } + + /** {@inheritDoc} */ + @Override protected CacheMode cacheMode() { + return PARTITIONED; + } + + /** + * @throws Exception If failed. + */ + public void testReadCommittedCacheCleanup() throws Exception { + IgniteCache<Integer, Integer> cache = ignite(0).jcache(null); + + Integer key = backupKey(cache); + + cache.put(key, key); + + try (Transaction tx = ignite(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { + assertEquals(key, cache.get(key)); + + tx.commit(); + } + + ignite(1).jcache(null).remove(key); // Remove from primary node. + + assertEquals(0, cache.localSize()); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/90e0560f/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 d081eaf..df9ffab 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 @@ -393,6 +393,9 @@ public class IgniteCacheTestSuite extends TestSuite { // suite.addTestSuite(IgniteCacheInvokeReadThroughTest.class); // suite.addTestSuite(GridCacheVersionMultinodeTest.class); + // TODO IGNITE-285. + // suite.addTestSuite(IgniteCacheNearReadCommittedTest.class); + return suite; } }