http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java deleted file mode 100644 index e7e7840..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java +++ /dev/null @@ -1,845 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.atomic.AtomicLong; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteAtomicSequence; -import org.apache.ignite.IgniteCompute; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.affinity.AffinityKey; -import org.apache.ignite.cache.affinity.AffinityKeyMapped; -import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; -import org.apache.ignite.cache.query.annotations.QueryGroupIndex; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.compute.ComputeJobAdapter; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.compute.ComputeTaskFuture; -import org.apache.ignite.compute.ComputeTaskSplitAdapter; -import org.apache.ignite.configuration.AtomicConfiguration; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry; -import org.apache.ignite.internal.util.GridAtomicLong; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.P1; -import org.apache.ignite.internal.util.typedef.T2; -import org.apache.ignite.internal.util.typedef.T5; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.lang.IgniteUuid; -import org.apache.ignite.resources.IgniteInstanceResource; -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; -import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheRebalanceMode.NONE; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * - */ -public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest { - /** IP finder. */ - private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); - - /** Timers. */ - private static final ConcurrentMap<Thread, ConcurrentMap<String, T5<Long, Long, Long, IgniteUuid, Object>>> timers = - new ConcurrentHashMap<>(); - - /** */ - private static final long PRINT_FREQ = 10000; - - /** */ - private static final GridAtomicLong lastPrint = new GridAtomicLong(); - - /** */ - private static final IgnitePredicate<ClusterNode> serverNode = new P1<ClusterNode>() { - @Override public boolean apply(ClusterNode n) { - String igniteInstanceName = G.ignite(n.id()).name(); - - return igniteInstanceName != null && igniteInstanceName.contains("server"); - } - }; - - /** */ - private static final IgnitePredicate<ClusterNode> clientNode = new P1<ClusterNode>() { - @Override public boolean apply(ClusterNode n) { - String igniteInstanceName = G.ignite(n.id()).name(); - - return igniteInstanceName != null && igniteInstanceName.contains("client"); - } - }; - - /** */ - private CacheMode mode = PARTITIONED; - - /** */ - private boolean cacheOn; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); - - c.getTransactionConfiguration().setDefaultTxConcurrency(PESSIMISTIC); - c.getTransactionConfiguration().setDefaultTxIsolation(REPEATABLE_READ); - - AtomicConfiguration atomicCfg = new AtomicConfiguration(); - - atomicCfg.setAtomicSequenceReserveSize(100000); - atomicCfg.setCacheMode(mode); - - c.setAtomicConfiguration(atomicCfg); - - if (cacheOn) { - CacheConfiguration cc = defaultCacheConfiguration(); - - cc.setCacheMode(mode); - - LruEvictionPolicy plc = new LruEvictionPolicy(); - plc.setMaxSize(1000); - - cc.setEvictionPolicy(plc); - cc.setOnheapCacheEnabled(true); - cc.setWriteSynchronizationMode(FULL_SYNC); - cc.setRebalanceMode(NONE); - - c.setCacheConfiguration(cc); - } - else - c.setCacheConfiguration(); - - TcpDiscoverySpi disco = new TcpDiscoverySpi(); - - disco.setIpFinder(ipFinder); - - c.setDiscoverySpi(disco); - - c.setPeerClassLoadingEnabled(false); - - return c; - } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return Long.MAX_VALUE; - } - - /** - * @throws Exception If failed. - */ - public void testEvictions() throws Exception { - try { - cacheOn = true; - - Ignite srvr1 = startGrid("server1"); - - srvr1.atomicSequence("ID", 0, true); - - startGrid("server2"); - - cacheOn = false; - - // Client processes count. - int clientCnt = 8; - - for (int i = 1; i <= clientCnt; i++) - startGrid("client" + i); - - Collection<ClusterNode> srvrNodes = srvr1.cluster().forPredicate(serverNode).nodes(); - Collection<ClusterNode> clientNodes = srvr1.cluster().forPredicate(clientNode).nodes(); - - assert srvrNodes.size() == 2; - - // Threads count per each client process. - int threadCnt = 2; - - int srvrMaxNoTerminals = threadCnt / srvrNodes.size(); - - if (srvrMaxNoTerminals * srvrNodes.size() != threadCnt) { - threadCnt = srvrMaxNoTerminals * srvrNodes.size(); - - info("Using " + threadCnt + " threads instead to ensure equal distribution of terminals"); - } - - Collection<Callable<Object>> clients = new ArrayList<>(threadCnt * clientCnt); - - info("No of servers: " + srvrNodes.size()); - info("No of clients: " + clientNodes.size()); - info("Thread count: " + threadCnt); - info("Max number of terminals / server: " + srvrMaxNoTerminals); - - // Distribute terminals evenly across all servers - for (ClusterNode node : srvrNodes) { - UUID srvrId = node.id(); - - info(">>> Node ID: " + srvrId); - - int terminalsPerSrvr = 0; - - int tid = 0; // Terminal ID. - - while (true) { - String terminalId = String.valueOf(++tid); - - // Server partition cache - UUID mappedId = srvr1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(terminalId).id(); - - if (!srvrId.equals(mappedId)) - continue; - - info("Affinity mapping [key=" + terminalId + ", nodeId=" + mappedId + ']'); - - for (int i = 1; i <= clientCnt; i++) - clients.add(new Client(G.ignite("client" + i), terminalId, srvrId)); - - info("Terminal ID: " + terminalId); - - terminalsPerSrvr++; - - if (terminalsPerSrvr == srvrMaxNoTerminals) - break; - } - } - - displayReqCount(); - - ExecutorService pool = Executors.newFixedThreadPool(clients.size()); - - pool.invokeAll(clients); - - Thread.sleep(Long.MAX_VALUE); - } - finally { - stopAllGrids(); - } - } - - /** - * - */ - private void displayReqCount() { - new Thread(new Runnable() { - @SuppressWarnings({"BusyWait", "InfiniteLoopStatement"}) - @Override public void run() { - int interval = 10; - - while (true) { - long cnt0 = Client.txCnt.get(); - long lt0 = Client.latency.get(); - - try { - Thread.sleep(interval * 1000); - } - catch (InterruptedException e) { - e.printStackTrace(); - } - - long cnt1 = Client.txCnt.get(); - long lt1 = Client.latency.get(); - - info(">>>"); - info(">>> Transaction/s: " + (cnt1 - cnt0) / interval); - info(">>> Avg Latency: " + ((cnt1 - cnt0) > 0 ? (lt1 - lt0) / (cnt1 - cnt0) + "ms" : "invalid")); - info(">>> Max Submit Time: " + Client.submitTime.getAndSet(0)); - - try { - PerfJob.printTimers(); - } - catch (Exception e) { - e.printStackTrace(); - } - } - } - }).start(); - } - - /** - * - */ - private static class Client implements Callable<Object> { - /** */ - private static AtomicLong txCnt = new AtomicLong(); - - /** */ - private static AtomicLong latency = new AtomicLong(); - - /** */ - private static GridAtomicLong submitTime = new GridAtomicLong(); - - - /** */ - private Ignite g; - - /** */ - private String terminalId; - - /** */ - private UUID nodeId; - - /** - * @param g Grid. - * @param terminalId Terminal ID. - * @param nodeId Node ID. - */ - private Client(Ignite g, String terminalId, UUID nodeId) { - this.g = g; - this.terminalId = terminalId; - this.nodeId = nodeId; - } - - /** {@inheritDoc} */ - @SuppressWarnings({"InfiniteLoopStatement"}) - @Override public Object call() throws Exception { - while (true) { - try { - long t0 = System.currentTimeMillis(); - - long submitTime1 = t0; - - IgniteCompute comp = g.compute(g.cluster().forPredicate(serverNode)); - - ComputeTaskFuture<Void> f1 = comp.executeAsync(RequestTask.class, new Message(terminalId, nodeId)); - - submitTime.setIfGreater(System.currentTimeMillis() - submitTime1); - - f1.get(); - - submitTime1 = System.currentTimeMillis(); - - ComputeTaskFuture<Void> f2 = comp.executeAsync(ResponseTask.class, new Message(terminalId, nodeId)); - - submitTime.setIfGreater(System.currentTimeMillis() - submitTime1); - - f2.get(); - - long t1 = System.currentTimeMillis(); - - txCnt.incrementAndGet(); - - latency.addAndGet(t1 - t0); - } - catch (IgniteException e) { - e.printStackTrace(); - } - } - } - } - - - /** - * - */ - private static class Message implements Serializable { - /** */ - private String terminalId; - - /** */ - private UUID nodeId; - - /** - * @param terminalId Terminal ID. - * @param nodeId Node ID. - */ - Message(String terminalId, UUID nodeId) { - this.terminalId = terminalId; - this.nodeId = nodeId; - } - - /** - * @return Terminal ID. - */ - String getTerminalId() { - return terminalId; - } - - /** - * @param terminalId Terminal ID. - */ - void setTerminalId(String terminalId) { - this.terminalId = terminalId; - } - - /** - * @return Node ID. - */ - UUID getNodeId() { - return nodeId; - } - - /** - * @param nodeId Node ID. - */ - void setNodeId(UUID nodeId) { - this.nodeId = nodeId; - } - } - - /** - * - */ - private static class PerfJob extends ComputeJobAdapter { - /** */ - private static final long MAX = 5000; - - /** */ - @AffinityKeyMapped - private String affKey; - - /** */ - @IgniteInstanceResource - private Ignite ignite; - - /** - * @param msg Message. - */ - PerfJob(Message msg) { - super(msg); - - affKey = msg.getTerminalId(); - } - - /** - * @return Message. - */ - private Message message() { - return argument(0); - } - - /** - * @return Terminal ID. - */ - public String terminalId() { - return message().getTerminalId(); - } - - /** {@inheritDoc} */ - @Override public Object execute() { - ConcurrentMap<String, T2<AtomicLong, AtomicLong>> nodeLoc = ignite.cluster().nodeLocalMap(); - - T2<AtomicLong, AtomicLong> cntrs = nodeLoc.get("cntrs"); - - if (cntrs == null) { - T2<AtomicLong, AtomicLong> other = nodeLoc.putIfAbsent("cntrs", - cntrs = new T2<>(new AtomicLong(), new AtomicLong(System.currentTimeMillis()))); - - if (other != null) - cntrs = other; - } - - long cnt = cntrs.get1().incrementAndGet(); - - doWork(); - - GridNearCacheAdapter near = (GridNearCacheAdapter)((IgniteKernal) ignite).internalCache(DEFAULT_CACHE_NAME); - GridDhtCacheAdapter dht = near.dht(); - - long start = cntrs.get2().get(); - - long now = System.currentTimeMillis(); - - long dur = now - start; - - if (dur > 20000 && cntrs.get2().compareAndSet(start, System.currentTimeMillis())) { - cntrs.get1().set(0); - - X.println("Stats [tx/sec=" + (cnt / (dur / 1000)) + ", nearSize=" + near.size() + - ", dhtSize=" + dht.size() + ']'); - } - - return null; - } - - /** - * @param name Timer name. - * @param xid XID. - * @param key Key. - * @param termId Terminal ID. - */ - private void startTimer(String name, @Nullable IgniteUuid xid, @Nullable String key, String termId) { - ConcurrentMap<String, T5<Long, Long, Long, IgniteUuid, Object>> m = timers.get(Thread.currentThread()); - - if (m == null) { - ConcurrentMap<String, T5<Long, Long, Long, IgniteUuid, Object>> old = - timers.putIfAbsent(Thread.currentThread(), - m = new ConcurrentHashMap<>()); - - if (old != null) - m = old; - } - - T5<Long, Long, Long, IgniteUuid, Object> t = m.get(name); - - if (t == null) { - T5<Long, Long, Long, IgniteUuid, Object> old = m.putIfAbsent(name, - t = new T5<>()); - - if (old != null) - t = old; - } - - t.set1(System.currentTimeMillis()); - t.set2(0L); - t.set4(xid); - t.set5(key == null ? null : new AffinityKey<String>(key, termId) {}); - } - - /** - * @param name Timer name. - */ - private void stopTimer(String name) { - ConcurrentMap<String, T5<Long, Long, Long, IgniteUuid, Object>> m = timers.get(Thread.currentThread()); - - T5<Long, Long, Long, IgniteUuid, Object> t = m.get(name); - - assert t != null; - - long now = System.currentTimeMillis(); - - t.set2(now); - t.set3(Math.max(t.get3() == null ? 0 : t.get3(), now - t.get1())); - t.set4(null); - t.set5(null); - } - - /** - * @throws Exception If failed. - */ - private static void printTimers() throws Exception { - //String termId = terminalId(); - - long now = System.currentTimeMillis(); - - if (lastPrint.get() + PRINT_FREQ < now && lastPrint.setIfGreater(now)) { - Map<String, Long> maxes = new HashMap<>(); - - Set<AffinityKey<String>> keys = null; - - for (Map.Entry<Thread, ConcurrentMap<String, T5<Long, Long, Long, IgniteUuid, Object>>> e1 : timers.entrySet()) { - for (Map.Entry<String, T5<Long, Long, Long, IgniteUuid, Object>> e2 : e1.getValue().entrySet()) { - T5<Long, Long, Long, IgniteUuid, Object> t = e2.getValue(); - - long start = t.get1(); - long end = t.get2(); - - IgniteUuid xid = t.get4(); - - long duration = end == 0 ? now - start : end - start; - - long max = t.get3() == null ? duration : t.get3(); - - if (duration < 0) - duration = now - start; - - if (duration > MAX) { - X.println("Maxed out timer [name=" + e2.getKey() + ", key=" + t.get5() + - ", duration=" + duration + ", ongoing=" + (end == 0) + - ", thread=" + e1.getKey().getName() + ", xid=" + xid + ']'); - - AffinityKey<String> key = (AffinityKey<String>)t.get5(); - - if (key != null) { - if (keys == null) - keys = new LinkedHashSet<>(); - - keys.add(key); - } - } - - Long cmax = maxes.get(e2.getKey()); - - if (cmax == null || max > cmax) - maxes.put(e2.getKey(), max); - - t.set3(null); - } - } - - if (!F.isEmpty(keys)) { - for (Ignite g : G.allGrids()) { - if (g.name().contains("server")) { - GridNearCacheAdapter<AffinityKey<String>, Object> near = - (GridNearCacheAdapter<AffinityKey<String>, Object>)((IgniteKernal)g). - <AffinityKey<String>, Object>internalCache(DEFAULT_CACHE_NAME); - GridDhtCacheAdapter<AffinityKey<String>, Object> dht = near.dht(); - - for (AffinityKey<String> k : keys) { - GridNearCacheEntry nearEntry = (GridNearCacheEntry)near.peekEx(k); - GridDhtCacheEntry dhtEntry = (GridDhtCacheEntry)dht.peekEx(k); - - X.println("Near entry [igniteInstanceName="+ g.name() + ", key=" + k + ", entry=" + - nearEntry); - X.println("DHT entry [igniteInstanceName=" + g.name() + ", key=" + k + ", entry=" + - dhtEntry); - } - } - } - } - - for (Map.Entry<String, Long> e : maxes.entrySet()) - X.println("Timer [name=" + e.getKey() + ", maxTime=" + e.getValue() + ']'); - - X.println(">>>>"); - } - } - - /** - * - */ - private void doWork() { - Session ses = new Session(terminalId()); - - try { - try (Transaction tx = ignite.transactions().txStart()) { - Request req = new Request(getId()); - - req.setMessageId(getId()); - - String key = req.getCacheKey(); - - startTimer("putRequest", tx.xid(), key, terminalId()); - - put(req, key, terminalId()); - - stopTimer("putRequest"); -// -// for (int i = 0; i < 5; i++) { -// Response rsp = new Response(getId()); -// -// startTimer("putResponse-" + i, tx.xid()); -// -// put(rsp, rsp.getCacheKey(), terminalId()); -// -// stopTimer("putResponse-" + i); -// } - - key = ses.getCacheKey(); - - startTimer("putSession", tx.xid(), key, terminalId()); - - put(ses, key, terminalId()); - - stopTimer("putSession"); - - startTimer("commit", tx.xid(), null, terminalId()); - - tx.commit(); - - stopTimer("commit"); - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * @return New ID. - */ - private long getId() { - IgniteAtomicSequence seq = ignite.atomicSequence("ID", 0, true); - - return seq.incrementAndGet(); - } - - /** - * @param o Object to put. - * @param cacheKey Cache key. - * @param terminalId Terminal ID. - */ - private void put(Object o, String cacheKey, String terminalId) { -// CacheProjection<AffinityKey<String>, Object> cache = ((IgniteKernal)ignite).cache(DEFAULT_CACHE_NAME); -// -// AffinityKey<String> affinityKey = new AffinityKey<>(cacheKey, terminalId); -// -// Entry<AffinityKey<String>, Object> entry = cache.entry(affinityKey); -// -// entry.setx(o); - assert false; - } - - /** - * @param cacheKey Cache key. - * @param terminalId Terminal ID. - * @return Cached object. - */ - @SuppressWarnings({"RedundantCast"}) - private <T> Object get(String cacheKey, String terminalId) { - Object key = new AffinityKey<>(cacheKey, terminalId); - - return (T) ignite.cache(DEFAULT_CACHE_NAME).get(key); - } - } - - /** - * - */ - @QueryGroupIndex(name = "msg_tx") - @SuppressWarnings({"UnusedDeclaration"}) - private static class Request implements Serializable { - /** */ - @QuerySqlField(index = true) - private Long id; - - /** */ - @QuerySqlField(name = "messageId") - @QuerySqlField.Group(name = "msg_tx", order = 3) - private long msgId; - - /** */ - @QuerySqlField(name = "transactionId") - @QuerySqlField.Group(name = "msg_tx", order = 1) - private long txId; - - /** - * @param id Request ID. - */ - Request(long id) { - this.id = id; - } - - /** - * @param msgId Message ID. - */ - public void setMessageId(long msgId) { - this.msgId = msgId; - } - - /** - * @return Cache key. - */ - public String getCacheKey() { - return "RESPONSE:" + id.toString(); - } - } - - /** - * - */ - @SuppressWarnings({"UnusedDeclaration"}) - private static class Response implements Serializable { - /** */ - @QuerySqlField - private Long id; - - /** */ - @QuerySqlField(name = "messageId") - private long msgId; - - /** */ - @QuerySqlField(name = "transactionId") - private long txId; - - /** - * @param id Response ID. - */ - Response(long id) { - this.id = id; - } - - /** - * @return Cache key. - */ - public String getCacheKey() { - return "REQUEST:" + id.toString(); - } - } - - /** - * - */ - private static class Session implements Serializable { - /** */ - @QuerySqlField(index = true) - private String terminalId; - - /** - * @param terminalId Terminal ID. - */ - Session(String terminalId) { - this.terminalId = terminalId; - } - - /** - * @return Cache key. - */ - public String getCacheKey() { - return "SESSION:" + terminalId; - } - } - - /** - * - */ - @SuppressWarnings( {"UnusedDeclaration"}) - private static class ResponseTask extends ComputeTaskSplitAdapter<Message, Void> { - /** {@inheritDoc} */ - @Override protected Collection<? extends ComputeJob> split(int arg0, Message msg) { - return Collections.singletonList(new PerfJob(msg)); - } - - /** {@inheritDoc} */ - @Nullable @Override public Void reduce(List<ComputeJobResult> results) { - return null; - } - } - - /** - * - */ - private static class RequestTask extends ComputeTaskSplitAdapter<Message, Void> { - /** {@inheritDoc} */ - @Override protected Collection<? extends ComputeJob> split(int arg0, Message msg) { - return Collections.singletonList(new PerfJob(msg)); - } - - /** {@inheritDoc} */ - @Nullable @Override public Void reduce(List<ComputeJobResult> results) { - return null; - } - } -}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java index acb3d73..90f8d60 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java @@ -70,7 +70,7 @@ public class GridCacheFullTextQueryMultithreadedSelfTest extends GridCacheAbstra */ @SuppressWarnings({"TooBroadScope"}) public void testH2Text() throws Exception { - int duration = 60 * 1000; + int duration = 20 * 1000; final int keyCnt = 5000; final int logFreq = 50; final String txt = "Value"; @@ -160,4 +160,4 @@ public class GridCacheFullTextQueryMultithreadedSelfTest extends GridCacheAbstra return S.toString(H2TextValue.class, this); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java index cff9745..1fed55f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java @@ -135,7 +135,7 @@ public class GridCacheLeakTest extends GridCommonAbstractTest { } } - if (i == 500_000) + if (i == 50_000) break; } } @@ -143,9 +143,4 @@ public class GridCacheLeakTest extends GridCommonAbstractTest { stopAllGrids(); } } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return Long.MAX_VALUE; - } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java index 1e04cb6..b117c86 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java @@ -63,8 +63,8 @@ public class GridCacheTtlManagerLoadTest extends GridCacheTtlManagerSelfTest { GridCacheTtlManager ttlMgr = g.internalCache(DEFAULT_CACHE_NAME).context().ttl(); - for (int i = 0; i < 300; i++) { - U.sleep(1000); + for (int i = 0; i < 5; i++) { + U.sleep(5000); ttlMgr.printMemoryStats(); } @@ -82,4 +82,4 @@ public class GridCacheTtlManagerLoadTest extends GridCacheTtlManagerSelfTest { @Override protected long getTestTimeout() { return Long.MAX_VALUE; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java index 941906b..daa5d83 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java @@ -34,7 +34,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; @SuppressWarnings("unchecked") public class IgniteCacheStartStopLoadTest extends GridCommonAbstractTest { /** */ - private static final long DURATION = 60_000L; + private static final long DURATION = 20_000L; /** */ private static final int CACHE_COUNT = 1; @@ -128,4 +128,4 @@ public class IgniteCacheStartStopLoadTest extends GridCommonAbstractTest { assert weakMap.isEmpty() : weakMap; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionDataStreamerTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionDataStreamerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionDataStreamerTest.java index 6b6d687..b5aab69 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionDataStreamerTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionDataStreamerTest.java @@ -27,7 +27,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; /** * */ -public class PageEvictionDataStreamerTest extends PageEvictionMultinodeTest { +public class PageEvictionDataStreamerTest extends PageEvictionMultinodeAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { return setEvictionMode(DataPageEvictionMode.RANDOM_LRU, super.getConfiguration(gridName)); http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java new file mode 100644 index 0000000..777c2d7 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java @@ -0,0 +1,123 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.ignite.internal.processors.cache.eviction.paged; + +import java.util.concurrent.ThreadLocalRandom; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.cache.CachePeekMode; +import org.apache.ignite.cache.CacheWriteSynchronizationMode; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; + +/** + * + */ +public abstract class PageEvictionMultinodeAbstractTest extends PageEvictionAbstractTest { + /** Cache modes. */ + private static final CacheMode[] CACHE_MODES = {CacheMode.PARTITIONED, CacheMode.REPLICATED}; + + /** Atomicity modes. */ + private static final CacheAtomicityMode[] ATOMICITY_MODES = { + CacheAtomicityMode.ATOMIC, CacheAtomicityMode.TRANSACTIONAL}; + + /** Write modes. */ + private static final CacheWriteSynchronizationMode[] WRITE_MODES = {CacheWriteSynchronizationMode.PRIMARY_SYNC, + CacheWriteSynchronizationMode.FULL_SYNC, CacheWriteSynchronizationMode.FULL_ASYNC}; + + /** Client grid. */ + Ignite clientGrid; + + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + startGridsMultiThreaded(4, false); + + clientGrid = startGrid("client"); + } + + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration configuration = super.getConfiguration(gridName); + + if (gridName.startsWith("client")) + configuration.setClientMode(true); + + return configuration; + } + + /** {@inheritDoc} */ + @Override protected long getTestTimeout() { + return 10 * 60 * 1000; + } + + /** + * @throws Exception If failed. + */ + public void testPageEviction() throws Exception { + for (int i = 0; i < CACHE_MODES.length; i++) { + for (int j = 0; j < ATOMICITY_MODES.length; j++) { + for (int k = 0; k < WRITE_MODES.length; k++) { + if (i + j + Math.min(k, 1) <= 1) { + CacheConfiguration<Object, Object> cfg = cacheConfig( + "evict" + i + j + k, null, CACHE_MODES[i], ATOMICITY_MODES[j], WRITE_MODES[k]); + + createCacheAndTestEvcition(cfg); + } + } + } + } + } + + /** + * @param cfg Config. + * @throws Exception If failed. + */ + protected void createCacheAndTestEvcition(CacheConfiguration<Object, Object> cfg) throws Exception { + IgniteCache<Object, Object> cache = clientGrid.getOrCreateCache(cfg); + + for (int i = 1; i <= ENTRIES; i++) { + ThreadLocalRandom r = ThreadLocalRandom.current(); + + if (r.nextInt() % 5 == 0) + cache.put(i, new TestObject(PAGE_SIZE / 4 - 50 + r.nextInt(5000))); // Fragmented object. + else + cache.put(i, new TestObject(r.nextInt(PAGE_SIZE / 4 - 50))); // Fits in one page. + + if (r.nextInt() % 7 == 0) + cache.get(r.nextInt(i)); // Touch. + else if (r.nextInt() % 11 == 0) + cache.remove(r.nextInt(i)); // Remove. + else if (r.nextInt() % 13 == 0) + cache.put(r.nextInt(i), new TestObject(r.nextInt(PAGE_SIZE / 2))); // Update. + + if (i % (ENTRIES / 10) == 0) + System.out.println(">>> Entries put: " + i); + } + + int resultingSize = cache.size(CachePeekMode.PRIMARY); + + System.out.println(">>> Resulting size: " + resultingSize); + + // Eviction started, no OutOfMemory occurred, success. + assertTrue(resultingSize < ENTRIES * 10 / 11); + + clientGrid.destroyCache(cfg.getName()); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeMixedRegionsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeMixedRegionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeMixedRegionsTest.java index 848e835..9a96a64 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeMixedRegionsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeMixedRegionsTest.java @@ -25,7 +25,7 @@ import org.apache.ignite.testframework.GridTestUtils; /** * Enables but not touches persistent region, checks page eviction and PDS+no PDS mode. */ -public class PageEvictionMultinodeMixedRegionsTest extends PageEvictionMultinodeTest { +public class PageEvictionMultinodeMixedRegionsTest extends PageEvictionMultinodeAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeTest.java deleted file mode 100644 index cd27cf9..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.ignite.internal.processors.cache.eviction.paged; - -import java.util.concurrent.ThreadLocalRandom; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.CachePeekMode; -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; - -/** - * - */ -public abstract class PageEvictionMultinodeTest extends PageEvictionAbstractTest { - /** Cache modes. */ - private static final CacheMode[] CACHE_MODES = {CacheMode.PARTITIONED, CacheMode.REPLICATED}; - - /** Atomicity modes. */ - private static final CacheAtomicityMode[] ATOMICITY_MODES = { - CacheAtomicityMode.ATOMIC, CacheAtomicityMode.TRANSACTIONAL}; - - /** Write modes. */ - private static final CacheWriteSynchronizationMode[] WRITE_MODES = {CacheWriteSynchronizationMode.PRIMARY_SYNC, - CacheWriteSynchronizationMode.FULL_SYNC, CacheWriteSynchronizationMode.FULL_ASYNC}; - - /** Client grid. */ - Ignite clientGrid; - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - startGridsMultiThreaded(4, false); - - clientGrid = startGrid("client"); - } - - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration configuration = super.getConfiguration(gridName); - - if (gridName.startsWith("client")) - configuration.setClientMode(true); - - return configuration; - } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return 10 * 60 * 1000; - } - - /** - * @throws Exception If failed. - */ - public void testPageEviction() throws Exception { - for (int i = 0; i < CACHE_MODES.length; i++) { - for (int j = 0; j < ATOMICITY_MODES.length; j++) { - for (int k = 0; k < WRITE_MODES.length; k++) { - if (i + j + Math.min(k, 1) <= 1) { - CacheConfiguration<Object, Object> cfg = cacheConfig( - "evict" + i + j + k, null, CACHE_MODES[i], ATOMICITY_MODES[j], WRITE_MODES[k]); - - createCacheAndTestEvcition(cfg); - } - } - } - } - } - - /** - * @param cfg Config. - * @throws Exception If failed. - */ - protected void createCacheAndTestEvcition(CacheConfiguration<Object, Object> cfg) throws Exception { - IgniteCache<Object, Object> cache = clientGrid.getOrCreateCache(cfg); - - for (int i = 1; i <= ENTRIES; i++) { - ThreadLocalRandom r = ThreadLocalRandom.current(); - - if (r.nextInt() % 5 == 0) - cache.put(i, new TestObject(PAGE_SIZE / 4 - 50 + r.nextInt(5000))); // Fragmented object. - else - cache.put(i, new TestObject(r.nextInt(PAGE_SIZE / 4 - 50))); // Fits in one page. - - if (r.nextInt() % 7 == 0) - cache.get(r.nextInt(i)); // Touch. - else if (r.nextInt() % 11 == 0) - cache.remove(r.nextInt(i)); // Remove. - else if (r.nextInt() % 13 == 0) - cache.put(r.nextInt(i), new TestObject(r.nextInt(PAGE_SIZE / 2))); // Update. - - if (i % (ENTRIES / 10) == 0) - System.out.println(">>> Entries put: " + i); - } - - int resultingSize = cache.size(CachePeekMode.PRIMARY); - - System.out.println(">>> Resulting size: " + resultingSize); - - // Eviction started, no OutOfMemory occurred, success. - assertTrue(resultingSize < ENTRIES * 10 / 11); - - clientGrid.destroyCache(cfg.getName()); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceAbstractTest.java new file mode 100644 index 0000000..3ad104b --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceAbstractTest.java @@ -0,0 +1,81 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.ignite.internal.processors.cache.eviction.paged; + +import java.util.concurrent.ThreadLocalRandom; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.cache.CachePeekMode; +import org.apache.ignite.cache.CacheWriteSynchronizationMode; +import org.apache.ignite.configuration.CacheConfiguration; + +/** + * + */ +public abstract class PageEvictionWithRebalanceAbstractTest extends PageEvictionAbstractTest { + /** + * @throws Exception If failed. + */ + public void testEvictionWithRebalance() throws Exception { + startGridsMultiThreaded(4); + + CacheConfiguration<Object, Object> cfg = cacheConfig("evict-rebalance", null, CacheMode.PARTITIONED, + CacheAtomicityMode.ATOMIC, CacheWriteSynchronizationMode.PRIMARY_SYNC); + + IgniteCache<Object, Object> cache = ignite(0).getOrCreateCache(cfg); + + for (int i = 1; i <= ENTRIES; i++) { + ThreadLocalRandom r = ThreadLocalRandom.current(); + + if (r.nextInt() % 5 == 0) + cache.put(i, new TestObject(PAGE_SIZE / 4 - 50 + r.nextInt(5000))); // Fragmented object. + else + cache.put(i, new TestObject(r.nextInt(PAGE_SIZE / 4 - 50))); // Fits in one page. + + if (i % (ENTRIES / 10) == 0) + System.out.println(">>> Entries put: " + i); + } + + int size = cache.size(CachePeekMode.ALL); + + System.out.println(">>> Resulting size: " + size); + + assertTrue(size < ENTRIES * 2); // Primary entries and backups. + + for (int i = 3; i >= 1; i--) { + stopGrid(i); + + cache.rebalance().get(); + + awaitPartitionMapExchange(); + + int rebalanceSize = cache.size(CachePeekMode.ALL); + + System.out.println(">>> Size after rebalance: " + rebalanceSize); + + assertTrue(rebalanceSize < size); + + size = rebalanceSize; + } + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceTest.java deleted file mode 100644 index f174908..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.ignite.internal.processors.cache.eviction.paged; - -import java.util.concurrent.ThreadLocalRandom; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.CachePeekMode; -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.configuration.CacheConfiguration; - -/** - * - */ -public abstract class PageEvictionWithRebalanceTest extends PageEvictionAbstractTest { - /** - * @throws Exception If failed. - */ - public void testEvictionWithRebalance() throws Exception { - startGridsMultiThreaded(4); - - CacheConfiguration<Object, Object> cfg = cacheConfig("evict-rebalance", null, CacheMode.PARTITIONED, - CacheAtomicityMode.ATOMIC, CacheWriteSynchronizationMode.PRIMARY_SYNC); - - IgniteCache<Object, Object> cache = ignite(0).getOrCreateCache(cfg); - - for (int i = 1; i <= ENTRIES; i++) { - ThreadLocalRandom r = ThreadLocalRandom.current(); - - if (r.nextInt() % 5 == 0) - cache.put(i, new TestObject(PAGE_SIZE / 4 - 50 + r.nextInt(5000))); // Fragmented object. - else - cache.put(i, new TestObject(r.nextInt(PAGE_SIZE / 4 - 50))); // Fits in one page. - - if (i % (ENTRIES / 10) == 0) - System.out.println(">>> Entries put: " + i); - } - - int size = cache.size(CachePeekMode.ALL); - - System.out.println(">>> Resulting size: " + size); - - assertTrue(size < ENTRIES * 2); // Primary entries and backups. - - for (int i = 3; i >= 1; i--) { - stopGrid(i); - - cache.rebalance().get(); - - awaitPartitionMapExchange(); - - int rebalanceSize = cache.size(CachePeekMode.ALL); - - System.out.println(">>> Size after rebalance: " + rebalanceSize); - - assertTrue(rebalanceSize < size); - - size = rebalanceSize; - } - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionMultinodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionMultinodeTest.java index b05ec43..6caa855 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionMultinodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionMultinodeTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; /** * */ -public class Random2LruPageEvictionMultinodeTest extends PageEvictionMultinodeTest { +public class Random2LruPageEvictionMultinodeTest extends PageEvictionMultinodeAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { return setEvictionMode(DataPageEvictionMode.RANDOM_2_LRU, super.getConfiguration(gridName)); http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionWithRebalanceTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionWithRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionWithRebalanceTest.java index 56698fb..7871e60 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionWithRebalanceTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruPageEvictionWithRebalanceTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; /** * */ -public class Random2LruPageEvictionWithRebalanceTest extends PageEvictionWithRebalanceTest { +public class Random2LruPageEvictionWithRebalanceTest extends PageEvictionWithRebalanceAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { return setEvictionMode(DataPageEvictionMode.RANDOM_2_LRU, super.getConfiguration(gridName)); http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionMultinodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionMultinodeTest.java index 38ca2af..969a522 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionMultinodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionMultinodeTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; /** * */ -public class RandomLruPageEvictionMultinodeTest extends PageEvictionMultinodeTest { +public class RandomLruPageEvictionMultinodeTest extends PageEvictionMultinodeAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { return setEvictionMode(DataPageEvictionMode.RANDOM_LRU, super.getConfiguration(gridName)); http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionWithRebalanceTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionWithRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionWithRebalanceTest.java index d961360..3a4b969 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionWithRebalanceTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruPageEvictionWithRebalanceTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; /** * */ -public class RandomLruPageEvictionWithRebalanceTest extends PageEvictionWithRebalanceTest { +public class RandomLruPageEvictionWithRebalanceTest extends PageEvictionWithRebalanceAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { return setEvictionMode(DataPageEvictionMode.RANDOM_LRU, super.getConfiguration(gridName)); http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java index 7693260..61d9b4c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java @@ -37,7 +37,9 @@ public class IgniteCacheExpiryPolicyTestSuite extends TestSuite { suite.addTestSuite(IgniteCacheLargeValueExpireTest.class); suite.addTestSuite(IgniteCacheAtomicLocalExpiryPolicyTest.class); + //suite.addTestSuite(IgniteCacheAtomicLocalOnheapExpiryPolicyTest.class); suite.addTestSuite(IgniteCacheAtomicExpiryPolicyTest.class); + //suite.addTestSuite(IgniteCacheAtomicOnheapExpiryPolicyTest.class); suite.addTestSuite(IgniteCacheAtomicWithStoreExpiryPolicyTest.class); suite.addTestSuite(IgniteCacheAtomicReplicatedExpiryPolicyTest.class); @@ -63,4 +65,4 @@ public class IgniteCacheExpiryPolicyTestSuite extends TestSuite { return suite; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java deleted file mode 100644 index 08a2597..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.persistence; - -import java.io.File; -import java.io.Serializable; -import java.util.List; -import java.util.UUID; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteDataStreamer; -import org.apache.ignite.cache.CacheRebalanceMode; -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.configuration.BinaryConfiguration; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.WALMode; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; -import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; - -/** - * - */ -public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest { - /** */ - private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); - - /** */ - private static final int GRID_CNT = 3; - - /** */ - private final File allocPath; - - /** - * Default constructor. - */ - public IgnitePdsMultiNodePutGetRestartTest() { - String home = U.getIgniteHome(); - - allocPath = new File(home, "work/db/" + UUID.randomUUID()); - - allocPath.mkdirs(); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - DataStorageConfiguration memCfg = new DataStorageConfiguration() - .setDefaultDataRegionConfiguration( - new DataRegionConfiguration().setMaxSize(100L * 1024 * 1024).setPersistenceEnabled(true)) - .setWalMode(WALMode.LOG_ONLY); - - cfg.setDataStorageConfiguration(memCfg); - - CacheConfiguration ccfg = new CacheConfiguration(); - - ccfg.setIndexedTypes(Integer.class, DbValue.class); - - ccfg.setRebalanceMode(CacheRebalanceMode.NONE); - - ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); - - ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - - cfg.setCacheConfiguration(ccfg); - - TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); - - discoSpi.setIpFinder(IP_FINDER); - - cfg.setDiscoverySpi(discoSpi); - - cfg.setMarshaller(null); - - BinaryConfiguration bCfg = new BinaryConfiguration(); - - bCfg.setCompactFooter(false); - - cfg.setBinaryConfiguration(bCfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - cleanPersistenceDir(); - - super.beforeTest(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - super.afterTest(); - - cleanPersistenceDir(); - } - - /** - * @throws Exception if failed. - */ - public void testPutGetSimple() throws Exception { - info(">>> Will use path: " + allocPath); - - startGrids(GRID_CNT); - - try { - IgniteEx ig = grid(0); - - ig.active(true); - - checkPutGetSql(ig, true); - } - finally { - stopAllGrids(); - } - - info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - - startGrids(GRID_CNT); - - try { - IgniteEx ig = grid(0); - - ig.active(true); - - checkPutGetSql(ig, false); - } - finally { - stopAllGrids(); - } - } - - /** - * @param ig Ig. - * @param write Write. - */ - private void checkPutGetSql(IgniteEx ig, boolean write) { - IgniteCache<Integer, DbValue> cache = ig.cache(null); - - if (write) { - try (IgniteDataStreamer<Object, Object> streamer = ig.dataStreamer(null)) { - for (int i = 0; i < 10_000; i++) - streamer.addData(i, new DbValue(i, "value-" + i, i)); - } - } - - List<List<?>> res = cache.query(new SqlFieldsQuery("select ival from dbvalue where ival < ? order by ival asc") - .setArgs(10_000)).getAll(); - - assertEquals(10_000, res.size()); - - for (int i = 0; i < 10_000; i++) { - assertEquals(1, res.get(i).size()); - assertEquals(i, res.get(i).get(0)); - } - - assertEquals(1, cache.query(new SqlFieldsQuery("select lval from dbvalue where ival = 7899")).getAll().size()); - assertEquals(5000, cache.query(new SqlFieldsQuery("select lval from dbvalue where ival >= 5000 and ival < 10000")) - .getAll().size()); - - for (int i = 0; i < 10_000; i++) - assertEquals(new DbValue(i, "value-" + i, i), cache.get(i)); - } - - /** - * - */ - private static class DbValue implements Serializable { - /** */ - @QuerySqlField(index = true) - private int iVal; - - /** */ - @QuerySqlField(index = true) - private String sVal; - - /** */ - @QuerySqlField - private long lVal; - - /** - * @param iVal Integer value. - * @param sVal String value. - * @param lVal Long value. - */ - public DbValue(int iVal, String sVal, long lVal) { - this.iVal = iVal; - this.sVal = sVal; - this.lVal = lVal; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - DbValue dbVal = (DbValue)o; - - return iVal == dbVal.iVal && lVal == dbVal.lVal && - !(sVal != null ? !sVal.equals(dbVal.sVal) : dbVal.sVal != null); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = iVal; - - res = 31 * res + (sVal != null ? sVal.hashCode() : 0); - res = 31 * res + (int)(lVal ^ (lVal >>> 32)); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(DbValue.class, this); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java index 1a8aaa4..626e794 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java @@ -64,13 +64,13 @@ public class PageIdDistributionTest extends GridCommonAbstractTest { */ public void testDistributions() { printPageIdDistribution( - CU.cacheId("partitioned"), 1024, 30_000, 32, 2.5f); + CU.cacheId("partitioned"), 1024, 10_000, 32, 2.5f); printPageIdDistribution( - CU.cacheId("partitioned"), 1024, 30_000, 64, 2.5f); + CU.cacheId("partitioned"), 1024, 10_000, 64, 2.5f); printPageIdDistribution( - CU.cacheId(null), 1024, 30_000, 32, 2.5f); + CU.cacheId(null), 1024, 10_000, 32, 2.5f); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationAtomicCacheSuit.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationAtomicCacheSuit.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationAtomicCacheSuit.java deleted file mode 100644 index 99b1152..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationAtomicCacheSuit.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.persistence.standbycluster.extended; - -import junit.framework.TestSuite; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicNearEnabledFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicClientOnlyMultiNodeP2PDisabledFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicCopyOnReadDisabledMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearOnlyMultiNodeP2PDisabledFullApiSelfTest; - -/** - * - */ -public class GridActivationAtomicCacheSuit extends GridActivationCacheAbstractTestSuit { - static { - addTest(GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.class); - addTest(GridCacheAtomicClientOnlyMultiNodeP2PDisabledFullApiSelfTest.class); - addTest(GridCacheAtomicCopyOnReadDisabledMultiNodeFullApiSelfTest.class); - addTest(GridCacheAtomicFullApiSelfTest.class); - addTest(GridCacheAtomicMultiNodeFullApiSelfTest.class); - addTest(GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest.class); - addTest(GridCacheAtomicNearEnabledFullApiSelfTest.class); - addTest(GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest.class); - addTest(GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.class); - addTest(GridCacheAtomicNearOnlyMultiNodeP2PDisabledFullApiSelfTest.class); - -// addTest(GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicClientOnlyMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicClientOnlyMultiJvmP2PDisabledFullApiSelfTest.class)); -// addTest(GridCacheAtomicCopyOnReadDisabledMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicFairAffinityMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest.class)); -// addTest(GridCacheAtomicOffHeapMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicOffHeapTieredMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicPrimaryWriteOrderFairAffinityMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.class)); -// addTest(GridCacheAtomicPrimaryWrityOrderOffHeapMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicNearEnabledFairAffinityMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicNearOnlyMultiJvmFullApiSelfTest.class)); -// addTest(GridCacheAtomicNearOnlyMultiJvmP2PDisabledFullApiSelfTest.class)); - } - - /** - * - */ - public static TestSuite suite() { - TestSuite suite = buildSuite(); - - suite.setName("Activation Stand-by Cluster After Primary Cluster Stopped Check Atomic Cache"); - - return suite; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationCacheAbstractTestSuit.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationCacheAbstractTestSuit.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationCacheAbstractTestSuit.java deleted file mode 100644 index 9380745..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationCacheAbstractTestSuit.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.persistence.standbycluster.extended; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import javassist.CannotCompileException; -import javassist.ClassClassPath; -import javassist.ClassPool; -import javassist.CtClass; -import javassist.NotFoundException; -import junit.framework.TestSuite; -import org.apache.ignite.IgniteException; - -/** - * - */ -public abstract class GridActivationCacheAbstractTestSuit { - /** Tests. */ - private static final List<Class> tests = new ArrayList<>(); - - /** Suffix. */ - private static final String SUFFIX = "Ex"; - - /** - * @return Suite. - */ - protected static TestSuite buildSuite() { - TestSuite suite = new TestSuite(); - - for (Class c : tests) - suite.addTestSuite(c); - - return suite; - } - - /** - * @param c Class. - */ - protected static void addTest(Class c){ - tests.add(transform(c)); - } - - - /** - * @param c Class to transform. - * @return Transformed class. - */ - private static Class transform(Class c){ - try { - ClassPool pool = ClassPool.getDefault(); - - pool.insertClassPath(new ClassClassPath(GridActivationCacheAbstractTestSuit.class)); - - String path = c.getProtectionDomain().getCodeSource().getLocation().getPath(); - - CtClass ct = pool.get(c.getName()); - - String name = c.getName() + SUFFIX; - - CtClass pr = pool.get(GridActivateExtensionTest.class.getName()); - - pr.setName(name); - - pr.setSuperclass(ct); - - pr.writeFile(path); - - return Class.forName(name); - } - catch (IOException e) { - System.out.println("Io exception: " + e.getMessage()); - - throw new IgniteException(e); - } - catch (CannotCompileException e) { - System.out.println("Cannot compile exception: " + e.getMessage()); - - throw new IgniteException(e); - } - catch (NotFoundException e) { - System.out.println("Not found exception: " + e.getMessage()); - - throw new IgniteException(e); - } - catch (ClassNotFoundException e) { - System.out.println("Class not found exception: " + e.getMessage()); - - throw new IgniteException(e); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationLocalAndNearCacheSuit.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationLocalAndNearCacheSuit.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationLocalAndNearCacheSuit.java deleted file mode 100644 index 4eb8a38..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationLocalAndNearCacheSuit.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.persistence.standbycluster.extended; - -import junit.framework.TestSuite; -import org.apache.ignite.internal.processors.cache.local.GridCacheLocalAtomicFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.local.GridCacheLocalFullApiSelfTest; - -/** - * - */ -public class GridActivationLocalAndNearCacheSuit extends GridActivationCacheAbstractTestSuit { - static { - addTest(GridCacheLocalAtomicFullApiSelfTest.class); - addTest(GridCacheLocalFullApiSelfTest.class); - -// addTest(GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest.class); -// addTest(GridCacheNearOnlyMultiJvmFullApiSelfTest.class); -// addTest(GridCacheNearOnlyMultiJvmP2PDisabledFullApiSelfTest.class); - } - - /** - * - */ - public static TestSuite suite() { - TestSuite suite = buildSuite(); - - suite.setName("Activation Stand-by Cluster After Primary Cluster Stopped Check Local and Near Cache"); - - return suite; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/de9227d7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationPartitionedCacheSuit.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationPartitionedCacheSuit.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationPartitionedCacheSuit.java deleted file mode 100644 index 303725f..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivationPartitionedCacheSuit.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.persistence.standbycluster.extended; - -import junit.framework.TestSuite; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledMultiNodeP2PDisabledFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.CachePartitionedMultiNodeLongTxTimeoutFullApiTest; -import org.apache.ignite.internal.processors.cache.distributed.near.CachePartitionedNearEnabledMultiNodeLongTxTimeoutFullApiTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearOnlyMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearOnlyMultiNodeP2PDisabledFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedCopyOnReadDisabledMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeP2PDisabledFullApiSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedNearOnlyNoPrimaryFullApiSelfTest; - -/** - * - */ -public class GridActivationPartitionedCacheSuit extends GridActivationCacheAbstractTestSuit { - static { - addTest(CachePartitionedMultiNodeLongTxTimeoutFullApiTest.class); - addTest(CachePartitionedNearEnabledMultiNodeLongTxTimeoutFullApiTest.class); - addTest(GridCacheNearOnlyMultiNodeFullApiSelfTest.class); - addTest(GridCacheNearOnlyMultiNodeP2PDisabledFullApiSelfTest.class); - addTest(GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.class); - addTest(GridCachePartitionedCopyOnReadDisabledMultiNodeFullApiSelfTest.class); - addTest(GridCachePartitionedFullApiSelfTest.class); - addTest(GridCachePartitionedMultiNodeFullApiSelfTest.class); - addTest(GridCachePartitionedMultiNodeP2PDisabledFullApiSelfTest.class); - addTest(GridCachePartitionedNearDisabledFullApiSelfTest.class); - addTest(GridCachePartitionedNearDisabledMultiNodeFullApiSelfTest.class); - addTest(GridCachePartitionedNearDisabledMultiNodeP2PDisabledFullApiSelfTest.class); - addTest(GridCachePartitionedNearOnlyNoPrimaryFullApiSelfTest.class); - -// addTest(GridCachePartitionedMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedFairAffinityMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedMultiJvmP2PDisabledFullApiSelfTest.class); -// addTest(GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedNearDisabledFairAffinityMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedNearDisabledMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedNearDisabledMultiJvmP2PDisabledFullApiSelfTest.class); -// addTest(GridCachePartitionedNearDisabledOffHeapMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedNearDisabledOffHeapTieredMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedOffHeapMultiJvmFullApiSelfTest.class); -// addTest(GridCachePartitionedOffHeapTieredMultiJvmFullApiSelfTest.class); - } - - /** - * - */ - public static TestSuite suite() { - TestSuite suite = buildSuite(); - - suite.setName("Activation Stand-by Cluster After Primary Cluster Stopped Check Partitioned Cache"); - - return suite; - } -}
