ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [25/53] [abbrv] [partial] incubator-ignite git commit: # ignite-164 : GridAbstractTest -> IgniteAbstractTest - auto-renaming with all suggested options + rename all methods and fields inside AbstractTest
Date Wed, 04 Feb 2015 14:37:59 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
deleted file mode 100644
index 0274966..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
+++ /dev/null
@@ -1,695 +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 org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import javax.cache.expiry.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-import java.util.concurrent.locks.*;
-
-import static java.util.concurrent.TimeUnit.*;
-import static org.apache.ignite.events.IgniteEventType.*;
-
-/**
- * Test cases for multi-threaded tests.
- */
-@SuppressWarnings("LockAcquiredButNotSafelyReleased")
-public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTest {
-    /** Grid. */
-    private Ignite ignite;
-
-    /**
-     *
-     */
-    protected GridCacheBasicApiAbstractTest() {
-        super(true /*start grid.*/);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
-
-        cfg.setDiscoverySpi(disco);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        ignite = grid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        ignite = null;
-    }
-
-    /**
-     *
-     * @throws Exception If test failed.
-     */
-    public void testBasicLock() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        Lock lock = cache.lock(1);
-
-        assert lock.tryLock();
-
-        assert cache.isLocalLocked(1, false);
-
-        lock.unlock();
-
-        assert !cache.isLocalLocked(1, false);
-    }
-
-    /**
-     * @throws IgniteCheckedException If test failed.
-     */
-    public void testSingleLockReentry() throws IgniteCheckedException {
-        IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        Lock lock = cache.lock(1);
-
-        lock.lock();
-
-        try {
-            assert cache.isLocalLocked(1, true);
-
-            lock.lock();
-
-            lock.unlock();
-
-            assert cache.isLocalLocked(1, true);
-        }
-        finally {
-            lock.unlock();
-        }
-
-        assert !cache.isLocalLocked(1, true);
-        assert !cache.isLocalLocked(1, false);
-    }
-
-    /**
-     *
-     * @throws Exception If test failed.
-     */
-    public void testReentry() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        Lock lock = cache.lock(1);
-
-        lock.lock();
-
-        assert cache.isLocalLocked(1, false);
-        assert cache.isLocalLocked(1, true);
-
-        lock.lock();
-
-        assert cache.isLocalLocked(1, false);
-        assert cache.isLocalLocked(1, true);
-
-        lock.lock();
-
-        assert cache.isLocalLocked(1, false);
-        assert cache.isLocalLocked(1, true);
-
-        lock.unlock();
-
-        assert cache.isLocalLocked(1, false);
-        assert cache.isLocalLocked(1, true);
-
-        lock.unlock();
-
-        assert cache.isLocalLocked(1, false);
-        assert cache.isLocalLocked(1, true);
-
-        lock.unlock();
-
-        assert !cache.isLocalLocked(1, false);
-        assert !cache.isLocalLocked(1, true);
-    }
-
-    /**
-     *
-     */
-    public void testInterruptLock() throws InterruptedException {
-        final IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        final Lock lock = cache.lock(1);
-
-        lock.lock();
-
-        final AtomicBoolean isOk = new AtomicBoolean(false);
-
-        Thread t = new Thread(new Runnable() {
-            @Override public void run() {
-                assertFalse(cache.isLocalLocked(1, true));
-
-                lock.lock();
-
-                try {
-                    assertTrue(cache.isLocalLocked(1, true));
-                }
-                finally {
-                    lock.unlock();
-                }
-
-                assertTrue(Thread.currentThread().isInterrupted());
-
-                isOk.set(true);
-            }
-        });
-
-        t.start();
-
-        Thread.sleep(100);
-
-        t.interrupt();
-
-        lock.unlock();
-
-        t.join();
-
-        assertTrue(isOk.get());
-    }
-
-    /**
-     *
-     */
-    public void testInterruptLockWithTimeout() throws Exception {
-        final IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        startGrid(1);
-
-        try {
-            final List<Integer> keys = primaryKeys(grid(1).jcache(null), 2, 1);
-
-            Lock lock1 = cache.lock(keys.get(1));
-
-            lock1.lock();
-
-            final AtomicBoolean isOk = new AtomicBoolean(false);
-
-            final CountDownLatch latch = new CountDownLatch(1);
-
-            Thread t = new Thread(new Runnable() {
-                @Override public void run() {
-                    try {
-                        latch.countDown();
-
-                        cache.lockAll(Arrays.asList(keys.get(0), keys.get(1))).tryLock(50000, MILLISECONDS);
-                    }
-                    catch (InterruptedException ignored) {
-                        isOk.set(true);
-                    }
-                }
-            });
-
-            t.start();
-
-            latch.await();
-
-            Thread.sleep(300);
-
-            t.interrupt();
-
-            t.join();
-
-            lock1.unlock();
-
-            Thread.sleep(1000);
-
-            assertFalse(cache.isLocalLocked(keys.get(0), false));
-            assertFalse(cache.isLocalLocked(keys.get(1), false));
-
-            assertFalse(grid(1).jcache(null).isLocalLocked(keys.get(0), false));
-            assertFalse(grid(1).jcache(null).isLocalLocked(keys.get(1), false));
-
-            assertTrue(isOk.get());
-        }
-        finally {
-            stopGrid(1);
-        }
-    }
-
-    /**
-     * @throws IgniteCheckedException If test failed.
-     */
-    public void testManyLockReentries() throws IgniteCheckedException {
-        IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        Integer key = 1;
-
-        Lock lock = cache.lock(key);
-
-        lock.lock();
-
-        try {
-            assert cache.get(key) == null;
-            assert cache.getAndPut(key, "1") == null;
-            assert "1".equals(cache.get(key));
-
-            assert cache.isLocalLocked(key, false);
-            assert cache.isLocalLocked(key, true);
-
-            lock.lock();
-
-            assert cache.isLocalLocked(key, false);
-            assert cache.isLocalLocked(key, true);
-
-            try {
-                assert "1".equals(cache.getAndRemove(key));
-            }
-            finally {
-                lock.unlock();
-            }
-
-            assert cache.isLocalLocked(key, false);
-            assert cache.isLocalLocked(key, true);
-        }
-        finally {
-            lock.unlock();
-
-            assert !cache.isLocalLocked(key, false);
-            assert !cache.isLocalLocked(key, true);
-        }
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testLockMultithreaded() throws Exception {
-        final IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        final CountDownLatch l1 = new CountDownLatch(1);
-        final CountDownLatch l2 = new CountDownLatch(1);
-        final CountDownLatch l3 = new CountDownLatch(1);
-
-        final Lock lock = cache.lock(1);
-
-        GridTestThread t1 = new GridTestThread(new Callable<Object>() {
-            /** {@inheritDoc} */
-            @Nullable @Override public Object call() throws Exception {
-                info("Before lock for.key 1");
-
-                lock.lock();
-
-                info("After lock for key 1");
-
-                try {
-                    assert cache.isLocalLocked(1, false);
-                    assert cache.isLocalLocked(1, true);
-
-                    l1.countDown();
-
-                    info("Let thread2 proceed.");
-
-                    // Reentry.
-                    assert lock.tryLock();
-
-                    // Nested lock.
-                    Lock lock2 = cache.lock(2);
-
-                    assert lock2.tryLock();
-
-                    l2.await();
-
-                    lock.unlock();
-
-                    // Unlock in reverse order.
-                    lock2.unlock();
-
-                    info("Waited for latch 2");
-                }
-                finally {
-                    lock.unlock();
-
-                    info("Unlocked entry for key 1.");
-                }
-
-                l3.countDown();
-
-                return null;
-            }
-        });
-
-        GridTestThread t2 = new GridTestThread(new Callable<Object>() {
-            /** {@inheritDoc} */
-            @Nullable @Override public Object call() throws Exception {
-                info("Waiting for latch1...");
-
-                l1.await();
-
-                info("Latch1 released.");
-
-                assert !lock.tryLock();
-
-                if (!cache.isLocalLocked(1, false))
-                    throw new IllegalArgumentException();
-
-                assert !cache.isLocalLocked(1, true);
-
-                info("Tried to lock cache for key1");
-
-                l2.countDown();
-
-                info("Released latch2");
-
-                l3.await();
-
-                assert lock.tryLock();
-
-                try {
-                    info("Locked cache for key 1");
-
-                    assert cache.isLocalLocked(1, false);
-                    assert cache.isLocalLocked(1, true);
-
-                    info("Checked that cache is locked for key 1");
-                }
-                finally {
-                    lock.unlock();
-
-                    info("Unlocked cache for key 1");
-                }
-
-                assert !cache.isLocalLocked(1, false);
-                assert !cache.isLocalLocked(1, true);
-
-                return null;
-            }
-        });
-
-        t1.start();
-        t2.start();
-
-        t1.join();
-        t2.join();
-
-        t1.checkError();
-        t2.checkError();
-
-        assert !cache.isLocalLocked(1, false);
-    }
-
-    /**
-     *
-     * @throws Exception If error occur.
-     */
-    public void testBasicOps() throws Exception {
-        GridCache<Integer, String> cache = ignite.cache(null);
-
-        CountDownLatch latch = new CountDownLatch(1);
-
-        CacheEventListener lsnr = new CacheEventListener(latch);
-
-        try {
-            ignite.events().localListen(lsnr, EVTS_CACHE);
-
-            int key = (int)System.currentTimeMillis();
-
-            assert !cache.containsKey(key);
-
-            cache.put(key, "a");
-
-            info("Start latch wait 1");
-
-            latch.await();
-
-            info("Stop latch wait 1");
-
-            assert cache.containsKey(key);
-
-            latch = new CountDownLatch(2);
-
-            lsnr.latch(latch);
-
-            cache.put(key, "b");
-            cache.put(key, "c");
-
-            info("Start latch wait 2");
-
-            latch.await();
-
-            info("Stop latch wait 2");
-
-            assert cache.containsKey(key);
-
-            latch = new CountDownLatch(1);
-
-            lsnr.latch(latch);
-
-            cache.remove(key);
-
-            info("Start latch wait 3");
-
-            latch.await();
-
-            info("Stop latch wait 3");
-
-            assert !cache.containsKey(key);
-        }
-        finally {
-            ignite.events().stopLocalListen(lsnr, EVTS_CACHE);
-        }
-    }
-
-    /**
-     * @throws Exception If error occur.
-     */
-    public void testBasicOpsWithReentry() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        int key = (int)System.currentTimeMillis();
-
-        assert !cache.containsKey(key);
-
-        Lock lock = cache.lock(key);
-
-        lock.lock();
-
-        CountDownLatch latch = new CountDownLatch(1);
-
-        CacheEventListener lsnr = new CacheEventListener(latch);
-
-        try {
-            ignite.events().localListen(lsnr, EVTS_CACHE);
-
-            cache.put(key, "a");
-
-            info("Start latch wait 1");
-
-            latch.await();
-
-            info("Stop latch wait 1");
-
-            assert cache.containsKey(key);
-            assert cache.isLocalLocked(key, true);
-
-            latch = new CountDownLatch(2);
-
-            lsnr.latch(latch);
-
-            cache.put(key, "b");
-            cache.put(key, "c");
-
-            info("Start latch wait 2");
-
-            latch.await();
-
-            info("Stop latch wait 2");
-
-            assert cache.containsKey(key);
-            assert cache.isLocalLocked(key, true);
-
-            latch = new CountDownLatch(1);
-
-            lsnr.latch(latch);
-
-            cache.remove(key);
-
-            info("Start latch wait 3");
-
-            latch.await();
-
-            info("Stop latch wait 3");
-
-            assert cache.isLocalLocked(key, false);
-        }
-        finally {
-            lock.unlock();
-
-            ignite.events().stopLocalListen(lsnr, EVTS_CACHE);
-        }
-
-        // Entry should be evicted since allowEmptyEntries is false.
-        assert !cache.isLocalLocked(key, false);
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testMultiLocks() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        Collection<Integer> keys = Arrays.asList(1, 2, 3);
-
-        Lock lock = cache.lockAll(keys);
-
-        lock.lock();
-
-        assert cache.isLocalLocked(1, false);
-        assert cache.isLocalLocked(2, false);
-        assert cache.isLocalLocked(3, false);
-
-        assert cache.isLocalLocked(1, true);
-        assert cache.isLocalLocked(2, true);
-        assert cache.isLocalLocked(3, true);
-
-        lock.unlock();
-
-        assert !cache.isLocalLocked(1, false);
-        assert !cache.isLocalLocked(2, false);
-        assert !cache.isLocalLocked(3, false);
-
-        assert !cache.isLocalLocked(1, true);
-        assert !cache.isLocalLocked(2, true);
-        assert !cache.isLocalLocked(3, true);
-    }
-
-    /**
-     * @throws IgniteCheckedException If test failed.
-     */
-    public void testGetPutRemove() throws IgniteCheckedException {
-        GridCache<Integer, String> cache = ignite.cache(null);
-
-        int key = (int)System.currentTimeMillis();
-
-        assert cache.get(key) == null;
-        assert cache.put(key, "1") == null;
-
-        String val = cache.get(key);
-
-        assert val != null;
-        assert "1".equals(val);
-
-        val = cache.remove(key);
-
-        assert val != null;
-        assert "1".equals(val);
-        assert cache.get(key) == null;
-    }
-
-    /**
-     *
-     * @throws Exception In case of error.
-     */
-    public void testPutWithExpiration() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.jcache(null);
-
-        CacheEventListener lsnr = new CacheEventListener(new CountDownLatch(1));
-
-        ignite.events().localListen(lsnr, EVTS_CACHE);
-
-        ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, 200L));
-
-        try {
-            int key = (int)System.currentTimeMillis();
-
-            cache.withExpiryPolicy(expiry).put(key, "val");
-
-            assert cache.get(key) != null;
-
-            cache.withExpiryPolicy(expiry).put(key, "val");
-
-            Thread.sleep(500);
-
-            assert cache.get(key) == null;
-        }
-        finally {
-            ignite.events().stopLocalListen(lsnr, EVTS_CACHE);
-        }
-    }
-
-    /**
-     * Event listener.
-     */
-    private class CacheEventListener implements IgnitePredicate<IgniteEvent> {
-        /** Wait latch. */
-        private CountDownLatch latch;
-
-        /** Event types. */
-        private int[] types;
-
-        /**
-         * @param latch Wait latch.
-         * @param types Event types.
-         */
-        CacheEventListener(CountDownLatch latch, int... types) {
-            this.latch = latch;
-            this.types = types;
-
-            if (F.isEmpty(types))
-                this.types = new int[] { EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED };
-        }
-
-        /**
-         * @param latch New latch.
-         */
-        void latch(CountDownLatch latch) {
-            this.latch = latch;
-        }
-
-        /**
-         * Waits for latch.
-         *
-         * @throws InterruptedException If got interrupted.
-         */
-        void await() throws InterruptedException {
-            latch.await();
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean apply(IgniteEvent evt) {
-            info("Grid cache event: " + evt);
-
-            if (U.containsIntArray(types, evt.type()))
-                latch.countDown();
-
-            return true;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
deleted file mode 100644
index 7b1c7cc..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
+++ /dev/null
@@ -1,589 +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 org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.typedef.*;
-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 org.apache.ignite.transactions.*;
-import org.jetbrains.annotations.*;
-
-import javax.cache.configuration.*;
-import java.util.*;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.cache.CacheDistributionMode.*;
-import static org.apache.ignite.cache.CachePreloadMode.*;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
-import static org.apache.ignite.transactions.IgniteTxConcurrency.*;
-import static org.apache.ignite.transactions.IgniteTxIsolation.*;
-
-/**
- * Basic store test.
- */
-public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Cache store. */
-    private static final GridCacheTestStore store = new GridCacheTestStore();
-
-    /**
-     *
-     */
-    protected GridCacheBasicStoreAbstractTest() {
-        super(true /*start grid. */);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        store.resetTimestamp();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        cache().clearAll();
-
-        store.reset();
-    }
-
-    /** @return Caching mode. */
-    protected abstract CacheMode cacheMode();
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override protected final IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration c = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        c.setDiscoverySpi(disco);
-
-        CacheConfiguration cc = defaultCacheConfiguration();
-
-        cc.setCacheMode(cacheMode());
-        cc.setWriteSynchronizationMode(FULL_SYNC);
-        cc.setSwapEnabled(false);
-        cc.setAtomicityMode(atomicityMode());
-        cc.setDistributionMode(distributionMode());
-        cc.setPreloadMode(SYNC);
-
-        cc.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(store));
-        cc.setReadThrough(true);
-        cc.setWriteThrough(true);
-        cc.setLoadPreviousValue(true);
-
-        c.setCacheConfiguration(cc);
-
-        return c;
-    }
-
-    /**
-     * @return Distribution mode.
-     */
-    protected CacheDistributionMode distributionMode() {
-        return NEAR_PARTITIONED;
-    }
-
-    /**
-     * @return Cache atomicity mode.
-     */
-    protected CacheAtomicityMode atomicityMode() {
-        return TRANSACTIONAL;
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    public void testNotExistingKeys() throws IgniteCheckedException {
-        GridCache<Integer, String> cache = cache();
-        Map<Integer, String> map = store.getMap();
-
-        cache.put(100, "hacuna matata");
-        assertEquals(1, map.size());
-
-        cache.evict(100);
-        assertEquals(1, map.size());
-
-        assertEquals("hacuna matata", cache.remove(100));
-        assertTrue(map.isEmpty());
-
-        store.resetLastMethod();
-        assertNull(store.getLastMethod());
-
-        cache.remove(200);
-        assertEquals("remove", store.getLastMethod());
-
-        cache.get(300);
-        assertEquals("load", store.getLastMethod());
-    }
-
-    /** @throws Exception If test fails. */
-    public void testWriteThrough() throws Exception {
-        GridCache<Integer, String> cache = cache();
-
-        Map<Integer, String> map = store.getMap();
-
-        assert map.isEmpty();
-
-        if (atomicityMode() == TRANSACTIONAL) {
-            try (IgniteTx tx = cache.txStart(OPTIMISTIC, REPEATABLE_READ)) {
-                for (int i = 1; i <= 10; i++) {
-                    cache.putx(i, Integer.toString(i));
-
-                    checkLastMethod(null);
-                }
-
-                tx.commit();
-            }
-        }
-        else {
-            Map<Integer, String> putMap = new HashMap<>();
-
-            for (int i = 1; i <= 10; i++)
-                putMap.put(i, Integer.toString(i));
-
-            cache.putAll(putMap);
-        }
-
-        checkLastMethod("putAll");
-
-        assert cache.size() == 10;
-
-        for (int i = 1; i <= 10; i++) {
-            String val = map.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-
-        store.resetLastMethod();
-
-        if (atomicityMode() == TRANSACTIONAL) {
-            try (IgniteTx tx = cache.txStart()) {
-                for (int i = 1; i <= 10; i++) {
-                    String val = cache.remove(i);
-
-                    checkLastMethod(null);
-
-                    assert val != null;
-                    assert val.equals(Integer.toString(i));
-                }
-
-                tx.commit();
-
-                checkLastMethod("removeAll");
-            }
-        }
-        else {
-            Collection<Integer> keys = new ArrayList<>(10);
-
-            for (int i = 1; i <= 10; i++)
-                keys.add(i);
-
-            cache.removeAll(keys);
-
-            checkLastMethod("removeAll");
-        }
-
-        assert map.isEmpty();
-    }
-
-    /** @throws Exception If test failed. */
-    public void testReadThrough() throws Exception {
-        GridCache<Integer, String> cache = cache();
-
-        Map<Integer, String> map = store.getMap();
-
-        assert map.isEmpty();
-
-        if (atomicityMode() == TRANSACTIONAL) {
-            try (IgniteTx tx = cache.txStart(OPTIMISTIC, REPEATABLE_READ)) {
-                for (int i = 1; i <= 10; i++)
-                    cache.putx(i, Integer.toString(i));
-
-                checkLastMethod(null);
-
-                tx.commit();
-            }
-        }
-        else {
-            Map<Integer, String> putMap = new HashMap<>();
-
-            for (int i = 1; i <= 10; i++)
-                putMap.put(i, Integer.toString(i));
-
-            cache.putAll(putMap);
-        }
-
-        checkLastMethod("putAll");
-
-        for (int i = 1; i <= 10; i++) {
-            String val = map.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-
-        cache.clearAll();
-
-        assert cache.isEmpty();
-        assert cache.isEmpty();
-
-        assert map.size() == 10;
-
-        for (int i = 1; i <= 10; i++) {
-            // Read through.
-            String val = cache.get(i);
-
-            checkLastMethod("load");
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-
-        assert cache.size() == 10;
-
-        cache.clearAll();
-
-        assert cache.isEmpty();
-        assert cache.isEmpty();
-
-        assert map.size() == 10;
-
-        Collection<Integer> keys = new ArrayList<>();
-
-        for (int i = 1; i <= 10; i++)
-            keys.add(i);
-
-        // Read through.
-        Map<Integer, String> vals = cache.getAll(keys);
-
-        checkLastMethod("loadAll");
-
-        assert vals != null;
-        assert vals.size() == 10;
-
-        for (int i = 1; i <= 10; i++) {
-            String val = vals.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-
-        // Write through.
-        cache.removeAll(keys);
-
-        checkLastMethod("removeAll");
-
-        assert cache.isEmpty();
-        assert cache.isEmpty();
-
-        assert map.isEmpty();
-    }
-
-    /** @throws Exception If test failed. */
-    public void testLoadCache() throws Exception {
-        GridCache<Integer, String> cache = cache();
-
-        int cnt = 1;
-
-        cache.loadCache(null, 0, cnt);
-
-        checkLastMethod("loadAllFull");
-
-        assert !cache.isEmpty();
-
-        Map<Integer, String> map = cache.getAll(cache.keySet());
-
-        assert map.size() == cnt : "Invalid map size: " + map.size();
-
-        // Recheck last method to make sure
-        // values were read from cache.
-        checkLastMethod("loadAllFull");
-
-        int start = store.getStart();
-
-        for (int i = start; i < start + cnt; i++) {
-            String val = map.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-    }
-
-    /** @throws Exception If test failed. */
-    public void testLoadCacheWithPredicate() throws Exception {
-        GridCache<Integer, String> cache = cache();
-
-        int cnt = 10;
-
-        cache.loadCache(new P2<Integer, String>() {
-            @Override public boolean apply(Integer key, String val) {
-                // Accept only even numbers.
-                return key % 2 == 0;
-            }
-        }, 0, cnt);
-
-        checkLastMethod("loadAllFull");
-
-        Map<Integer, String> map = cache.getAll(cache.keySet());
-
-        assert map.size() == cnt / 2 : "Invalid map size: " + map.size();
-
-        // Recheck last method to make sure
-        // values were read from cache.
-        checkLastMethod("loadAllFull");
-
-        int start = store.getStart();
-
-        for (int i = start; i < start + cnt; i++) {
-            String val = map.get(i);
-
-            if (i % 2 == 0) {
-                assert val != null;
-                assert val.equals(Integer.toString(i));
-            }
-            else
-                assert val == null;
-        }
-    }
-
-    /** @throws Exception If test failed. */
-    public void testReloadCache() throws Exception {
-        GridCache<Integer, String> cache = cache();
-
-        cache.loadCache(null, 0, 0);
-
-        assert cache.isEmpty();
-
-        checkLastMethod("loadAllFull");
-
-        for (int i = 1; i <= 10; i++) {
-            cache.put(i, Integer.toString(i));
-
-            checkLastMethod("put");
-        }
-
-        assert cache.size() == 10;
-
-        cache.reloadAll();
-
-        checkLastMethod("loadAll");
-
-        assert cache.size() == 10;
-
-        store.resetLastMethod();
-
-        for (int i = 1; i <= 10; i++) {
-            String val = cache.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-
-            // Make sure that value is coming from cache, not from store.
-            checkLastMethod(null);
-        }
-
-        cache.clearAll();
-
-        cache.loadCache(new P2<Integer, String>() {
-            @Override public boolean apply(Integer k, String v) {
-                // Only accept even numbers.
-                return k % 2 == 0;
-            }
-        }, 0, 10);
-
-        checkLastMethod("loadAllFull");
-
-        store.resetLastMethod();
-
-        assertEquals(5, cache.size());
-
-        cache.forEach(new CIX1<CacheEntry<Integer, String>>() {
-            @Override public void applyx(CacheEntry<Integer, String> entry) throws IgniteCheckedException {
-                String val = entry.get();
-
-                assert val != null;
-                assert val.equals(Integer.toString(entry.getKey()));
-                assert entry.getKey() % 2 == 0;
-
-                // Make sure that value is coming from cache, not from store.
-                checkLastMethod(null);
-            }
-        });
-
-        // Make sure that value is coming from cache, not from store.
-        checkLastMethod(null);
-    }
-
-    /** @throws Exception If test failed. */
-    public void testReloadAll() throws Exception {
-        GridCache<Integer, String> cache = cache();
-
-        assert cache.isEmpty();
-
-        Map<Integer, String> vals = new HashMap<>();
-
-        for (int i = 1; i <= 10; i++)
-            vals.put(i, Integer.toString(i));
-
-        cache.reloadAll(vals.keySet());
-
-        assert cache.isEmpty() : "Cache is not empty: " + cache.values();
-
-        checkLastMethod("loadAll");
-
-        cache.putAll(vals);
-
-        checkLastMethod("putAll");
-
-        assert cache.size() == 10;
-
-        cache.reloadAll(vals.keySet());
-
-        checkLastMethod("loadAll");
-
-        assert cache.size() == 10;
-
-        store.resetLastMethod();
-
-        for (int i = 1; i <= 10; i++) {
-            String val = cache.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-
-            // Make sure that value is coming from cache, not from store.
-            checkLastMethod(null);
-        }
-
-        for (int i = 1; i <= 10; i++)
-            store.write(new CacheEntryImpl<>(i, "reloaded-" + i));
-
-        cache.reloadAll(vals.keySet());
-
-        checkLastMethod("loadAll");
-
-        store.resetLastMethod();
-
-        assert cache.size() == 10;
-
-        for (int i = 1; i <= 10; i++) {
-            String val = cache.get(i);
-
-            assert val != null;
-            assert val.equals("reloaded-" + i);
-
-            // Make sure that value is coming from cache, not from store.
-            checkLastMethod(null);
-        }
-    }
-
-    /** @throws Exception If test failed. */
-    @SuppressWarnings("StringEquality")
-    public void testReload() throws Exception {
-        GridCache<Integer, String> cache = cache();
-
-        assert cache.isEmpty();
-
-        Map<Integer, String> vals = new HashMap<>();
-
-        for (int i = 1; i <= 10; i++)
-            vals.put(i, Integer.toString(i));
-
-        cache.reloadAll(vals.keySet());
-
-        assert cache.isEmpty();
-
-        checkLastMethod("loadAll");
-
-        cache.putAll(vals);
-
-        checkLastMethod("putAll");
-
-        assert cache.size() == 10;
-
-        String val = cache.reload(1);
-
-        assert val != null;
-        assert "1".equals(val);
-
-        checkLastMethod("load");
-
-        assert cache.size() == 10;
-
-        store.resetLastMethod();
-
-        for (int i = 1; i <= 10; i++) {
-            val = cache.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-
-            // Make sure that value is coming from cache, not from store.
-            checkLastMethod(null);
-        }
-
-        for (int i = 1; i <= 10; i++)
-            store.write(new CacheEntryImpl<>(i, "reloaded-" + i));
-
-        store.resetLastMethod();
-
-        assert cache.size() == 10;
-
-        for (int i = 1; i <= 10; i++) {
-            val = cache.reload(i);
-
-            checkLastMethod("load");
-
-            assert val != null;
-            assert val.equals("reloaded-" + i);
-
-            store.resetLastMethod();
-
-            String cached = cache.get(i);
-
-            assert cached != null;
-
-            assert cached == val : "Cached value mismatch [expected=" + val + ", cached=" + cached + ']';
-
-            // Make sure that value is coming from cache, not from store.
-            checkLastMethod(null);
-        }
-    }
-
-    /** @param mtd Expected last method value. */
-    private void checkLastMethod(@Nullable String mtd) {
-        String lastMtd = store.getLastMethod();
-
-        if (mtd == null)
-            assert lastMtd == null : "Last method must be null: " + lastMtd;
-        else {
-            assert lastMtd != null : "Last method must be not null";
-            assert lastMtd.equals(mtd) : "Last method does not match [expected=" + mtd + ", lastMtd=" + lastMtd + ']';
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreMultithreadedAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreMultithreadedAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreMultithreadedAbstractTest.java
deleted file mode 100644
index 1c0f479..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreMultithreadedAbstractTest.java
+++ /dev/null
@@ -1,131 +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 org.apache.ignite.cache.*;
-import org.apache.ignite.cache.store.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import javax.cache.configuration.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
-
-/**
- * Basic store test.
- */
-public abstract class GridCacheBasicStoreMultithreadedAbstractTest extends GridCommonAbstractTest {
-    /** Cache store. */
-    private CacheStore<Integer, Integer> store;
-
-    /**
-     *
-     */
-    protected GridCacheBasicStoreMultithreadedAbstractTest() {
-        super(false /*start grid. */);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        GridCache<?, ?> cache = cache();
-
-        if (cache != null)
-            cache.clearAll();
-
-        stopAllGrids();
-    }
-
-    /**
-     * @return Caching mode.
-     */
-    protected abstract CacheMode cacheMode();
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override protected final IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration c = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
-
-        c.setDiscoverySpi(disco);
-
-        CacheConfiguration cc = defaultCacheConfiguration();
-
-        cc.setCacheMode(cacheMode());
-        cc.setWriteSynchronizationMode(FULL_SYNC);
-        cc.setSwapEnabled(false);
-
-        cc.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(store));
-        cc.setReadThrough(true);
-        cc.setWriteThrough(true);
-        cc.setLoadPreviousValue(true);
-
-        c.setCacheConfiguration(cc);
-
-        return c;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConcurrentGet() throws Exception {
-        final AtomicInteger cntr = new AtomicInteger();
-
-        store = new CacheStoreAdapter<Integer, Integer>() {
-            @Override public Integer load(Integer key) {
-                return cntr.incrementAndGet();
-            }
-
-            /** {@inheritDoc} */
-            @Override public void write(javax.cache.Cache.Entry<? extends Integer, ? extends Integer> e) {
-                assert false;
-            }
-
-            /** {@inheritDoc} */
-            @Override public void delete(Object key) {
-                assert false;
-            }
-        };
-
-        startGrid();
-
-        final GridCache<Integer, Integer> cache = cache();
-
-        int threads = 2;
-
-        final CyclicBarrier barrier = new CyclicBarrier(threads);
-
-        multithreaded(new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                barrier.await();
-
-                cache.get(1);
-
-                return null;
-            }
-        }, threads, "concurrent-get-worker");
-
-        assertEquals(1, cntr.get());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java
deleted file mode 100644
index 3764fc5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java
+++ /dev/null
@@ -1,335 +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 org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.apache.ignite.transactions.*;
-
-import java.lang.reflect.*;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.cache.CacheDistributionMode.*;
-import static org.apache.ignite.cache.CacheMode.*;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
-import static org.apache.ignite.internal.processors.cache.GridCacheAdapter.*;
-
-/**
- * Test {@link org.apache.ignite.cache.GridCache#clearAll()} operations in multinode environment with nodes having caches with different names.
- */
-public class GridCacheClearAllSelfTest extends GridCommonAbstractTest {
-    /** Local cache. */
-    private static final String CACHE_LOCAL = "cache_local";
-
-    /** Partitioned cache. */
-    private static final String CACHE_PARTITIONED = "cache_partitioned";
-
-    /** Co-located cache. */
-    private static final String CACHE_COLOCATED = "cache_colocated";
-
-    /** Replicated cache. */
-    private static final String CACHE_REPLICATED = "cache_replicated";
-
-    /** Grid nodes count. */
-    private static final int GRID_CNT = 3;
-
-    /** VM IP finder for TCP discovery SPI. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Local caches. */
-    private GridCache<Integer, Integer>[] cachesLoc;
-
-    /** Partitioned caches. */
-    private GridCache<Integer, Integer>[] cachesPartitioned;
-
-    /** Colocated caches. */
-    private GridCache<Integer, Integer>[] cachesColocated;
-
-    /** Replicated caches. */
-    private GridCache<Integer, Integer>[] cachesReplicated;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        CacheConfiguration ccfgLoc = new CacheConfiguration();
-
-        ccfgLoc.setName(CACHE_LOCAL);
-        ccfgLoc.setCacheMode(LOCAL);
-        ccfgLoc.setWriteSynchronizationMode(FULL_SYNC);
-        ccfgLoc.setAtomicityMode(TRANSACTIONAL);
-
-        CacheConfiguration ccfgPartitioned = new CacheConfiguration();
-
-        ccfgPartitioned.setName(CACHE_PARTITIONED);
-        ccfgPartitioned.setCacheMode(PARTITIONED);
-        ccfgPartitioned.setBackups(1);
-        ccfgPartitioned.setWriteSynchronizationMode(FULL_SYNC);
-        ccfgPartitioned.setDistributionMode(gridName.equals(getTestGridName(0)) ? NEAR_PARTITIONED :
-            gridName.equals(getTestGridName(1)) ? NEAR_ONLY : CLIENT_ONLY);
-        ccfgPartitioned.setAtomicityMode(TRANSACTIONAL);
-
-        CacheConfiguration ccfgColocated = new CacheConfiguration();
-
-        ccfgColocated.setName(CACHE_COLOCATED);
-        ccfgColocated.setCacheMode(PARTITIONED);
-        ccfgColocated.setBackups(1);
-        ccfgColocated.setWriteSynchronizationMode(FULL_SYNC);
-        ccfgColocated.setDistributionMode(PARTITIONED_ONLY);
-        ccfgColocated.setAtomicityMode(TRANSACTIONAL);
-
-        CacheConfiguration ccfgReplicated = new CacheConfiguration();
-
-        ccfgReplicated.setName(CACHE_REPLICATED);
-        ccfgReplicated.setCacheMode(REPLICATED);
-        ccfgReplicated.setWriteSynchronizationMode(FULL_SYNC);
-        ccfgReplicated.setAtomicityMode(TRANSACTIONAL);
-
-        cfg.setCacheConfiguration(ccfgLoc, ccfgPartitioned, ccfgColocated, ccfgReplicated);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-
-        cachesLoc = null;
-        cachesPartitioned = null;
-        cachesColocated = null;
-        cachesReplicated = null;
-    }
-
-    /**
-     * Startup routine.
-     *
-     * @throws Exception If failed.
-     */
-    private void startUp() throws Exception {
-        cachesLoc = (GridCache<Integer, Integer>[])Array.newInstance(GridCache.class, GRID_CNT);
-        cachesPartitioned = (GridCache<Integer, Integer>[])Array.newInstance(GridCache.class, GRID_CNT);
-        cachesColocated = (GridCache<Integer, Integer>[])Array.newInstance(GridCache.class, GRID_CNT);
-        cachesReplicated = (GridCache<Integer, Integer>[])Array.newInstance(GridCache.class, GRID_CNT);
-
-        for (int i = 0; i < GRID_CNT; i++) {
-            Ignite ignite = startGrid(i);
-
-            cachesLoc[i] = ignite.cache(CACHE_LOCAL);
-            cachesPartitioned[i] = ignite.cache(CACHE_PARTITIONED);
-            cachesColocated[i] = ignite.cache(CACHE_COLOCATED);
-            cachesReplicated[i] = ignite.cache(CACHE_REPLICATED);
-        }
-    }
-
-    /**
-     * Test {@link org.apache.ignite.cache.GridCache#clearAll()} on LOCAL cache with no split.
-     *
-     * @throws Exception If failed.
-     */
-    public void testLocalNoSplit() throws Exception {
-        test(Mode.TEST_LOCAL, CLEAR_ALL_SPLIT_THRESHOLD / 2);
-    }
-
-    /**
-     * Test {@link org.apache.ignite.cache.GridCache#clearAll()} on LOCAL cache with split.
-     *
-     * @throws Exception If failed.
-     */
-    public void testLocalSplit() throws Exception {
-        test(Mode.TEST_LOCAL, CLEAR_ALL_SPLIT_THRESHOLD + 1);
-    }
-
-    /**
-     * Test {@link org.apache.ignite.cache.GridCache#clearAll()} on PARTITIONED cache with no split.
-     *
-     * @throws Exception If failed.
-     */
-    public void testPartitionedNoSplit() throws Exception {
-        test(Mode.TEST_PARTITIONED, CLEAR_ALL_SPLIT_THRESHOLD / 2);
-    }
-
-    /**
-     * Test {@link org.apache.ignite.cache.GridCache#clearAll()} on PARTITIONED cache with split.
-     *
-     * @throws Exception If failed.
-     */
-    public void testPartitionedSplit() throws Exception {
-        test(Mode.TEST_PARTITIONED, CLEAR_ALL_SPLIT_THRESHOLD + 1);
-    }
-
-    /**
-     * Test {@link org.apache.ignite.cache.GridCache#clearAll()} on co-located cache with no split.
-     *
-     * @throws Exception If failed.
-     */
-    public void testColocatedNoSplit() throws Exception {
-        test(Mode.TEST_COLOCATED, CLEAR_ALL_SPLIT_THRESHOLD / 2);
-    }
-
-    /**
-     * Test {@link org.apache.ignite.cache.GridCache#clearAll()} on co-located cache with split.
-     *
-     * @throws Exception If failed.
-     */
-    public void testColocatedSplit() throws Exception {
-        test(Mode.TEST_COLOCATED, CLEAR_ALL_SPLIT_THRESHOLD + 1);
-    }
-
-    /**
-     * Test {@link org.apache.ignite.cache.GridCache#clearAll()} on REPLICATED cache with no split.
-     *
-     * @throws Exception If failed.
-     */
-    public void testReplicatedNoSplit() throws Exception {
-        test(Mode.TEST_REPLICATED, CLEAR_ALL_SPLIT_THRESHOLD / 2);
-    }
-
-    /**
-     * Test {@link org.apache.ignite.cache.GridCache#clearAll()} on REPLICATED cache with split.
-     *
-     * @throws Exception If failed.
-     */
-    public void testReplicatedSplit() throws Exception {
-        test(Mode.TEST_REPLICATED, CLEAR_ALL_SPLIT_THRESHOLD + 1);
-    }
-
-    /**
-     * Internal method for all tests.
-     *
-     * @param mode Test mode
-     * @param keysCnt Keys count.
-     * @throws Exception In case of exception.
-     */
-    private void test(Mode mode, int keysCnt) throws Exception {
-        startUp();
-
-        switch (mode) {
-            case TEST_LOCAL: {
-                // Check on only one node.
-                GridCache<Integer, Integer> cache = cachesLoc[0];
-
-                fillCache(cache, keysCnt);
-
-                cache.clearAll();
-
-                assert cache.isEmpty();
-
-                break;
-            }
-            case TEST_PARTITIONED: {
-                // Take in count special case for near-only cache as well.
-                fillCache(cachesPartitioned[0], keysCnt);
-
-                // Ensure correct no-op clean of CLIENT_ONLY cache.
-                warmCache(cachesPartitioned[2], keysCnt);
-                assert cachesPartitioned[2].isEmpty();
-                cachesPartitioned[2].clearAll();
-                assert cachesPartitioned[2].isEmpty();
-
-                stopGrid(2); // Shutdown Grid in order to remove reader in NEAR_PARTITIONED cache.
-
-                // Ensure correct clear of NEA_ONLY cache.
-                warmCache(cachesPartitioned[1], keysCnt);
-                assert !cachesPartitioned[1].isEmpty();
-                cachesPartitioned[1].clearAll();
-                assert cachesPartitioned[1].isEmpty();
-                fillCache(cachesPartitioned[1], keysCnt);
-
-                stopGrid(1); // Shutdown Grid in order to remove reader in NEAR_PARTITIONED cache.
-
-                // Ensure correct clear of NEAR_PARTITIONED cache.
-                assert !cachesPartitioned[0].isEmpty();
-                cachesPartitioned[0].clearAll();
-                assert cachesPartitioned[0].isEmpty();
-
-                break;
-            }
-            default: {
-                assert mode == Mode.TEST_COLOCATED || mode == Mode.TEST_REPLICATED;
-
-                GridCache<Integer, Integer>[] caches = mode == Mode.TEST_COLOCATED ? cachesColocated : cachesReplicated;
-
-                fillCache(caches[0], keysCnt);
-
-                for (GridCache<Integer, Integer> cache : caches) {
-                    assert !cache.isEmpty();
-
-                    cache.clearAll();
-
-                    assert cache.isEmpty();
-                }
-            }
-        }
-    }
-
-    /**
-     * Fill cache with values.
-     *
-     * @param cache Cache.
-     * @param keysCnt Amount of keys to put.
-     * @throws Exception If failed.
-     */
-    private void fillCache(GridCache<Integer, Integer> cache, int keysCnt) throws Exception {
-        try (IgniteTx tx = cache.txStart()) {
-            for (int i = 0; i < keysCnt; i++)
-                cache.put(i, i);
-
-            tx.commit();
-        }
-    }
-
-    /**
-     * Warm cache up.
-     *
-     * @param cache Cache.
-     * @param keysCnt Amount of keys to get.
-     * @throws Exception If failed.
-     */
-    private void warmCache(GridCache<Integer, Integer> cache, int keysCnt) throws Exception {
-        for (int i = 0; i < keysCnt; i++)
-            cache.get(i);
-    }
-
-    /**
-     * Test mode.
-     */
-    private enum Mode {
-        /** Local cache. */
-        TEST_LOCAL,
-
-        /** Partitioned cache. */
-        TEST_PARTITIONED,
-
-        /** Co-located cache. */
-        TEST_COLOCATED,
-
-        /** Replicated cache. */
-        TEST_REPLICATED
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheColocatedTxStoreExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheColocatedTxStoreExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheColocatedTxStoreExceptionSelfTest.java
deleted file mode 100644
index 2628d6c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheColocatedTxStoreExceptionSelfTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.cache.*;
-
-import static org.apache.ignite.cache.CacheDistributionMode.*;
-import static org.apache.ignite.cache.CacheMode.*;
-
-/**
- *
- */
-public class GridCacheColocatedTxStoreExceptionSelfTest extends IgniteTxStoreExceptionAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheDistributionMode distributionMode() {
-        return PARTITIONED_ONLY;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
deleted file mode 100644
index a5518cd..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
+++ /dev/null
@@ -1,384 +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 org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-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.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.cache.CacheMode.*;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
-
-/**
- * Grid cache concurrent hash map self test.
- */
-public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest {
-    /** Ip finder. */
-    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        CacheConfiguration cc = defaultCacheConfiguration();
-
-        cc.setCacheMode(LOCAL);
-        cc.setWriteSynchronizationMode(FULL_SYNC);
-        cc.setStartSize(4);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(ipFinder);
-
-        cfg.setDiscoverySpi(disco);
-
-        cfg.setCacheConfiguration(cc);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRehash() throws Exception {
-        GridCache<Integer, String> c = grid().cache(null);
-
-        int cnt = 100 * 1024;
-
-        for (int i = 0; i < cnt; i++) {
-            c.put(i, Integer.toString(i));
-
-            if (i > 0 && i % 50000 == 0)
-                info(">>> " + i + " puts completed");
-        }
-
-        for (int i = 0; i < cnt; i++)
-            assertEquals(Integer.toString(i), c.get(i));
-
-        assertEquals(cnt, c.size());
-
-        int idx = 0;
-
-        for (CacheEntry<Integer, String> e : c.entrySet()) {
-            assertNotNull(e.peek());
-
-            idx++;
-        }
-
-        assertEquals(cnt, idx);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRehashRandom() throws Exception {
-        GridCache<Integer, String> c = grid().cache(null);
-
-        int cnt = 100 * 1024;
-
-        Random rnd = new Random();
-
-        Map<Integer, String> puts = new HashMap<>();
-
-        for (int i = 0; i < cnt * 2; i++) {
-            int key = rnd.nextInt(cnt);
-
-            c.put(key, Integer.toString(key));
-
-            puts.put(key, Integer.toString(key));
-
-            if (i > 0 && i % 50000 == 0)
-                info(">>> " + i + " puts completed");
-        }
-
-        for (Integer key : puts.keySet())
-            assertEquals(Integer.toString(key), c.get(key));
-
-        assertEquals(puts.size(), c.size());
-
-        int idx = 0;
-
-        for (CacheEntry<Integer, String> e : c.entrySet()) {
-            assertNotNull(e.peek());
-
-            idx++;
-        }
-
-        assertEquals(puts.size(), idx);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRehashMultithreaded1() throws Exception {
-        final AtomicInteger tidGen = new AtomicInteger();
-
-        final Random rand = new Random();
-
-        final int cnt = 100 * 1024;
-
-        multithreaded(new Callable<Object>() {
-            @SuppressWarnings("UnusedAssignment")
-            @Override public Object call() throws Exception {
-                GridCache<Integer, String> c = grid().cache(null);
-
-                int tid = tidGen.getAndIncrement();
-
-                int start = 2 * 1024 * tid;
-
-                Iterator<String> it1 = null;
-                Iterator<CacheEntry<Integer, String>> it2 = null;
-                Iterator<Integer> it3 = null;
-
-                boolean created = false;
-
-                for (int i = start; i < start + cnt; i++) {
-                    int key = i % cnt;
-
-                    if (!created && i >= start + tid * 100) {
-                        if (it1 == null)
-                            it1 = c.values().iterator();
-
-                        if (it2 == null)
-                            it2 = c.entrySet().iterator();
-
-                        if (it3 == null)
-                            it3 = c.keySet().iterator();
-
-                        created = true;
-                    }
-
-                    c.put(key, Integer.toString(key));
-
-                    c.get(rand.nextInt(cnt));
-                }
-
-                // Go through iterators.
-                while(it1.hasNext())
-                    it1.next();
-
-                while(it2.hasNext())
-                    it2.next();
-
-                while(it3.hasNext())
-                    it3.next();
-
-                // Make sure that hard references are gone.
-                it1 = null;
-                it2 = null;
-                it3 = null;
-
-                for (int i = start; i < start + cnt; i++) {
-                    int key = i % cnt;
-
-                    assertEquals(Integer.toString(key), c.get(key));
-                }
-
-                assertEquals(cnt, c.size());
-
-                int idx = 0;
-
-                for (CacheEntry<Integer, String> e : c.entrySet()) {
-                    assertNotNull(e.peek());
-
-                    idx++;
-                }
-
-                assertEquals(cnt, idx);
-
-                System.gc();
-
-                return null;
-            }
-        }, 10);
-
-        cache().get(rand.nextInt(cnt));
-
-        System.gc();
-
-        Thread.sleep(1000);
-
-        cache().get(rand.nextInt(cnt));
-
-        assertEquals(0, local().map.iteratorMapSize());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRehashMultithreaded2() throws Exception {
-        final AtomicInteger tidGen = new AtomicInteger(0);
-
-        final Random rand = new Random();
-
-        final int cnt = 100 * 1024;
-
-        multithreaded(new Callable<Object>() {
-            @SuppressWarnings("UnusedAssignment")
-            @Override public Object call() throws Exception {
-                GridCache<Integer, String> c = grid().cache(null);
-
-                int tid = tidGen.getAndIncrement();
-
-                int start = 2 * 1024 * tid;
-
-                Iterator<String> it1 = null;
-                Iterator<CacheEntry<Integer, String>> it2 = null;
-                Iterator<Integer> it3 = null;
-
-                boolean forgot = false;
-
-                for (int i = start; i < start + cnt; i++) {
-                    int key = i % cnt;
-
-                    if (!forgot && i >= start + tid * 100) {
-                        if (it1 == null)
-                            it1 = c.values().iterator();
-
-                        if (it2 == null)
-                            it2 = c.entrySet().iterator();
-
-                        if (it3 == null)
-                            it3 = c.keySet().iterator();
-                    }
-
-                    c.put(key, Integer.toString(key));
-
-                    c.get(rand.nextInt(cnt));
-
-                    if (!forgot && i == cnt) {
-                        info("Forgetting iterators [it1=" + it1 + ", it2=" + it2 + ", it3=" + it3 + ']');
-
-                        // GC
-                        it1 = null;
-                        it2 = null;
-                        it3 = null;
-
-                        forgot = true;
-                    }
-                }
-
-                // Make sure that hard references are gone.
-                it1 = null;
-                it2 = null;
-                it3 = null;
-
-                for (int i = start; i < start + cnt; i++) {
-                    int key = i % cnt;
-
-                    assertEquals(Integer.toString(key), c.get(key));
-                }
-
-                assertEquals(cnt, c.size());
-
-                int idx = 0;
-
-                for (CacheEntry<Integer, String> e : c.entrySet()) {
-                    assertNotNull(e.peek());
-
-                    idx++;
-                }
-
-                assertEquals(cnt, idx);
-
-                System.gc();
-
-                return null;
-            }
-        }, 10);
-
-        cache().get(rand.nextInt(cnt));
-
-        System.gc();
-
-        Thread.sleep(1000);
-
-        cache().get(rand.nextInt(cnt));
-
-        assertEquals(0, local().map.iteratorMapSize());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("ResultOfObjectAllocationIgnored")
-    public void testEmptyWeakIterator() throws Exception {
-        final GridCache<Integer, String> c = grid().cache(null);
-
-        for (int i = 0; i < 100; i++) {
-            multithreaded(new Callable<Object>() {
-                @SuppressWarnings("UnusedAssignment")
-                @Override public Object call() throws Exception {
-                    Iterator<String> it1 = c.values().iterator();
-                    Iterator<CacheEntry<Integer, String>> it2 = c.entrySet().iterator();
-                    Iterator<Integer> it3 = c.keySet().iterator();
-
-                    for (int i = 0; i < 1000; i++) {
-                        c.put(i, String.valueOf(i));
-
-                        if (i == 0) {
-                            it1.hasNext();
-                            it2.hasNext();
-                            it3.hasNext();
-                        }
-                    }
-
-                    // Make sure that hard references are gone.
-                    it1 = null;
-                    it2 = null;
-                    it3 = null;
-
-                    System.gc();
-
-                    return null;
-                }
-            }, 10);
-
-            for (int r = 0; r < 10; r++) {
-                System.gc();
-
-                c.get(100);
-
-                if (local().map.iteratorMapSize() == 0)
-                    break;
-                else
-                    U.sleep(500);
-            }
-
-            assertEquals(0, local().map.iteratorMapSize());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapTest.java
deleted file mode 100644
index 9cc6f1a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapTest.java
+++ /dev/null
@@ -1,137 +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 org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.cache.CacheMode.*;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
-
-/**
- * Grid cache concurrent hash map self test.
- */
-public class GridCacheConcurrentMapTest extends GridCommonAbstractTest {
-    /** Random. */
-    private static final Random RAND = new Random();
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        CacheConfiguration cc = defaultCacheConfiguration();
-
-        cc.setCacheMode(LOCAL);
-        cc.setWriteSynchronizationMode(FULL_SYNC);
-
-        cfg.setCacheConfiguration(cc);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid(0);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        grid(0).cache(null).removeAll();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRandomEntry() throws Exception {
-        GridCache<String, String> cache = grid(0).cache(null);
-
-        for (int i = 0; i < 500; i++)
-            cache.put("key" + i, "val" + i);
-
-        for (int i = 0; i < 20; i++) {
-            CacheEntry<String, String> entry = cache.randomEntry();
-
-            assert entry != null;
-
-            info("Random entry key: " + entry.getKey());
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRandomEntryMultiThreaded() throws Exception {
-        final GridCache<String, String> cache = grid(0).cache(null);
-
-        final AtomicBoolean done = new AtomicBoolean();
-
-        IgniteInternalFuture<?> fut1 = multithreadedAsync(
-            new Callable<Object>() {
-                @Nullable @Override public Object call() throws Exception {
-                    while (!done.get()) {
-                        int i = RAND.nextInt(500);
-
-                        boolean rmv = RAND.nextBoolean();
-
-                        if (rmv)
-                            cache.remove("key" + i);
-                        else
-                            cache.put("key" + i, "val" + i);
-                    }
-
-                    return null;
-                }
-            },
-            3
-        );
-
-        IgniteInternalFuture<?> fut2 = multithreadedAsync(
-            new Callable<Object>() {
-                @Nullable @Override public Object call() throws Exception {
-                    while (!done.get()) {
-                        CacheEntry<String, String> entry = cache.randomEntry();
-
-                        info("Random entry key: " + (entry != null ? entry.getKey() : "N/A"));
-                    }
-
-                    return null;
-                }
-            },
-            1
-        );
-
-        Thread.sleep( 60 * 1000);
-
-        done.set(true);
-
-        fut1.get();
-        fut2.get();
-    }
-}


Mime
View raw message