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/03 00:54:06 UTC
[5/8] incubator-ignite git commit: Merge branches 'ignite-916' and
'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-916
Merge branches 'ignite-916' and 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-916
Conflicts:
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingNearErrorTest.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/859f1829
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/859f1829
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/859f1829
Branch: refs/heads/ignite-sprint-5
Commit: 859f1829c60d7f148090c79112968b5ea3ac5809
Parents: e5d5d08 82cfb47
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Jun 2 16:13:17 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Jun 2 16:13:17 2015 +0300
----------------------------------------------------------------------
assembly/dependencies-visor-console.xml | 3 +
.../hibernate/CacheHibernatePersonStore.java | 202 +-
.../hibernate/CacheHibernateStoreExample.java | 17 +
.../store/jdbc/CacheJdbcPersonStore.java | 180 +-
.../store/jdbc/CacheJdbcStoreExample.java | 13 +
.../store/spring/CacheSpringPersonStore.java | 128 +
.../store/spring/CacheSpringStoreExample.java | 143 +
.../datagrid/store/spring/package-info.java | 22 +
.../main/java/org/apache/ignite/Ignition.java | 18 +-
.../apache/ignite/cache/store/CacheStore.java | 2 +
.../ignite/cache/store/CacheStoreSession.java | 22 +
.../cache/store/CacheStoreSessionListener.java | 133 +
.../jdbc/CacheJdbcStoreSessionListener.java | 141 +
.../org/apache/ignite/cluster/ClusterNode.java | 24 +-
.../configuration/CacheConfiguration.java | 53 +-
.../configuration/IgniteConfiguration.java | 48 +-
.../ignite/internal/ClusterMetricsSnapshot.java | 14 +
.../internal/GridEventConsumeHandler.java | 100 +-
.../ignite/internal/GridKernalContext.java | 5 +
.../ignite/internal/GridKernalContextImpl.java | 5 +
.../apache/ignite/internal/IgniteKernal.java | 23 +-
.../org/apache/ignite/internal/IgnitionEx.java | 22 +-
.../ignite/internal/MarshallerContextImpl.java | 2 +-
.../internal/events/DiscoveryCustomEvent.java | 18 +-
.../managers/communication/GridIoManager.java | 12 +-
.../managers/discovery/CustomEventListener.java | 31 +
.../discovery/CustomMessageWrapper.java | 63 +
.../discovery/DiscoveryCustomMessage.java | 48 +
.../discovery/GridDiscoveryManager.java | 214 +-
.../affinity/GridAffinityAssignmentCache.java | 32 +
.../cache/DynamicCacheChangeBatch.java | 20 +-
.../cache/DynamicCacheDescriptor.java | 2 +
.../processors/cache/GridCacheAdapter.java | 17 +-
.../cache/GridCacheAffinityManager.java | 14 +
.../cache/GridCacheConcurrentMap.java | 21 +-
.../processors/cache/GridCacheContext.java | 6 +-
.../processors/cache/GridCacheEntryEx.java | 6 +
.../processors/cache/GridCacheGateway.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 8 +-
.../processors/cache/GridCacheMapEntry.java | 5 +
.../processors/cache/GridCacheMvccManager.java | 32 +-
.../GridCachePartitionExchangeManager.java | 71 +-
.../processors/cache/GridCachePreloader.java | 6 +-
.../cache/GridCachePreloaderAdapter.java | 11 +-
.../processors/cache/GridCacheProcessor.java | 86 +-
.../processors/cache/GridCacheProxyImpl.java | 12 +
.../cache/GridCacheSharedContext.java | 48 +-
.../processors/cache/GridCacheUtils.java | 288 +-
.../processors/cache/IgniteInternalCache.java | 5 +
.../cache/affinity/GridCacheAffinityImpl.java | 10 +-
.../CacheDataStructuresManager.java | 2 +-
.../distributed/GridDistributedCacheEntry.java | 7 -
.../distributed/GridDistributedTxMapping.java | 17 +
.../dht/GridClientPartitionTopology.java | 8 +-
.../dht/GridDhtAssignmentFetchFuture.java | 4 +-
.../distributed/dht/GridDhtCacheAdapter.java | 27 +-
.../distributed/dht/GridDhtCacheEntry.java | 6 +-
.../distributed/dht/GridDhtLockFuture.java | 10 +-
.../dht/GridDhtPartitionTopologyImpl.java | 22 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 224 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 8 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 3 +-
.../dht/atomic/GridDhtAtomicCache.java | 18 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 10 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 78 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 112 +-
.../dht/colocated/GridDhtColocatedCache.java | 12 +-
.../colocated/GridDhtColocatedLockFuture.java | 213 +-
.../dht/preloader/GridDhtForceKeysFuture.java | 4 +-
.../preloader/GridDhtPartitionDemandPool.java | 26 +-
.../dht/preloader/GridDhtPartitionMap.java | 2 +-
.../preloader/GridDhtPartitionSupplyPool.java | 29 +-
.../GridDhtPartitionsExchangeFuture.java | 313 +-
.../preloader/GridDhtPartitionsFullMessage.java | 4 +-
.../GridDhtPartitionsSingleMessage.java | 33 +-
.../dht/preloader/GridDhtPreloader.java | 37 +-
.../preloader/GridDhtPreloaderAssignments.java | 3 +-
.../distributed/near/GridNearAtomicCache.java | 5 +
.../distributed/near/GridNearCacheAdapter.java | 2 +-
.../distributed/near/GridNearGetFuture.java | 2 +-
.../distributed/near/GridNearLockFuture.java | 271 +-
.../distributed/near/GridNearLockRequest.java | 68 +-
.../distributed/near/GridNearLockResponse.java | 48 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 83 +-
.../GridNearPessimisticTxPrepareFuture.java | 5 +-
.../near/GridNearTransactionalCache.java | 4 +-
.../cache/distributed/near/GridNearTxLocal.java | 43 +-
.../near/GridNearTxPrepareRequest.java | 72 +-
.../near/GridNearTxPrepareResponse.java | 70 +-
.../processors/cache/local/GridLocalCache.java | 6 +-
.../local/atomic/GridLocalAtomicCache.java | 6 +-
.../cache/query/GridCacheQueryAdapter.java | 12 +-
.../cache/query/GridCacheQueryErrorFuture.java | 2 +
.../cache/query/GridCacheQueryManager.java | 2 +-
.../continuous/CacheContinuousQueryManager.java | 28 +-
.../cache/store/CacheOsStoreManager.java | 1 -
.../cache/store/CacheStoreManager.java | 7 +-
.../store/GridCacheStoreManagerAdapter.java | 202 +-
.../cache/transactions/IgniteInternalTx.java | 5 +
.../cache/transactions/IgniteTxAdapter.java | 48 +-
.../cache/transactions/IgniteTxHandler.java | 148 +-
.../transactions/IgniteTxLocalAdapter.java | 142 +-
.../cacheobject/IgniteCacheObjectProcessor.java | 5 +-
.../IgniteCacheObjectProcessorImpl.java | 2 +-
.../continuous/AbstractContinuousMessage.java | 54 +
.../continuous/GridContinuousMessageType.java | 12 -
.../continuous/GridContinuousProcessor.java | 836 +--
.../processors/continuous/StartRequestData.java | 267 +
.../StartRoutineAckDiscoveryMessage.java | 63 +
.../StartRoutineDiscoveryMessage.java | 85 +
.../StopRoutineAckDiscoveryMessage.java | 49 +
.../continuous/StopRoutineDiscoveryMessage.java | 49 +
.../datastreamer/DataStreamerImpl.java | 2 +
.../service/GridServiceProcessor.java | 121 +-
.../internal/util/future/GridFutureAdapter.java | 4 +-
.../apache/ignite/plugin/PluginProvider.java | 26 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +-
.../communication/tcp/TcpCommunicationSpi.java | 2 +-
.../ignite/spi/discovery/DiscoverySpi.java | 20 +-
.../discovery/DiscoverySpiCustomMessage.java | 40 +
.../spi/discovery/DiscoverySpiListener.java | 5 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 1478 +++++
.../ignite/spi/discovery/tcp/ServerImpl.java | 4766 ++++++++++++++
.../discovery/tcp/TcpClientDiscoverySpi.java | 1264 ----
.../tcp/TcpClientDiscoverySpiMBean.java | 164 -
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 170 +
.../spi/discovery/tcp/TcpDiscoverySpi.java | 5799 ++++--------------
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 1160 ----
.../spi/discovery/tcp/TcpDiscoverySpiMBean.java | 9 +
.../tcp/internal/TcpDiscoveryNode.java | 7 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 2 +-
.../TcpDiscoveryMulticastIpFinder.java | 10 +-
.../messages/TcpDiscoveryAbstractMessage.java | 24 +-
.../TcpDiscoveryClientHeartbeatMessage.java | 67 +
.../messages/TcpDiscoveryClientPingRequest.java | 56 +
.../TcpDiscoveryClientPingResponse.java | 67 +
.../TcpDiscoveryCustomEventMessage.java | 41 +-
.../messages/TcpDiscoveryHeartbeatMessage.java | 28 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 43 +
.../messages/TcpDiscoveryNodeAddedMessage.java | 2 +-
.../tcp/messages/TcpDiscoveryPingRequest.java | 6 +
.../tcp/messages/TcpDiscoveryPingResponse.java | 15 +-
.../affinity/IgniteClientNodeAffinityTest.java | 182 +
...cheStoreSessionListenerAbstractSelfTest.java | 315 +
...heStoreSessionListenerLifecycleSelfTest.java | 395 ++
.../CacheJdbcStoreSessionListenerSelfTest.java | 175 +
.../ignite/internal/GridAffinitySelfTest.java | 1 +
.../internal/GridDiscoveryEventSelfTest.java | 7 +-
...ridFailFastNodeFailureDetectionSelfTest.java | 7 +-
.../internal/GridProjectionAbstractTest.java | 16 +
.../GridProjectionForCachesSelfTest.java | 11 +-
.../internal/GridReleaseTypeSelfTest.java | 77 +-
.../apache/ignite/internal/GridSelfTest.java | 4 +-
.../GridDiscoveryManagerAliveCacheSelfTest.java | 62 +-
.../GridDiscoveryManagerAttributesSelfTest.java | 122 +-
.../discovery/GridDiscoveryManagerSelfTest.java | 46 +-
.../GridAffinityProcessorAbstractSelfTest.java | 1 +
.../cache/CacheRemoveAllSelfTest.java | 2 +-
.../GridCacheAbstractFailoverSelfTest.java | 2 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 3 +
.../GridCacheAbstractRemoveFailureTest.java | 23 +
.../cache/GridCacheAbstractSelfTest.java | 2 +-
.../GridCacheAtomicMessageCountSelfTest.java | 1 +
...GridCacheMixedPartitionExchangeSelfTest.java | 2 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 1 +
.../GridCacheReturnValueTransferSelfTest.java | 3 +
...acheTcpClientDiscoveryMultiThreadedTest.java | 190 +
.../processors/cache/GridCacheTestEntryEx.java | 4 +
.../GridCacheVariableTopologySelfTest.java | 12 +-
.../IgniteCacheAbstractStopBusySelfTest.java | 6 +-
.../cache/IgniteCacheAbstractTest.java | 2 +-
.../IgniteCacheConfigurationTemplateTest.java | 2 +-
.../cache/IgniteCacheNearLockValueSelfTest.java | 3 +
.../IgniteCacheP2pUnmarshallingErrorTest.java | 29 +-
...gniteCacheP2pUnmarshallingNearErrorTest.java | 17 +-
.../IgniteCachePartitionMapUpdateTest.java | 226 +
.../IgniteDynamicClientCacheStartSelfTest.java | 283 +
.../cache/IgniteSystemCacheOnClientTest.java | 97 +
.../GridCacheQueueApiSelfAbstractTest.java | 4 +-
.../IgniteClientDataStructuresAbstractTest.java | 283 +
.../IgniteClientDataStructuresTest.java | 28 +
...IgniteClientDiscoveryDataStructuresTest.java | 28 +
.../GridCacheClientModesAbstractSelfTest.java | 94 +-
...ientModesTcpClientDiscoveryAbstractTest.java | 168 +
.../distributed/GridCacheMixedModeSelfTest.java | 3 +
...niteCacheClientNodeChangingTopologyTest.java | 1803 ++++++
.../IgniteCacheClientNodeConcurrentStart.java | 105 +
...teCacheClientNodePartitionsExchangeTest.java | 632 ++
.../IgniteCrossCacheTxStoreSelfTest.java | 147 +-
.../dht/GridCacheClientOnlySelfTest.java | 60 +-
.../GridCacheDhtClientRemoveFailureTest.java | 28 +
.../dht/IgniteCacheMultiTxLockSelfTest.java | 47 +-
...cClientInvalidPartitionHandlingSelfTest.java | 29 +
.../GridCacheAtomicClientRemoveFailureTest.java | 28 +
...eAtomicInvalidPartitionHandlingSelfTest.java | 23 +-
...unctionExcludeNeighborsAbstractSelfTest.java | 3 +-
.../near/GridCacheAtomicNearOnlySelfTest.java | 32 -
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 2 +
.../near/GridCacheNearOnlySelfTest.java | 63 +-
.../near/GridCacheNearOnlyTopologySelfTest.java | 1 +
...ionedClientOnlyNoPrimaryFullApiSelfTest.java | 5 +-
...idCacheRendezvousAffinityClientSelfTest.java | 4 +
.../GridCacheReplicatedClientOnlySelfTest.java | 43 -
.../GridCacheReplicatedNearOnlySelfTest.java | 43 -
.../GridCacheSyncReplicatedPreloadSelfTest.java | 1 -
.../LruNearOnlyNearEvictionPolicySelfTest.java | 25 +-
...ridCacheContinuousQueryAbstractSelfTest.java | 6 +-
.../continuous/GridEventConsumeSelfTest.java | 93 +-
.../DataStreamProcessorSelfTest.java | 1 +
.../DataStreamerMultiThreadedSelfTest.java | 2 -
.../igfs/IgfsClientCacheSelfTest.java | 3 +-
.../processors/igfs/IgfsCommonAbstractTest.java | 10 -
.../processors/igfs/IgfsOneClientNodeTest.java | 8 +-
.../service/ClosureServiceClientsNodesTest.java | 16 +-
.../service/GridServiceClientNodeTest.java | 81 +
.../loadtests/hashmap/GridCacheTestContext.java | 3 +-
.../OptimizedMarshallerNodeFailoverTest.java | 4 +-
...GridMessagingNoPeerClassLoadingSelfTest.java | 7 +-
.../ignite/messaging/GridMessagingSelfTest.java | 13 +-
.../discovery/AbstractDiscoverySelfTest.java | 8 +-
...pClientDiscoveryMarshallerCheckSelfTest.java | 76 +
.../tcp/TcpClientDiscoverySelfTest.java | 700 ---
.../tcp/TcpClientDiscoverySpiSelfTest.java | 1171 ++++
.../tcp/TcpDiscoveryConcurrentStartTest.java | 61 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 18 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 2 +-
.../ignite/testframework/GridTestUtils.java | 15 +
.../testframework/junits/GridAbstractTest.java | 52 +-
.../junits/cache/TestCacheSession.java | 18 +
.../cache/TestThreadLocalCacheSession.java | 15 +
.../junits/common/GridCommonAbstractTest.java | 83 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +-
.../IgniteCacheDataStructuresSelfTestSuite.java | 3 +
.../IgniteCacheFailoverTestSuite.java | 4 +-
.../IgniteCacheNearOnlySelfTestSuite.java | 16 +-
...gniteCacheP2pUnmarshallingErrorTestSuit.java | 41 -
...niteCacheP2pUnmarshallingErrorTestSuite.java | 41 +
.../IgniteCacheTcpClientDiscoveryTestSuite.java | 47 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 4 +
.../testsuites/IgniteCacheTestSuite2.java | 11 +-
.../testsuites/IgniteCacheTestSuite4.java | 5 +
.../testsuites/IgniteKernalSelfTestSuite.java | 7 +-
.../IgniteSpiDiscoverySelfTestSuite.java | 3 +-
.../igfs/IgfsNearOnlyMultiNodeSelfTest.java | 5 +-
.../CacheHibernateStoreSessionListener.java | 216 +
...heHibernateStoreSessionListenerSelfTest.java | 228 +
.../testsuites/IgniteHibernateTestSuite.java | 2 +
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
...niteCacheP2pUnmarshallingQueryErrorTest.java | 3 +-
.../IgniteCacheQuerySelfTestSuite.java | 2 +-
modules/spring/pom.xml | 14 +
.../spring/CacheSpringStoreSessionListener.java | 207 +
...CacheSpringStoreSessionListenerSelfTest.java | 197 +
.../testsuites/IgniteSpringTestSuite.java | 3 +
scripts/git-format-patch.sh | 14 +-
255 files changed, 20612 insertions(+), 10742 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/859f1829/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
index 77fe8cf,f33de76..9e54673
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
@@@ -66,16 -72,12 +72,16 @@@ public class IgniteCacheMultiTxLockSelf
CacheConfiguration ccfg = new CacheConfiguration();
ccfg.setName(CACHE_NAME);
- ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
- ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
+ ccfg.setAtomicityMode(TRANSACTIONAL);
+ ccfg.setWriteSynchronizationMode(PRIMARY_SYNC);
ccfg.setBackups(2);
- ccfg.setCacheMode(CacheMode.PARTITIONED);
+ ccfg.setCacheMode(PARTITIONED);
ccfg.setStartSize(100000);
- ccfg.setEvictionPolicy(new LruEvictionPolicy(100000));
+
+ LruEvictionPolicy plc = new LruEvictionPolicy();
+ plc.setMaxSize(100000);
+
+ ccfg.setEvictionPolicy(plc);
ccfg.setEvictSynchronized(true);
c.setCacheConfiguration(ccfg);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/859f1829/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java
index faca01d,0000000..0d3c692
mode 100644,000000..100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java
@@@ -1,175 -1,0 +1,172 @@@
+/*
+ * 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.eviction.lru;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.eviction.lru.*;
+import org.apache.ignite.configuration.*;
+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 static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ * LRU near eviction tests for NEAR_ONLY distribution mode (GG-8884).
+ */
+public class LruNearOnlyNearEvictionPolicySelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** Grid count. */
+ private static final int GRID_COUNT = 2;
+
+ /** Maximum size for near eviction policy. */
+ private static final int EVICTION_MAX_SIZE = 10;
+
+ /** Node count. */
+ private int cnt;
+
+ /** Caching mode specified by test. */
+ private CacheMode cacheMode;
+
+ /** Cache atomicity mode specified by test. */
+ private CacheAtomicityMode atomicityMode;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ cnt = 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration c = super.getConfiguration(gridName);
+
+ if (cnt == 0)
+ c.setClientMode(true);
++ else {
++ CacheConfiguration cc = new CacheConfiguration();
+
- CacheConfiguration cc = new CacheConfiguration();
++ cc.setAtomicityMode(atomicityMode);
++ cc.setCacheMode(cacheMode);
++ cc.setWriteSynchronizationMode(PRIMARY_SYNC);
++ cc.setRebalanceMode(SYNC);
++ cc.setStartSize(100);
++ cc.setBackups(0);
+
- cc.setAtomicityMode(atomicityMode);
- cc.setCacheMode(cacheMode);
- cc.setWriteSynchronizationMode(PRIMARY_SYNC);
- cc.setRebalanceMode(SYNC);
- cc.setStartSize(100);
- cc.setBackups(0);
++ c.setCacheConfiguration(cc);
++ }
+
- c.setCacheConfiguration(cc);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(ipFinder);
-
- c.setDiscoverySpi(disco);
++ c.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder).setForceServerMode(true));
+
+ cnt++;
+
+ return c;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionedAtomicNearEvictionMaxSize() throws Exception {
+ atomicityMode = ATOMIC;
+ cacheMode = PARTITIONED;
+
+ checkNearEvictionMaxSize();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionedTransactionalNearEvictionMaxSize() throws Exception {
+ atomicityMode = TRANSACTIONAL;
+ cacheMode = PARTITIONED;
+
+ checkNearEvictionMaxSize();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedAtomicNearEvictionMaxSize() throws Exception {
+ atomicityMode = ATOMIC;
+ cacheMode = REPLICATED;
+
+ checkNearEvictionMaxSize();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedTransactionalNearEvictionMaxSize() throws Exception {
+ atomicityMode = TRANSACTIONAL;
+ cacheMode = REPLICATED;
+
+ checkNearEvictionMaxSize();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void checkNearEvictionMaxSize() throws Exception {
+ startGrids(GRID_COUNT);
+
+ try {
+ NearCacheConfiguration nearCfg = new NearCacheConfiguration();
+
+ LruEvictionPolicy plc = new LruEvictionPolicy();
+ plc.setMaxSize(EVICTION_MAX_SIZE);
+
+ nearCfg.setNearEvictionPolicy(plc);
+
+ grid(0).createNearCache(null, nearCfg);
+
+ int cnt = 1000;
+
+ info("Inserting " + cnt + " keys to cache.");
+
+ try (IgniteDataStreamer<Integer, String> ldr = grid(1).dataStreamer(null)) {
+ for (int i = 0; i < cnt; i++)
+ ldr.addData(i, Integer.toString(i));
+ }
+
+ assertTrue("Near cache size " + near(0).nearSize() + ", but eviction maximum size " + EVICTION_MAX_SIZE,
+ near(0).nearSize() <= EVICTION_MAX_SIZE);
+
+ info("Getting " + cnt + " keys from cache.");
+
+ for (int i = 0; i < cnt; i++) {
+ IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+ assertTrue(cache.get(i).equals(Integer.toString(i)));
+ }
+
+ assertTrue("Near cache size " + near(0).nearSize() + ", but eviction maximum size " + EVICTION_MAX_SIZE,
+ near(0).nearSize() <= EVICTION_MAX_SIZE);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+}