http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java index 8fbe916..34c48c2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java @@ -267,38 +267,48 @@ public class GridTcpMemcachedNioListener extends GridNioServerListenerAdapter<Gr * @return REST request. */ @SuppressWarnings("unchecked") - private GridRestCacheRequest createRestRequest(GridMemcachedMessage req, GridRestCommand cmd) { + private GridRestRequest createRestRequest(GridMemcachedMessage req, GridRestCommand cmd) { assert req != null; - GridRestCacheRequest restReq = new GridRestCacheRequest(); + if (cmd == CACHE_INCREMENT || cmd == CACHE_DECREMENT) { + DataStructuresRequest restReq = new DataStructuresRequest(); - restReq.command(cmd); - restReq.clientId(req.clientId()); - restReq.ttl(req.expiration()); - restReq.delta(req.delta()); - restReq.initial(req.initial()); - restReq.cacheName(req.cacheName()); - restReq.key(req.key()); + restReq.command(cmd); + restReq.key(req.key()); + restReq.delta(req.delta()); + restReq.initial(req.initial()); - if (cmd == CACHE_REMOVE_ALL) { - Object[] keys = (Object[]) req.value(); + return restReq; + } + else { + GridRestCacheRequest restReq = new GridRestCacheRequest(); - if (keys != null) { - Map<Object, Object> map = new HashMap<>(); + restReq.command(cmd); + restReq.clientId(req.clientId()); + restReq.ttl(req.expiration()); + restReq.cacheName(req.cacheName()); + restReq.key(req.key()); - for (Object key : keys) { - map.put(key, null); - } + if (cmd == CACHE_REMOVE_ALL) { + Object[] keys = (Object[]) req.value(); + + if (keys != null) { + Map<Object, Object> map = new HashMap<>(); + + for (Object key : keys) { + map.put(key, null); + } - restReq.values(map); + restReq.values(map); + } + } + else { + if (req.value() != null) + restReq.value(req.value()); } - } - else { - if (req.value() != null) - restReq.value(req.value()); - } - return restReq; + return restReq; + } } /**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/DatastructuresRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/DatastructuresRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/DatastructuresRequest.java new file mode 100644 index 0000000..13f03cd --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/DatastructuresRequest.java @@ -0,0 +1,74 @@ +/* + * 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.rest.request; + +/** + * + */ +public class DataStructuresRequest extends GridRestRequest { + /** Value to add/subtract. */ + private Long delta; + + /** Initial value for increment and decrement commands. */ + private Long init; + + /** Key. */ + private Object key; + + /** + * @return Key. + */ + public Object key() { + return key; + } + + /** + * @param key Key. + */ + public void key(Object key) { + this.key = key; + } + + /** + * @return Delta for increment and decrement commands. + */ + public Long delta() { + return delta; + } + + /** + * @param delta Delta for increment and decrement commands. + */ + public void delta(Long delta) { + this.delta = delta; + } + + /** + * @return Initial value for increment and decrement commands. + */ + public Long initial() { + return init; + } + + /** + * @param init Initial value for increment and decrement commands. + */ + public void initial(Long init) { + this.init = init; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestCacheRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestCacheRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestCacheRequest.java index 89cd06f..0174201 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestCacheRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestCacheRequest.java @@ -21,6 +21,9 @@ import org.apache.ignite.internal.util.typedef.internal.*; import java.util.*; +/** + * + */ public class GridRestCacheRequest extends GridRestRequest { /** Cache name. */ private String cacheName; @@ -43,12 +46,6 @@ public class GridRestCacheRequest extends GridRestRequest { /** Expiration time. */ private Long ttl; - /** Value to add/subtract. */ - private Long delta; - - /** Initial value for increment and decrement commands. */ - private Long init; - /** * @return Cache name, or {@code null} if not set. */ @@ -147,34 +144,6 @@ public class GridRestCacheRequest extends GridRestRequest { this.ttl = ttl; } - /** - * @return Delta for increment and decrement commands. - */ - public Long delta() { - return delta; - } - - /** - * @param delta Delta for increment and decrement commands. - */ - public void delta(Long delta) { - this.delta = delta; - } - - /** - * @return Initial value for increment and decrement commands. - */ - public Long initial() { - return init; - } - - /** - * @param init Initial value for increment and decrement commands. - */ - public void initial(Long init) { - this.init = init; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridRestCacheRequest.class, this, super.toString()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java index 5f11190..e7908d3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java @@ -70,7 +70,7 @@ public class GridCacheQueryInternalKeysSelfTest extends GridCacheAbstractSelfTes GridCache<Object, Object> cache = grid(0).cache(null); for (int i = 0; i < ENTRY_CNT; i++) - cache.dataStructures().queue("queue" + i, Integer.MAX_VALUE, false, true); + cache.put(new GridCacheQueueHeaderKey("queue" + i), 1); startGrid(GRID_CNT); // Start additional node. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java index 97b2ba3..61f78cd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java @@ -325,7 +325,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest { m.put(i, val); - cache.dataStructures().atomicLong("testLong" + i, 0, true).incrementAndGet(); + g.atomicLong("testLong" + i, 0, true).incrementAndGet(); } cache.putAll(m); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java index 8e6cfc9..c8b45fc 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java @@ -35,7 +35,7 @@ import static org.apache.ignite.cache.CacheAtomicityMode.*; /** * Failover tests for cache data structures. */ -public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends IgniteAtomicsAbstractTest { +public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends IgniteCollectionAbstractTest { /** */ private static final long TEST_TIMEOUT = 2 * 60 * 1000; @@ -92,6 +92,13 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); + IgniteAtomicConfiguration atomicCfg = new IgniteAtomicConfiguration(); + + atomicCfg.setCacheMode(collectionCacheMode()); + atomicCfg.setBackups(collectionConfiguration().getBackups()); + + cfg.setAtomicConfiguration(atomicCfg); + CacheConfiguration ccfg = new CacheConfiguration(); ccfg.setName(TRANSACTIONAL_CACHE_NAME); @@ -602,20 +609,20 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig */ public void testFifoQueueTopologyChange() throws Exception { try { - cache().dataStructures().queue(STRUCTURE_NAME, 0, false, true).put(10); + grid(0).queue(STRUCTURE_NAME, collectionConfiguration(), 0, true).put(10); Ignite g = startGrid(NEW_GRID_NAME); - assert g.cache(null).dataStructures().<Integer>queue(STRUCTURE_NAME, 0, false, false).poll() == 10; + assert g.<Integer>queue(STRUCTURE_NAME, null, 0, false).poll() == 10; - g.cache(null).dataStructures().queue(STRUCTURE_NAME, 0, false, false).put(20); + g.queue(STRUCTURE_NAME, null, 0, false).put(20); stopGrid(NEW_GRID_NAME); - assert cache().dataStructures().<Integer>queue(STRUCTURE_NAME, 0, false, false).peek() == 20; + assert grid(0).<Integer>queue(STRUCTURE_NAME, null, 0, false).peek() == 20; } finally { - cache().dataStructures().removeQueue(STRUCTURE_NAME); + grid(0).<Integer>queue(STRUCTURE_NAME, null, 0, false).close(); } } @@ -623,9 +630,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig * @throws Exception If failed. */ public void testQueueConstantTopologyChange() throws Exception { - try { - IgniteQueue<Integer> s = cache().dataStructures().queue(STRUCTURE_NAME, 0, false, true); - + try (IgniteQueue<Integer> s = grid(0).queue(STRUCTURE_NAME, collectionConfiguration(), 0, true)) { s.put(1); IgniteFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new CA() { @@ -637,8 +642,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig try { Ignite g = startGrid(name); - assert g.cache(null).dataStructures().<Integer>queue(STRUCTURE_NAME, 0, false, - false).peek() > 0; + assert g.<Integer>queue(STRUCTURE_NAME, null, 0, false).peek() > 0; } finally { if (i != TOP_CHANGE_CNT - 1) @@ -662,10 +666,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig fut.get(); for (Ignite g : G.allGrids()) - assert g.cache(null).dataStructures().<Integer>queue(STRUCTURE_NAME, 0, false, false).peek() == origVal; - } - finally { - cache().dataStructures().removeQueue(STRUCTURE_NAME); + assert g.<Integer>queue(STRUCTURE_NAME, null, 0, false).peek() == origVal; } } @@ -673,9 +674,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig * @throws Exception If failed. */ public void testQueueConstantMultipleTopologyChange() throws Exception { - try { - IgniteQueue<Integer> s = cache().dataStructures().queue(STRUCTURE_NAME, 0, false, true); - + try (IgniteQueue<Integer> s = grid(0).queue(STRUCTURE_NAME, collectionConfiguration(), 0, true)) { s.put(1); IgniteFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new CA() { @@ -692,8 +691,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig Ignite g = startGrid(name); - assert g.cache(null).dataStructures() - .<Integer>queue(STRUCTURE_NAME, 0, false, false).peek() > 0; + assert g.<Integer>queue(STRUCTURE_NAME, null, 0, false).peek() > 0; } } finally { @@ -719,10 +717,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig fut.get(); for (Ignite g : G.allGrids()) - assert g.cache(null).dataStructures().<Integer>queue(STRUCTURE_NAME, 0, false, false).peek() == origVal; - } - finally { - cache().dataStructures().removeQueue(STRUCTURE_NAME); + assert g.<Integer>queue(STRUCTURE_NAME, null, 0, false).peek() == origVal; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java index 77c6050..f0739bf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java @@ -86,7 +86,7 @@ public abstract class GridCacheAbstractQueueFailoverDataConsistencySelfTest exte } /** {@inheritDoc} */ - @Override IgniteCollectionConfiguration collectionConfiguration() { + @Override protected IgniteCollectionConfiguration collectionConfiguration() { IgniteCollectionConfiguration colCfg = super.collectionConfiguration(); colCfg.setBackups(1); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java index 4103944..703cc7d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java @@ -20,57 +20,27 @@ package org.apache.ignite.internal.processors.cache.datastructures; import org.apache.ignite.*; import org.apache.ignite.configuration.*; 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.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.testframework.junits.common.*; +import org.apache.ignite.marshaller.optimized.*; import java.util.*; /** * AtomicReference and AtomicStamped multi node tests. */ -public abstract class GridCacheAtomicReferenceMultiNodeAbstractTest extends GridCommonAbstractTest { +public abstract class GridCacheAtomicReferenceMultiNodeAbstractTest extends IgniteAtomicsAbstractTest { /** */ protected static final int GRID_CNT = 4; - /** */ - protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); - - /** - * Constructs test. - */ - protected GridCacheAtomicReferenceMultiNodeAbstractTest() { - super(/* don't start grid */ false); - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - for (int i = 0; i < GRID_CNT; i++) - startGrid(i); - - assert G.allGrids().size() == GRID_CNT; - } - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - super.afterTestsStopped(); - - stopAllGrids(); + @Override protected int gridCount() { + return GRID_CNT; } /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); - TcpDiscoverySpi spi = new TcpDiscoverySpi(); - - spi.setIpFinder(ipFinder); - - cfg.setDiscoverySpi(spi); + cfg.setMarshaller(new IgniteOptimizedMarshaller(false)); return cfg; } @@ -89,14 +59,14 @@ public abstract class GridCacheAtomicReferenceMultiNodeAbstractTest extends Grid final String newVal = UUID.randomUUID().toString(); // Initialize atomicReference in cache. - IgniteAtomicReference<String> ref = grid(0).cache(null).dataStructures().atomicReference(refName, val, true); + IgniteAtomicReference<String> ref = grid(0).atomicReference(refName, val, true); final Ignite ignite = grid(0); // Execute task on all grid nodes. ignite.compute().call(new IgniteCallable<Object>() { @Override public String call() throws IgniteCheckedException { - IgniteAtomicReference<String> ref = ignite.cache(null).dataStructures().atomicReference(refName, val, true); + IgniteAtomicReference<String> ref = ignite.atomicReference(refName, val, true); assertEquals(val, ref.get()); @@ -109,7 +79,7 @@ public abstract class GridCacheAtomicReferenceMultiNodeAbstractTest extends Grid // Execute task on all grid nodes. ignite.compute().call(new IgniteCallable<String>() { @Override public String call() throws IgniteCheckedException { - IgniteAtomicReference<String> ref = ignite.cache(null).dataStructures().atomicReference(refName, val, true); + IgniteAtomicReference<String> ref = ignite.atomicReference(refName, val, true); assertEquals(val, ref.get()); @@ -122,7 +92,7 @@ public abstract class GridCacheAtomicReferenceMultiNodeAbstractTest extends Grid // Execute task on all grid nodes. ignite.compute().call(new IgniteCallable<String>() { @Override public String call() throws IgniteCheckedException { - IgniteAtomicReference<String> ref = ignite.cache(null).dataStructures().atomicReference(refName, val, true); + IgniteAtomicReference<String> ref = ignite.atomicReference(refName, val, true); assertEquals(newVal, ref.get()); @@ -149,16 +119,14 @@ public abstract class GridCacheAtomicReferenceMultiNodeAbstractTest extends Grid final String newStamp = UUID.randomUUID().toString(); // Initialize atomicStamped in cache. - IgniteAtomicStamped<String, String> stamped = grid(0).cache(null).dataStructures() - .atomicStamped(stampedName, val, stamp, true); + IgniteAtomicStamped<String, String> stamped = grid(0).atomicStamped(stampedName, val, stamp, true); final Ignite ignite = grid(0); // Execute task on all grid nodes. ignite.compute().call(new IgniteCallable<String>() { @Override public String call() throws IgniteCheckedException { - IgniteAtomicStamped<String, String> stamped = ignite.cache(null).dataStructures() - .atomicStamped(stampedName, val, stamp, true); + IgniteAtomicStamped<String, String> stamped = ignite.atomicStamped(stampedName, val, stamp, true); assertEquals(val, stamped.value()); assertEquals(stamp, stamped.stamp()); @@ -172,8 +140,7 @@ public abstract class GridCacheAtomicReferenceMultiNodeAbstractTest extends Grid // Execute task on all grid nodes. ignite.compute().call(new IgniteCallable<String>() { @Override public String call() throws IgniteCheckedException { - IgniteAtomicStamped<String, String> stamped = ignite.cache(null).dataStructures() - .atomicStamped(stampedName, val, stamp, true); + IgniteAtomicStamped<String, String> stamped = ignite.atomicStamped(stampedName, val, stamp, true); assertEquals(val, stamped.value()); assertEquals(stamp, stamped.stamp()); @@ -187,8 +154,7 @@ public abstract class GridCacheAtomicReferenceMultiNodeAbstractTest extends Grid // Execute task on all grid nodes. ignite.compute().call(new IgniteCallable<String>() { @Override public String call() throws IgniteCheckedException { - IgniteAtomicStamped<String, String> stamped = ignite.cache(null).dataStructures() - .atomicStamped(stampedName, val, stamp, true); + IgniteAtomicStamped<String, String> stamped = ignite.atomicStamped(stampedName, val, stamp, true); assertEquals(newVal, stamped.value()); assertEquals(newStamp, stamped.stamp()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java index 2d351ab..6a003bd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.datastructures; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; +import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.datastructures.*; @@ -31,13 +32,13 @@ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; -import static org.apache.ignite.cache.CacheDistributionMode.*; +import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; /** * Tests cleanup of orphaned queue items. */ -public class GridCacheQueueCleanupSelfTest extends GridCacheAbstractSelfTest { +public class GridCacheQueueCleanupSelfTest extends IgniteCollectionAbstractTest { /** */ private static final String QUEUE_NAME1 = "CleanupTestQueue1"; @@ -50,36 +51,35 @@ public class GridCacheQueueCleanupSelfTest extends GridCacheAbstractSelfTest { } /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - // No-op. + @Override protected CacheMode collectionCacheMode() { + return PARTITIONED; } /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { - CacheConfiguration ccfg = super.cacheConfiguration(gridName); - - ccfg.setBackups(0); - - return ccfg; + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return TRANSACTIONAL; } /** {@inheritDoc} */ - @Override protected CacheDistributionMode distributionMode() { - return PARTITIONED_ONLY; - } + @Override protected IgniteCollectionConfiguration collectionConfiguration() { + IgniteCollectionConfiguration colCfg = super.collectionConfiguration(); - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; + colCfg.setBackups(0); + + return colCfg; } /** * @throws Exception If failed. */ public void testCleanup() throws Exception { - IgniteQueue<Integer> queue = cache().dataStructures().queue(QUEUE_NAME1, 0, false, true); + IgniteQueue<Integer> queue = grid(0).queue(QUEUE_NAME1, collectionConfiguration(), 0, true); + + GridCacheContext cctx = GridTestUtils.getFieldValue(queue, "cctx"); + + final String queueCacheName = cctx.name(); - ClusterNode node = grid(0).cache(null).affinity().mapKeyToNode(new GridCacheQueueHeaderKey(QUEUE_NAME1)); + ClusterNode node = grid(0).affinity(queueCacheName).mapKeyToNode(new GridCacheQueueHeaderKey(QUEUE_NAME1)); final Ignite ignite = grid(0).localNode().equals(node) ? grid(1) : grid(0); @@ -160,9 +160,9 @@ public class GridCacheQueueCleanupSelfTest extends GridCacheAbstractSelfTest { assertEquals(500, queue.size()); // Remove queue and create queue with the same name. - ignite.cache(null).dataStructures().removeQueue(QUEUE_NAME1); + queue.close(); - queue = ignite.cache(null).dataStructures().queue(QUEUE_NAME1, 0, false, true); + queue = ignite.queue(QUEUE_NAME1, collectionConfiguration(), 0, true); assertEquals(0, queue.size()); @@ -178,8 +178,10 @@ public class GridCacheQueueCleanupSelfTest extends GridCacheAbstractSelfTest { int cnt = 0; for (int i = 0; i < gridCount(); i++) { - Iterator<GridCacheEntryEx<Object, Object>> entries = - ((GridKernal)grid(i)).context().cache().internalCache().map().allEntries0().iterator(); + GridCacheAdapter<Object, Object> cache = + ((GridKernal)grid(i)).context().cache().internalCache(queueCacheName); + + Iterator<GridCacheEntryEx<Object, Object>> entries = cache.map().allEntries0().iterator(); while (entries.hasNext()) { cnt++; @@ -211,7 +213,7 @@ public class GridCacheQueueCleanupSelfTest extends GridCacheAbstractSelfTest { private IgniteFuture<?> startAddPollThread(final Ignite ignite, final AtomicBoolean stop, final String queueName) { return GridTestUtils.runAsync(new Callable<Void>() { @Override public Void call() throws Exception { - IgniteQueue<Integer> queue = ignite.cache(null).dataStructures().queue(queueName, 0, false, true); + IgniteQueue<Integer> queue = ignite.queue(queueName, collectionConfiguration(), 0, true); assertEquals(0, queue.size()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java index 02c2fd4..394ed69 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java @@ -36,7 +36,7 @@ import java.util.concurrent.*; * Test that joining node is able to take items from queue. * See GG-2311 for more information. */ -public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends GridCommonAbstractTest { +public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends IgniteCollectionAbstractTest { /** */ protected static final int GRID_CNT = 3; @@ -47,26 +47,8 @@ public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends GridCommo protected static final int ITEMS_CNT = 300; /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - startGridsMultiThreaded(GRID_CNT); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - stopAllGrids(); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - TcpDiscoverySpi spi = new TcpDiscoverySpi(); - - spi.setIpFinder(ipFinder); - - cfg.setDiscoverySpi(spi); - - return cfg; + @Override protected int gridCount() { + return GRID_CNT; } /** @@ -75,8 +57,7 @@ public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends GridCommo public void testTakeFromJoined() throws Exception { String queueName = UUID.randomUUID().toString(); - IgniteQueue<Integer> queue = grid(0).cache(null).dataStructures() - .queue(queueName, 0, true, true); + IgniteQueue<Integer> queue = grid(0).queue(queueName, collocatedCollectionConfiguration(), 0, true); assertNotNull(queue); @@ -174,7 +155,7 @@ public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends GridCommo ", job=" + getClass().getSimpleName() + "]"); try { - IgniteQueue<Integer> queue = ignite.cache(null).dataStructures().queue(queueName, 0, true, false); + IgniteQueue<Integer> queue = ignite.queue(queueName, null, 0, false); assertNotNull(queue); @@ -268,7 +249,7 @@ public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends GridCommo Integer lastPolled = null; try { - IgniteQueue<Integer> queue = ignite.cache(null).dataStructures().queue(queueName, 0, true, false); + IgniteQueue<Integer> queue = ignite.queue(queueName, null, 0, false); assertNotNull(queue); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java index 34622d3..517c76a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java @@ -23,6 +23,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.datastructures.*; import org.apache.ignite.lang.*; +import org.apache.ignite.marshaller.optimized.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; @@ -114,6 +115,8 @@ public abstract class GridCacheQueueMultiNodeAbstractSelfTest extends IgniteColl cfg.setSystemExecutorServiceShutdown(true); + cfg.setMarshaller(new IgniteOptimizedMarshaller(false)); + return cfg; } @@ -279,7 +282,7 @@ public abstract class GridCacheQueueMultiNodeAbstractSelfTest extends IgniteColl queue.put(val); - grid(0).compute().call(new GetJob(queueName, RETRIES, val)); + grid(0).compute().call(new GetJob(queueName, collectionConfiguration(), RETRIES, val)); assertEquals(1, queue.size()); @@ -702,13 +705,18 @@ public abstract class GridCacheQueueMultiNodeAbstractSelfTest extends IgniteColl /** */ private final String expVal; + /** */ + private final IgniteCollectionConfiguration colCfg; + /** * @param queueName Queue name. + * @param colCfg Collection configuration. * @param retries Number of operations. * @param expVal Expected value. */ - GetJob(String queueName, int retries, String expVal) { + GetJob(String queueName, IgniteCollectionConfiguration colCfg, int retries, String expVal) { this.queueName = queueName; + this.colCfg = colCfg; this.retries = retries; this.expVal = expVal; } @@ -719,8 +727,7 @@ public abstract class GridCacheQueueMultiNodeAbstractSelfTest extends IgniteColl ignite.log().info("Running job [node=" + ignite.cluster().localNode().id() + ", job=" + this + "]"); - IgniteQueue<String> queue = ignite.cache(null).dataStructures().queue(queueName, QUEUE_CAPACITY, - false, true); + IgniteQueue<String> queue = ignite.queue(queueName, colCfg, QUEUE_CAPACITY, true); assertNotNull(queue); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java index 06caf07..d6e4d94 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java @@ -23,26 +23,20 @@ import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.apache.ignite.testframework.junits.common.*; import java.util.*; +import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.internal.processors.cache.datastructures.GridCacheQueueMultiNodeAbstractSelfTest.*; /** * Consistency test for cache queue in multi node environment. */ -public class GridCacheQueueMultiNodeConsistencySelfTest extends GridCommonAbstractTest { +public class GridCacheQueueMultiNodeConsistencySelfTest extends IgniteCollectionAbstractTest { /** */ protected static final int GRID_CNT = 3; - /** IP finder. */ - private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); - /** */ protected static final int RETRIES = 20; @@ -56,94 +50,47 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends GridCommonAbstra private boolean stopRandomGrid; /** */ - private CacheConfiguration cc = new CacheConfiguration(); + private int backups; /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); + @Override protected void beforeTestsStarted() throws Exception { + // No-op. } /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration c = super.getConfiguration(gridName); - - TcpDiscoverySpi spi = new TcpDiscoverySpi(); - - spi.setIpFinder(IP_FINDER); - - c.setDiscoverySpi(spi); - - cc.setCacheMode(PARTITIONED); - cc.setQueryIndexEnabled(true); - cc.setSwapEnabled(false); - - c.setCacheConfiguration(cc); - - return c; + @Override protected int gridCount() { + return GRID_CNT; } - /** - * @throws Exception If failed. - */ - public void testIteratorIfNoPreloadingAndBackupDisabled() throws Exception { - cc.setBackups(0); - cc.setPreloadPartitionedDelay(-1); - cc.setPreloadMode(CachePreloadMode.NONE); - - checkCacheQueue(); + /** {@inheritDoc} */ + @Override protected CacheMode collectionCacheMode() { + return PARTITIONED; } - /** - * @throws Exception If failed. - */ - public void testIteratorIfNoPreloadingAndBackupDisabledAndRepartitionForced() throws Exception { - cc.setBackups(0); - cc.setPreloadPartitionedDelay(-1); - cc.setPreloadMode(CachePreloadMode.NONE); - - forceRepartition = true; - - checkCacheQueue(); + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return TRANSACTIONAL; } - /** - * @throws Exception If failed. - */ - public void testIteratorIfPreloadingIsSyncAndBackupDisabled() throws Exception { - cc.setBackups(0); - cc.setPreloadMode(CachePreloadMode.SYNC); - - checkCacheQueue(); - } + /** {@inheritDoc} */ + @Override protected IgniteCollectionConfiguration collectionConfiguration() { + IgniteCollectionConfiguration colCfg = super.collectionConfiguration(); - /** - * @throws Exception If failed. - */ - public void testIteratorIfPreloadingIsAsyncAndBackupDisabled() throws Exception { - cc.setBackups(0); - cc.setPreloadMode(CachePreloadMode.ASYNC); + colCfg.setBackups(backups); - checkCacheQueue(); + return colCfg; } - /** - * @throws Exception If failed. - */ - public void testIteratorIfPreloadingIsSyncAndPartitionedDelayAndBackupDisabled() throws Exception { - cc.setBackups(0); - cc.setPreloadPartitionedDelay(PRELOAD_DELAY); - cc.setPreloadMode(CachePreloadMode.SYNC); - - checkCacheQueue(); + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(); } /** * @throws Exception If failed. */ - public void testIteratorIfPreloadingIsAsyncAndPartitionedDelayAndBackupDisabled() throws Exception { - cc.setBackups(0); - cc.setPreloadPartitionedDelay(PRELOAD_DELAY); - cc.setPreloadMode(CachePreloadMode.ASYNC); + public void testIteratorIfBackupDisabled() throws Exception { + backups = 0; checkCacheQueue(); } @@ -151,19 +98,10 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends GridCommonAbstra /** * @throws Exception If failed. */ - public void testIteratorIfPreloadingIsSyncAndBackupEnabled() throws Exception { - cc.setBackups(1); - cc.setPreloadMode(CachePreloadMode.SYNC); - - checkCacheQueue(); - } + public void testIteratorIfNoPreloadingAndBackupDisabledAndRepartitionForced() throws Exception { + backups = 0; - /** - * @throws Exception If failed. - */ - public void testIteratorIfPreloadingIsAsyncAndBackupEnabled() throws Exception { - cc.setBackups(1); - cc.setPreloadMode(CachePreloadMode.ASYNC); + forceRepartition = true; checkCacheQueue(); } @@ -171,11 +109,8 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends GridCommonAbstra /** * @throws Exception If failed. */ - public void testIteratorIfPreloadingIsSyncAndBackupEnabledAndOneNodeIsKilled() throws Exception { - cc.setBackups(1); - cc.setPreloadMode(CachePreloadMode.SYNC); - - stopRandomGrid = true; + public void testIteratorIfBackupEnabled() throws Exception { + backups = 1; checkCacheQueue(); } @@ -183,9 +118,8 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends GridCommonAbstra /** * @throws Exception If failed. */ - public void testIteratorIfPreloadingIsAsyncAndBackupEnabledAndOneNodeIsKilled() throws Exception { - cc.setBackups(1); - cc.setPreloadMode(CachePreloadMode.ASYNC); + public void testIteratorIfBackupEnabledAndOneNodeIsKilled() throws Exception { + backups = 1; stopRandomGrid = true; @@ -203,8 +137,7 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends GridCommonAbstra final String queueName = UUID.randomUUID().toString(); - IgniteQueue<Integer> queue0 = grid(0).cache(null).dataStructures().queue(queueName, QUEUE_CAPACITY, - false, true); + IgniteQueue<Integer> queue0 = grid(0).queue(queueName, collectionConfiguration(), QUEUE_CAPACITY, true); assertTrue(queue0.isEmpty()); @@ -235,8 +168,7 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends GridCommonAbstra grid.log().info("Running job [node=" + grid.cluster().localNode().id() + ", job=" + this + "]"); - IgniteQueue<Integer> locQueue = grid.cache(null).dataStructures().queue(queueName, QUEUE_CAPACITY, - false, true); + IgniteQueue<Integer> locQueue = grid.queue(queueName, collectionConfiguration(), QUEUE_CAPACITY, true); grid.log().info("Queue size " + locQueue.size()); @@ -249,6 +181,6 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends GridCommonAbstra assertTrue(CollectionUtils.isEqualCollection(queue0, locQueueContent)); - grid(0).cache(null).dataStructures().removeQueue(queueName); + queue0.close(); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java index 62e7898..ffe9bb6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java @@ -28,6 +28,7 @@ import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.marshaller.optimized.*; import org.apache.ignite.testframework.*; import java.util.*; @@ -49,6 +50,15 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr } /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + cfg.setMarshaller(new IgniteOptimizedMarshaller(false)); + + return cfg; + } + + /** {@inheritDoc} */ @Override protected IgniteCollectionConfiguration collectionConfiguration() { IgniteCollectionConfiguration colCfg = super.collectionConfiguration(); @@ -107,13 +117,13 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr for (int i = 0; i < gridCount(); i++) { GridKernal grid = (GridKernal)grid(i); - Map map = GridTestUtils.getFieldValue(grid.context().dataStructures(), "setsMap"); - - assertEquals("Set not removed [grid=" + i + ", map=" + map + ']', 0, map.size()); - for (GridCache cache : grid.caches()) { CacheDataStructuresManager dsMgr = grid.internalCache(cache.name()).context().dataStructures(); + Map map = GridTestUtils.getFieldValue(dsMgr, "setsMap"); + + assertEquals("Set not removed [grid=" + i + ", map=" + map + ']', 0, map.size()); + map = GridTestUtils.getFieldValue(dsMgr, "setDataMap"); assertEquals("Set data not removed [grid=" + i + ", cache=" + cache.name() + ", map=" + map + ']', @@ -835,7 +845,7 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr for (int i = 0; i < 10; i++) set.add(i); - Collection<Integer> c = grid(0).compute().broadcast(new IgniteCallable<Integer>() { + Collection<Integer> c = grid(0).compute().broadcast(new Callable<Integer>() { @Override public Integer call() throws Exception { assertEquals(SET_NAME, set.name()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java index 675ffa2..f48123a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java @@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.datastructures; import org.apache.ignite.*; import org.apache.ignite.cache.*; -import org.apache.ignite.cache.store.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.datastructures.*; @@ -31,14 +30,12 @@ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; -import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*; -import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; /** * Set failover tests. */ -public class GridCacheSetFailoverAbstractSelfTest extends GridCacheAbstractSelfTest { +public abstract class GridCacheSetFailoverAbstractSelfTest extends IgniteCollectionAbstractTest { /** */ private static final String SET_NAME = "testFailoverSet"; @@ -71,21 +68,8 @@ public class GridCacheSetFailoverAbstractSelfTest extends GridCacheAbstractSelfT } /** {@inheritDoc} */ - @Override protected CacheStore<?, ?> cacheStore() { - return null; - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { - CacheConfiguration ccfg = super.cacheConfiguration(gridName); - - ccfg.setBackups(1); - ccfg.setAtomicWriteOrderMode(PRIMARY); - ccfg.setCacheStoreFactory(null); - ccfg.setCacheMode(PARTITIONED); - ccfg.setDistributionMode(PARTITIONED_ONLY); - - return ccfg; + @Override protected CacheMode collectionCacheMode() { + return PARTITIONED; } /** {@inheritDoc} */ @@ -98,7 +82,7 @@ public class GridCacheSetFailoverAbstractSelfTest extends GridCacheAbstractSelfT */ @SuppressWarnings("WhileLoopReplaceableByForEach") public void testNodeRestart() throws Exception { - IgniteSet<Integer> set = cache().dataStructures().set(SET_NAME, false, true); + IgniteSet<Integer> set = grid(0).set(SET_NAME, collectionConfiguration(), true); final int ITEMS = 10_000; @@ -161,13 +145,11 @@ public class GridCacheSetFailoverAbstractSelfTest extends GridCacheAbstractSelfT log.info("Remove set."); - boolean rmv = cache().dataStructures().removeSet(SET_NAME); - - assertTrue(rmv); + set.close(); log.info("Create new set."); - set = cache().dataStructures().set(SET_NAME, false, true); + set = grid(0).set(SET_NAME, collectionConfiguration(), true); set.addAll(items); } @@ -178,9 +160,7 @@ public class GridCacheSetFailoverAbstractSelfTest extends GridCacheAbstractSelfT killFut.get(); - boolean rmv = cache().dataStructures().removeSet(SET_NAME); - - assertTrue(rmv); + set.close(); if (false) { // TODO GG-8962: enable check when fixed. int cnt = 0; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCollectionAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCollectionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCollectionAbstractTest.java index 159bc3b..0f8429e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCollectionAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCollectionAbstractTest.java @@ -26,6 +26,7 @@ import org.apache.ignite.testframework.junits.common.*; import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; +import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; @@ -71,13 +72,16 @@ public abstract class IgniteCollectionAbstractTest extends GridCommonAbstractTes /** * @return Collection configuration. */ - IgniteCollectionConfiguration collectionConfiguration() { + protected IgniteCollectionConfiguration collectionConfiguration() { IgniteCollectionConfiguration colCfg = new IgniteCollectionConfiguration(); colCfg.setCacheMode(collectionCacheMode()); colCfg.setAtomicityMode(collectionCacheAtomicityMode()); colCfg.setDistributionMode(PARTITIONED_ONLY); + if (colCfg.getCacheMode() == PARTITIONED) + colCfg.setBackups(1); + return colCfg; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest.java index 9b08c23..0e9fdea 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest.java @@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.datastructures.partitioned; import org.apache.ignite.cache.*; -import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; /** @@ -28,12 +27,7 @@ import static org.apache.ignite.cache.CacheAtomicityMode.*; public class GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest extends GridCachePartitionedQueueCreateMultiNodeSelfTest { /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration() { - CacheConfiguration ccfg = super.cacheConfiguration(); - - ccfg.setAtomicityMode(ATOMIC); - ccfg.setAtomicWriteOrderMode(PRIMARY); - - return ccfg; + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return ATOMIC; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicReferenceMultiNodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicReferenceMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicReferenceMultiNodeTest.java index 7d268b0..b420cc4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicReferenceMultiNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicReferenceMultiNodeTest.java @@ -22,25 +22,22 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.cache.datastructures.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; /** * AtomicReference and AtomicStamped multi node tests. */ public class GridCachePartitionedAtomicReferenceMultiNodeTest extends GridCacheAtomicReferenceMultiNodeAbstractTest { /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - // Default cache configuration. - CacheConfiguration cacheCfg = defaultCacheConfiguration(); + @Override protected CacheMode atomicsCacheMode() { + return PARTITIONED; + } - cacheCfg.setCacheMode(PARTITIONED); - cacheCfg.setWriteSynchronizationMode(FULL_SYNC); - cacheCfg.setBackups(1); + /** {@inheritDoc} */ + @Override protected IgniteAtomicConfiguration atomicConfiguration() { + IgniteAtomicConfiguration atomicCfg = super.atomicConfiguration(); - cfg.setCacheConfiguration(cacheCfg); + atomicCfg.setBackups(1); - return cfg; + return atomicCfg; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSetFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSetFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSetFailoverSelfTest.java index 31be3fc..9e2ffd2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSetFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSetFailoverSelfTest.java @@ -21,19 +21,13 @@ import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.datastructures.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; -import static org.apache.ignite.cache.CacheMode.*; /** * Set failover tests. */ public class GridCachePartitionedAtomicSetFailoverSelfTest extends GridCacheSetFailoverAbstractSelfTest { /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { return ATOMIC; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedDataStructuresFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedDataStructuresFailoverSelfTest.java index 0a018ff..03c7b99 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedDataStructuresFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedDataStructuresFailoverSelfTest.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.datastructures.partitioned; import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.datastructures.*; +import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; /** @@ -28,7 +29,12 @@ import static org.apache.ignite.cache.CacheMode.*; public class GridCachePartitionedDataStructuresFailoverSelfTest extends GridCacheAbstractDataStructuresFailoverSelfTest { /** {@inheritDoc} */ - @Override protected CacheMode atomicsCacheMode() { + @Override protected CacheMode collectionCacheMode() { return PARTITIONED; } + + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return TRANSACTIONAL; + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java index ee2acc3..cebdc21 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java @@ -20,12 +20,9 @@ package org.apache.ignite.internal.processors.cache.datastructures.partitioned; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.processors.cache.datastructures.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.apache.ignite.testframework.junits.common.*; import java.util.*; import java.util.concurrent.*; @@ -42,23 +39,43 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; /** * */ -public class GridCachePartitionedQueueCreateMultiNodeSelfTest extends GridCommonAbstractTest { - /** */ - private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); +public class GridCachePartitionedQueueCreateMultiNodeSelfTest extends IgniteCollectionAbstractTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 1; + } /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration c = super.getConfiguration(gridName); + @Override protected CacheMode collectionCacheMode() { + return PARTITIONED; + } + + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return TRANSACTIONAL; + } - TcpDiscoverySpi spi = new TcpDiscoverySpi(); + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + // No-op. + } - spi.setIpFinder(ipFinder); + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration c = super.getConfiguration(gridName); - c.setDiscoverySpi(spi); c.setIncludeEventTypes(); c.setPeerClassLoadingEnabled(false); - c.setCacheConfiguration(cacheConfiguration()); + CacheConfiguration[] ccfg = c.getCacheConfiguration(); + + if (ccfg != null) { + assert ccfg.length == 1 : ccfg.length; + + c.setCacheConfiguration(ccfg[0], cacheConfiguration()); + } + else + c.setCacheConfiguration(cacheConfiguration()); return c; } @@ -95,11 +112,9 @@ public class GridCachePartitionedQueueCreateMultiNodeSelfTest extends GridCommon info("Started grid: " + locNodeId); - GridCache<String, ?> cache = ignite.cache(null); - info("Creating queue: " + locNodeId); - IgniteQueue<String> q = cache.dataStructures().queue("queue", 1, true, true); + IgniteQueue<String> q = ignite.queue("queue", collocatedCollectionConfiguration(), 1, true); assert q != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java index 7f856c7..687ea0c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java @@ -22,29 +22,23 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.processors.cache.datastructures.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.processors.affinity.*; -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.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.testframework.*; -import org.apache.ignite.testframework.junits.common.*; import java.util.*; import java.util.concurrent.*; +import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.cache.CachePreloadMode.*; /** * Cache queue test with changing topology. */ -public class GridCachePartitionedQueueEntryMoveSelfTest extends GridCommonAbstractTest { - /** IP finder. */ - private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); - +public class GridCachePartitionedQueueEntryMoveSelfTest extends IgniteCollectionAbstractTest { /** Queue capacity. */ private static final int QUEUE_CAP = 5; @@ -58,23 +52,33 @@ public class GridCachePartitionedQueueEntryMoveSelfTest extends GridCommonAbstra private UUID nodeId; /** {@inheritDoc} */ - @SuppressWarnings("deprecation") - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); + @Override protected int gridCount() { + return GRID_CNT; + } - CacheConfiguration cacheCfg = defaultCacheConfiguration(); + /** {@inheritDoc} */ + @Override protected CacheMode collectionCacheMode() { + return PARTITIONED; + } - cacheCfg.setCacheMode(PARTITIONED); - cacheCfg.setBackups(BACKUP_CNT); - cacheCfg.setPreloadMode(SYNC); + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return TRANSACTIONAL; + } - cfg.setCacheConfiguration(cacheCfg); + /** {@inheritDoc} */ + @Override protected IgniteCollectionConfiguration collectionConfiguration() { + IgniteCollectionConfiguration colCfg = super.collectionConfiguration(); - TcpDiscoverySpi spi = new TcpDiscoverySpi(); + colCfg.setBackups(BACKUP_CNT); - spi.setIpFinder(IP_FINDER); + return colCfg; + } - cfg.setDiscoverySpi(spi); + /** {@inheritDoc} */ + @SuppressWarnings("deprecation") + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); if (nodeId != null) { cfg.setNodeId(nodeId); @@ -103,8 +107,10 @@ public class GridCachePartitionedQueueEntryMoveSelfTest extends GridCommonAbstra @Override public Void call() throws IgniteCheckedException { Ignite ignite = grid(0); - IgniteQueue<Integer> queue = ignite.cache(null).dataStructures().queue(queueName, QUEUE_CAP, - true, true); + IgniteQueue<Integer> queue = ignite.queue(queueName, + collocatedCollectionConfiguration(), + QUEUE_CAP, + true); for (int i = 0; i < QUEUE_CAP * 2; i++) { if (i == QUEUE_CAP) { @@ -143,8 +149,10 @@ public class GridCachePartitionedQueueEntryMoveSelfTest extends GridCommonAbstra @Override public Void call() throws IgniteCheckedException { Ignite ignite = grid(GRID_CNT); - IgniteQueue<Integer> queue = ignite.cache(null).dataStructures(). - queue(queueName, Integer.MAX_VALUE, true, true); + IgniteQueue<Integer> queue = ignite.queue(queueName, + collocatedCollectionConfiguration(), + Integer.MAX_VALUE, + true); int cnt = 0; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueJoinedNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueJoinedNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueJoinedNodeSelfTest.java index 0ba03a3..8bda877 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueJoinedNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueJoinedNodeSelfTest.java @@ -18,35 +18,22 @@ package org.apache.ignite.internal.processors.cache.datastructures.partitioned; import org.apache.ignite.cache.*; -import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.cache.datastructures.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.cache.CacheDistributionMode.*; -import static org.apache.ignite.cache.CachePreloadMode.*; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; /** * Test that joined node is able to poll values from cache queue in partitioned configuration. */ public class GridCachePartitionedQueueJoinedNodeSelfTest extends GridCacheQueueJoinedNodeSelfAbstractTest { /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration c = super.getConfiguration(gridName); - - // Default cache configuration. - CacheConfiguration cc = defaultCacheConfiguration(); - - cc.setCacheMode(PARTITIONED); - cc.setBackups(1); - cc.setWriteSynchronizationMode(FULL_SYNC); - cc.setPreloadMode(SYNC); - cc.setAtomicityMode(TRANSACTIONAL); - cc.setDistributionMode(PARTITIONED_ONLY); - - c.setCacheConfiguration(cc); + @Override protected CacheMode collectionCacheMode() { + return PARTITIONED; + } - return c; + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return TRANSACTIONAL; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetFailoverSelfTest.java index d382ae1..6cbf65e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetFailoverSelfTest.java @@ -20,14 +20,14 @@ package org.apache.ignite.internal.processors.cache.datastructures.partitioned; import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.datastructures.*; -import static org.apache.ignite.cache.CacheMode.*; +import static org.apache.ignite.cache.CacheAtomicityMode.*; /** * Set failover tests. */ public class GridCachePartitionedSetFailoverSelfTest extends GridCacheSetFailoverAbstractSelfTest { /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return TRANSACTIONAL; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedAtomicReferenceMultiNodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedAtomicReferenceMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedAtomicReferenceMultiNodeTest.java index 8929111..0d63962 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedAtomicReferenceMultiNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedAtomicReferenceMultiNodeTest.java @@ -28,18 +28,8 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; * AtomicReference and AtomicStamped tests with replicated cache. */ public class GridCacheReplicatedAtomicReferenceMultiNodeTest extends GridCacheAtomicReferenceMultiNodeAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - // Default cache configuration. - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - - cacheCfg.setCacheMode(REPLICATED); - cacheCfg.setWriteSynchronizationMode(FULL_SYNC); - cfg.setCacheConfiguration(cacheCfg); - - return cfg; + @Override protected CacheMode atomicsCacheMode() { + return REPLICATED; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedDataStructuresFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedDataStructuresFailoverSelfTest.java index b0a936b..336e267 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedDataStructuresFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedDataStructuresFailoverSelfTest.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.datastructures.replicated; import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.datastructures.*; +import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; /** @@ -28,7 +29,11 @@ import static org.apache.ignite.cache.CacheMode.*; public class GridCacheReplicatedDataStructuresFailoverSelfTest extends GridCacheAbstractDataStructuresFailoverSelfTest { /** {@inheritDoc} */ - @Override protected CacheMode atomicsCacheMode() { + @Override protected CacheMode collectionCacheMode() { return REPLICATED; } + + @Override protected CacheAtomicityMode collectionCacheAtomicityMode() { + return TRANSACTIONAL; + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java index 7252ddb..4f57adb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java @@ -96,33 +96,20 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { ClusterNode other = nodes.get2(); // Create on non-primary node. - IgniteAtomicLong l = grid(other).cache(null).dataStructures().atomicLong(ATOMIC_LONG_NAME, 1, true); - - assert l != null; - assert l.get() == 1; + grid(other).cache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 1); check(primary, other, true); // Update on primary. - l = grid(primary).cache(null).dataStructures().atomicLong(ATOMIC_LONG_NAME, 1, true); - - assert l != null; - assert l.get() == 1; - - l.incrementAndGet(); - - assert l.get() == 2; + grid(primary).cache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 2); // Check on non-primary. - l = grid(other).cache(null).dataStructures().atomicLong(ATOMIC_LONG_NAME, 1, true); - - assert l != null; - assert l.get() == 2; + assertEquals(2, grid(other).cache(null).get(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME))); check(primary, other, true); // Remove. - assert grid(other).cache(null).dataStructures().removeAtomicLong(ATOMIC_LONG_NAME); + assert grid(other).cache(null).removex(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME)); check(primary, other, false); } @@ -156,8 +143,8 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { * @param node Node. * @return Atomic long value. */ - private GridCacheAtomicLongValue peekGlobal(ClusterNode node) { - return (GridCacheAtomicLongValue)grid(node).cache(null).peek( + private Object peekGlobal(ClusterNode node) { + return grid(node).cache(null).peek( new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME)); } @@ -166,8 +153,8 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { * @return Atomic long value. * @throws IgniteCheckedException In case of error. */ - private GridCacheAtomicLongValue peekNear(ClusterNode node) throws IgniteCheckedException { - return (GridCacheAtomicLongValue)grid(node).cache(null).peek( + private Object peekNear(ClusterNode node) throws IgniteCheckedException { + return grid(node).cache(null).peek( new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), Collections.singleton(NEAR_ONLY)); } @@ -176,8 +163,8 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { * @return Atomic long value. * @throws IgniteCheckedException In case of error. */ - private GridCacheAtomicLongValue peekDht(ClusterNode node) throws IgniteCheckedException { - return (GridCacheAtomicLongValue)grid(node).cache(null).peek( + private Object peekDht(ClusterNode node) throws IgniteCheckedException { + return grid(node).cache(null).peek( new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), Collections.singleton(PARTITIONED_ONLY)); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java index 48497b9..7afa392 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java @@ -21,6 +21,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.datastructures.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.typedef.*; @@ -102,7 +103,7 @@ public class GridCacheLocalFullApiSelfTest extends GridCacheAbstractFullApiSelfT final AtomicLong cntr = new AtomicLong(); // Some counter. - myCache.dataStructures().atomicLong("some_counter", 0L, true).incrementAndGet(); + grid(0).jcache(null).put(new GridCacheInternalKeyImpl("test"), 1); // I would like to filter from key set all entities which key name is not started with "a_". IgnitePredicate<CacheEntry<String, Integer>> aPred = new IgnitePredicate<CacheEntry<String, Integer>>() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e3c81b4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index a3d69c5..1c12d07 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@ -27,6 +27,7 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.datastructures.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.optimized.*; @@ -1248,7 +1249,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo try { qry.execute(); - cache.dataStructures().atomicLong("long", 0, true); + cache.putx(new GridCacheInternalKeyImpl("test"), 1); cache.putx(1, 1); cache.putx(2, 2);