ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [47/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:38:21 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java
deleted file mode 100644
index baaeaae..0000000
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java
+++ /dev/null
@@ -1,114 +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.cache.store;
-
-import org.apache.ignite.cache.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
-
-import javax.cache.configuration.*;
-import java.util.*;
-
-/**
- *
- */
-public class GridCacheLoadOnlyStoreAdapterSelfTest extends GridCacheAbstractSelfTest {
-    /** Expected loadAll arguments, hardcoded on call site for convenience. */
-    private static final Integer[] EXP_ARGS = {1, 2, 3};
-
-    /** Test input size. */
-    private static final int INPUT_SIZE = 100;
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 1;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
-        CacheConfiguration cfg = super.cacheConfiguration(gridName);
-
-        cfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestStore()));
-        cfg.setReadThrough(true);
-        cfg.setWriteThrough(true);
-        cfg.setLoadPreviousValue(true);
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStore() throws Exception {
-        jcache().localLoadCache(null, 1, 2, 3);
-
-        int cnt = 0;
-
-        for (int i = 0; i < gridCount(); i++)
-            cnt += cache(i).size();
-
-        assertEquals(INPUT_SIZE - (INPUT_SIZE/10), cnt);
-    }
-
-    /**
-     *
-     */
-    private static class TestStore extends CacheLoadOnlyStoreAdapter<Integer, String, String> {
-        /** {@inheritDoc} */
-        @Override protected Iterator<String> inputIterator(@Nullable Object... args) {
-            assertNotNull(args);
-            assertTrue(Arrays.equals(EXP_ARGS, args));
-
-            return new Iterator<String>() {
-                private int i = -1;
-
-                @Override public boolean hasNext() {
-                    return i < INPUT_SIZE;
-                }
-
-                @Override public String next() {
-                    if (!hasNext())
-                        throw new NoSuchElementException();
-
-                    i++;
-
-                    return i + "=str" + i;
-                }
-
-                @Override public void remove() {
-                    // No-op.
-                }
-            };
-        }
-
-        /** {@inheritDoc} */
-        @Override protected IgniteBiTuple<Integer, String> parse(String rec, @Nullable Object... args) {
-            assertNotNull(args);
-            assertTrue(Arrays.equals(EXP_ARGS, args));
-
-            String[] p = rec.split("=");
-
-            int i = Integer.parseInt(p[0]);
-
-            return i % 10 == 0 ? null : new T2<>(i, p[1]);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheBalancingStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheBalancingStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheBalancingStoreSelfTest.java
new file mode 100644
index 0000000..78338b8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheBalancingStoreSelfTest.java
@@ -0,0 +1,200 @@
+/*
+ * 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.cache.store;
+
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jetbrains.annotations.*;
+
+import javax.cache.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+import java.util.concurrent.locks.*;
+
+/**
+ * Store test.
+ */
+public class IgniteCacheBalancingStoreSelfTest extends IgniteCommonAbstractTest {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLoads() throws Exception {
+        final int range = 300;
+
+        final AtomicInteger cycles = new AtomicInteger();
+        final AtomicReference<Exception> err = new AtomicReference<>();
+
+        final CacheStoreBalancingWrapper<Integer, Integer> w =
+            new CacheStoreBalancingWrapper<>(new VerifyStore(range));
+
+        final AtomicBoolean finish = new AtomicBoolean();
+
+        IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new IgniteCallable<Void>() {
+            @Override public Void call() throws Exception {
+                try {
+                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+                    while (!finish.get()) {
+                        int cnt = rnd.nextInt(CacheStoreBalancingWrapper.DFLT_LOAD_ALL_THRESHOLD) + 1;
+
+                        if (cnt == 1) {
+                            int key = rnd.nextInt(range);
+
+                            assertEquals((Integer)key, w.load(key));
+                        }
+                        else {
+                            Collection<Integer> keys = new HashSet<>(cnt);
+
+                            for (int i = 0; i < cnt; i++)
+                                keys.add(rnd.nextInt(range));
+
+                            final Map<Integer, Integer> loaded = new HashMap<>();
+
+                            w.loadAll(keys, new CI2<Integer, Integer>() {
+                                @Override public void apply(Integer k, Integer v) {
+                                    loaded.put(k, v);
+                                }
+                            });
+
+                            for (Integer key : keys)
+                                assertEquals(key, loaded.get(key));
+                        }
+
+                        int c = cycles.incrementAndGet();
+
+                        if (c > 0 && c % 2_000_000 == 0)
+                            info("Finished cycles: " + c);
+                    }
+                }
+                catch (Exception e) {
+                    e.printStackTrace();
+
+                    err.compareAndSet(null, e);
+                }
+
+                return null;
+            }
+        }, 10, "test");
+
+        try {
+            Thread.sleep(30_000);
+        }
+        finally {
+            finish.set(true);
+        }
+
+        fut.get();
+
+        if (err.get() != null)
+            throw err.get();
+
+        info("Total: " + cycles.get());
+    }
+
+    /**
+     *
+     */
+    private static class VerifyStore extends CacheStore<Integer, Integer> {
+        /** */
+        private Lock[] locks;
+
+        /**
+         * @param range Range.
+         */
+        private VerifyStore(int range) {
+            locks = new Lock[range];
+
+            for (int i = 0; i < locks.length; i++)
+                locks[i] = new ReentrantLock();
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Integer load(Integer key) {
+            boolean res = locks[key].tryLock();
+
+            if (res) {
+                try {
+                    return key;
+                }
+                finally {
+                    locks[key].unlock();
+                }
+            }
+            else
+                fail("Failed to acquire lock for key: " + key);
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void loadCache(IgniteBiInClosure<Integer, Integer> clo, @Nullable Object... args) {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<Integer, Integer> loadAll(Iterable<? extends Integer> keys) {
+            Map<Integer, Integer> loaded = new HashMap<>();
+
+            for (Integer key : keys) {
+                boolean res = locks[key].tryLock();
+
+                if (res) {
+                    try {
+                        loaded.put(key, key);
+                    }
+                    finally {
+                        locks[key].unlock();
+                    }
+                }
+                else
+                    fail("Failed to acquire lock for key: " + key);
+            }
+
+            return loaded;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void write(Cache.Entry<? extends Integer, ? extends Integer> entry) {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeAll(Collection<Cache.Entry<? extends Integer, ? extends Integer>> entries) {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void delete(Object key) {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void deleteAll(Collection<?> keys) {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void txEnd(boolean commit) {
+            // No-op.
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheLoadOnlyStoreAdapterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheLoadOnlyStoreAdapterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheLoadOnlyStoreAdapterSelfTest.java
new file mode 100644
index 0000000..38d2146
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheLoadOnlyStoreAdapterSelfTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.cache.store;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+import javax.cache.configuration.*;
+import java.util.*;
+
+/**
+ *
+ */
+public class IgniteCacheLoadOnlyStoreAdapterSelfTest extends IgniteCacheAbstractSelfTest {
+    /** Expected loadAll arguments, hardcoded on call site for convenience. */
+    private static final Integer[] EXP_ARGS = {1, 2, 3};
+
+    /** Test input size. */
+    private static final int INPUT_SIZE = 100;
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
+        CacheConfiguration cfg = super.cacheConfiguration(gridName);
+
+        cfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestStore()));
+        cfg.setReadThrough(true);
+        cfg.setWriteThrough(true);
+        cfg.setLoadPreviousValue(true);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testStore() throws Exception {
+        jcache().localLoadCache(null, 1, 2, 3);
+
+        int cnt = 0;
+
+        for (int i = 0; i < gridCount(); i++)
+            cnt += cache(i).size();
+
+        assertEquals(INPUT_SIZE - (INPUT_SIZE/10), cnt);
+    }
+
+    /**
+     *
+     */
+    private static class TestStore extends CacheLoadOnlyStoreAdapter<Integer, String, String> {
+        /** {@inheritDoc} */
+        @Override protected Iterator<String> inputIterator(@Nullable Object... args) {
+            assertNotNull(args);
+            assertTrue(Arrays.equals(EXP_ARGS, args));
+
+            return new Iterator<String>() {
+                private int i = -1;
+
+                @Override public boolean hasNext() {
+                    return i < INPUT_SIZE;
+                }
+
+                @Override public String next() {
+                    if (!hasNext())
+                        throw new NoSuchElementException();
+
+                    i++;
+
+                    return i + "=str" + i;
+                }
+
+                @Override public void remove() {
+                    // No-op.
+                }
+            };
+        }
+
+        /** {@inheritDoc} */
+        @Override protected IgniteBiTuple<Integer, String> parse(String rec, @Nullable Object... args) {
+            assertNotNull(args);
+            assertTrue(Arrays.equals(EXP_ARGS, args));
+
+            String[] p = rec.split("=");
+
+            int i = Integer.parseInt(p[0]);
+
+            return i % 10 == 0 ? null : new T2<>(i, p[1]);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java
deleted file mode 100644
index 691cf9d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.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.cache.store.jdbc;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.store.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.cache.*;
-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 org.apache.ignite.transactions.*;
-import org.jdk8.backport.*;
-
-import javax.cache.configuration.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-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.testframework.GridTestUtils.*;
-
-/**
- *
- */
-public class GridCacheJdbcBlobStoreMultithreadedSelfTest extends GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Number of grids to start. */
-    private static final int GRID_CNT = 5;
-
-    /** Number of transactions. */
-    private static final int TX_CNT = 1000;
-
-    /** Distribution mode. */
-    private CacheDistributionMode mode;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        mode = NEAR_PARTITIONED;
-
-        startGridsMultiThreaded(GRID_CNT - 2);
-
-        mode = NEAR_ONLY;
-
-        startGrid(GRID_CNT - 2);
-
-        mode = CLIENT_ONLY;
-
-        startGrid(GRID_CNT - 1);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@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(PARTITIONED);
-        cc.setWriteSynchronizationMode(FULL_SYNC);
-        cc.setSwapEnabled(false);
-        cc.setAtomicityMode(TRANSACTIONAL);
-        cc.setBackups(1);
-        cc.setDistributionMode(mode);
-
-        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 testMultithreadedPut() throws Exception {
-        IgniteInternalFuture<?> fut1 = runMultiThreadedAsync(new Callable<Object>() {
-            private final Random rnd = new Random();
-
-            @Override public Object call() throws Exception {
-                for (int i = 0; i < TX_CNT; i++) {
-                    GridCache<Integer, String> cache = cache(rnd.nextInt(GRID_CNT));
-
-                    cache.put(rnd.nextInt(1000), "value");
-                }
-
-                return null;
-            }
-        }, 4, "put");
-
-        IgniteInternalFuture<?> fut2 = runMultiThreadedAsync(new Callable<Object>() {
-            private final Random rnd = new Random();
-
-            @Override public Object call() throws Exception {
-                for (int i = 0; i < TX_CNT; i++) {
-                    GridCache<Integer, String> cache = cache(rnd.nextInt(GRID_CNT));
-
-                    cache.putIfAbsent(rnd.nextInt(1000), "value");
-                }
-
-                return null;
-            }
-        }, 4, "putIfAbsent");
-
-        fut1.get();
-        fut2.get();
-
-        checkOpenedClosedCount();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMultithreadedPutAll() throws Exception {
-        runMultiThreaded(new Callable<Object>() {
-            private final Random rnd = new Random();
-
-            @Override public Object call() throws Exception {
-                for (int i = 0; i < TX_CNT; i++) {
-                    Map<Integer, String> map = new TreeMap<>();
-
-                    for (int j = 0; j < 10; j++)
-                        map.put(rnd.nextInt(1000), "value");
-
-                    GridCache<Integer, String> cache = cache(rnd.nextInt(GRID_CNT));
-
-                    cache.putAll(map);
-                }
-
-                return null;
-            }
-        }, 8, "putAll");
-
-        checkOpenedClosedCount();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMultithreadedExplicitTx() throws Exception {
-        runMultiThreaded(new Callable<Object>() {
-            private final Random rnd = new Random();
-
-            @Override public Object call() throws Exception {
-                for (int i = 0; i < TX_CNT; i++) {
-                    GridCache<Integer, String> cache = cache(rnd.nextInt(GRID_CNT));
-
-                    try (IgniteTx tx = cache.txStart()) {
-                        cache.put(1, "value");
-                        cache.put(2, "value");
-                        cache.put(3, "value");
-
-                        cache.get(1);
-                        cache.get(4);
-
-                        Map<Integer, String> map = new TreeMap<>();
-
-                        map.put(5, "value");
-                        map.put(6, "value");
-
-                        cache.putAll(map);
-
-                        tx.commit();
-                    }
-                }
-
-                return null;
-            }
-        }, 8, "tx");
-
-        checkOpenedClosedCount();
-    }
-
-    /**
-     * @return New store.
-     * @throws Exception In case of error.
-     */
-    private CacheStore<Integer, String> store() throws Exception {
-        CacheStore<Integer, String> store = new CacheJdbcBlobStore<>();
-
-        Field f = store.getClass().getDeclaredField("testMode");
-
-        f.setAccessible(true);
-
-        f.set(store, true);
-
-        return store;
-    }
-
-    /**
-     *
-     */
-    private void checkOpenedClosedCount() {
-        assertEquals(GRID_CNT, Ignition.allGrids().size());
-
-        for (Ignite ignite : Ignition.allGrids()) {
-            GridCacheContext cctx = ((IgniteKernal)ignite).internalCache().context();
-
-            CacheStore store = cctx.store().configuredStore();
-
-            long opened = ((LongAdder)U.field(store, "opened")).sum();
-            long closed = ((LongAdder)U.field(store, "closed")).sum();
-
-            assert opened > 0;
-            assert closed > 0;
-
-            assertEquals(opened, closed);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreSelfTest.java
deleted file mode 100644
index 01b2081..0000000
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreSelfTest.java
+++ /dev/null
@@ -1,51 +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.cache.store.jdbc;
-
-import org.apache.ignite.testframework.junits.cache.*;
-
-import java.sql.*;
-
-/**
- * Cache store test.
- */
-public class GridCacheJdbcBlobStoreSelfTest
-    extends GridAbstractCacheStoreSelfTest<CacheJdbcBlobStore<Object, Object>> {
-    /**
-     * @throws Exception If failed.
-     */
-    public GridCacheJdbcBlobStoreSelfTest() throws Exception {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        try (Connection c = DriverManager.getConnection(CacheJdbcBlobStore.DFLT_CONN_URL, null, null)) {
-            try (Statement s = c.createStatement()) {
-                s.executeUpdate("drop table ENTRIES");
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheJdbcBlobStore<Object, Object> store() {
-        return new CacheJdbcBlobStore<>();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/IgniteCacheJdbcBlobStoreMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/IgniteCacheJdbcBlobStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/IgniteCacheJdbcBlobStoreMultithreadedSelfTest.java
new file mode 100644
index 0000000..7077c5f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/IgniteCacheJdbcBlobStoreMultithreadedSelfTest.java
@@ -0,0 +1,249 @@
+/*
+ * 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.cache.store.jdbc;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+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 org.apache.ignite.transactions.*;
+import org.jdk8.backport.*;
+
+import javax.cache.configuration.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+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.testframework.GridTestUtils.*;
+
+/**
+ *
+ */
+public class IgniteCacheJdbcBlobStoreMultithreadedSelfTest extends IgniteCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Number of grids to start. */
+    private static final int GRID_CNT = 5;
+
+    /** Number of transactions. */
+    private static final int TX_CNT = 1000;
+
+    /** Distribution mode. */
+    private CacheDistributionMode mode;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        mode = NEAR_PARTITIONED;
+
+        startIgnitesMultiThreaded(GRID_CNT - 2);
+
+        mode = NEAR_ONLY;
+
+        startIgnite(GRID_CNT - 2);
+
+        mode = CLIENT_ONLY;
+
+        startIgnite(GRID_CNT - 1);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllIgnites();
+    }
+
+    /** {@inheritDoc}
+     * @param igniteName*/
+    @SuppressWarnings("unchecked")
+    @Override protected final IgniteConfiguration getConfiguration(String igniteName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(igniteName);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        c.setDiscoverySpi(disco);
+
+        CacheConfiguration cc = defaultCacheConfiguration();
+
+        cc.setCacheMode(PARTITIONED);
+        cc.setWriteSynchronizationMode(FULL_SYNC);
+        cc.setSwapEnabled(false);
+        cc.setAtomicityMode(TRANSACTIONAL);
+        cc.setBackups(1);
+        cc.setDistributionMode(mode);
+
+        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 testMultithreadedPut() throws Exception {
+        IgniteInternalFuture<?> fut1 = runMultiThreadedAsync(new Callable<Object>() {
+            private final Random rnd = new Random();
+
+            @Override public Object call() throws Exception {
+                for (int i = 0; i < TX_CNT; i++) {
+                    GridCache<Integer, String> cache = cache(rnd.nextInt(GRID_CNT));
+
+                    cache.put(rnd.nextInt(1000), "value");
+                }
+
+                return null;
+            }
+        }, 4, "put");
+
+        IgniteInternalFuture<?> fut2 = runMultiThreadedAsync(new Callable<Object>() {
+            private final Random rnd = new Random();
+
+            @Override public Object call() throws Exception {
+                for (int i = 0; i < TX_CNT; i++) {
+                    GridCache<Integer, String> cache = cache(rnd.nextInt(GRID_CNT));
+
+                    cache.putIfAbsent(rnd.nextInt(1000), "value");
+                }
+
+                return null;
+            }
+        }, 4, "putIfAbsent");
+
+        fut1.get();
+        fut2.get();
+
+        checkOpenedClosedCount();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMultithreadedPutAll() throws Exception {
+        runMultiThreaded(new Callable<Object>() {
+            private final Random rnd = new Random();
+
+            @Override public Object call() throws Exception {
+                for (int i = 0; i < TX_CNT; i++) {
+                    Map<Integer, String> map = new TreeMap<>();
+
+                    for (int j = 0; j < 10; j++)
+                        map.put(rnd.nextInt(1000), "value");
+
+                    GridCache<Integer, String> cache = cache(rnd.nextInt(GRID_CNT));
+
+                    cache.putAll(map);
+                }
+
+                return null;
+            }
+        }, 8, "putAll");
+
+        checkOpenedClosedCount();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMultithreadedExplicitTx() throws Exception {
+        runMultiThreaded(new Callable<Object>() {
+            private final Random rnd = new Random();
+
+            @Override public Object call() throws Exception {
+                for (int i = 0; i < TX_CNT; i++) {
+                    GridCache<Integer, String> cache = cache(rnd.nextInt(GRID_CNT));
+
+                    try (IgniteTx tx = cache.txStart()) {
+                        cache.put(1, "value");
+                        cache.put(2, "value");
+                        cache.put(3, "value");
+
+                        cache.get(1);
+                        cache.get(4);
+
+                        Map<Integer, String> map = new TreeMap<>();
+
+                        map.put(5, "value");
+                        map.put(6, "value");
+
+                        cache.putAll(map);
+
+                        tx.commit();
+                    }
+                }
+
+                return null;
+            }
+        }, 8, "tx");
+
+        checkOpenedClosedCount();
+    }
+
+    /**
+     * @return New store.
+     * @throws Exception In case of error.
+     */
+    private CacheStore<Integer, String> store() throws Exception {
+        CacheStore<Integer, String> store = new CacheJdbcBlobStore<>();
+
+        Field f = store.getClass().getDeclaredField("testMode");
+
+        f.setAccessible(true);
+
+        f.set(store, true);
+
+        return store;
+    }
+
+    /**
+     *
+     */
+    private void checkOpenedClosedCount() {
+        assertEquals(GRID_CNT, Ignition.allGrids().size());
+
+        for (Ignite ignite : Ignition.allGrids()) {
+            GridCacheContext cctx = ((IgniteKernal)ignite).internalCache().context();
+
+            CacheStore store = cctx.store().configuredStore();
+
+            long opened = ((LongAdder)U.field(store, "opened")).sum();
+            long closed = ((LongAdder)U.field(store, "closed")).sum();
+
+            assert opened > 0;
+            assert closed > 0;
+
+            assertEquals(opened, closed);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/IgniteCacheJdbcBlobStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/IgniteCacheJdbcBlobStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/IgniteCacheJdbcBlobStoreSelfTest.java
new file mode 100644
index 0000000..d6bf1b6
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/IgniteCacheJdbcBlobStoreSelfTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.cache.store.jdbc;
+
+import org.apache.ignite.testframework.junits.cache.*;
+
+import java.sql.*;
+
+/**
+ * Cache store test.
+ */
+public class IgniteCacheJdbcBlobStoreSelfTest
+    extends IgniteAbstractCacheStoreSelfTest<CacheJdbcBlobStore<Object, Object>> {
+    /**
+     * @throws Exception If failed.
+     */
+    public IgniteCacheJdbcBlobStoreSelfTest() throws Exception {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        try (Connection c = DriverManager.getConnection(CacheJdbcBlobStore.DFLT_CONN_URL, null, null)) {
+            try (Statement s = c.createStatement()) {
+                s.executeUpdate("drop table ENTRIES");
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheJdbcBlobStore<Object, Object> store() {
+        return new CacheJdbcBlobStore<>();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java
deleted file mode 100644
index 0b2e8d5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java
+++ /dev/null
@@ -1,849 +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.fs;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.fs.*;
-import org.apache.ignite.internal.util.typedef.*;
-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.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-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.events.IgniteEventType.*;
-import static org.apache.ignite.testframework.GridTestUtils.*;
-
-/**
- * Tests events, generated by {@link IgniteFs} implementation.
- */
-public abstract class GridGgfsEventsAbstractSelfTest extends GridCommonAbstractTest {
-    /** GGFS. */
-    private static GridGgfsImpl ggfs;
-
-    /** Event listener. */
-    private IgnitePredicate<IgniteEvent> lsnr;
-
-    /**
-     * Gets cache configuration.
-     *
-     * @param gridName Grid name.
-     * @return Cache configuration.
-     */
-    @SuppressWarnings("deprecation")
-    protected CacheConfiguration[] getCacheConfiguration(String gridName) {
-        CacheConfiguration cacheCfg = defaultCacheConfiguration();
-
-        cacheCfg.setName("dataCache");
-        cacheCfg.setCacheMode(PARTITIONED);
-        cacheCfg.setDistributionMode(PARTITIONED_ONLY);
-        cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
-        cacheCfg.setEvictionPolicy(null);
-        cacheCfg.setAffinityMapper(new IgniteFsGroupDataBlocksKeyMapper(128));
-        cacheCfg.setBackups(0);
-        cacheCfg.setQueryIndexEnabled(false);
-        cacheCfg.setAtomicityMode(TRANSACTIONAL);
-
-        CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
-
-        metaCacheCfg.setName("metaCache");
-        metaCacheCfg.setCacheMode(REPLICATED);
-        metaCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
-        metaCacheCfg.setEvictionPolicy(null);
-        metaCacheCfg.setQueryIndexEnabled(false);
-        metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
-
-        return new CacheConfiguration[] {cacheCfg, metaCacheCfg};
-    }
-
-    /**
-     * @return GGFS configuration for this test.
-     */
-    protected IgniteFsConfiguration getGgfsConfiguration() throws IgniteCheckedException {
-        IgniteFsConfiguration ggfsCfg = new IgniteFsConfiguration();
-
-        ggfsCfg.setDataCacheName("dataCache");
-        ggfsCfg.setMetaCacheName("metaCache");
-        ggfsCfg.setName("ggfs");
-
-        ggfsCfg.setBlockSize(512 * 1024); // Together with group blocks mapper will yield 64M per node groups.
-
-        return ggfsCfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        return getConfiguration(gridName, getGgfsConfiguration());
-    }
-
-    /**
-     * The same as getConfiguration(String gridName) but it sets custom GGFS configuration
-     *
-     * @param gridName Grid name.
-     * @param ggfsCfg GGFS configuration.
-     * @return Grid configuration.
-     * @throws Exception If failed.
-     */
-    protected IgniteConfiguration getConfiguration(String gridName, IgniteFsConfiguration ggfsCfg) throws Exception {
-        IgniteConfiguration cfg = IgnitionEx.loadConfiguration("config/hadoop/default-config.xml").get1();
-
-        assert cfg != null;
-
-        cfg.setGridName(gridName);
-
-        cfg.setIncludeEventTypes(concat(EVTS_GGFS, EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED));
-
-        cfg.setGgfsConfiguration(ggfsCfg);
-
-        cfg.setCacheConfiguration(getCacheConfiguration(gridName));
-
-        cfg.setHadoopConfiguration(null);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        return cfg;
-    }
-
-    /**
-     * Concatenates elements to an int array.
-     *
-     * @param arr Array.
-     * @param obj One or more elements to concatenate.
-     * @return Concatenated array.
-     */
-    protected static int[] concat(@Nullable int[] arr, int... obj) {
-        int[] newArr;
-
-        if (arr == null || arr.length == 0)
-            newArr = obj;
-        else {
-            newArr = Arrays.copyOf(arr, arr.length + obj.length);
-
-            System.arraycopy(obj, 0, newArr, arr.length, obj.length);
-        }
-
-        return newArr;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        Ignite ignite = startGrid(1);
-
-        ggfs = (GridGgfsImpl) ignite.fileSystems().iterator().next();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        if (lsnr != null) {
-            grid(1).events().stopLocalListen(lsnr, EVTS_GGFS);
-
-            lsnr = null;
-        }
-
-        // Clean up file system.
-        ggfs.format();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopGrid(1);
-    }
-
-    /**
-     * Checks events on CRUD operations on a single file in nested directories.
-     *
-     * @throws Exception If failed.
-     */
-    public void testSingleFileNestedDirs() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 6 + 1 + 1;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        IgniteFsPath dir = new IgniteFsPath("/dir1/dir2/dir3");
-
-        IgniteFsPath file = new IgniteFsPath(dir, "file1");
-
-        // Will generate 3 EVT_GGFS_DIR_CREATED + EVT_GGFS_FILE_CREATED + EVT_GGFS_FILE_OPENED_WRITE +
-        // EVT_GGFS_FILE_CLOSED and a number of EVT_GGFS_META_UPDATED.
-        ggfs.create(file, true).close();
-
-        IgniteFsPath mvFile = new IgniteFsPath(dir, "mvFile1");
-
-        ggfs.rename(file, mvFile); // Will generate EVT_GGFS_FILE_RENAMED.
-
-        // Will generate EVT_GGFS_DIR_DELETED event.
-        assertTrue(ggfs.delete(dir.parent(), true));
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-        assertTrue(evt.isDirectory());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/dir3"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(3);
-        assertEquals(EVT_GGFS_FILE_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/dir3/file1"), evt.path());
-        assertFalse(evt.isDirectory());
-
-        evt = (IgniteFsEvent)evtList.get(4);
-        assertEquals(EVT_GGFS_FILE_OPENED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/dir3/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(5);
-        assertEquals(EVT_GGFS_FILE_CLOSED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/dir3/file1"), evt.path());
-        assertEquals(0, evt.dataSize());
-
-        evt = (IgniteFsEvent)evtList.get(6);
-        assertEquals(EVT_GGFS_FILE_RENAMED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/dir3/file1"), evt.path());
-        assertEquals(new IgniteFsPath("/dir1/dir2/dir3/mvFile1"), evt.newPath());
-
-        evt = (IgniteFsEvent)evtList.get(7);
-        assertEquals(EVT_GGFS_DIR_DELETED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2"), evt.path());
-    }
-
-    /**
-     * Checks events on CRUD operations on a single directory
-     * with some files.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDirWithFiles() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 4 + 3 + 1;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        IgniteFsPath dir = new IgniteFsPath("/dir1");
-
-        IgniteFsPath file1 = new IgniteFsPath(dir, "file1");
-        IgniteFsPath file2 = new IgniteFsPath(dir, "file2");
-
-        // Will generate EVT_GGFS_DIR_CREATED + EVT_GGFS_FILE_CREATED + EVT_GGFS_FILE_OPENED_WRITE +
-        // EVT_GGFS_FILE_CLOSED_WRITE.
-        ggfs.create(file1, true).close();
-
-        // Will generate EVT_GGFS_FILE_CREATED + EVT_GGFS_FILE_OPENED_WRITE +
-        // EVT_GGFS_FILE_CLOSED.
-        ggfs.create(file2, true).close();
-
-        // Will generate EVT_GGFS_DIR_DELETED event.
-        assertTrue(ggfs.delete(dir, true));
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-        assertTrue(evt.isDirectory());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_FILE_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file1"), evt.path());
-        assertFalse(evt.isDirectory());
-
-        evt = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_FILE_OPENED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(3);
-        assertEquals(EVT_GGFS_FILE_CLOSED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(4);
-        assertEquals(EVT_GGFS_FILE_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file2"), evt.path());
-        assertFalse(evt.isDirectory());
-
-        evt = (IgniteFsEvent)evtList.get(5);
-        assertEquals(EVT_GGFS_FILE_OPENED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file2"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(6);
-        assertEquals(EVT_GGFS_FILE_CLOSED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file2"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(7);
-        assertEquals(EVT_GGFS_DIR_DELETED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-    }
-
-    /**
-     * Checks events on CRUD operations on a single empty
-     * directory.
-     *
-     * @throws Exception If failed.
-     */
-    public void testSingleEmptyDir() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 1 + 1 + 0 + 1;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        IgniteFsPath dir = new IgniteFsPath("/dir1");
-
-        ggfs.mkdirs(dir); // Will generate EVT_GGFS_DIR_CREATED.
-
-        IgniteFsPath mvDir = new IgniteFsPath("/mvDir1");
-
-        ggfs.rename(dir, mvDir); // Will generate EVT_GGFS_DIR_RENAMED.
-
-        assertFalse(ggfs.delete(dir, true)); // Will generate no event.
-
-        assertTrue(ggfs.delete(mvDir, true)); // Will generate EVT_GGFS_DIR_DELETED events.
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-        assertTrue(evt.isDirectory());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_DIR_RENAMED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-        assertEquals(new IgniteFsPath("/mvDir1"), evt.newPath());
-        assertTrue(evt.isDirectory());
-
-        evt = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_DIR_DELETED, evt.type());
-        assertEquals(new IgniteFsPath("/mvDir1"), evt.path());
-        assertTrue(evt.isDirectory());
-    }
-
-    /**
-     * Checks events on CRUD operations on 2 files.
-     *
-     * @throws Exception If failed.
-     */
-    public void testTwoFiles() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 4 + 3 + 2 + 2;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        IgniteFsPath dir = new IgniteFsPath("/dir1");
-
-        IgniteFsPath file1 = new IgniteFsPath(dir, "file1");
-
-        // Will generate EVT_GGFS_FILE_CREATED event + EVT_GGFS_DIR_CREATED event + OPEN + CLOSE.
-        ggfs.create(file1, true).close();
-
-        IgniteFsPath file2 = new IgniteFsPath(dir, "file2");
-
-        ggfs.create(file2, true).close(); // Will generate 1 EVT_GGFS_FILE_CREATED event + OPEN + CLOSE.
-
-        assertTrue(ggfs.exists(dir));
-        assertTrue(ggfs.exists(file1));
-        assertTrue(ggfs.exists(file2));
-
-        assertTrue(ggfs.delete(file1, false)); // Will generate 1 EVT_GGFS_FILE_DELETED and 1 EVT_GGFS_FILE_PURGED.
-        assertTrue(ggfs.delete(file2, false)); // Same.
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-        assertTrue(evt.isDirectory());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_FILE_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_FILE_OPENED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(3);
-        assertEquals(EVT_GGFS_FILE_CLOSED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file1"), evt.path());
-        assertEquals(0, evt.dataSize());
-
-        evt = (IgniteFsEvent)evtList.get(4);
-        assertEquals(EVT_GGFS_FILE_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file2"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(5);
-        assertEquals(EVT_GGFS_FILE_OPENED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file2"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(6);
-        assertEquals(EVT_GGFS_FILE_CLOSED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/file2"), evt.path());
-        assertEquals(0, evt.dataSize());
-
-        assertOneToOne(
-            evtList.subList(7, 11),
-            new EventPredicate(EVT_GGFS_FILE_DELETED, new IgniteFsPath("/dir1/file1")),
-            new EventPredicate(EVT_GGFS_FILE_PURGED, new IgniteFsPath("/dir1/file1")),
-            new EventPredicate(EVT_GGFS_FILE_DELETED, new IgniteFsPath("/dir1/file2")),
-            new EventPredicate(EVT_GGFS_FILE_PURGED, new IgniteFsPath("/dir1/file2"))
-        );
-    }
-
-    /**
-     * Checks events on CRUD operations with non-recursive
-     * directory deletion.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDeleteNonRecursive() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 2 + 0 + 1;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        IgniteFsPath dir = new IgniteFsPath("/dir1/dir2");
-
-        ggfs.mkdirs(dir); // Will generate 2 EVT_GGFS_DIR_CREATED events.
-
-        try {
-            ggfs.delete(dir.parent(), false); // Will generate no events.
-        }
-        catch (IgniteException ignore) {
-            // No-op.
-        }
-
-        assertTrue(ggfs.delete(dir, false)); // Will generate 1 EVT_GGFS_DIR_DELETED event.
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2"), evt.path());
-
-        IgniteFsEvent evt3 = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_DIR_DELETED, evt3.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2"), evt3.path());
-    }
-
-    /**
-     * Checks events on CRUD operations on file move.
-     *
-     * @throws Exception If failed.
-     */
-    public void testMoveFile() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 5 + 1;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        IgniteFsPath dir = new IgniteFsPath("/dir1/dir2");
-
-        IgniteFsPath file = new IgniteFsPath(dir, "file1");
-
-        // Will generate 2 EVT_GGFS_DIR_CREATED events + EVT_GGFS_FILE_CREATED_EVENT + OPEN + CLOSE.
-        ggfs.create(file, true).close();
-
-        ggfs.rename(file, dir.parent()); // Will generate 1 EVT_GGFS_FILE_RENAMED.
-
-        assertTrue(ggfs.exists(new IgniteFsPath(dir.parent(), file.name())));
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_FILE_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(3);
-        assertEquals(EVT_GGFS_FILE_OPENED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(4);
-        assertEquals(EVT_GGFS_FILE_CLOSED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/file1"), evt.path());
-        assertEquals(0, evt.dataSize());
-
-        IgniteFsEvent evt4 = (IgniteFsEvent)evtList.get(5);
-        assertEquals(EVT_GGFS_FILE_RENAMED, evt4.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2/file1"), evt4.path());
-        assertEquals(new IgniteFsPath("/dir1/file1"), evt4.newPath());
-    }
-
-    /**
-     * Checks events on CRUD operations with multiple
-     * empty directories.
-     *
-     * @throws Exception If failed.
-     */
-    public void testNestedEmptyDirs() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 2 + 1;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        IgniteFsPath dir = new IgniteFsPath("/dir1/dir2");
-
-        assertFalse(ggfs.exists(dir.parent()));
-
-        ggfs.mkdirs(dir); // Will generate 2 EVT_GGFS_DIR_RENAMED events.
-
-        assertTrue(ggfs.delete(dir.parent(), true)); // Will generate EVT_GGFS_DIR_DELETED event.
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_DIR_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1/dir2"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_DIR_DELETED, evt.type());
-        assertEquals(new IgniteFsPath("/dir1"), evt.path());
-    }
-
-    /**
-     * Checks events on CRUD operations with single
-     * file overwrite.
-     *
-     * @throws Exception If failed.
-     */
-    public void testSingleFileOverwrite() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 3 + 4 + 1;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        final IgniteFsPath file = new IgniteFsPath("/file1");
-
-        ggfs.create(file, false).close(); // Will generate create, open and close events.
-
-        ggfs.create(file, true).close(); // Will generate same event set + delete and purge events.
-
-        try {
-            ggfs.create(file, false).close(); // Won't generate any event.
-        }
-        catch (Exception ignore) {
-            // No-op.
-        }
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        final IgniteFsPath file1 = new IgniteFsPath("/file1");
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_FILE_CREATED, evt.type());
-        assertEquals(file1, evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_FILE_OPENED_WRITE, evt.type());
-        assertEquals(file1, evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_FILE_CLOSED_WRITE, evt.type());
-        assertEquals(file1, evt.path());
-        assertEquals(0, evt.dataSize());
-
-        assertOneToOne(
-            evtList.subList(3, 8),
-            new P1<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent e) {
-                    IgniteFsEvent e0 = (IgniteFsEvent)e;
-
-                    return e0.type() == EVT_GGFS_FILE_DELETED && e0.path().equals(file1);
-                }
-            },
-            new P1<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent e) {
-                    IgniteFsEvent e0 = (IgniteFsEvent)e;
-
-                    return e0.type() == EVT_GGFS_FILE_PURGED && e0.path().equals(file1);
-                }
-            },
-            new P1<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent e) {
-                    IgniteFsEvent e0 = (IgniteFsEvent)e;
-
-                    return e0.type() == EVT_GGFS_FILE_CREATED && e0.path().equals(file1);
-                }
-            },
-            new P1<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent e) {
-                    IgniteFsEvent e0 = (IgniteFsEvent)e;
-
-                    return e0.type() == EVT_GGFS_FILE_OPENED_WRITE && e0.path().equals(file1);
-                }
-            },
-            new P1<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent e) {
-                    IgniteFsEvent e0 = (IgniteFsEvent)e;
-
-                    return e0.type() == EVT_GGFS_FILE_CLOSED_WRITE && e0.path().equals(file1);
-                }
-            }
-        );
-    }
-
-    /**
-     * Checks events on file data transfer operations.
-     *
-     * @throws Exception If failed.
-     */
-    public void testFileDataEvents() throws Exception {
-        final List<IgniteEvent> evtList = new ArrayList<>();
-
-        final int evtsCnt = 5;
-
-        final CountDownLatch latch = new CountDownLatch(evtsCnt);
-
-        grid(1).events().localListen(lsnr = new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                log.info("Received event [evt=" + evt + ']');
-
-                evtList.add(evt);
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVTS_GGFS);
-
-        final IgniteFsPath file = new IgniteFsPath("/file1");
-
-        final int dataSize = 1024;
-
-        byte[] buf = new byte[dataSize];
-
-        // Will generate GGFS_FILE_CREATED, GGFS_FILE_OPENED_WRITE, GGFS_FILE_CLOSED_WRITE.
-        try (IgniteFsOutputStream os = ggfs.create(file, false)) {
-            os.write(buf); // Will generate no events.
-        }
-
-        // Will generate EVT_GGFS_FILE_OPENED_READ, GGFS_FILE_CLOSED_READ.
-        try (IgniteFsInputStream is = ggfs.open(file, 256)) {
-            is.readFully(0, buf); // Will generate no events.
-        }
-
-        assertTrue(latch.await(10, TimeUnit.SECONDS));
-
-        assertEquals(evtsCnt, evtList.size());
-
-        IgniteFsEvent evt = (IgniteFsEvent)evtList.get(0);
-        assertEquals(EVT_GGFS_FILE_CREATED, evt.type());
-        assertEquals(new IgniteFsPath("/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(1);
-        assertEquals(EVT_GGFS_FILE_OPENED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(2);
-        assertEquals(EVT_GGFS_FILE_CLOSED_WRITE, evt.type());
-        assertEquals(new IgniteFsPath("/file1"), evt.path());
-        assertEquals((long)dataSize, evt.dataSize());
-
-        evt = (IgniteFsEvent)evtList.get(3);
-        assertEquals(EVT_GGFS_FILE_OPENED_READ, evt.type());
-        assertEquals(new IgniteFsPath("/file1"), evt.path());
-
-        evt = (IgniteFsEvent)evtList.get(4);
-        assertEquals(EVT_GGFS_FILE_CLOSED_READ, evt.type());
-        assertEquals(new IgniteFsPath("/file1"), evt.path());
-        assertEquals((long)dataSize, evt.dataSize());
-    }
-
-    /**
-     * Predicate for matching {@link org.apache.ignite.events.IgniteFsEvent}.
-     */
-    private static class EventPredicate implements IgnitePredicate<IgniteEvent> {
-        /** */
-        private final int evt;
-
-        /** */
-        private final IgniteFsPath path;
-
-        /**
-         * @param evt Event type.
-         * @param path GGFS path.
-         */
-        EventPredicate(int evt, IgniteFsPath path) {
-
-            this.evt = evt;
-            this.path = path;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean apply(IgniteEvent e) {
-            IgniteFsEvent e0 = (IgniteFsEvent)e;
-
-            return e0.type() == evt && e0.path().equals(path);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerAbstractSelfTest.java
deleted file mode 100644
index 61cf721..0000000
--- a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerAbstractSelfTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.fs;
-
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.processors.fs.*;
-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.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.cache.CacheMode.*;
-
-/**
- * Fragmentizer abstract self test.
- */
-public class GridGgfsFragmentizerAbstractSelfTest extends GridGgfsCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Test nodes count. */
-    protected static final int NODE_CNT = 4;
-
-    /** GGFS block size. */
-    protected static final int GGFS_BLOCK_SIZE = 1024;
-
-    /** GGFS group size. */
-    protected static final int GGFS_GROUP_SIZE = 32;
-
-    /** Metadata cache name. */
-    private static final String META_CACHE_NAME = "meta";
-
-    /** File data cache name. */
-    protected static final String DATA_CACHE_NAME = "data";
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        cfg.setCacheConfiguration(metaConfiguration(), dataConfiguration());
-
-        IgniteFsConfiguration ggfsCfg = new IgniteFsConfiguration();
-
-        ggfsCfg.setName("ggfs");
-        ggfsCfg.setMetaCacheName(META_CACHE_NAME);
-        ggfsCfg.setDataCacheName(DATA_CACHE_NAME);
-        ggfsCfg.setBlockSize(GGFS_BLOCK_SIZE);
-
-        // Need to set this to avoid thread starvation.
-        ggfsCfg.setPerNodeParallelBatchCount(8);
-
-        ggfsCfg.setFragmentizerThrottlingBlockLength(16 * GGFS_BLOCK_SIZE);
-        ggfsCfg.setFragmentizerThrottlingDelay(10);
-
-        cfg.setGgfsConfiguration(ggfsCfg);
-
-        return cfg;
-    }
-
-    /**
-     * Gets meta cache configuration.
-     *
-     * @return Meta cache configuration.
-     */
-    protected CacheConfiguration metaConfiguration() {
-        CacheConfiguration cfg = defaultCacheConfiguration();
-
-        cfg.setName(META_CACHE_NAME);
-
-        cfg.setCacheMode(REPLICATED);
-        cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-        cfg.setQueryIndexEnabled(false);
-        cfg.setAtomicityMode(TRANSACTIONAL);
-
-        return cfg;
-    }
-
-    /**
-     * Gets data cache configuration.
-     *
-     * @return Data cache configuration.
-     */
-    protected CacheConfiguration dataConfiguration() {
-        CacheConfiguration cfg = defaultCacheConfiguration();
-
-        cfg.setName(DATA_CACHE_NAME);
-
-        cfg.setCacheMode(PARTITIONED);
-        cfg.setBackups(0);
-        cfg.setAffinityMapper(new IgniteFsGroupDataBlocksKeyMapper(GGFS_GROUP_SIZE));
-        cfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY);
-        cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-        cfg.setQueryIndexEnabled(false);
-        cfg.setAtomicityMode(TRANSACTIONAL);
-
-        return cfg;
-    }
-
-    /**
-     * @param gridIdx Grid index.
-     * @param path Path to await.
-     * @throws Exception If failed.
-     */
-    protected void awaitFileFragmenting(int gridIdx, IgniteFsPath path) throws Exception {
-        GridGgfsEx ggfs = (GridGgfsEx)grid(gridIdx).fileSystem("ggfs");
-
-        GridGgfsMetaManager meta = ggfs.context().meta();
-
-        IgniteUuid fileId = meta.fileId(path);
-
-        if (fileId == null)
-            throw new IgniteFsFileNotFoundException("File not found: " + path);
-
-        GridGgfsFileInfo fileInfo = meta.info(fileId);
-
-        do {
-            if (fileInfo == null)
-                throw new IgniteFsFileNotFoundException("File not found: " + path);
-
-            if (fileInfo.fileMap().ranges().isEmpty())
-                return;
-
-            U.sleep(100);
-
-            fileInfo = meta.info(fileId);
-        }
-        while (true);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrids(NODE_CNT);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        grid(0).fileSystem("ggfs").format();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerSelfTest.java
deleted file mode 100644
index 0756be1..0000000
--- a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerSelfTest.java
+++ /dev/null
@@ -1,268 +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.fs;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.fs.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.testframework.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Tests fragmentizer work.
- */
-public class GridGgfsFragmentizerSelfTest extends GridGgfsFragmentizerAbstractSelfTest {
-    /**
-     * @throws Exception If failed.
-     */
-    public void testReadFragmentizing() throws Exception {
-        IgniteFs ggfs = grid(0).fileSystem("ggfs");
-
-        IgniteFsPath path = new IgniteFsPath("/someFile");
-
-        try (IgniteFsOutputStream out = ggfs.create(path, true)) {
-            // Write 10 groups.
-            for (int i = 0; i < 10 * GGFS_GROUP_SIZE; i++) {
-                byte[] data = new byte[GGFS_BLOCK_SIZE];
-
-                Arrays.fill(data, (byte)i);
-
-                out.write(data);
-            }
-        }
-
-        long start = System.currentTimeMillis();
-
-        do {
-            try (IgniteFsInputStream in = ggfs.open(path)) {
-                for (int i = 0; i < 10 * GGFS_GROUP_SIZE; i++) {
-                    for (int j = 0; j < GGFS_BLOCK_SIZE; j++)
-                        assertEquals(i & 0xFF, in.read());
-                }
-
-                assertEquals(-1, in.read());
-            }
-        }
-        while (System.currentTimeMillis() - start < 7000);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAppendFragmentizing() throws Exception {
-        checkAppendFragmentizing(GGFS_BLOCK_SIZE / 4, false);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAppendFragmentizingAligned() throws Exception {
-        checkAppendFragmentizing(GGFS_BLOCK_SIZE, false);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAppendFragmentizingDifferentNodes() throws Exception {
-        checkAppendFragmentizing(GGFS_BLOCK_SIZE / 4, true);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAppendFragmentizingAlignedDifferentNodes() throws Exception {
-        checkAppendFragmentizing(GGFS_BLOCK_SIZE, true);
-    }
-
-    /**
-    * @throws Exception If failed.
-    */
-    private void checkAppendFragmentizing(int chunkSize, boolean rotate) throws Exception {
-        IgniteFsPath path = new IgniteFsPath("/someFile");
-
-        long written = 0;
-
-        int i = 0;
-        int ggfsIdx = 0;
-
-        int fileSize = 30 * GGFS_GROUP_SIZE * GGFS_BLOCK_SIZE;
-
-        while (written < fileSize) {
-            IgniteFs ggfs = grid(ggfsIdx).fileSystem("ggfs");
-
-            try (IgniteFsOutputStream out = ggfs.append(path, true)) {
-                byte[] data = new byte[chunkSize];
-
-                Arrays.fill(data, (byte)i);
-
-                out.write(data);
-            }
-
-            System.out.println("Written [start=" + written + ", filler=" + i + ']');
-
-            written += chunkSize;
-            i++;
-
-            if (rotate && i % 5 == 0) {
-                ggfsIdx++;
-
-                if (ggfsIdx >= NODE_CNT)
-                    ggfsIdx = 0;
-            }
-        }
-
-        IgniteFs ggfs = grid(0).fileSystem("ggfs");
-
-        try (IgniteFsInputStream in = ggfs.open(path)) {
-            i = 0;
-
-            int read = 0;
-
-            byte[] chunk = new byte[chunkSize];
-
-            while (read < fileSize) {
-                readFully(in, chunk);
-
-                for (byte b : chunk)
-                    assertEquals("For read offset [start=" + read + ", filler=" + (i & 0xFF) + ']',
-                        i & 0xFF, b & 0xFF);
-
-                i++;
-
-                read += chunkSize;
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFlushFragmentizing() throws Exception {
-        checkFlushFragmentizing(GGFS_BLOCK_SIZE / 4);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFlushFragmentizingAligned() throws Exception {
-        checkFlushFragmentizing(GGFS_BLOCK_SIZE);
-    }
-
-    /**
-     * @param chunkSize Chunk size to test.
-     * @throws Exception If failed.
-     */
-    private void checkFlushFragmentizing(int chunkSize) throws Exception {
-        IgniteFsPath path = new IgniteFsPath("/someFile");
-
-        long written = 0;
-        int cnt = 0;
-
-        int fileSize = 50 * GGFS_GROUP_SIZE * GGFS_BLOCK_SIZE;
-
-        IgniteFs ggfs = grid(0).fileSystem("ggfs");
-
-        byte[] chunk = new byte[chunkSize];
-
-        while (written < fileSize) {
-            try (IgniteFsOutputStream out = ggfs.append(path, true)) {
-                for (int i = 0; i < 8; i++) {
-                    Arrays.fill(chunk, (byte)cnt);
-
-                    out.write(chunk);
-
-                    out.flush();
-
-                    written += chunkSize;
-
-                    cnt++;
-                }
-            }
-        }
-
-        try (IgniteFsInputStream in = ggfs.open(path)) {
-            cnt = 0;
-
-            int read = 0;
-
-            while (read < fileSize) {
-                readFully(in, chunk);
-
-                for (byte b : chunk)
-                    assertEquals("For read offset [start=" + read + ", filler=" + (cnt & 0xFF) + ']',
-                        cnt & 0xFF, b & 0xFF);
-
-                cnt++;
-
-                read += chunkSize;
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDeleteFragmentizing() throws Exception {
-        GridGgfsImpl ggfs = (GridGgfsImpl)grid(0).fileSystem("ggfs");
-
-        for (int i = 0; i < 30; i++) {
-            IgniteFsPath path = new IgniteFsPath("/someFile" + i);
-
-            try (IgniteFsOutputStream out = ggfs.create(path, true)) {
-                for (int j = 0; j < 5 * GGFS_GROUP_SIZE; j++)
-                    out.write(new byte[GGFS_BLOCK_SIZE]);
-            }
-
-            U.sleep(200);
-        }
-
-        ggfs.delete(new IgniteFsPath("/"), true);
-
-        ggfs.awaitDeletesAsync().get();
-
-        GridTestUtils.retryAssert(log, 50, 100, new CA() {
-            @Override public void apply() {
-                for (int i = 0; i < NODE_CNT; i++) {
-                    IgniteEx g = grid(i);
-
-                    GridCache<Object, Object> cache = g.cachex(DATA_CACHE_NAME);
-
-                    assertTrue("Data cache is not empty [keys=" + cache.keySet() +
-                        ", node=" + g.localNode().id() + ']', cache.isEmpty());
-                }
-            }
-        });
-    }
-
-    /**
-     * @param in Input stream to read from.
-     * @param data Byte array to read to.
-     * @throws IOException If read failed.
-     */
-    private static void readFully(InputStream in, byte[] data) throws IOException {
-        int read = 0;
-
-        while(read < data.length)
-            read += in.read(data, read, data.length - read);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerTopologySelfTest.java
deleted file mode 100644
index 67e5685..0000000
--- a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsFragmentizerTopologySelfTest.java
+++ /dev/null
@@ -1,49 +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.fs;
-
-import org.apache.ignite.*;
-
-/**
- * Tests coordinator transfer from one node to other.
- */
-public class GridGgfsFragmentizerTopologySelfTest extends GridGgfsFragmentizerAbstractSelfTest {
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCoordinatorLeave() throws Exception {
-        stopGrid(0);
-
-        // Now node 1 should be coordinator.
-        try {
-            IgniteFsPath path = new IgniteFsPath("/someFile");
-
-            IgniteFs ggfs = grid(1).fileSystem("ggfs");
-
-            try (IgniteFsOutputStream out = ggfs.create(path, true)) {
-                for (int i = 0; i < 10 * GGFS_GROUP_SIZE; i++)
-                    out.write(new byte[GGFS_BLOCK_SIZE]);
-            }
-
-            awaitFileFragmenting(1, path);
-        }
-        finally {
-            startGrid(0);
-        }
-    }
-}


Mime
View raw message