http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxConsistencyColocatedRestartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxConsistencyColocatedRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxConsistencyColocatedRestartSelfTest.java new file mode 100644 index 0000000..ba161f7 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxConsistencyColocatedRestartSelfTest.java @@ -0,0 +1,36 @@ +/* + * 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.dht; + +import org.apache.ignite.cache.*; +import org.gridgain.grid.kernal.processors.cache.distributed.*; + +/** + * + */ +public class IgniteTxConsistencyColocatedRestartSelfTest extends IgniteTxConsistencyRestartAbstractSelfTest { + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return GridCacheMode.PARTITIONED; + } + + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode partitionDistributionMode() { + return GridCacheDistributionMode.PARTITIONED_ONLY; + } +}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java new file mode 100644 index 0000000..36c02cc --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java @@ -0,0 +1,79 @@ +/* + * 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.dht; + +import org.apache.ignite.cache.*; +import org.apache.ignite.cluster.*; +import org.gridgain.grid.kernal.processors.cache.*; + +import java.util.*; + +import static org.apache.ignite.cache.GridCacheMode.*; + +/** + * + */ +public class IgniteTxReentryColocatedSelfTest extends IgniteTxReentryAbstractSelfTest { + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return PARTITIONED; + } + + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 3; + } + + /** {@inheritDoc} */ + @Override protected int testKey() { + int key = 0; + + GridCache<Object, Object> cache = grid(0).cache(null); + + while (true) { + Collection<ClusterNode> nodes = cache.affinity().mapKeyToPrimaryAndBackups(key); + + if (nodes.contains(grid(0).localNode())) + key++; + else + break; + } + + return key; + } + + /** {@inheritDoc} */ + @Override protected int expectedNearLockRequests() { + return 1; + } + + /** {@inheritDoc} */ + @Override protected int expectedDhtLockRequests() { + return 0; + } + + /** {@inheritDoc} */ + @Override protected int expectedDistributedLockRequests() { + return 1; + } + + /** {@inheritDoc} */ + @Override protected boolean nearEnabled() { + return false; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java index e11c8ac..b34eab0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java @@ -17,7 +17,7 @@ package org.apache.ignite.internal.processors.cache.distributed.near; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; /** * Multi-node test for group lock in near cache. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java index f611492..6eb3ff3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java @@ -26,7 +26,7 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.transactions.*; import org.gridgain.grid.kernal.processors.cache.distributed.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java index 69e017d..0f8a18b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java @@ -23,7 +23,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.gridgain.grid.kernal.processors.cache.distributed.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java index ba177c0..b09c473 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java @@ -24,7 +24,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.transactions.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPessimisticOriginatingNodeFailureSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPessimisticOriginatingNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPessimisticOriginatingNodeFailureSelfTest.java index bb999ea..6d47263 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPessimisticOriginatingNodeFailureSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPessimisticOriginatingNodeFailureSelfTest.java @@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.cache.distributed.near; import org.apache.ignite.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.util.typedef.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java index 151b0b2..a651aef 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java @@ -25,7 +25,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.transactions.*; import org.gridgain.grid.kernal.processors.cache.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java index 5aa1289..5cd28da 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java @@ -27,7 +27,7 @@ import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; import org.apache.ignite.transactions.*; import org.gridgain.grid.kernal.processors.cache.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java index 03ddfc0..4c62343 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java @@ -31,7 +31,7 @@ import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; import org.apache.ignite.transactions.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryMemorySizeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryMemorySizeSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryMemorySizeSelfTest.java index 1a7d254..913a4b0 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryMemorySizeSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryMemorySizeSelfTest.java @@ -25,7 +25,7 @@ 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.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.gridgain.testframework.junits.common.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheMultiUpdateLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheMultiUpdateLockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheMultiUpdateLockSelfTest.java index 70a5cd3..51430b0 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheMultiUpdateLockSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheMultiUpdateLockSelfTest.java @@ -23,7 +23,7 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.spi.checkpoint.noop.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxConcurrentGetAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxConcurrentGetAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxConcurrentGetAbstractTest.java index 389ca26..fb56f5b 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxConcurrentGetAbstractTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxConcurrentGetAbstractTest.java @@ -21,7 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.transactions.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxMultiNodeAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxMultiNodeAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxMultiNodeAbstractTest.java index ef47b6e..0bfa741 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxMultiNodeAbstractTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxMultiNodeAbstractTest.java @@ -27,7 +27,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; import org.apache.ignite.transactions.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxReentryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxReentryAbstractSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxReentryAbstractSelfTest.java index b11cc40..ee8bd6a 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxReentryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/IgniteTxReentryAbstractSelfTest.java @@ -24,7 +24,7 @@ import org.apache.ignite.spi.*; import org.apache.ignite.transactions.*; import org.apache.ignite.internal.managers.communication.*; import org.gridgain.grid.kernal.processors.cache.distributed.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java index ff2d8b3..f9b116f 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java @@ -26,7 +26,7 @@ import org.apache.ignite.lang.*; 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.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.gridgain.testframework.*; import org.gridgain.testframework.junits.common.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java index 8a69229..a5ca374 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java @@ -23,7 +23,7 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; import org.gridgain.grid.kernal.processors.cache.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java deleted file mode 100644 index 676783b..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java +++ /dev/null @@ -1,168 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; -import org.apache.ignite.configuration.*; -import org.gridgain.grid.kernal.processors.cache.distributed.*; -import org.apache.ignite.spi.swapspace.file.*; - -import static org.apache.ignite.cache.GridCacheAtomicWriteOrderMode.*; -import static org.apache.ignite.cache.GridCacheAtomicityMode.*; -import static org.apache.ignite.cache.GridCacheDistributionMode.*; -import static org.junit.Assert.*; - -/** - * Tests for byte array values in PARTITIONED-ONLY caches. - */ -public abstract class GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest extends - GridCacheAbstractPartitionedByteArrayValuesSelfTest { - /** Offheap cache name. */ - protected static final String CACHE_ATOMIC = "cache_atomic"; - - /** Offheap cache name. */ - protected static final String CACHE_ATOMIC_OFFHEAP = "cache_atomic_offheap"; - - /** Offheap tiered cache name. */ - protected static final String CACHE_ATOMIC_OFFHEAP_TIERED = "cache_atomic_offheap_tiered"; - - /** Atomic caches. */ - private static GridCache<Integer, Object>[] cachesAtomic; - - /** Atomic offheap caches. */ - private static GridCache<Integer, Object>[] cachesAtomicOffheap; - - /** Atomic offheap caches. */ - private static GridCache<Integer, Object>[] cachesAtomicOffheapTiered; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration c = super.getConfiguration(gridName); - - CacheConfiguration atomicCacheCfg = cacheConfiguration0(); - - atomicCacheCfg.setName(CACHE_ATOMIC); - atomicCacheCfg.setAtomicityMode(ATOMIC); - atomicCacheCfg.setAtomicWriteOrderMode(PRIMARY); - - CacheConfiguration atomicOffheapCacheCfg = offheapCacheConfiguration0(); - - atomicOffheapCacheCfg.setName(CACHE_ATOMIC_OFFHEAP); - atomicOffheapCacheCfg.setAtomicityMode(ATOMIC); - atomicOffheapCacheCfg.setAtomicWriteOrderMode(PRIMARY); - - CacheConfiguration atomicOffheapTieredCacheCfg = offheapTieredCacheConfiguration(); - - atomicOffheapTieredCacheCfg.setName(CACHE_ATOMIC_OFFHEAP_TIERED); - atomicOffheapTieredCacheCfg.setAtomicityMode(ATOMIC); - atomicOffheapTieredCacheCfg.setAtomicWriteOrderMode(PRIMARY); - - c.setCacheConfiguration(cacheConfiguration(), - offheapCacheConfiguration(), - offheapTieredCacheConfiguration(), - atomicCacheCfg, - atomicOffheapCacheCfg, - atomicOffheapTieredCacheCfg); - - c.setSwapSpaceSpi(new FileSwapSpaceSpi()); - - c.setPeerClassLoadingEnabled(peerClassLoading()); - - return c; - } - - /** {@inheritDoc} */ - @Override protected GridCacheDistributionMode distributionMode() { - return PARTITIONED_ONLY; - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - int gridCnt = gridCount(); - - cachesAtomic = new GridCache[gridCnt]; - cachesAtomicOffheap = new GridCache[gridCnt]; - cachesAtomicOffheapTiered = new GridCache[gridCnt]; - - for (int i = 0; i < gridCount(); i++) { - cachesAtomic[i] = ignites[i].cache(CACHE_ATOMIC); - cachesAtomicOffheap[i] = ignites[i].cache(CACHE_ATOMIC_OFFHEAP); - cachesAtomicOffheapTiered[i] = ignites[i].cache(CACHE_ATOMIC_OFFHEAP_TIERED); - } - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - cachesAtomic = null; - cachesAtomicOffheap = null; - cachesAtomicOffheapTiered = null; - - super.afterTestsStopped(); - } - - /** - * Test atomic cache. - * - * @throws Exception If failed. - */ - public void testAtomic() throws Exception { - testAtomic0(cachesAtomic); - } - - /** - * Test atomic offheap cache. - * - * @throws Exception If failed. - */ - public void testAtomicOffheap() throws Exception { - testAtomic0(cachesAtomicOffheap); - } - - /** - * Test atomic offheap cache. - * - * @throws Exception If failed. - */ - public void testAtomicOffheapTiered() throws Exception { - testAtomic0(cachesAtomicOffheapTiered); - } - - /** - * INternal routine for ATOMIC cache testing. - * - * @param caches Caches. - * @throws Exception If failed. - */ - private void testAtomic0(GridCache<Integer, Object>[] caches) throws Exception { - byte[] val = wrap(1); - - for (GridCache<Integer, Object> cache : caches) { - cache.put(KEY_1, val); - - for (GridCache<Integer, Object> cacheInner : caches) - assertArrayEquals(val, (byte[])cacheInner.get(KEY_1)); - - cache.remove(KEY_1); - - assertNull(cache.get(KEY_1)); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java deleted file mode 100644 index 764e549..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java +++ /dev/null @@ -1,336 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.marshaller.optimized.*; -import org.apache.ignite.transactions.*; -import org.gridgain.grid.kernal.processors.cache.*; -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.gridgain.testframework.junits.common.*; - -import javax.cache.configuration.*; -import javax.cache.processor.*; -import java.util.*; - -import static org.apache.ignite.cache.GridCacheAtomicityMode.*; -import static org.apache.ignite.cache.GridCacheMode.*; -import static org.apache.ignite.cache.GridCacheDistributionMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; - -/** - * Tests write-through. - */ -public abstract class GridCacheAbstractTransformWriteThroughSelfTest extends GridCommonAbstractTest { - /** Grid count. */ - protected static final int GRID_CNT = 3; - - /** Update operation. */ - protected static final int OP_UPDATE = 0; - - /** Delete operation. */ - protected static final int OP_DELETE = 1; - - /** Near node constant. */ - protected static final int NEAR_NODE = 0; - - /** Primary node constant. */ - protected static final int PRIMARY_NODE = 0; - - /** Backup node constant. */ - protected static final int BACKUP_NODE = 0; - - /** Keys number. */ - public static final int KEYS_CNT = 30; - - /** IP finder. */ - private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); - - /** Value increment processor. */ - private static final EntryProcessor<String, Integer, Void> INCR_CLOS = new EntryProcessor<String, Integer, Void>() { - @Override public Void process(MutableEntry<String, Integer> e, Object... args) { - if (!e.exists()) - e.setValue(1); - else - e.setValue(e.getValue() + 1); - - return null; - } - }; - - /** Value remove processor. */ - private static final EntryProcessor<String, Integer, Void> RMV_CLOS = new EntryProcessor<String, Integer, Void>() { - @Override public Void process(MutableEntry<String, Integer> e, Object... args) { - e.remove(); - - return null; - } - }; - - /** Test store. */ - private static List<GridCacheGenericTestStore<String, Integer>> stores = - new ArrayList<>(GRID_CNT); - - /** - * @return {@code True} if batch update is enabled. - */ - protected abstract boolean batchUpdate(); - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - cfg.setMarshaller(new IgniteOptimizedMarshaller(false)); - - TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); - - discoSpi.setIpFinder(IP_FINDER); - - cfg.setDiscoverySpi(discoSpi); - - GridCacheGenericTestStore<String, Integer> store = new GridCacheGenericTestStore<>(); - - stores.add(store); - - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - - cacheCfg.setCacheMode(PARTITIONED); - cacheCfg.setBackups(1); - cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(store)); - cacheCfg.setReadThrough(true); - cacheCfg.setWriteThrough(true); - cacheCfg.setLoadPreviousValue(true); - cacheCfg.setAtomicityMode(TRANSACTIONAL); - cacheCfg.setDistributionMode(NEAR_PARTITIONED); - - cfg.setCacheConfiguration(cacheCfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - for (int i = 0; i < GRID_CNT; i++) - startGrid(i); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - stopAllGrids(true); - - stores.clear(); - - super.afterTestsStopped(); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - for (GridCacheGenericTestStore<String, Integer> store : stores) - store.reset(); - } - - /** - * @throws Exception If failed. - */ - public void testTransformOptimisticNearUpdate() throws Exception { - checkTransform(OPTIMISTIC, NEAR_NODE, OP_UPDATE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformOptimisticPrimaryUpdate() throws Exception { - checkTransform(OPTIMISTIC, PRIMARY_NODE, OP_UPDATE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformOptimisticBackupUpdate() throws Exception { - checkTransform(OPTIMISTIC, BACKUP_NODE, OP_UPDATE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformOptimisticNearDelete() throws Exception { - checkTransform(OPTIMISTIC, NEAR_NODE, OP_DELETE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformOptimisticPrimaryDelete() throws Exception { - checkTransform(OPTIMISTIC, PRIMARY_NODE, OP_DELETE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformOptimisticBackupDelete() throws Exception { - checkTransform(OPTIMISTIC, BACKUP_NODE, OP_DELETE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformPessimisticNearUpdate() throws Exception { - checkTransform(PESSIMISTIC, NEAR_NODE, OP_UPDATE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformPessimisticPrimaryUpdate() throws Exception { - checkTransform(PESSIMISTIC, PRIMARY_NODE, OP_UPDATE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformPessimisticBackupUpdate() throws Exception { - checkTransform(PESSIMISTIC, BACKUP_NODE, OP_UPDATE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformPessimisticNearDelete() throws Exception { - checkTransform(PESSIMISTIC, NEAR_NODE, OP_DELETE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformPessimisticPrimaryDelete() throws Exception { - checkTransform(PESSIMISTIC, PRIMARY_NODE, OP_DELETE); - } - - /** - * @throws Exception If failed. - */ - public void testTransformPessimisticBackupDelete() throws Exception { - checkTransform(PESSIMISTIC, BACKUP_NODE, OP_DELETE); - } - - /** - * @param concurrency Concurrency. - * @param nodeType Node type. - * @param op Op. - * @throws Exception If failed. - */ - protected void checkTransform(IgniteTxConcurrency concurrency, int nodeType, int op) throws Exception { - IgniteCache<String, Integer> cache = jcache(0); - - Collection<String> keys = keysForType(nodeType); - - for (String key : keys) - cache.put(key, 1); - - GridCacheGenericTestStore<String, Integer> nearStore = stores.get(0); - - nearStore.reset(); - - for (String key : keys) - cache(0).clear(key); - - info(">>> Starting transform transaction"); - - try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, READ_COMMITTED)) { - if (op == OP_UPDATE) { - for (String key : keys) - cache.invoke(key, INCR_CLOS); - } - else { - for (String key : keys) - cache.invoke(key, RMV_CLOS); - } - - tx.commit(); - } - - if (batchUpdate()) { - assertEquals(0, nearStore.getPutCount()); - assertEquals(0, nearStore.getRemoveCount()); - - if (op == OP_UPDATE) - assertEquals(1, nearStore.getPutAllCount()); - else - assertEquals(1, nearStore.getRemoveAllCount()); - } - else { - assertEquals(0, nearStore.getPutAllCount()); - assertEquals(0, nearStore.getRemoveAllCount()); - - if (op == OP_UPDATE) - assertEquals(keys.size(), nearStore.getPutCount()); - else - assertEquals(keys.size(), nearStore.getRemoveCount()); - } - - if (op == OP_UPDATE) { - for (String key : keys) - assertEquals((Integer)2, nearStore.getMap().get(key)); - } - else { - for (String key : keys) - assertNull(nearStore.getMap().get(key)); - } - } - - /** - * @param nodeType Node type to generate keys for. - * @return Collection of keys. - */ - private Collection<String> keysForType(int nodeType) { - Collection<String> keys = new ArrayList<>(KEYS_CNT); - - int numKey = 0; - - while (keys.size() < 30) { - String key = String.valueOf(numKey); - - if (nodeType == NEAR_NODE) { - if (!cache(0).affinity().isPrimaryOrBackup(grid(0).localNode(), key)) - keys.add(key); - } - else if (nodeType == PRIMARY_NODE) { - if (cache(0).affinity().isPrimary(grid(0).localNode(), key)) - keys.add(key); - } - else if (nodeType == BACKUP_NODE) { - if (cache(0).affinity().isBackup(grid(0).localNode(), key)) - keys.add(key); - } - - numKey++; - } - - return keys; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java deleted file mode 100644 index 47066f1..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java +++ /dev/null @@ -1,45 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; -import org.gridgain.grid.kernal.processors.cache.distributed.*; - -import static org.apache.ignite.cache.GridCacheAtomicityMode.*; -import static org.apache.ignite.cache.GridCacheMode.*; -import static org.apache.ignite.cache.GridCacheDistributionMode.*; - -/** - * Tests preloading of expired entries. - */ -public class GridCacheAtomicExpiredEntriesPreloadSelfTest extends GridCacheExpiredEntriesPreloadAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected GridCacheMode cacheMode() { - return PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected GridCacheAtomicityMode atomicityMode() { - return ATOMIC; - } - - /** {@inheritDoc} */ - @Override protected GridCacheDistributionMode distributionMode() { - return PARTITIONED_ONLY; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java deleted file mode 100644 index 1b874ac..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java +++ /dev/null @@ -1,100 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.near.*; -import org.apache.ignite.internal.util.typedef.*; - -import java.util.*; - -import static org.apache.ignite.cache.GridCacheAtomicWriteOrderMode.*; -import static org.apache.ignite.cache.GridCacheAtomicityMode.*; -import static org.apache.ignite.cache.GridCacheDistributionMode.*; - -/** - * Multi node test for disabled near cache. - */ -public class GridCacheAtomicFullApiSelfTest extends GridCachePartitionedFullApiSelfTest { - /** - * @return Write order mode for atomic cache. - */ - protected GridCacheAtomicWriteOrderMode atomicWriteOrderMode() { - return CLOCK; - } - - /** {@inheritDoc} */ - @Override protected GridCacheAtomicityMode atomicityMode() { - return ATOMIC; - } - - /** {@inheritDoc} */ - @Override protected GridCacheDistributionMode distributionMode() { - return PARTITIONED_ONLY; - } - - /** {@inheritDoc} */ - @Override protected boolean txEnabled() { - return false; - } - - /** {@inheritDoc} */ - @Override protected boolean lockingEnabled() { - return false; - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { - CacheConfiguration ccfg = super.cacheConfiguration(gridName); - - ccfg.setAtomicWriteOrderMode(atomicWriteOrderMode()); - - return ccfg; - } - - /** - * @throws Exception In case of error. - */ - @Override public void testGetAll() throws Exception { - cache().put("key1", 1); - cache().put("key2", 2); - - assert cache().getAll((Collection<String>)null).isEmpty(); - assert cache().getAll(Collections.<String>emptyList()).isEmpty(); - - Map<String, Integer> map1 = cache().getAll(F.asList("key1", "key2", "key9999")); - - info("Retrieved map1: " + map1); - - assert 2 == map1.size() : "Invalid map: " + map1; - - assertEquals(1, (int)map1.get("key1")); - assertEquals(2, (int)map1.get("key2")); - assertNull(map1.get("key9999")); - - Map<String, Integer> map2 = cache().getAll(F.asList("key1", "key2", "key9999")); - - info("Retrieved map2: " + map2); - - assert 2 == map2.size() : "Invalid map: " + map2; - - assertEquals(1, (int)map2.get("key1")); - assertEquals(2, (int)map2.get("key2")); - assertNull(map2.get("key9999")); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java deleted file mode 100644 index 75ecccb..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java +++ /dev/null @@ -1,820 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.gridgain.grid.kernal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.near.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.junits.common.*; -import org.jetbrains.annotations.*; - -import javax.cache.processor.*; -import java.io.*; -import java.util.*; - -import static org.apache.ignite.cache.GridCacheAtomicWriteOrderMode.*; -import static org.apache.ignite.cache.GridCacheAtomicityMode.*; -import static org.apache.ignite.cache.GridCacheDistributionMode.*; -import static org.apache.ignite.cache.GridCacheMode.*; -import static org.apache.ignite.cache.GridCachePreloadMode.*; -import static org.apache.ignite.cache.GridCacheWriteSynchronizationMode.*; -import static org.apache.ignite.internal.GridNodeAttributes.*; - -/** - * Tests near cache with various atomic cache configuration. - */ -public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { - /** */ - private static final int GRID_CNT = 4; - - /** */ - private static final int PRIMARY = 0; - - /** */ - private static final int BACKUP = 1; - - /** */ - private static final int NOT_PRIMARY_AND_BACKUP = 2; - - /** */ - private int backups; - - /** */ - private GridCacheAtomicWriteOrderMode writeOrderMode; - - /** */ - private int lastKey; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - CacheConfiguration ccfg = new CacheConfiguration(); - - ccfg.setCacheMode(PARTITIONED); - ccfg.setAtomicityMode(ATOMIC); - ccfg.setDistributionMode(NEAR_PARTITIONED); - ccfg.setWriteSynchronizationMode(FULL_SYNC); - ccfg.setPreloadMode(SYNC); - - assert writeOrderMode != null; - - ccfg.setAtomicWriteOrderMode(writeOrderMode); - ccfg.setBackups(backups); - - cfg.setCacheConfiguration(ccfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * @throws Exception If failed. - */ - public void testNoBackupsPrimaryWriteOrder() throws Exception { - startGrids(0, GridCacheAtomicWriteOrderMode.PRIMARY); - - checkNearCache(); - } - - /** - * @throws Exception If failed. - */ - public void testNoBackupsClockWriteOrder() throws Exception { - startGrids(0, CLOCK); - - checkNearCache(); - } - - /** - * @throws Exception If failed. - */ - public void testWithBackupsPrimaryWriteOrder() throws Exception { - startGrids(2, GridCacheAtomicWriteOrderMode.PRIMARY); - - checkNearCache(); - } - - - /** - * @throws Exception If failed. - */ - public void testWithBackupsClockWriteOrder() throws Exception { - startGrids(2, CLOCK); - - checkNearCache(); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ZeroLengthArrayAllocation") - private void checkNearCache() throws Exception { - checkPut(); - - checkPutAll(); - - checkTransform(); - - checkTransformAll(); - - checkRemove(); - - checkReaderEvict(); - - checkReaderRemove(); - - checkPutRemoveGet(); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ZeroLengthArrayAllocation") - private void checkPutAll() throws Exception { - log.info("Check putAll."); - - Ignite ignite0 = grid(0); - - GridCache<Integer, Integer> cache0 = ignite0.cache(null); - - GridCacheAffinity<Integer> aff = cache0.affinity(); - - UUID id0 = ignite0.cluster().localNode().id(); - - Map<Integer, Integer> primaryKeys = new HashMap<>(); - - for (int i = 0; i < 10; i++) - primaryKeys.put(key(ignite0, PRIMARY), 1); - - log.info("PutAll from primary."); - - cache0.putAll(primaryKeys); - - for (int i = 0; i < GRID_CNT; i++) { - for (Integer primaryKey : primaryKeys.keySet()) - checkEntry(grid(i), primaryKey, 1, false); - } - - if (backups > 0) { - Map<Integer, Integer> backupKeys = new HashMap<>(); - - for (int i = 0; i < 10; i++) - backupKeys.put(key(ignite0, BACKUP), 2); - - log.info("PutAll from backup."); - - cache0.putAll(backupKeys); - - for (int i = 0; i < GRID_CNT; i++) { - for (Integer backupKey : backupKeys.keySet()) - checkEntry(grid(i), backupKey, 2, false); - } - } - - Map<Integer, Integer> nearKeys = new HashMap<>(); - - for (int i = 0; i < 30; i++) - nearKeys.put(key(ignite0, NOT_PRIMARY_AND_BACKUP), 3); - - log.info("PutAll from near."); - - cache0.putAll(nearKeys); - - for (int i = 0; i < GRID_CNT; i++) { - for (Integer nearKey : nearKeys.keySet()) { - UUID[] expReaders = aff.isPrimary(grid(i).localNode(), nearKey) ? new UUID[]{id0} : new UUID[]{}; - - checkEntry(grid(i), nearKey, 3, i == 0, expReaders); - } - } - - Map<Integer, Collection<UUID>> readersMap = new HashMap<>(); - - for (Integer key : nearKeys.keySet()) - readersMap.put(key, new HashSet<UUID>()); - - int val = 4; - - for (int i = 0; i < GRID_CNT; i++) { - delay(); - - GridCache<Integer, Integer> cache = grid(i).cache(null); - - for (Integer key : nearKeys.keySet()) - nearKeys.put(key, val); - - log.info("PutAll [grid=" + grid(i).name() + ", val=" + val + ']'); - - cache.putAll(nearKeys); - - for (Integer key : nearKeys.keySet()) { - if (!aff.isPrimaryOrBackup(grid(i).localNode(), key)) - readersMap.get(key).add(grid(i).localNode().id()); - } - - for (int j = 0; j < GRID_CNT; j++) { - for (Integer key : nearKeys.keySet()) { - boolean primaryNode = aff.isPrimary(grid(j).localNode(), key); - - Collection<UUID> readers = readersMap.get(key); - - UUID[] expReaders = primaryNode ? U.toArray(readers, new UUID[readers.size()]) : new UUID[]{}; - - checkEntry(grid(j), key, val, readers.contains(grid(j).localNode().id()), expReaders); - } - } - - val++; - } - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ZeroLengthArrayAllocation") - private void checkTransform() throws Exception { - log.info("Check transform."); - - Ignite ignite0 = grid(0); - - IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); - - GridCacheAffinity<Object> aff = cache(0).affinity(); - - UUID id0 = ignite0.cluster().localNode().id(); - - Integer primaryKey = key(ignite0, PRIMARY); - - log.info("Transform from primary."); - - cache0.invoke(primaryKey, new Processor(primaryKey)); - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), primaryKey, primaryKey, false); - - if (backups > 0) { - Integer backupKey = key(ignite0, BACKUP); - - log.info("Transform from backup."); - - cache0.invoke(backupKey, new Processor(backupKey)); - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), backupKey, backupKey, false); - } - - Integer nearKey = key(ignite0, NOT_PRIMARY_AND_BACKUP); - - log.info("Transform from near."); - - cache0.invoke(nearKey, new Processor(nearKey)); - - for (int i = 0; i < GRID_CNT; i++) { - UUID[] expReaders = aff.isPrimary(grid(i).localNode(), nearKey) ? new UUID[]{id0} : new UUID[]{}; - - checkEntry(grid(i), nearKey, nearKey, i == 0, expReaders); - } - - Collection<UUID> readers = new HashSet<>(); - - readers.add(id0); - - int val = nearKey + 1; - - for (int i = 0; i < GRID_CNT; i++) { - delay(); - - IgniteCache<Integer, Integer> cache = grid(i).jcache(null); - - log.info("Transform [grid=" + grid(i).name() + ", val=" + val + ']'); - - cache.invoke(nearKey, new Processor(val)); - - if (!aff.isPrimaryOrBackup(grid(i).localNode(), nearKey)) - readers.add(grid(i).localNode().id()); - - for (int j = 0; j < GRID_CNT; j++) { - boolean primaryNode = aff.isPrimary(grid(j).localNode(), nearKey); - - UUID[] expReaders = primaryNode ? U.toArray(readers, new UUID[readers.size()]) : new UUID[]{}; - - checkEntry(grid(j), nearKey, val, readers.contains(grid(j).localNode().id()), expReaders); - } - - val++; - } - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ZeroLengthArrayAllocation") - private void checkTransformAll() throws Exception { - log.info("Check transformAll."); - - Ignite ignite0 = grid(0); - - IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); - - GridCacheAffinity<Object> aff = ignite0.cache(null).affinity(); - - UUID id0 = ignite0.cluster().localNode().id(); - - Set<Integer> primaryKeys = new HashSet<>(); - - for (int i = 0; i < 10; i++) - primaryKeys.add(key(ignite0, PRIMARY)); - - log.info("TransformAll from primary."); - - cache0.invokeAll(primaryKeys, new Processor(1)); - - for (int i = 0; i < GRID_CNT; i++) { - for (Integer primaryKey : primaryKeys) - checkEntry(grid(i), primaryKey, 1, false); - } - - if (backups > 0) { - Set<Integer> backupKeys = new HashSet<>(); - - for (int i = 0; i < 10; i++) - backupKeys.add(key(ignite0, BACKUP)); - - log.info("TransformAll from backup."); - - cache0.invokeAll(backupKeys, new Processor(2)); - - for (int i = 0; i < GRID_CNT; i++) { - for (Integer backupKey : backupKeys) - checkEntry(grid(i), backupKey, 2, false); - } - } - - Set<Integer> nearKeys = new HashSet<>(); - - for (int i = 0; i < 30; i++) - nearKeys.add(key(ignite0, NOT_PRIMARY_AND_BACKUP)); - - log.info("TransformAll from near."); - - cache0.invokeAll(nearKeys, new Processor(3)); - - for (int i = 0; i < GRID_CNT; i++) { - for (Integer nearKey : nearKeys) { - UUID[] expReaders = aff.isPrimary(grid(i).localNode(), nearKey) ? new UUID[]{id0} : new UUID[]{}; - - checkEntry(grid(i), nearKey, 3, i == 0, expReaders); - } - } - - Map<Integer, Collection<UUID>> readersMap = new HashMap<>(); - - for (Integer key : nearKeys) - readersMap.put(key, new HashSet<UUID>()); - - int val = 4; - - for (int i = 0; i < GRID_CNT; i++) { - delay(); - - IgniteCache<Integer, Integer> cache = grid(i).jcache(null); - - for (Integer key : nearKeys) - nearKeys.add(key); - - log.info("TransformAll [grid=" + grid(i).name() + ", val=" + val + ']'); - - cache.invokeAll(nearKeys, new Processor(val)); - - for (Integer key : nearKeys) { - if (!aff.isPrimaryOrBackup(grid(i).localNode(), key)) - readersMap.get(key).add(grid(i).localNode().id()); - } - - for (int j = 0; j < GRID_CNT; j++) { - for (Integer key : nearKeys) { - boolean primaryNode = aff.isPrimary(grid(j).localNode(), key); - - Collection<UUID> readers = readersMap.get(key); - - UUID[] expReaders = primaryNode ? U.toArray(readers, new UUID[readers.size()]) : new UUID[]{}; - - checkEntry(grid(j), key, val, readers.contains(grid(j).localNode().id()), expReaders); - } - } - - val++; - } - } - - /** - * @throws Exception If failed. - */ - private void checkPutRemoveGet() throws Exception { - Ignite ignite0 = grid(0); - - GridCache<Integer, Integer> cache0 = ignite0.cache(null); - - Integer key = key(ignite0, NOT_PRIMARY_AND_BACKUP); - - cache0.put(key, key); - - for (int i = 0; i < GRID_CNT; i++) - grid(i).cache(null).get(key); - - cache0.remove(key); - - cache0.put(key, key); - - for (int i = 0; i < GRID_CNT; i++) - grid(i).cache(null).get(key); - - cache0.remove(key); - } - - /** - * @throws Exception If failed. - */ - private void checkPut() throws Exception { - checkPut(0); - - checkPut(GRID_CNT - 1); - } - - /** - * @param grid Grid Index. - * @throws Exception If failed. - */ - @SuppressWarnings("ZeroLengthArrayAllocation") - private void checkPut(int grid) throws Exception { - log.info("Check put, grid: " + grid); - - Ignite ignite0 = grid(grid); - - GridCache<Integer, Integer> cache0 = ignite0.cache(null); - - GridCacheAffinity<Integer> aff = cache0.affinity(); - - UUID id0 = ignite0.cluster().localNode().id(); - - Integer primaryKey = key(ignite0, PRIMARY); - - log.info("Put from primary."); - - cache0.put(primaryKey, primaryKey); - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), primaryKey, primaryKey, false); - - if (backups > 0) { - Integer backupKey = key(ignite0, BACKUP); - - log.info("Put from backup."); - - cache0.put(backupKey, backupKey); - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), backupKey, backupKey, false); - } - - Integer nearKey = key(ignite0, NOT_PRIMARY_AND_BACKUP); - - log.info("Put from near."); - - cache0.put(nearKey, nearKey); - - for (int i = 0; i < GRID_CNT; i++) { - UUID[] expReaders = aff.isPrimary(grid(i).localNode(), nearKey) ? new UUID[]{id0} : new UUID[]{}; - - checkEntry(grid(i), nearKey, nearKey, i == grid, expReaders); - } - - Collection<UUID> readers = new HashSet<>(); - - readers.add(id0); - - int val = nearKey + 1; - - for (int i = 0; i < GRID_CNT; i++) { - delay(); - - GridCache<Integer, Integer> cache = grid(i).cache(null); - - log.info("Put [grid=" + grid(i).name() + ", val=" + val + ']'); - - cache.put(nearKey, val); - - if (!aff.isPrimaryOrBackup(grid(i).localNode(), nearKey)) - readers.add(grid(i).localNode().id()); - - for (int j = 0; j < GRID_CNT; j++) { - boolean primaryNode = aff.isPrimary(grid(j).localNode(), nearKey); - - UUID[] expReaders = primaryNode ? U.toArray(readers, new UUID[readers.size()]) : new UUID[]{}; - - checkEntry(grid(j), nearKey, val, readers.contains(grid(j).localNode().id()), expReaders); - } - - val++; - } - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ZeroLengthArrayAllocation") - private void checkRemove() throws Exception { - log.info("Check remove."); - - Ignite ignite0 = grid(0); - - GridCache<Integer, Integer> cache0 = ignite0.cache(null); - - Integer primaryKey = key(ignite0, PRIMARY); - - log.info("Put from primary."); - - cache0.put(primaryKey, primaryKey); - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), primaryKey, primaryKey, false); - - log.info("Remove from primary."); - - cache0.remove(primaryKey); - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), primaryKey, null, false); - - if (backups > 0) { - Integer backupKey = key(ignite0, BACKUP); - - log.info("Put from backup."); - - cache0.put(backupKey, backupKey); - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), backupKey, backupKey, false); - - log.info("Remove from backup."); - - cache0.remove(backupKey); - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), backupKey, null, false); - } - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ZeroLengthArrayAllocation") - private void checkReaderEvict() throws Exception { - log.info("Check evict."); - - Ignite ignite0 = grid(0); - - GridCache<Integer, Integer> cache0 = ignite0.cache(null); - - GridCacheAffinity<Integer> aff = cache0.affinity(); - - UUID id0 = ignite0.cluster().localNode().id(); - - Integer nearKey = key(ignite0, NOT_PRIMARY_AND_BACKUP); - - cache0.put(nearKey, 1); // Put should create near entry on grid0. - - for (int i = 0; i < GRID_CNT; i++) { - UUID[] expReaders = aff.isPrimary(grid(i).localNode(), nearKey) ? new UUID[]{id0} : new UUID[]{}; - - checkEntry(grid(i), nearKey, 1, i == 0, expReaders); - } - - cache0.evict(nearKey); // Remove near entry on grid0. - - for (int i = 0; i < GRID_CNT; i++) { - UUID[] expReaders = aff.isPrimary(grid(i).localNode(), nearKey) ? new UUID[]{id0} : new UUID[]{}; - - checkEntry(grid(i), nearKey, 1, false, expReaders); - } - - GridCache<Integer, Integer> primaryCache = G.ignite( - (String) aff.mapKeyToNode(nearKey).attribute(ATTR_GRID_NAME)).cache(null); - - delay(); - - primaryCache.put(nearKey, 2); // This put should see that near entry evicted on grid0 and remove reader. - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), nearKey, 2, false); - - assertEquals((Integer)2, cache0.get(nearKey)); // Get should again create near entry on grid0. - - for (int i = 0; i < GRID_CNT; i++) { - UUID[] expReaders = aff.isPrimary(grid(i).localNode(), nearKey) ? new UUID[]{id0} : new UUID[]{}; - - checkEntry(grid(i), nearKey, 2, i == 0, expReaders); - } - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ZeroLengthArrayAllocation") - private void checkReaderRemove() throws Exception { - Ignite ignite0 = grid(0); - - GridCache<Integer, Integer> cache0 = ignite0.cache(null); - - GridCacheAffinity<Integer> aff = cache0.affinity(); - - UUID id0 = ignite0.cluster().localNode().id(); - - Integer nearKey = key(ignite0, NOT_PRIMARY_AND_BACKUP); - - cache0.put(nearKey, 1); // Put should create near entry on grid0. - - for (int i = 0; i < GRID_CNT; i++) { - UUID[] expReaders = aff.isPrimary(grid(i).localNode(), nearKey) ? new UUID[]{id0} : new UUID[]{}; - - checkEntry(grid(i), nearKey, 1, i == 0, expReaders); - } - - cache0.remove(nearKey); // Remove from grid0, this should remove readers on primary node. - - for (int i = 0; i < GRID_CNT; i++) - checkEntry(grid(i), nearKey, null, i == 0); - - Ignite primaryNode = G.ignite((String) aff.mapKeyToNode(nearKey).attribute(ATTR_GRID_NAME)); - - delay(); - - GridCache<Integer, Integer> primaryCache = primaryNode.cache(null); - - primaryCache.put(nearKey, 2); // Put from primary, check there are no readers. - - checkEntry(primaryNode, nearKey, 2, false); - } - - /** - * @param ignite Node. - * @param key Key. - * @param val Expected value. - * @param expectNear If {@code true} then near cache entry is expected. - * @param expReaders Expected readers. - * @throws Exception If failed. - */ - @SuppressWarnings("ConstantConditions") - private void checkEntry(Ignite ignite, Integer key, @Nullable Integer val, boolean expectNear, UUID... expReaders) - throws Exception { - GridCacheAdapter<Integer, Integer> near = ((GridKernal) ignite).internalCache(); - - assertTrue(near.isNear()); - - GridCacheEntryEx<Integer, Integer> nearEntry = near.peekEx(key); - - if (expectNear) { - assertNotNull("No near entry for: " + key + ", grid: " + ignite.name(), nearEntry); - - assertEquals("Unexpected value for grid: " + ignite.name(), val, nearEntry.info().value()); - } - else - assertNull("Unexpected near entry: " + nearEntry + ", grid: " + ignite.name(), nearEntry); - - GridDhtCacheAdapter<Integer, Integer> dht = ((GridNearCacheAdapter<Integer, Integer>)near).dht(); - - GridDhtCacheEntry<Integer, Integer> dhtEntry = (GridDhtCacheEntry<Integer, Integer>)dht.peekEx(key); - - boolean expectDht = near.affinity().isPrimaryOrBackup(ignite.cluster().localNode(), key); - - if (expectDht) { - assertNotNull("No dht entry for: " + key + ", grid: " + ignite.name(), dhtEntry); - - Collection<UUID> readers = dhtEntry.readers(); - - assertEquals(expReaders.length, readers.size()); - - for (UUID reader : expReaders) - assertTrue(readers.contains(reader)); - - assertEquals("Unexpected value for grid: " + ignite.name(), val, dhtEntry.info().value()); - } - else - assertNull("Unexpected dht entry: " + dhtEntry + ", grid: " + ignite.name(), dhtEntry); - } - - /** - * @param ignite Grid. - * @param mode One of {@link #PRIMARY}, {@link #BACKUP} or {@link #NOT_PRIMARY_AND_BACKUP}. - * @return Key with properties specified by the given mode. - */ - private Integer key(Ignite ignite, int mode) { - GridCache<Integer, Integer> cache = ignite.cache(null); - - GridCacheAffinity<Integer> aff = cache.affinity(); - - Integer key = null; - - for (int i = lastKey + 1; i < 1_000_000; i++) { - boolean pass = false; - - switch(mode) { - case PRIMARY: pass = aff.isPrimary(ignite.cluster().localNode(), i); break; - - case BACKUP: pass = aff.isBackup(ignite.cluster().localNode(), i); break; - - case NOT_PRIMARY_AND_BACKUP: pass = !aff.isPrimaryOrBackup(ignite.cluster().localNode(), i); break; - - default: fail(); - } - - lastKey = i; - - if (pass) { - key = i; - - break; - } - } - - assertNotNull(key); - - return key; - } - - /** - * @throws IgniteCheckedException If failed. - */ - private void delay() throws IgniteCheckedException { - if (writeOrderMode == CLOCK) - U.sleep(100); - } - - /** - * @param backups Backups number. - * @param writeOrderMode Write order mode. - * @throws Exception If failed. - */ - private void startGrids(int backups, GridCacheAtomicWriteOrderMode writeOrderMode) throws Exception { - this.backups = backups; - - this.writeOrderMode = writeOrderMode; - - startGrids(GRID_CNT); - - awaitPartitionMapExchange(); - - log.info("Grids: "); - - for (int i = 0; i < GRID_CNT; i++) - log.info(grid(i).name() + ": " + grid(i).localNode().id()); - } - - /** - * - */ - private static class Processor implements EntryProcessor<Integer, Integer, Void>, Serializable { - /** */ - private final Integer newVal; - - /** - * @param newVal New value. - */ - private Processor(Integer newVal) { - this.newVal = newVal; - } - - /** {@inheritDoc} */ - @Override public Void process(MutableEntry<Integer, Integer> e, Object... args) { - e.setValue(newVal); - - return null; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledFullApiSelfTest.java deleted file mode 100644 index 494d8b9..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledFullApiSelfTest.java +++ /dev/null @@ -1,32 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; - -import static org.apache.ignite.cache.GridCacheDistributionMode.*; - -/** - * Tests atomic cache with near cache enabled. - */ -public class GridCacheAtomicNearEnabledFullApiSelfTest extends GridCacheAtomicFullApiSelfTest { - /** {@inheritDoc} */ - @Override protected GridCacheDistributionMode distributionMode() { - return NEAR_PARTITIONED; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.java deleted file mode 100644 index 12ac8f6..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.java +++ /dev/null @@ -1,33 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; - -import static org.apache.ignite.cache.GridCacheDistributionMode.*; - -/** - * Tests atomic cache with near cache enabled. - */ -public class GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest - extends GridCacheAtomicPrimaryWriteOrderFullApiSelfTest { - /** {@inheritDoc} */ - @Override protected GridCacheDistributionMode distributionMode() { - return NEAR_PARTITIONED; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.java deleted file mode 100644 index aa1ecd8..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.java +++ /dev/null @@ -1,32 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; - -import static org.apache.ignite.cache.GridCacheAtomicWriteOrderMode.*; - -/** - * Test for atomic cache with primary write order mode. - */ -public class GridCacheAtomicPrimaryWriteOrderFullApiSelfTest extends GridCacheAtomicFullApiSelfTest { - /** {@inheritDoc} */ - @Override protected GridCacheAtomicWriteOrderMode atomicWriteOrderMode() { - return PRIMARY; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.java deleted file mode 100644 index 145d166..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.java +++ /dev/null @@ -1,32 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; - -import static org.apache.ignite.cache.GridCacheAtomicWriteOrderMode.*; - -/** - * Tests reloadAll for colocated cache with primary write order. - */ -public class GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest extends GridCacheAtomicReloadAllSelfTest { - /** {@inheritDoc} */ - @Override protected GridCacheAtomicWriteOrderMode atomicWriteOrderMode() { - return PRIMARY; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java deleted file mode 100644 index 0b5c00c..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java +++ /dev/null @@ -1,38 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; -import org.gridgain.grid.kernal.processors.cache.distributed.*; - -import static org.apache.ignite.cache.GridCacheAtomicityMode.*; - -/** - * Tests reloadAll for colocated cache. - */ -public class GridCacheAtomicReloadAllSelfTest extends GridCachePartitionedReloadAllAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected GridCacheAtomicityMode atomicityMode() { - return ATOMIC; - } - - /** {@inheritDoc} */ - @Override protected boolean nearEnabled() { - return false; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b77f2a59/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java deleted file mode 100644 index 9d3a0a6..0000000 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java +++ /dev/null @@ -1,38 +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.gridgain.grid.kernal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.*; -import org.gridgain.grid.kernal.processors.cache.distributed.*; - -import static org.apache.ignite.cache.GridCacheDistributionMode.*; - -/** - * Client only test. - */ -public class GridCacheClientOnlySelfTest extends GridCacheClientModesAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected GridCacheDistributionMode distributionMode() { - return PARTITIONED_ONLY; - } - - /** {@inheritDoc} */ - @Override protected boolean clientOnly() { - return true; - } -}