You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/05/06 14:16:12 UTC

[03/12] incubator-ignite git commit: #ignite-841: add tests

#ignite-841: add tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d6145c9f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d6145c9f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d6145c9f

Branch: refs/heads/ignite-841
Commit: d6145c9f2d1d004a8fdd9df4349ca048c1d0a3ce
Parents: 2d2fd56
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue May 5 23:26:11 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue May 5 23:26:11 2015 +0300

----------------------------------------------------------------------
 .../igfs/IgfsClientCacheSelfTest.java           | 62 +++++++++++++-------
 1 file changed, 41 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6145c9f/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java
index 8e85d24..9a4043d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java
@@ -17,13 +17,15 @@
 
 package org.apache.ignite.internal.processors.igfs;
 
+import org.apache.ignite.Ignite;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.igfs.*;
+import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
+import org.apache.ignite.internal.util.typedef.G;
 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 static org.apache.ignite.cache.CacheAtomicityMode.*;
 import static org.apache.ignite.cache.CacheMode.*;
@@ -31,7 +33,7 @@ import static org.apache.ignite.cache.CacheMode.*;
 /**
  * Test for igfs with incorrect configuration.
  */
-public class IgfsClientCacheSelfTest  extends GridCommonAbstractTest {
+public class IgfsClientCacheSelfTest  extends IgfsAbstractSelfTest {
     /** */
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
@@ -44,8 +46,40 @@ public class IgfsClientCacheSelfTest  extends GridCommonAbstractTest {
     /** Regular cache name. */
     private static final String CACHE_NAME = "cache";
 
+    /**
+     * Constructor.
+     */
+    public IgfsClientCacheSelfTest() {
+        super(IgfsMode.PRIMARY);
+    }
+
     /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+    @Override protected void beforeTestsStarted() throws Exception {
+        igfsSecondaryFileSystem = createSecondaryFileSystemStack();
+
+        Ignite ignite1 = G.start(getConfiguration(getTestGridName(1)));
+
+        igfs = (IgfsImpl) ignite1.fileSystem("igfs");
+    }
+
+    /**{@inheritDoc} */
+    protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception {
+        Ignite igniteSecondary = G.start(getConfiguration(getTestGridName(0)));
+
+        IgfsEx secondaryIgfsImpl = (IgfsEx) igniteSecondary.fileSystem("igfs");
+
+        igfsSecondary = new IgfsExUniversalFileSystemAdapter(secondaryIgfsImpl);
+
+        return secondaryIgfsImpl.asSecondary();
+    }
+
+    /**
+     *
+     * @param gridName Grid name.
+     * @return Ignite configuration.
+     * @throws Exception If failed.
+     */
+    protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
         cfg.setCacheConfiguration(cacheConfiguration(META_CACHE_NAME), cacheConfiguration(DATA_CACHE_NAME),
@@ -71,7 +105,10 @@ public class IgfsClientCacheSelfTest  extends GridCommonAbstractTest {
         return cfg;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * @param cacheName Cache name.
+     * @return Cache configuration.
+     */
     protected CacheConfiguration cacheConfiguration(String cacheName) {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
 
@@ -92,21 +129,4 @@ public class IgfsClientCacheSelfTest  extends GridCommonAbstractTest {
 
         return cacheCfg;
     }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStartIgfs() throws Exception {
-        startGrids(2);
-    }
 }