Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C2FD317C44 for ; Thu, 18 Jun 2015 10:17:01 +0000 (UTC) Received: (qmail 76863 invoked by uid 500); 18 Jun 2015 10:17:01 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 76831 invoked by uid 500); 18 Jun 2015 10:17:01 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 76822 invoked by uid 99); 18 Jun 2015 10:17:01 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2015 10:17:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 2DBEC1A5CC1 for ; Thu, 18 Jun 2015 10:17:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id A2D6dEwD3Y07 for ; Thu, 18 Jun 2015 10:16:56 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 67B3F4E5E0 for ; Thu, 18 Jun 2015 10:16:41 +0000 (UTC) Received: (qmail 75247 invoked by uid 99); 18 Jun 2015 10:16:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2015 10:16:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8BC8EE3C94; Thu, 18 Jun 2015 10:16:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Thu, 18 Jun 2015 10:17:00 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [21/50] incubator-ignite git commit: # ignite-1020 properly skip non-primary entries for store update , tests # ignite-1020 properly skip non-primary entries for store update , tests Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a75b8686 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a75b8686 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a75b8686 Branch: refs/heads/ignite-917-review Commit: a75b868605f661a71ed96f17e9d36471ccbfcd13 Parents: 9a0e659 Author: sboikov Authored: Wed Jun 17 11:25:23 2015 +0300 Committer: sboikov Committed: Wed Jun 17 12:07:37 2015 +0300 ---------------------------------------------------------------------- .../transactions/IgniteTxLocalAdapter.java | 12 +- .../CacheStoreUsageMultinodeAbstractTest.java | 305 +++++++++++++++++++ ...eUsageMultinodeDynamicStartAbstractTest.java | 169 ++++++++++ ...oreUsageMultinodeDynamicStartAtomicTest.java | 32 ++ ...heStoreUsageMultinodeDynamicStartTxTest.java | 32 ++ ...reUsageMultinodeStaticStartAbstractTest.java | 158 ++++++++++ ...toreUsageMultinodeStaticStartAtomicTest.java | 32 ++ ...cheStoreUsageMultinodeStaticStartTxTest.java | 32 ++ .../testsuites/IgniteCacheTestSuite4.java | 4 + 9 files changed, 772 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index bc6308b..7bc9042 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -500,12 +500,16 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter List rmvCol = null; CacheStoreManager writeStore = null; - boolean skipNear = near() && isWriteToStoreFromDht; + boolean skipNonPrimary = near() && isWriteToStoreFromDht; for (IgniteTxEntry e : writeEntries) { - boolean skip = (skipNear && e.cached().isNear()) || - e.skipStore() || - (e.context().store().isLocal() && !e.context().affinityNode()); + boolean skip = e.skipStore(); + + if (!skip && skipNonPrimary) { + skip = e.cached().isNear() || + e.cached().detached() || + !e.context().affinity().primary(e.cached().partition(), topologyVersion()).isLocal(); + } if (skip) continue; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java new file mode 100644 index 0000000..79a0293 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java @@ -0,0 +1,305 @@ +/* + * 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.cache.affinity.*; +import org.apache.ignite.cache.store.*; +import org.apache.ignite.cluster.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.processors.cache.store.*; +import org.apache.ignite.internal.util.lang.*; +import org.apache.ignite.resources.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.junits.common.*; +import org.apache.ignite.transactions.*; +import org.jetbrains.annotations.*; + +import javax.cache.*; +import javax.cache.configuration.*; +import javax.cache.integration.*; +import java.util.*; + +import static org.apache.ignite.cache.CacheAtomicityMode.*; +import static org.apache.ignite.cache.CacheMode.*; +import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; +import static org.apache.ignite.internal.IgniteNodeAttributes.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; + +/** + * + */ +public abstract class CacheStoreUsageMultinodeAbstractTest extends GridCommonAbstractTest { + /** */ + private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); + + /** */ + protected boolean client; + + /** */ + protected boolean cache; + + /** */ + protected boolean cacheStore; + + /** */ + protected boolean locStore; + + /** */ + protected boolean writeBehind; + + /** */ + protected boolean nearCache; + + /** */ + protected static Map>> writeMap; + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + cfg.setClientMode(client); + + ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER); + + if (cache) + cfg.setCacheConfiguration(cacheConfiguration()); + + return cfg; + } + + /** + * @return Cache configuration. + */ + @SuppressWarnings("unchecked") + protected CacheConfiguration cacheConfiguration() { + CacheConfiguration ccfg = new CacheConfiguration(); + + ccfg.setCacheMode(PARTITIONED); + ccfg.setAtomicityMode(atomicityMode()); + ccfg.setBackups(1); + ccfg.setWriteSynchronizationMode(FULL_SYNC); + + if (cacheStore) { + if (writeBehind) { + ccfg.setWriteBehindEnabled(true); + ccfg.setWriteBehindFlushFrequency(100); + } + + ccfg.setWriteThrough(true); + + ccfg.setCacheStoreFactory(locStore ? new TestLocalStoreFactory() : new TestStoreFactory()); + } + + if (nearCache) + ccfg.setNearConfiguration(new NearCacheConfiguration()); + + return ccfg; + } + + /** + * @return Cache atomicity mode. + */ + protected abstract CacheAtomicityMode atomicityMode(); + + /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + super.beforeTest(); + + writeMap = new HashMap<>(); + } + + /** + * @param clientStore {@code True} if store configured on client node. + * @throws Exception If failed. + */ + protected void checkStoreUpdate(boolean clientStore) throws Exception { + Ignite client = grid(3); + + assertTrue(client.configuration().isClientMode()); + + awaitPartitionMapExchange(); + + IgniteCache cache0 = ignite(0).cache(null); + IgniteCache cache1 = ignite(1).cache(null); + IgniteCache clientCache = client.cache(null); + + assertTrue(((IgniteCacheProxy)cache0).context().store().configured()); + assertEquals(clientStore, ((IgniteCacheProxy) clientCache).context().store().configured()); + + List tcList = new ArrayList<>(); + + tcList.add(null); + + if (atomicityMode() == TRANSACTIONAL) { + tcList.add(TransactionConcurrency.OPTIMISTIC); + tcList.add(TransactionConcurrency.PESSIMISTIC); + } + + log.info("Start test [atomicityMode=" + atomicityMode() + + ", locStore=" + locStore + + ", writeBehind=" + writeBehind + + ", nearCache=" + nearCache + + ", clientStore=" + clientStore + ']'); + + for (TransactionConcurrency tc : tcList) { + testStoreUpdate(cache0, primaryKey(cache0), tc); + + testStoreUpdate(cache0, backupKey(cache0), tc); + + testStoreUpdate(cache0, nearKey(cache0), tc); + + testStoreUpdate(cache0, primaryKey(cache1), tc); + + testStoreUpdate(clientCache, primaryKey(cache0), tc); + + testStoreUpdate(clientCache, primaryKey(cache1), tc); + } + } + + /** + * @param cache Cache. + * @param key Key. + * @param tc Transaction concurrency mode. + * @throws Exception If failed. + */ + protected void testStoreUpdate(IgniteCache cache, + Object key, + @Nullable TransactionConcurrency tc) + throws Exception + { + boolean storeOnPrimary = atomicityMode() == ATOMIC || locStore || writeBehind; + + assertTrue(writeMap.isEmpty()); + + Ignite ignite = cache.unwrap(Ignite.class); + + Affinity obj = ignite.affinity(cache.getName()); + + ClusterNode node = obj.mapKeyToNode(key); + + assertNotNull(node); + + String expNode = storeOnPrimary ? (String)node.attribute(ATTR_GRID_NAME) : ignite.name(); + + assertNotNull(expNode); + + log.info("Put [node=" + ignite.name() + + ", key=" + key + + ", primary=" + node.attribute(ATTR_GRID_NAME) + + ", tx=" + tc + + ", nearCache=" + (cache.getConfiguration(CacheConfiguration.class).getNearConfiguration() != null) + + ", storeOnPrimary=" + storeOnPrimary + ']'); + + Transaction tx = tc != null ? ignite.transactions().txStart(tc, REPEATABLE_READ) : null; + + cache.put(key, key); + + if (tx != null) + tx.commit(); + + boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override + public boolean apply() { + return writeMap.size() > 0; + } + }, 1000); + + assertTrue("Store is not updated", wait); + + assertEquals("Write on wrong node: " + writeMap, 1, writeMap.size()); + + assertEquals(expNode, writeMap.keySet().iterator().next()); + + writeMap.clear(); + } + + /** + * + */ + public static class TestStoreFactory implements Factory { + /** {@inheritDoc} */ + @Override public CacheStore create() { + return new TestStore(); + } + } + + /** + * + */ + public static class TestLocalStoreFactory implements Factory { + /** {@inheritDoc} */ + @Override public CacheStore create() { + return new TestLocalStore(); + } + } + + /** + * + */ + public static class TestStore extends CacheStoreAdapter { + /** */ + @IgniteInstanceResource + private Ignite ignite; + + /** {@inheritDoc} */ + @SuppressWarnings("SynchronizeOnNonFinalField") + @Override public void write(Cache.Entry entry) { + synchronized (writeMap) { + ignite.log().info("Write [node=" + ignite.name() + ", entry=" + entry + ']'); + + String name = ignite.name(); + + List> list = writeMap.get(name); + + if (list == null) { + list = new ArrayList<>(); + + writeMap.put(name, list); + } + + list.add(entry); + } + } + + /** {@inheritDoc} */ + @Override public Object load(Object key) throws CacheLoaderException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void delete(Object key) { + throw new UnsupportedOperationException(); + } + } + + /** + * + */ + @CacheLocalStore + public static class TestLocalStore extends TestStore { + /** {@inheritDoc} */ + @Override public void delete(Object key) { + // No-op. + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java new file mode 100644 index 0000000..82667d9 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java @@ -0,0 +1,169 @@ +/* + * 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.configuration.*; + +/** + * + */ +public abstract class CacheStoreUsageMultinodeDynamicStartAbstractTest extends CacheStoreUsageMultinodeAbstractTest { + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + cache = false; + + startGridsMultiThreaded(3); + + client = true; + + startGrid(3); + } + + /** {@inheritDoc} */ + @Override protected void afterTestsStopped() throws Exception { + super.afterTestsStopped(); + + stopAllGrids(); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStart() throws Exception { + checkStoreWithDynamicStart(false); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStartNearEnabled() throws Exception { + nearCache = true; + + checkStoreWithDynamicStart(false); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicFromClientStart() throws Exception { + checkStoreWithDynamicStart(true); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStartFromClientNearEnabled() throws Exception { + nearCache = true; + + checkStoreWithDynamicStart(true); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStartLocalStore() throws Exception { + locStore = true; + + checkStoreWithDynamicStart(false); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStartFromClientLocalStore() throws Exception { + locStore = true; + + checkStoreWithDynamicStart(true); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStartLocalStoreNearEnabled() throws Exception { + locStore = true; + + nearCache = true; + + checkStoreWithDynamicStart(false); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStartWriteBehindStore() throws Exception { + writeBehind = true; + + checkStoreWithDynamicStart(false); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStartFromClientWriteBehindStore() throws Exception { + writeBehind = true; + + checkStoreWithDynamicStart(true); + } + + /** + * @throws Exception If failed. + */ + public void testDynamicStartWriteBehindStoreNearEnabled() throws Exception { + writeBehind = true; + + nearCache = true; + + checkStoreWithDynamicStart(false); + } + + /** + * @param clientStart {@code True} if start cache from client node. + * @throws Exception If failed. + */ + private void checkStoreWithDynamicStart(boolean clientStart) throws Exception { + cacheStore = true; + + CacheConfiguration ccfg = cacheConfiguration(); + + assertNotNull(ccfg.getCacheStoreFactory()); + + Ignite srv = ignite(0); + + Ignite client = ignite(3); + + Ignite node = clientStart ? client : srv; + + IgniteCache cache = nearCache ? node.createCache(ccfg, new NearCacheConfiguration()) : node.createCache(ccfg); + + assertNotNull(cache); + + try { + if (nearCache) + client.createNearCache(null, new NearCacheConfiguration<>()); + + checkStoreUpdate(true); + } + finally { + cache = srv.cache(null); + + if (cache != null) + cache.close(); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAtomicTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAtomicTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAtomicTest.java new file mode 100644 index 0000000..884dedd --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAtomicTest.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 CacheStoreUsageMultinodeDynamicStartAtomicTest extends CacheStoreUsageMultinodeDynamicStartAbstractTest { + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode atomicityMode() { + return ATOMIC; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java new file mode 100644 index 0000000..825b450 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.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 CacheStoreUsageMultinodeDynamicStartTxTest extends CacheStoreUsageMultinodeDynamicStartAbstractTest { + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode atomicityMode() { + return TRANSACTIONAL; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartAbstractTest.java new file mode 100644 index 0000000..c00d003 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartAbstractTest.java @@ -0,0 +1,158 @@ +/* + * 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.transactions.*; + +import java.util.*; + +import static org.apache.ignite.cache.CacheAtomicityMode.*; + +/** + * + */ +public abstract class CacheStoreUsageMultinodeStaticStartAbstractTest extends CacheStoreUsageMultinodeAbstractTest { + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfiguration() throws Exception { + checkStoreUpdateStaticConfig(true); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationNearEnabled() throws Exception { + nearCache = true; + + checkStoreUpdateStaticConfig(true); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationLocalStore() throws Exception { + locStore = true; + + checkStoreUpdateStaticConfig(true); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationLocalStoreNearEnabled() throws Exception { + locStore = true; + + nearCache = true; + + checkStoreUpdateStaticConfig(true); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationTxLocalStoreNoClientStore() throws Exception { + locStore = true; + + checkStoreUpdateStaticConfig(false); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationTxLocalStoreNoClientStoreNearEnabled() throws Exception { + locStore = true; + + nearCache = true; + + checkStoreUpdateStaticConfig(false); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationTxWriteBehindStore() throws Exception { + writeBehind = true; + + checkStoreUpdateStaticConfig(true); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationTxWriteBehindStoreNearEnabled() throws Exception { + writeBehind = true; + + nearCache = true; + + checkStoreUpdateStaticConfig(true); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationTxWriteBehindStoreNoClientStore() throws Exception { + writeBehind = true; + + checkStoreUpdateStaticConfig(false); + } + + /** + * @throws Exception If failed. + */ + public void testStaticConfigurationTxWriteBehindStoreNoClientStoreNearEnabled() throws Exception { + writeBehind = true; + + nearCache = true; + + checkStoreUpdateStaticConfig(false); + } + + /** + * @param clientStore {@code True} if store should be configured on client node. + * @throws Exception If failed. + */ + private void checkStoreUpdateStaticConfig(boolean clientStore) throws Exception { + try { + cache = true; + + cacheStore = true; + + startGridsMultiThreaded(3); + + client = true; + + cacheStore = clientStore; + + startGrid(3); + + checkStoreUpdate(clientStore); + } + finally { + stopAllGrids(); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartAtomicTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartAtomicTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartAtomicTest.java new file mode 100644 index 0000000..6908aaa --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartAtomicTest.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 CacheStoreUsageMultinodeStaticStartAtomicTest extends CacheStoreUsageMultinodeStaticStartAbstractTest { + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode atomicityMode() { + return ATOMIC; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java new file mode 100644 index 0000000..b42fd44 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.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 CacheStoreUsageMultinodeStaticStartTxTest extends CacheStoreUsageMultinodeStaticStartAbstractTest { + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode atomicityMode() { + return TRANSACTIONAL; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a75b8686/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 d155330..6295a4d 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 @@ -135,6 +135,10 @@ public class IgniteCacheTestSuite4 extends TestSuite { suite.addTestSuite(CacheJdbcStoreSessionListenerSelfTest.class); suite.addTestSuite(CacheClientStoreSelfTest.class); + suite.addTestSuite(CacheStoreUsageMultinodeStaticStartAtomicTest.class); + suite.addTestSuite(CacheStoreUsageMultinodeStaticStartTxTest.class); + suite.addTestSuite(CacheStoreUsageMultinodeDynamicStartAtomicTest.class); + suite.addTestSuite(CacheStoreUsageMultinodeDynamicStartTxTest.class); suite.addTestSuite(IgniteStartCacheInTransactionSelfTest.class); suite.addTestSuite(IgniteStartCacheInTransactionAtomicSelfTest.class);