ignite-gg-11842 Add reproducer test (name update).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/46688083 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/46688083 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/46688083 Branch: refs/heads/ignite-3477 Commit: 46688083acbbb183a2d28c548e773878b91d23ae Parents: 2999ffd Author: Dmitriy Govorukhin <[email protected]> Authored: Wed Dec 28 18:55:08 2016 +0300 Committer: Dmitriy Govorukhin <[email protected]> Committed: Wed Dec 28 18:55:08 2016 +0300 ---------------------------------------------------------------------- .../GridCacheConcurrentGetCacheOnClient.java | 129 ------------------- ...GridCacheConcurrentGetCacheOnClientTest.java | 129 +++++++++++++++++++ 2 files changed, 129 insertions(+), 129 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/46688083/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentGetCacheOnClient.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentGetCacheOnClient.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentGetCacheOnClient.java deleted file mode 100644 index 3a97964..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentGetCacheOnClient.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 java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; - -import static org.apache.ignite.testframework.GridTestUtils.runAsync; - -/** - * - */ -public class GridCacheConcurrentGetCacheOnClient extends GridCommonAbstractTest{ - /** Ip finder. */ - private final static TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); - - /** - * @param gridName Grid name. - */ - @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception { - final IgniteConfiguration cfg = super.getConfiguration(gridName); - - ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder); - - return cfg; - } - - /** - * - */ - public void test() throws Exception { - IgniteConfiguration node1cfg = getConfiguration("node1"); - IgniteConfiguration node2cfg = getConfiguration("node2"); - - Ignite node1 = startGrid("node1", node1cfg); - Ignite node2 = startGrid("node2", node2cfg); - - IgniteConfiguration clientCfg1 = getConfiguration("client"); - clientCfg1.setClientMode(true); - - IgniteConfiguration clientCfg2 = getConfiguration("client"); - clientCfg2.setClientMode(true); - - final IgniteEx client1 = (IgniteEx)startGrid("client1", clientCfg1); - final IgniteEx client2 = (IgniteEx)startGrid("client2", clientCfg2); - - final CountDownLatch startLatch = new CountDownLatch(1); - - final CountDownLatch stopLatch = new CountDownLatch(2); - - final AtomicInteger countFails = new AtomicInteger(); - - final AtomicInteger exceptionFails = new AtomicInteger(); - - final String cacheName = "TEST_CACHE"; - - runAsync(new Runnable() { - @Override public void run() { - try { - startLatch.await(); - - IgniteCache<Object, Object> cache = client2.cache(cacheName); - - if (cache == null) - countFails.incrementAndGet(); - - stopLatch.countDown(); - } - catch (Exception e) { - exceptionFails.incrementAndGet(); - } - } - }); - - runAsync(new Runnable() { - @Override public void run() { - try { - startLatch.await(); - - IgniteCache<Object, Object> cache = client2.cache(cacheName); - - if (cache == null) - countFails.incrementAndGet(); - - stopLatch.countDown(); - } - catch (Exception e) { - exceptionFails.incrementAndGet(); - } - } - }); - - client1.getOrCreateCache(cacheName); - - startLatch.countDown(); - - IgniteCache<Object, Object> cache = client2.cache(cacheName); - - if (cache == null) - countFails.incrementAndGet(); - - stopLatch.await(); - - if (countFails.get() != 0 || exceptionFails.get() != 0) - fail("Cache return null in " + countFails.get() + " of 3 cases. Total exception: " + exceptionFails.get()); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/46688083/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentGetCacheOnClientTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentGetCacheOnClientTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentGetCacheOnClientTest.java new file mode 100644 index 0000000..fb83405 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentGetCacheOnClientTest.java @@ -0,0 +1,129 @@ +/* + * 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 java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicInteger; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; + +import static org.apache.ignite.testframework.GridTestUtils.runAsync; + +/** + * + */ +public class GridCacheConcurrentGetCacheOnClientTest extends GridCommonAbstractTest{ + /** Ip finder. */ + private final static TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** + * @param gridName Grid name. + */ + @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception { + final IgniteConfiguration cfg = super.getConfiguration(gridName); + + ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder); + + return cfg; + } + + /** + * + */ + public void test() throws Exception { + IgniteConfiguration node1cfg = getConfiguration("node1"); + IgniteConfiguration node2cfg = getConfiguration("node2"); + + Ignite node1 = startGrid("node1", node1cfg); + Ignite node2 = startGrid("node2", node2cfg); + + IgniteConfiguration clientCfg1 = getConfiguration("client"); + clientCfg1.setClientMode(true); + + IgniteConfiguration clientCfg2 = getConfiguration("client"); + clientCfg2.setClientMode(true); + + final IgniteEx client1 = (IgniteEx)startGrid("client1", clientCfg1); + final IgniteEx client2 = (IgniteEx)startGrid("client2", clientCfg2); + + final CountDownLatch startLatch = new CountDownLatch(1); + + final CountDownLatch stopLatch = new CountDownLatch(2); + + final AtomicInteger countFails = new AtomicInteger(); + + final AtomicInteger exceptionFails = new AtomicInteger(); + + final String cacheName = "TEST_CACHE"; + + runAsync(new Runnable() { + @Override public void run() { + try { + startLatch.await(); + + IgniteCache<Object, Object> cache = client2.cache(cacheName); + + if (cache == null) + countFails.incrementAndGet(); + + stopLatch.countDown(); + } + catch (Exception e) { + exceptionFails.incrementAndGet(); + } + } + }); + + runAsync(new Runnable() { + @Override public void run() { + try { + startLatch.await(); + + IgniteCache<Object, Object> cache = client2.cache(cacheName); + + if (cache == null) + countFails.incrementAndGet(); + + stopLatch.countDown(); + } + catch (Exception e) { + exceptionFails.incrementAndGet(); + } + } + }); + + client1.getOrCreateCache(cacheName); + + startLatch.countDown(); + + IgniteCache<Object, Object> cache = client2.cache(cacheName); + + if (cache == null) + countFails.incrementAndGet(); + + stopLatch.await(); + + if (countFails.get() != 0 || exceptionFails.get() != 0) + fail("Cache return null in " + countFails.get() + " of 3 cases. Total exception: " + exceptionFails.get()); + } +}
