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/08/11 10:47:24 UTC
incubator-ignite git commit: # ignite-1171 debug
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-1171 [created] 91115c81d
# ignite-1171 debug
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/91115c81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/91115c81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/91115c81
Branch: refs/heads/ignite-1171
Commit: 91115c81df64ec68220d92bb7b0e7ee25c6a7a7d
Parents: ae11e9b
Author: sboikov <sb...@gridgain.com>
Authored: Tue Aug 11 11:47:09 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Aug 11 11:47:09 2015 +0300
----------------------------------------------------------------------
.../distributed/GridCacheAffEarlySelfTest.java | 175 +++++++++++++++++++
.../ignite/testsuites/IgniteCacheTestSuite.java | 122 +------------
2 files changed, 178 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91115c81/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAffEarlySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAffEarlySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAffEarlySelfTest.java
new file mode 100644
index 0000000..d915f09
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAffEarlySelfTest.java
@@ -0,0 +1,175 @@
+/*
+ * 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.internal.*;
+import org.apache.ignite.marshaller.optimized.*;
+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.junits.common.*;
+
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ *
+ */
+public class GridCacheAffEarlySelfTest extends GridCommonAbstractTest {
+ /** Grid count. */
+ private static int GRID_CNT = 8;
+
+ /** Stopped. */
+ private volatile boolean stopped;
+
+ /** Iteration. */
+ private static final int iters = 10;
+
+ /** Concurrent. */
+ private static final boolean concurrent = true;
+
+ /** Futs. */
+ private Collection<IgniteInternalFuture<?>> futs = new ArrayList<>(GRID_CNT);
+
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+ discoSpi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ OptimizedMarshaller marsh = new OptimizedMarshaller();
+ marsh.setRequireSerializable(false);
+
+ cfg.setMarshaller(marsh);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return 6 * 60 * 1000L;
+ }
+
+ /**
+ *
+ */
+ public void testStartNodes() throws Exception {
+ for (int i = 0; i < iters; i++) {
+ try {
+ System.out.println("*** Iteration " + (i + 1) + '/' + iters);
+
+ IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+ @Override public void run() {
+ try {
+ doTest();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }, 1);
+
+ fut.get(30000);
+ }
+ catch (IgniteFutureTimeoutCheckedException e) {
+ // No-op.
+ }
+ finally {
+ stopAllGrids(true);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public void doTest() throws Exception {
+ final AtomicBoolean failed = new AtomicBoolean();
+
+ for (int i = 0; i < GRID_CNT; i++) {
+ final int idx = i;
+
+ final Ignite grid = concurrent ? null : startGrid(idx);
+
+ IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+ @Override
+ public void run() {
+ Random rnd = new Random();
+
+ try {
+ Ignite ignite = grid == null ? startGrid(idx) : grid;
+
+ IgniteCache cache = getCache(ignite);
+
+ cache.put(ignite.cluster().localNode().id(), UUID.randomUUID());
+
+ while (!stopped) {
+ int val = Math.abs(rnd.nextInt(100));
+ if (val >= 0 && val < 40)
+ cache.containsKey(ignite.cluster().localNode().id());
+ else if (val >= 40 && val < 80)
+ cache.get(ignite.cluster().localNode().id());
+ else
+ cache.put(ignite.cluster().localNode().id(), UUID.randomUUID());
+
+ Thread.sleep(50);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ failed.set(true);
+ }
+ }
+ }, 1);
+
+ futs.add(fut);
+ }
+
+ Thread.sleep(10000);
+
+ stopped = true;
+
+ for (IgniteInternalFuture<?> fut : futs)
+ fut.get();
+
+ assertFalse(failed.get());
+ }
+
+ /**
+ * @param grid Grid.
+ */
+ private IgniteCache getCache(Ignite grid) {
+ CacheConfiguration ccfg = defaultCacheConfiguration();
+
+ ccfg.setCacheMode(CacheMode.PARTITIONED);
+ ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ ccfg.setBackups(1);
+ ccfg.setNearConfiguration(null);
+
+ return grid.getOrCreateCache(ccfg);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91115c81/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 bafdfef..5eba9c8 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
@@ -56,125 +56,9 @@ public class IgniteCacheTestSuite extends TestSuite {
public static TestSuite suite(Set<Class> ignoredTests) throws Exception {
TestSuite suite = new TestSuite("IgniteCache Test Suite");
- suite.addTestSuite(IgniteCacheEntryListenerAtomicTest.class);
- suite.addTestSuite(IgniteCacheEntryListenerAtomicReplicatedTest.class);
- suite.addTestSuite(IgniteCacheEntryListenerAtomicLocalTest.class);
- suite.addTestSuite(IgniteCacheEntryListenerTxTest.class);
- suite.addTestSuite(IgniteCacheEntryListenerTxReplicatedTest.class);
- suite.addTestSuite(IgniteCacheEntryListenerTxLocalTest.class);
- suite.addTestSuite(IgniteCacheEntryListenerEagerTtlDisabledTest.class);
-
- suite.addTestSuite(IgniteClientAffinityAssignmentSelfTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicInvokeTest.class);
- suite.addTestSuite(IgniteCacheAtomicNearEnabledInvokeTest.class);
- suite.addTestSuite(IgniteCacheAtomicPrimaryWriteOrderInvokeTest.class);
- suite.addTestSuite(IgniteCacheAtomicPrimaryWriteOrderWithStoreInvokeTest.class);
- suite.addTestSuite(IgniteCacheAtomicLocalInvokeTest.class);
- suite.addTestSuite(IgniteCacheAtomicLocalWithStoreInvokeTest.class);
- suite.addTestSuite(IgniteCacheTxInvokeTest.class);
- suite.addTestSuite(IgniteCacheTxNearEnabledInvokeTest.class);
- suite.addTestSuite(IgniteCacheTxLocalInvokeTest.class);
- suite.addTestSuite(IgniteCrossCacheTxStoreSelfTest.class);
-
- suite.addTestSuite(IgnitePutAllLargeBatchSelfTest.class);
- suite.addTestSuite(IgnitePutAllUpdateNonPreloadedPartitionSelfTest.class);
-
- // User's class loader tests.
- suite.addTestSuite(IgniteCacheAtomicExecutionContextTest.class);
- suite.addTestSuite(IgniteCachePartitionedExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheReplicatedExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheTxExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheContinuousExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheIsolatedExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheP2PDisableExecutionContextTest.class);
- suite.addTestSuite(IgniteCachePrivateExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheSharedExecutionContextTest.class);
-
- // Warmup closure tests.
- suite.addTestSuite(IgniteWarmupClosureSelfTest.class);
-
- // Affinity tests.
- suite.addTestSuite(GridFairAffinityFunctionNodesSelfTest.class);
- suite.addTestSuite(GridFairAffinityFunctionSelfTest.class);
- suite.addTestSuite(IgniteFairAffinityDynamicCacheSelfTest.class);
- suite.addTestSuite(GridCacheAffinityBackupsSelfTest.class);
- suite.addTestSuite(IgniteCacheAffinitySelfTest.class);
- suite.addTestSuite(IgniteClientNodeAffinityTest.class);
-
- // Swap tests.
- suite.addTestSuite(GridCacheSwapPreloadSelfTest.class);
- suite.addTestSuite(GridCacheSwapReloadSelfTest.class);
-
- // Common tests.
- suite.addTestSuite(GridCacheConcurrentMapSelfTest.class);
- suite.addTestSuite(GridCacheAffinityMapperSelfTest.class);
- suite.addTestSuite(CacheAffinityCallSelfTest.class);
- GridTestUtils.addTestIfNeeded(suite, GridCacheAffinityRoutingSelfTest.class, ignoredTests);
- GridTestUtils.addTestIfNeeded(suite, GridCacheMvccSelfTest.class, ignoredTests);
- suite.addTestSuite(GridCacheMvccPartitionedSelfTest.class);
- suite.addTestSuite(GridCacheMvccManagerSelfTest.class);
- suite.addTestSuite(GridCacheP2PUndeploySelfTest.class);
- suite.addTestSuite(GridCacheConfigurationValidationSelfTest.class);
- suite.addTestSuite(GridCacheConfigurationConsistencySelfTest.class);
- suite.addTestSuite(GridCacheJdbcBlobStoreSelfTest.class);
- suite.addTestSuite(GridCacheJdbcBlobStoreMultithreadedSelfTest.class);
- suite.addTestSuite(CacheJdbcPojoStoreTest.class);
- suite.addTestSuite(CacheJdbcPojoStoreMultitreadedSelfTest.class);
- suite.addTestSuite(GridCacheBalancingStoreSelfTest.class);
- suite.addTestSuite(GridCacheAffinityApiSelfTest.class);
- suite.addTestSuite(GridCacheStoreValueBytesSelfTest.class);
- GridTestUtils.addTestIfNeeded(suite, DataStreamProcessorSelfTest.class, ignoredTests);
- suite.addTestSuite(DataStreamerMultiThreadedSelfTest.class);
- suite.addTestSuite(DataStreamerMultinodeCreateCacheTest.class);
- suite.addTestSuite(DataStreamerImplSelfTest.class);
- GridTestUtils.addTestIfNeeded(suite, GridCacheEntryMemorySizeSelfTest.class, ignoredTests);
- suite.addTestSuite(GridCacheClearAllSelfTest.class);
- suite.addTestSuite(GridCacheObjectToStringSelfTest.class);
- suite.addTestSuite(GridCacheLoadOnlyStoreAdapterSelfTest.class);
- suite.addTestSuite(GridCacheGetStoreErrorSelfTest.class);
- suite.addTestSuite(CacheFutureExceptionSelfTest.class);
- suite.addTestSuite(GridCacheAsyncOperationsLimitSelfTest.class);
- suite.addTestSuite(GridCacheTtlManagerSelfTest.class);
- suite.addTestSuite(GridCacheLifecycleAwareSelfTest.class);
- suite.addTestSuite(IgniteCacheAtomicStopBusySelfTest.class);
- suite.addTestSuite(IgniteCacheTransactionalStopBusySelfTest.class);
- suite.addTestSuite(GridCacheAtomicNearCacheSelfTest.class);
- suite.addTestSuite(CacheAtomicNearUpdateTopologyChangeTest.class);
- suite.addTestSuite(CacheTxNearUpdateTopologyChangeTest.class);
- suite.addTestSuite(GridCacheStorePutxSelfTest.class);
- suite.addTestSuite(GridCacheOffHeapMultiThreadedUpdateSelfTest.class);
- suite.addTestSuite(GridCacheOffHeapAtomicMultiThreadedUpdateSelfTest.class);
- suite.addTestSuite(GridCacheColocatedTxStoreExceptionSelfTest.class);
- suite.addTestSuite(GridCacheReplicatedTxStoreExceptionSelfTest.class);
- suite.addTestSuite(GridCacheLocalTxStoreExceptionSelfTest.class);
- suite.addTestSuite(GridCacheNearTxStoreExceptionSelfTest.class);
- suite.addTestSuite(GridCacheMissingCommitVersionSelfTest.class);
- suite.addTestSuite(GridCacheEntrySetIterationPreloadingSelfTest.class);
- suite.addTestSuite(GridCacheMixedPartitionExchangeSelfTest.class);
- suite.addTestSuite(IgniteCacheAtomicMessageRecoveryTest.class);
- suite.addTestSuite(IgniteCacheTxMessageRecoveryTest.class);
- GridTestUtils.addTestIfNeeded(suite, GridCacheOffHeapTieredEvictionAtomicSelfTest.class, ignoredTests);
- GridTestUtils.addTestIfNeeded(suite, GridCacheOffHeapTieredEvictionSelfTest.class, ignoredTests);
- GridTestUtils.addTestIfNeeded(suite, GridCacheOffHeapTieredAtomicSelfTest.class, ignoredTests);
- GridTestUtils.addTestIfNeeded(suite, GridCacheOffHeapTieredSelfTest.class, ignoredTests);
- suite.addTestSuite(GridCacheGlobalLoadTest.class);
- suite.addTestSuite(GridCachePartitionedLocalStoreSelfTest.class);
- suite.addTestSuite(GridCacheReplicatedLocalStoreSelfTest.class);
- suite.addTestSuite(GridCachePartitionedOffHeapLocalStoreSelfTest.class);
- suite.addTestSuite(GridCacheTxPartitionedLocalStoreSelfTest.class);
- suite.addTestSuite(IgniteCacheSystemTransactionsSelfTest.class);
-
- suite.addTest(IgniteCacheTcpClientDiscoveryTestSuite.suite());
-
- // Heuristic exception handling.
- suite.addTestSuite(GridCacheColocatedTxExceptionSelfTest.class);
- suite.addTestSuite(GridCacheReplicatedTxExceptionSelfTest.class);
- suite.addTestSuite(GridCacheLocalTxExceptionSelfTest.class);
- suite.addTestSuite(GridCacheNearTxExceptionSelfTest.class);
- suite.addTestSuite(GridCacheStopSelfTest.class);
-
- suite.addTestSuite(IgniteCacheNearLockValueSelfTest.class);
+ suite.addTestSuite(GridCacheAffEarlySelfTest.class);
+ suite.addTestSuite(GridCacheAffEarlySelfTest.class);
+ suite.addTestSuite(GridCacheAffEarlySelfTest.class);
return suite;
}