IGNITE-3524 IGFS: Null file system names are no longer allowed. This closes 
#1789.


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

Branch: refs/heads/ignite-4535
Commit: 1a9b38df5eb083c1b03fe1ba381587594f6e79f7
Parents: 3ab6e48
Author: tledkov-gridgain <tled...@gridgain.com>
Authored: Wed Apr 19 15:39:26 2017 +0300
Committer: devozerov <voze...@gridgain.com>
Committed: Wed Apr 19 15:39:26 2017 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/IgniteFileSystem.java     |   2 +-
 .../configuration/FileSystemConfiguration.java  |   8 +-
 .../org/apache/ignite/internal/IgniteEx.java    |   2 +-
 .../apache/ignite/internal/IgniteKernal.java    |   8 +-
 .../internal/processors/igfs/IgfsAsyncImpl.java |   2 +-
 .../internal/processors/igfs/IgfsImpl.java      |   2 +-
 .../processors/igfs/IgfsNoopProcessor.java      |   4 +-
 .../internal/processors/igfs/IgfsProcessor.java |  30 ++---
 .../processors/igfs/IgfsProcessorAdapter.java   |   4 +-
 .../internal/processors/igfs/IgfsUtils.java     |   3 +
 ...lockMessageSystemPoolStarvationSelfTest.java |   8 +-
 .../processors/igfs/IgfsIgniteMock.java         |   2 +-
 .../igfs/IgfsProcessorValidationSelfTest.java   |  19 ++-
 .../junits/multijvm/IgniteProcessProxy.java     |   2 +-
 .../hadoop/igfs/HadoopIgfsEndpoint.java         |   6 +-
 .../hadoop/impl/HadoopAbstractSelfTest.java     |   4 +-
 .../impl/HadoopTaskExecutionSelfTest.java       |  16 +--
 ...opClientProtocolMultipleServersSelfTest.java |   8 +-
 .../client/HadoopClientProtocolSelfTest.java    |   7 +-
 ...IgniteHadoopFileSystemHandshakeSelfTest.java | 119 +------------------
 20 files changed, 90 insertions(+), 166 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java 
b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
index 0100c7b..9c3f9dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
@@ -74,7 +74,7 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
     /**
      * Gets IGFS name.
      *
-     * @return IGFS name, or {@code null} for default file system.
+     * @return IGFS name.
      */
     public String name();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
 
b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
index d667fe8..af5be3c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
@@ -202,12 +202,11 @@ public class FileSystemConfiguration {
     }
 
     /**
-     * Gets IGFS instance name. If {@code null}, then instance with default
-     * name will be used.
+     * Gets IGFS instance name.
      *
      * @return IGFS instance name.
      */
-    @Nullable public String getName() {
+    public String getName() {
         return name;
     }
 
@@ -218,6 +217,9 @@ public class FileSystemConfiguration {
      * @return {@code this} for chaining.
      */
     public FileSystemConfiguration setName(String name) {
+        if (name == null)
+            throw new IllegalArgumentException("IGFS name cannot be null");
+
         this.name = name;
 
         return this;

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index e3859c5..164839e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -108,7 +108,7 @@ public interface IgniteEx extends Ignite {
      * @param name IGFS name.
      * @return IGFS.
      */
-    @Nullable public IgniteFileSystem igfsx(@Nullable String name);
+    @Nullable public IgniteFileSystem igfsx(String name);
 
     /**
      * Get Hadoop facade.

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 922dd55..50f39fa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -3221,6 +3221,9 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @Override public IgniteFileSystem fileSystem(String name) {
+        if (name == null)
+            throw new IllegalArgumentException("IGFS name cannot be null");
+
         guard();
 
         try {
@@ -3239,7 +3242,10 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public IgniteFileSystem igfsx(@Nullable String name) {
+    @Nullable @Override public IgniteFileSystem igfsx(String name) {
+        if (name == null)
+            throw new IllegalArgumentException("IGFS name cannot be null");
+
         guard();
 
         try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
index c4e2fe7..4df6f59 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
@@ -215,7 +215,7 @@ public class IgfsAsyncImpl extends 
AsyncSupportAdapter<IgniteFileSystem> impleme
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public String name() {
+    @Override public String name() {
         return igfs.name();
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 6a7400c..2057c71 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -391,7 +391,7 @@ public final class IgfsImpl implements IgfsEx {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public String name() {
+    @Override public String name() {
         return cfg.getName();
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsNoopProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsNoopProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsNoopProcessor.java
index 68bb1bc..2dfac90 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsNoopProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsNoopProcessor.java
@@ -55,12 +55,12 @@ public class IgfsNoopProcessor extends IgfsProcessorAdapter 
{
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public IgniteFileSystem igfs(@Nullable String name) {
+    @Nullable @Override public IgniteFileSystem igfs(String name) {
         return null;
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<IpcServerEndpoint> endpoints(@Nullable String 
name) {
+    @Override public Collection<IpcServerEndpoint> endpoints(String name) {
         return Collections.emptyList();
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index 57ae7c6..d848d2f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
@@ -57,9 +56,6 @@ import static 
org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGFS;
  * Fully operational Ignite file system processor.
  */
 public class IgfsProcessor extends IgfsProcessorAdapter {
-    /** Null IGFS name. */
-    private static final String NULL_NAME = UUID.randomUUID().toString();
-
     /** Converts context to IGFS. */
     private static final IgniteClosure<IgfsContext,IgniteFileSystem> 
CTX_TO_IGFS = new C1<IgfsContext, IgniteFileSystem>() {
         @Override public IgniteFileSystem apply(IgfsContext igfsCtx) {
@@ -91,6 +87,8 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
 
         // Start IGFS instances.
         for (FileSystemConfiguration cfg : cfgs) {
+            assert cfg.getName() != null;
+
             FileSystemConfiguration cfg0 = new FileSystemConfiguration(cfg);
 
             boolean metaClient = true;
@@ -124,7 +122,7 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
             for (IgfsManager mgr : igfsCtx.managers())
                 mgr.start(igfsCtx);
 
-            igfsCache.put(maskName(cfg0.getName()), igfsCtx);
+            igfsCache.put(cfg0.getName(), igfsCtx);
         }
 
         if (log.isDebugEnabled())
@@ -250,15 +248,21 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public IgniteFileSystem igfs(@Nullable String name) {
-        IgfsContext igfsCtx = igfsCache.get(maskName(name));
+    @Override @Nullable public IgniteFileSystem igfs(String name) {
+        if (name == null)
+            throw new IllegalArgumentException("IGFS name cannot be null");
+
+        IgfsContext igfsCtx = igfsCache.get(name);
 
         return igfsCtx == null ? null : igfsCtx.igfs();
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public Collection<IpcServerEndpoint> 
endpoints(@Nullable String name) {
-        IgfsContext igfsCtx = igfsCache.get(maskName(name));
+    @Override @Nullable public Collection<IpcServerEndpoint> endpoints(String 
name) {
+        if (name == null)
+            throw new IllegalArgumentException("IGFS name cannot be null");
+
+        IgfsContext igfsCtx = igfsCache.get(name);
 
         return igfsCtx == null ? Collections.<IpcServerEndpoint>emptyList() : 
igfsCtx.server().endpoints();
     }
@@ -270,14 +274,6 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
     }
 
     /**
-     * @param name Cache name.
-     * @return Masked name accounting for {@code nulls}.
-     */
-    private String maskName(@Nullable String name) {
-        return name == null ? NULL_NAME : name;
-    }
-
-    /**
      * Check IGFS config on remote node.
      *
      * @param rmtNode Remote node.

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorAdapter.java
index 6648c7f..8b7f662 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorAdapter.java
@@ -54,7 +54,7 @@ public abstract class IgfsProcessorAdapter extends 
GridProcessorAdapter {
      * @param name (Nullable) IGFS name.
      * @return IGFS instance.
      */
-    @Nullable public abstract IgniteFileSystem igfs(@Nullable String name);
+    @Nullable public abstract IgniteFileSystem igfs(String name);
 
     /**
      * Gets server endpoints for particular IGFS.
@@ -62,7 +62,7 @@ public abstract class IgfsProcessorAdapter extends 
GridProcessorAdapter {
      * @param name IGFS name.
      * @return Collection of endpoints or {@code null} in case IGFS is not 
defined.
      */
-    public abstract Collection<IpcServerEndpoint> endpoints(@Nullable String 
name);
+    public abstract Collection<IpcServerEndpoint> endpoints(String name);
 
     /**
      * Create compute job for the given IGFS job.

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index bb11b7f..832f68d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -466,6 +466,9 @@ public class IgfsUtils {
         for (FileSystemConfiguration cfg : 
igniteCfg.getFileSystemConfiguration()) {
             String name = cfg.getName();
 
+            if (name == null)
+                throw new IgniteCheckedException("IGFS name cannot be null");
+
             if (cfgNames.contains(name))
                 throw new IgniteCheckedException("Duplicate IGFS name found 
(check configuration and " +
                     "assign unique name to each): " + name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
index 16596ed..e6bdc8e 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
@@ -57,6 +57,9 @@ public class IgfsBlockMessageSystemPoolStarvationSelfTest 
extends IgfsCommonAbst
     /** Second node name. */
     private static final String NODE_2_NAME = "node2";
 
+    /** IGFS name. */
+    private static final String IGFS_NAME = "test";
+
     /** Key in data caceh we will use to reproduce the issue. */
     private static final Integer DATA_KEY = 1;
 
@@ -183,7 +186,7 @@ public class IgfsBlockMessageSystemPoolStarvationSelfTest 
extends IgfsCommonAbst
     private IgniteInternalFuture<Void> createFileAsync(final IgfsPath path, 
final CountDownLatch writeStartLatch) {
         return GridTestUtils.runAsync(new Callable<Void>() {
             @Override public Void call() throws Exception {
-                IgniteFileSystem igfs = attacker.fileSystem(null);
+                IgniteFileSystem igfs = attacker.fileSystem(IGFS_NAME);
 
                 try (IgfsOutputStream out = igfs.create(path, true)) {
                     writeStartLatch.await();
@@ -206,7 +209,7 @@ public class IgfsBlockMessageSystemPoolStarvationSelfTest 
extends IgfsCommonAbst
      * @throws Exception If failed.
      */
     private GridCacheAdapter dataCache(Ignite node) throws Exception  {
-        return 
((IgniteKernal)node).internalCache(((IgniteKernal)node).igfsx(null).configuration()
+        return 
((IgniteKernal)node).internalCache(((IgniteKernal)node).igfsx(IGFS_NAME).configuration()
             .getDataCacheConfiguration().getName());
     }
 
@@ -243,6 +246,7 @@ public class IgfsBlockMessageSystemPoolStarvationSelfTest 
extends IgfsCommonAbst
         igfsCfg.setBlockSize(1024);
         igfsCfg.setDataCacheConfiguration(dataCcfg);
         igfsCfg.setMetaCacheConfiguration(metaCcfg);
+        igfsCfg.setName(IGFS_NAME);
 
         // Ignite configuration.
         IgniteConfiguration cfg = getConfiguration(name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
index cb988e3..e4faa41 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
@@ -142,7 +142,7 @@ public class IgfsIgniteMock implements IgniteEx {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public IgniteFileSystem igfsx(@Nullable String name) {
+    @Nullable @Override public IgniteFileSystem igfsx(String name) {
         return F.eq(name, igfs.name()) ? igfs : null;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
index 001696a..7484c59 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
@@ -164,10 +164,23 @@ public class IgfsProcessorValidationSelfTest extends 
IgfsCommonAbstractTest {
      * @throws Exception If failed.
      */
     @SuppressWarnings("NullableProblems")
-    public void testLocalNullIgfsNameIsSupported() throws Exception {
-        g1IgfsCfg1.setName(null);
+    public void testLocalNullIgfsNameIsNotSupported() throws Exception {
+        try {
+            g1IgfsCfg1.setName(null);
+
+            fail("IGFS name cannot be null");
+        }
+        catch (IllegalArgumentException e) {
+            // No-op.
+        }
+
+        ArrayList<FileSystemConfiguration> fsCfgs = new 
ArrayList<>(Arrays.asList(g1Cfg.getFileSystemConfiguration()));
+
+        fsCfgs.add(new FileSystemConfiguration()); // IGFS doesn't have 
default name (name == null).
+
+        g1Cfg.setFileSystemConfiguration(fsCfgs.toArray(new 
FileSystemConfiguration[fsCfgs.size()]));
 
-        assertFalse(G.start(g1Cfg).cluster().nodes().isEmpty());
+        checkGridStartFails(g1Cfg, "IGFS name cannot be null", true);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index ca65890..dc76852 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -387,7 +387,7 @@ public class IgniteProcessProxy implements IgniteEx {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public IgniteFileSystem igfsx(@Nullable String name) {
+    @Nullable @Override public IgniteFileSystem igfsx(String name) {
         throw new UnsupportedOperationException("Operation isn't supported 
yet.");
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsEndpoint.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsEndpoint.java
 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsEndpoint.java
index c0751fa..b29dcb7 100644
--- 
a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsEndpoint.java
+++ 
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsEndpoint.java
@@ -123,6 +123,10 @@ public class HadoopIgfsEndpoint {
         else
             throw new IgniteCheckedException("Invalid connection string 
format: " + connStr);
 
+        if (igfsName == null)
+            throw new IgniteCheckedException("Invalid connection string format 
(IGFS name cannot be empty): "
+                + connStr);
+
         host = hostPort.get1();
 
         assert hostPort.get2() != null;
@@ -172,7 +176,7 @@ public class HadoopIgfsEndpoint {
     /**
      * @return IGFS name.
      */
-    @Nullable public String igfs() {
+    public String igfs() {
         return igfsName;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
index bf17d05..eb8caa2 100644
--- 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
+++ 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
@@ -51,7 +51,7 @@ public abstract class HadoopAbstractSelfTest extends 
GridCommonAbstractTest {
     protected static final int REST_PORT = 
ConnectorConfiguration.DFLT_TCP_PORT;
 
     /** IGFS name. */
-    protected static final String igfsName = null;
+    protected static final String igfsName = "test";
 
     /** IGFS block size. */
     protected static final int igfsBlockSize = 1024;
@@ -236,6 +236,6 @@ public abstract class HadoopAbstractSelfTest extends 
GridCommonAbstractTest {
      * @return IGFS scheme for test.
      */
     protected String igfsScheme() {
-        return "igfs://@/";
+        return "igfs://" + igfsName + "@/";
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
index f25d78a..c27a67f 100644
--- 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
+++ 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
@@ -137,8 +137,8 @@ public class HadoopTaskExecutionSelfTest extends 
HadoopAbstractSelfTest {
 
         job.setInputFormatClass(TextInputFormat.class);
 
-        FileInputFormat.setInputPaths(job, new Path("igfs://@/"));
-        FileOutputFormat.setOutputPath(job, new Path("igfs://@/output/"));
+        FileInputFormat.setInputPaths(job, new Path("igfs://" + igfsName + 
"@/"));
+        FileOutputFormat.setOutputPath(job, new Path("igfs://" + igfsName  + 
"@/output/"));
 
         job.setJarByClass(getClass());
 
@@ -181,8 +181,8 @@ public class HadoopTaskExecutionSelfTest extends 
HadoopAbstractSelfTest {
 
         job.setInputFormatClass(TextInputFormat.class);
 
-        FileInputFormat.setInputPaths(job, new Path("igfs://@/"));
-        FileOutputFormat.setOutputPath(job, new Path("igfs://@/output"));
+        FileInputFormat.setInputPaths(job, new Path("igfs://" + igfsName + 
"@/"));
+        FileOutputFormat.setOutputPath(job, new Path("igfs://" + igfsName  + 
"@/output/"));
 
         job.setJarByClass(getClass());
 
@@ -220,8 +220,8 @@ public class HadoopTaskExecutionSelfTest extends 
HadoopAbstractSelfTest {
 
         job.setInputFormatClass(TextInputFormat.class);
 
-        FileInputFormat.setInputPaths(job, new Path("igfs://@/"));
-        FileOutputFormat.setOutputPath(job, new Path("igfs://@/output/"));
+        FileInputFormat.setInputPaths(job, new Path("igfs://" + igfsName + 
"@/"));
+        FileOutputFormat.setOutputPath(job, new Path("igfs://" + igfsName  + 
"@/output/"));
 
         job.setJarByClass(getClass());
 
@@ -282,8 +282,8 @@ public class HadoopTaskExecutionSelfTest extends 
HadoopAbstractSelfTest {
 
         job.setInputFormatClass(InFormat.class);
 
-        FileInputFormat.setInputPaths(job, new Path("igfs://@/"));
-        FileOutputFormat.setOutputPath(job, new Path("igfs://@/output/"));
+        FileInputFormat.setInputPaths(job, new Path("igfs://" + igfsName + 
"@/"));
+        FileOutputFormat.setOutputPath(job, new Path("igfs://" + igfsName  + 
"@/output/"));
 
         job.setJarByClass(getClass());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
index 7767ec1..0e5ad03 100644
--- 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
+++ 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
@@ -131,7 +131,7 @@ public class HadoopClientProtocolMultipleServersSelfTest 
extends HadoopAbstractS
 
             job.setNumReduceTasks(0);
 
-            FileInputFormat.setInputPaths(job, new Path(PATH_INPUT));
+            FileInputFormat.setInputPaths(job, new Path("igfs://" + igfsName + 
"@" + PATH_INPUT));
 
             job.submit();
 
@@ -219,7 +219,7 @@ public class HadoopClientProtocolMultipleServersSelfTest 
extends HadoopAbstractS
         conf.set(MRConfig.FRAMEWORK_NAME, 
IgniteHadoopClientProtocolProvider.FRAMEWORK_NAME);
         conf.set(MRConfig.MASTER_ADDRESS, "127.0.0.1:" + REST_PORT);
 
-        conf.set("fs.defaultFS", "igfs:///");
+        conf.set("fs.defaultFS", "igfs://" + igfsName + "@/");
 
         return conf;
     }
@@ -242,7 +242,7 @@ public class HadoopClientProtocolMultipleServersSelfTest 
extends HadoopAbstractS
 
         conf.set(MRConfig.MASTER_ADDRESS, F.concat(addrs, ","));
 
-        conf.set("fs.defaultFS", "igfs:///");
+        conf.set("fs.defaultFS", "igfs://" + igfsName + "@/");
 
         return conf;
     }
@@ -264,7 +264,7 @@ public class HadoopClientProtocolMultipleServersSelfTest 
extends HadoopAbstractS
 
         conf.set(MRConfig.MASTER_ADDRESS, F.concat(addrs, ","));
 
-        conf.set("fs.defaultFS", "igfs:///");
+        conf.set("fs.defaultFS", "igfs://" + igfsName + "@/");
 
         return conf;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
index 7241506..a8d58c2 100644
--- 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
+++ 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
@@ -200,8 +200,8 @@ public class HadoopClientProtocolSelfTest extends 
HadoopAbstractSelfTest {
             job.setReducerClass(TestCountingReducer.class);
             job.setCombinerClass(TestCountingCombiner.class);
 
-            FileInputFormat.setInputPaths(job, new Path(PATH_INPUT));
-            FileOutputFormat.setOutputPath(job, new Path(PATH_OUTPUT));
+            FileInputFormat.setInputPaths(job, new Path("igfs://" + igfsName + 
"@" + PATH_INPUT));
+            FileOutputFormat.setOutputPath(job, new Path("igfs://" + igfsName 
+ "@" + PATH_OUTPUT));
 
             job.submit();
 
@@ -231,6 +231,9 @@ public class HadoopClientProtocolSelfTest extends 
HadoopAbstractSelfTest {
             assertEquals("wrong counter value", 3, 
counters.findCounter(TestCounter.COUNTER2).getValue());
             assertEquals("wrong counter value", 3, 
counters.findCounter(TestCounter.COUNTER3).getValue());
         }
+        catch (Throwable t) {
+            log.error("Unexpected exception", t);
+        }
         finally {
             job.getCluster().close();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a9b38df/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemHandshakeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemHandshakeSelfTest.java
 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemHandshakeSelfTest.java
index 9839ad5..02c708b 100644
--- 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemHandshakeSelfTest.java
+++ 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemHandshakeSelfTest.java
@@ -96,13 +96,6 @@ public class IgniteHadoopFileSystemHandshakeSelfTest extends 
IgfsCommonAbstractT
         checkValid(IGFS_NAME + "@127.0.0.1");
         checkValid(IGFS_NAME + "@127.0.0.1:" + DFLT_IPC_PORT);
 
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@127.0.0.1");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@127.0.0.1:" + DFLT_IPC_PORT);
-
-        checkValid("");
-        checkValid("127.0.0.1");
-        checkValid("127.0.0.1:" + DFLT_IPC_PORT);
 
         tcp = false; // Embedded mode:
 
@@ -111,12 +104,6 @@ public class IgniteHadoopFileSystemHandshakeSelfTest 
extends IgfsCommonAbstractT
 
         checkValid(IGFS_NAME + "@"); // Embedded mode fails, but remote tcp 
succeeds.
         checkValid(IGFS_NAME + "@" + HOST_PORT_UNUSED);
-
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@"); // Embedded mode fails, 
but remote tcp succeeds.
-        checkInvalid(":" + IGNITE_INSTANCE_NAME + "@" + HOST_PORT_UNUSED);
-
-        checkValid("@"); // Embedded mode fails, but remote tcp succeeds.
-        checkInvalid("@" + HOST_PORT_UNUSED);
     }
 
     /**
@@ -137,13 +124,6 @@ public class IgniteHadoopFileSystemHandshakeSelfTest 
extends IgfsCommonAbstractT
         checkValid(IGFS_NAME + "@127.0.0.1");
         checkValid(IGFS_NAME + "@127.0.0.1:" + DFLT_IPC_PORT);
 
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@127.0.0.1");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@127.0.0.1:" + DFLT_IPC_PORT);
-
-        checkValid("");
-        checkValid("127.0.0.1");
-        checkValid("127.0.0.1:" + DFLT_IPC_PORT);
 
         tcp = false; // Embedded mode:
 
@@ -152,94 +132,6 @@ public class IgniteHadoopFileSystemHandshakeSelfTest 
extends IgfsCommonAbstractT
 
         checkValid(IGFS_NAME + "@");
         checkValid(IGFS_NAME + "@" + HOST_PORT_UNUSED);
-
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@");
-        checkInvalid(":" + IGNITE_INSTANCE_NAME + "@" + HOST_PORT_UNUSED);
-
-        checkValid("@"); // Embedded mode fails, but remote tcp succeeds.
-        checkInvalid("@" + HOST_PORT_UNUSED);
-    }
-
-    /**
-     * Tests for Grid having normal name and IGFS having {@code null} name.
-     *
-     * @throws Exception If failed.
-     */
-    public void testHandshakeDefaultIgfs() throws Exception {
-        startUp(false/*Ignite instance name*/, true/*default igfs*/);
-
-        tcp = true;
-
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@");
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@127.0.0.1");
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@127.0.0.1:" + 
DFLT_IPC_PORT);
-
-        checkInvalid(IGFS_NAME + "@");
-        checkInvalid(IGFS_NAME + "@127.0.0.1");
-        checkInvalid(IGFS_NAME + "@127.0.0.1:" + DFLT_IPC_PORT);
-
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@127.0.0.1");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@127.0.0.1:" + DFLT_IPC_PORT);
-
-        checkValid("");
-        checkValid("127.0.0.1");
-        checkValid("127.0.0.1:" + DFLT_IPC_PORT);
-
-        tcp = false; // Embedded mode:
-
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@");
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@" + 
HOST_PORT_UNUSED);
-
-        checkInvalid(IGFS_NAME + "@");
-        checkInvalid(IGFS_NAME + "@" + HOST_PORT_UNUSED);
-
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@" + HOST_PORT_UNUSED);
-
-        checkValid("@"); // NB: in embedded mode this fails, but remote TCP 
still succeeds.
-        checkValid("@" + HOST_PORT_UNUSED);
-    }
-
-    /**
-     * Tests for Grid having {@code null} name and IGFS having {@code null} 
name.
-     *
-     * @throws Exception If failed.
-     */
-    public void testHandshakeDefaultGridDefaultIgfs() throws Exception {
-        startUp(true, true);
-
-        tcp = true;
-
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@");
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@127.0.0.1");
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@127.0.0.1:" + 
DFLT_IPC_PORT);
-
-        checkInvalid(IGFS_NAME + "@");
-        checkInvalid(IGFS_NAME + "@127.0.0.1");
-        checkInvalid(IGFS_NAME + "@127.0.0.1:" + DFLT_IPC_PORT);
-
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@127.0.0.1");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@127.0.0.1:" + DFLT_IPC_PORT);
-
-        checkValid("");
-        checkValid("127.0.0.1");
-        checkValid("127.0.0.1:" + DFLT_IPC_PORT);
-
-        tcp = false; // Embedded mode:
-
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@");
-        checkInvalid(IGFS_NAME + ":" + IGNITE_INSTANCE_NAME + "@" + 
HOST_PORT_UNUSED);
-
-        checkInvalid(IGFS_NAME + "@");
-        checkInvalid(IGFS_NAME + "@" + HOST_PORT_UNUSED);
-
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@");
-        checkValid(":" + IGNITE_INSTANCE_NAME + "@" + HOST_PORT_UNUSED);
-
-        checkValid("@");
-        checkValid("@" + HOST_PORT_UNUSED);
     }
 
     /**
@@ -250,9 +142,9 @@ public class IgniteHadoopFileSystemHandshakeSelfTest 
extends IgfsCommonAbstractT
      * @throws Exception If failed.
      */
     private void startUp(boolean dfltIgniteInstanceName, boolean dfltIgfsName) 
throws Exception {
-        Ignite ignite = G.start(gridConfiguration(dfltIgniteInstanceName, 
dfltIgfsName));
+        Ignite ignite = G.start(gridConfiguration(dfltIgniteInstanceName));
 
-        IgniteFileSystem igfs = ignite.fileSystem(dfltIgfsName ? null : 
IGFS_NAME);
+        IgniteFileSystem igfs = ignite.fileSystem(dfltIgfsName ? "" : 
IGFS_NAME);
 
         igfs.mkdirs(PATH);
     }
@@ -261,11 +153,10 @@ public class IgniteHadoopFileSystemHandshakeSelfTest 
extends IgfsCommonAbstractT
      * Create Grid configuration.
      *
      * @param dfltIgniteInstanceName Default Ignite instance name.
-     * @param dfltIgfsName Default IGFS name.
      * @return Grid configuration.
      * @throws Exception If failed.
      */
-    private IgniteConfiguration gridConfiguration(boolean 
dfltIgniteInstanceName, boolean dfltIgfsName)
+    private IgniteConfiguration gridConfiguration(boolean 
dfltIgniteInstanceName)
         throws Exception {
         IgniteConfiguration cfg = 
super.getConfiguration(dfltIgniteInstanceName ? null : IGNITE_INSTANCE_NAME);
 
@@ -301,7 +192,7 @@ public class IgniteHadoopFileSystemHandshakeSelfTest 
extends IgfsCommonAbstractT
 
         FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
 
-        igfsCfg.setName(dfltIgfsName ? null : IGFS_NAME);
+        igfsCfg.setName(IGFS_NAME);
         igfsCfg.setPrefetchBlocks(1);
         igfsCfg.setDefaultMode(PRIMARY);
         igfsCfg.setDataCacheConfiguration(dataCacheCfg);
@@ -355,6 +246,7 @@ public class IgniteHadoopFileSystemHandshakeSelfTest 
extends IgfsCommonAbstractT
      * Gets the file system using authority and tcp flag.
      *
      * @param authority Authority.
+     * @param tcp Use TCP endpoint.
      * @return File system.
      * @throws Exception If failed.
      */
@@ -366,6 +258,7 @@ public class IgniteHadoopFileSystemHandshakeSelfTest 
extends IgfsCommonAbstractT
      * Create configuration for test.
      *
      * @param authority Authority.
+     * @param tcp Use TCP endpoint.
      * @return Configuration.
      */
     private static Configuration configuration(String authority, boolean tcp) {

Reply via email to