ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [09/40] ignite git commit: IGNITE-3887: IGFS: IgfsPath API cleanup.
Date Thu, 15 Sep 2016 06:40:07 GMT
IGNITE-3887: IGFS: IgfsPath API cleanup.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 0852baeef4c828e4832b34edf24c0869619c5745
Parents: 499700c
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Sep 13 16:50:14 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Sep 13 16:50:14 2016 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/igfs/IgfsPath.java   | 14 ++++++++++++-
 .../org/apache/ignite/igfs/IgfsPathSummary.java |  3 +--
 .../local/LocalIgfsSecondaryFileSystem.java     |  2 +-
 .../igfs/common/IgfsControlResponse.java        | 19 +++++-------------
 .../internal/igfs/common/IgfsMarshaller.java    | 14 +++----------
 .../internal/processors/igfs/IgfsFileImpl.java  |  5 +----
 .../internal/processors/igfs/IgfsImpl.java      |  4 ++--
 .../processors/igfs/IgfsModeResolver.java       |  3 ++-
 .../internal/processors/igfs/IgfsPathIds.java   |  2 +-
 .../internal/processors/igfs/IgfsPaths.java     |  5 +----
 .../internal/processors/igfs/IgfsUtils.java     | 21 ++++++++++++++++----
 .../apache/ignite/igfs/IgfsPathSelfTest.java    |  6 ------
 .../igfs/IgfsAbstractBaseSelfTest.java          |  2 +-
 .../processors/igfs/IgfsAbstractSelfTest.java   | 12 +++++------
 .../igfs/IgfsDataManagerSelfTest.java           |  6 +++---
 .../igfs/IgfsDualAbstractSelfTest.java          | 14 ++++++-------
 .../igfs/IgfsMetaManagerSelfTest.java           |  4 ++--
 .../igfs/IgfsModeResolverSelfTest.java          |  4 ++--
 .../processors/igfs/IgfsStreamsSelfTest.java    |  4 +---
 19 files changed, 68 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPath.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPath.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPath.java
index c705274..d01e1db 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPath.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPath.java
@@ -62,9 +62,15 @@ public final class IgfsPath implements Comparable<IgfsPath>, Externalizable,
Bin
     /** URI representing this path. Should never change after object creation or de-serialization.
*/
     private String path;
 
+    /** Root path. */
+    public static final IgfsPath ROOT = new IgfsPath(SLASH);
+
     /**
      * Constructs default root path.
+     *
+     * @deprecated Use {@link #ROOT} instead.
      */
+    @Deprecated
     public IgfsPath() {
         path = SLASH;
     }
@@ -146,9 +152,11 @@ public final class IgfsPath implements Comparable<IgfsPath>, Externalizable,
Bin
      * Returns a root for this path.
      *
      * @return Root for this path.
+     * @deprecated Use {@link #ROOT} instead.
      */
+    @Deprecated
     public IgfsPath root() {
-        return new IgfsPath();
+        return ROOT;
     }
 
     /**
@@ -244,7 +252,10 @@ public final class IgfsPath implements Comparable<IgfsPath>, Externalizable,
Bin
      *
      * @param path Path to check.
      * @return {@code True} if paths are identical.
+     * @deprecated Use {@link #equals(Object)} instead.
      */
+    @SuppressWarnings("unused")
+    @Deprecated
     public boolean isSame(IgfsPath path) {
         A.notNull(path, "path");
 
@@ -252,6 +263,7 @@ public final class IgfsPath implements Comparable<IgfsPath>, Externalizable,
Bin
     }
 
     /** {@inheritDoc} */
+    @SuppressWarnings("NullableProblems")
     @Override public int compareTo(IgfsPath o) {
         return path.compareTo(o.path);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPathSummary.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPathSummary.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPathSummary.java
index 7d60b95..0eff4b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPathSummary.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsPathSummary.java
@@ -137,8 +137,7 @@ public class IgfsPathSummary implements Externalizable, Binarylizable
{
         dirCnt = in.readInt();
         totalLen = in.readLong();
 
-        path = new IgfsPath();
-        path.readExternal(in);
+        path = IgfsUtils.readPath(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
index 36080f2..c84fcf2 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
@@ -303,7 +303,7 @@ public class LocalIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem,
Li
 
     /** {@inheritDoc} */
     @Override public long usedSpaceSize() {
-        Path p = fileForPath(new IgfsPath("/")).toPath();
+        Path p = fileForPath(IgfsPath.ROOT).toPath();
 
         try {
             LocalFileSystemSizeVisitor visitor = new LocalFileSystemSizeVisitor();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsControlResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsControlResponse.java
b/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsControlResponse.java
index ce7107d..595f3c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsControlResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsControlResponse.java
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsFileImpl;
 import org.apache.ignite.internal.processors.igfs.IgfsHandshakeResponse;
 import org.apache.ignite.internal.processors.igfs.IgfsInputStreamDescriptor;
 import org.apache.ignite.internal.processors.igfs.IgfsStatus;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -492,13 +493,8 @@ public class IgfsControlResponse extends IgfsMessage {
             case RES_TYPE_IGFS_PATH: {
                 boolean hasVal = in.readBoolean();
 
-                if (hasVal) {
-                    IgfsPath path = new IgfsPath();
-
-                    path.readExternal(in);
-
-                    res = path;
-                }
+                if (hasVal)
+                    res = IgfsUtils.readPath(in);
 
                 break;
             }
@@ -603,13 +599,8 @@ public class IgfsControlResponse extends IgfsMessage {
                 if (size >= 0) {
                     paths = new ArrayList<>(size);
 
-                    for (int i = 0; i < size; i++) {
-                        IgfsPath path = new IgfsPath();
-
-                        path.readExternal(in);
-
-                        paths.add(path);
-                    }
+                    for (int i = 0; i < size; i++)
+                        paths.add(IgfsUtils.readPath(in));
                 }
 
                 res = paths;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsMarshaller.java
b/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsMarshaller.java
index 1dba21c..91656fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/igfs/common/IgfsMarshaller.java
@@ -23,6 +23,7 @@ import java.io.ObjectOutput;
 import java.util.Arrays;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.jetbrains.annotations.Nullable;
 
@@ -331,21 +332,12 @@ public class IgfsMarshaller {
     }
 
     /**
-     * Reads IGFS path from data input that was written by {@link #writePath(ObjectOutput,
org.apache.ignite.igfs.IgfsPath)}
-     * method.
+     * Reads IGFS path from data input that was written by {@link #writePath(ObjectOutput,
IgfsPath)} method.
      *
      * @param in Data input.
      * @return Written path or {@code null}.
      */
     @Nullable private IgfsPath readPath(ObjectInput in) throws IOException {
-        if(in.readBoolean()) {
-            IgfsPath path = new IgfsPath();
-
-            path.readExternal(in);
-
-            return path;
-        }
-
-        return null;
+        return in.readBoolean() ? IgfsUtils.readPath(in) : null;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileImpl.java
index 984c8f5..98777be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileImpl.java
@@ -231,10 +231,7 @@ public final class IgfsFileImpl implements IgfsFile, Externalizable,
Binarylizab
      * @param in Data input.
      */
     @Override public void readExternal(ObjectInput in) throws IOException {
-        path = new IgfsPath();
-
-        path.readExternal(in);
-
+        path = IgfsUtils.readPath(in);
         blockSize = in.readInt();
         grpBlockSize = in.readLong();
         len = in.readLong();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/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 636b4a9..273e67d 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
@@ -388,7 +388,7 @@ public final class IgfsImpl implements IgfsEx {
             boolean await = false;
 
             for (IgfsPath path : paths) {
-                if (workerPath.isSubDirectoryOf(path) || workerPath.isSame(path))  {
+                if (workerPath.isSubDirectoryOf(path) || F.eq(workerPath, path))  {
                     await = true;
 
                     break;
@@ -749,7 +749,7 @@ public final class IgfsImpl implements IgfsEx {
                 if (log.isDebugEnabled())
                     log.debug("Deleting file [path=" + path + ", recursive=" + recursive
+ ']');
 
-                if (IgfsPath.SLASH.equals(path.toString()))
+                if (F.eq(IgfsPath.ROOT, path))
                     return false;
 
                 IgfsMode mode = resolveMode(path);

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
index 33b835f..d4e248d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
@@ -26,6 +26,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.igfs.IgfsMode;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.jetbrains.annotations.Nullable;
 
@@ -84,7 +85,7 @@ public class IgfsModeResolver {
 
             if (mode == null) {
                 for (T2<IgfsPath, IgfsMode> entry : modes) {
-                    if (path.isSame(entry.getKey()) || path.isSubDirectoryOf(entry.getKey()))
{
+                    if (F.eq(path, entry.getKey()) || path.isSubDirectoryOf(entry.getKey()))
{
                         // As modes ordered from most specific to least specific first mode
found is ours.
                         mode = entry.getValue();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
index b710ba2..9b30913 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
@@ -163,7 +163,7 @@ public class IgfsPathIds {
      * @return Path of the last existing element.
      */
     public IgfsPath lastExistingPath() {
-        IgfsPath path = new IgfsPath();
+        IgfsPath path = IgfsPath.ROOT;
 
         for (int i = 1; i <= lastExistingIdx; i++)
             path = new IgfsPath(path, parts[i]);

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
index 2bdb23b..72b5a19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.ArrayList;
-import java.util.List;
 
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.igfs.IgfsMode;
@@ -144,9 +143,7 @@ public class IgfsPaths implements Externalizable {
             pathModes = new ArrayList<>(size);
 
             for (int i = 0; i < size; i++) {
-                IgfsPath path = new IgfsPath();
-
-                path.readExternal(in);
+                IgfsPath path = IgfsUtils.readPath(in);
 
                 pathModes.add(new T2<>(path, IgfsMode.fromOrdinal(in.readByte())));
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/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 2e79a98..4453dba 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
@@ -52,6 +52,7 @@ import org.jetbrains.annotations.Nullable;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.io.ObjectInput;
 import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -126,9 +127,6 @@ public class IgfsUtils {
     /** Flag: this is a file. */
     private static final byte FLAG_FILE = 0x2;
 
-    /**
-     * Static initializer.
-     */
     static {
         TRASH_IDS = new IgniteUuid[TRASH_CONCURRENCY];
 
@@ -750,6 +748,21 @@ public class IgfsUtils {
     }
 
     /**
+     * Read non-null path from the input.
+     *
+     * @param in Input.
+     * @return IGFS path.
+     * @throws IOException If failed.
+     */
+    public static IgfsPath readPath(ObjectInput in) throws IOException {
+        IgfsPath res = new IgfsPath();
+
+        res.readExternal(in);
+
+        return res;
+    }
+
+    /**
      * Write IgfsFileAffinityRange.
      *
      * @param writer Writer
@@ -878,7 +891,7 @@ public class IgfsUtils {
 
         ArrayList<T2<IgfsPath, IgfsMode>> resModes = new ArrayList<>(modes.size()
+ 1);
 
-        resModes.add(new T2<>(new IgfsPath("/"), dfltMode));
+        resModes.add(new T2<>(IgfsPath.ROOT, dfltMode));
 
         for (T2<IgfsPath, IgfsMode> mode : modes) {
             assert mode.getKey() != null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/test/java/org/apache/ignite/igfs/IgfsPathSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsPathSelfTest.java b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsPathSelfTest.java
index eb0f383..3092374 100644
--- a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsPathSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsPathSelfTest.java
@@ -97,12 +97,6 @@ public class IgfsPathSelfTest extends GridCommonAbstractTest {
         URI uri = URI.create(pathStr);
         IgfsPath path = new IgfsPath(uri);
 
-        assertNotNull(new IgfsPath(uri));
-        assertNotNull(new IgfsPath(pathStr));
-        assertNotNull(new IgfsPath("/"));
-        assertNotNull(new IgfsPath(path, pathStr));
-        assertNotNull(new IgfsPath());
-
         Class nullUri = URI.class;
         Class nullStr = String.class;
         Class nullPath = IgfsPath.class;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
index 03f24a4..3f62cf5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
@@ -342,7 +342,7 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest
{
     @Override protected void afterTest() throws Exception {
         clear(igfs, igfsSecondary);
 
-        assert igfs.listFiles(new IgfsPath("/")).isEmpty();
+        assert igfs.listFiles(IgfsPath.ROOT).isEmpty();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 89979ad..a115e03 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -265,7 +265,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsAbstractBaseSelfTest
{
     public void testMoveFileDestinationRoot() throws Exception {
         create(igfs, paths(DIR, SUBDIR), paths(FILE));
 
-        igfs.rename(FILE, new IgfsPath());
+        igfs.rename(FILE, IgfsPath.ROOT);
 
         checkExist(igfs, igfsSecondary, new IgfsPath("/" + FILE.name()));
         checkNotExist(igfs, igfsSecondary, FILE);
@@ -357,7 +357,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsAbstractBaseSelfTest
{
     public void testMoveDirectoryDestinationRoot() throws Exception {
         create(igfs, paths(DIR, SUBDIR, SUBSUBDIR), null);
 
-        igfs.rename(SUBSUBDIR, new IgfsPath());
+        igfs.rename(SUBSUBDIR, IgfsPath.ROOT);
 
         checkExist(igfs, igfsSecondary, new IgfsPath("/" + SUBSUBDIR.name()));
         checkNotExist(igfs, igfsSecondary, SUBSUBDIR);
@@ -745,13 +745,11 @@ public abstract class IgfsAbstractSelfTest extends IgfsAbstractBaseSelfTest
{
      * @throws Exception If failed.
      */
     private void checkRootPropertyUpdate(String prop, String setVal, String expGetVal) throws
Exception {
-        final IgfsPath rootPath = new IgfsPath("/");
-
-        igfs.update(rootPath, Collections.singletonMap(prop, setVal));
+        igfs.update(IgfsPath.ROOT, Collections.singletonMap(prop, setVal));
 
         igfs.format();
 
-        IgfsFile file = igfs.info(rootPath);
+        IgfsFile file = igfs.info(IgfsPath.ROOT);
 
         assert file != null;
 
@@ -2334,7 +2332,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsAbstractBaseSelfTest
{
 
         Queue<IgniteBiTuple<Integer, IgfsPath>> queue = new ArrayDeque<>();
 
-        queue.add(F.t(0, new IgfsPath())); // Add root directory.
+        queue.add(F.t(0, IgfsPath.ROOT)); // Add root directory.
 
         while (!queue.isEmpty()) {
             IgniteBiTuple<Integer, IgfsPath> entry = queue.poll();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
index 70d6b99..a98c3a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
@@ -165,7 +165,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
     @SuppressWarnings("ConstantConditions")
     public void testDataStoring() throws Exception {
         for (int i = 0; i < 10; i++) {
-            IgfsPath path = new IgfsPath();
+            IgfsPath path = IgfsPath.ROOT;
 
             long t = System.currentTimeMillis();
 
@@ -250,7 +250,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
         final int blockSize = IGFS_BLOCK_SIZE;
 
         for (int i = 0; i < 10; i++) {
-            IgfsPath path = new IgfsPath();
+            IgfsPath path = IgfsPath.ROOT;
 
             long t = System.currentTimeMillis();
 
@@ -341,7 +341,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
         final int writesCnt = 64;
 
         for (int i = 0; i < 10; i++) {
-            IgfsPath path = new IgfsPath();
+            IgfsPath path = IgfsPath.ROOT;
 
             long t = System.currentTimeMillis();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
index 02027d6..57bc4f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.igfs.IgfsMode;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
@@ -334,7 +335,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest
{
         create(igfsSecondary, paths(DIR, SUBDIR), paths(FILE));
         create(igfs, paths(DIR), null);
 
-        igfs.rename(FILE, new IgfsPath());
+        igfs.rename(FILE, IgfsPath.ROOT);
 
         checkExist(igfs, SUBDIR);
         checkExist(igfs, igfsSecondary, new IgfsPath("/" + FILE.name()));
@@ -350,7 +351,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest
{
         create(igfsSecondary, paths(DIR, SUBDIR), paths(FILE));
         create(igfs, null, null);
 
-        igfs.rename(FILE, new IgfsPath());
+        igfs.rename(FILE, IgfsPath.ROOT);
 
         checkExist(igfs, DIR, SUBDIR);
         checkExist(igfs, igfsSecondary, new IgfsPath("/" + FILE.name()));
@@ -701,7 +702,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest
{
         create(igfsSecondary, paths(DIR, SUBDIR, SUBSUBDIR), null);
         create(igfs, paths(DIR), null);
 
-        igfs.rename(SUBSUBDIR, new IgfsPath());
+        igfs.rename(SUBSUBDIR, IgfsPath.ROOT);
 
         checkExist(igfs, SUBDIR);
         checkExist(igfs, igfsSecondary, new IgfsPath("/" + SUBSUBDIR.name()));
@@ -717,7 +718,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest
{
         create(igfsSecondary, paths(DIR, SUBDIR, SUBSUBDIR), null);
         create(igfs, null, null);
 
-        igfs.rename(SUBSUBDIR, new IgfsPath());
+        igfs.rename(SUBSUBDIR, IgfsPath.ROOT);
 
         checkExist(igfs, DIR, SUBDIR);
         checkExist(igfs, igfsSecondary, new IgfsPath("/" + SUBSUBDIR.name()));
@@ -1510,8 +1511,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest
{
         T2<Long, Long> t0 = new T2<>(f0.accessTime(), f0.modificationTime());
 
         // Root cannot be seen through the parent listing:
-        if (!p.isSame(p.root())) {
-
+        if (!F.eq(IgfsPath.ROOT, p)) {
             assertNotNull(f0);
 
             Collection<IgfsFile> listing = fs.listFiles(p.parent());
@@ -1519,7 +1519,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest
{
             IgfsFile f1 = null;
 
             for (IgfsFile fi : listing) {
-                if (fi.path().isSame(p)) {
+                if (F.eq(fi.path(), p)) {
                     f1 = fi;
 
                     break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
index 6053d3b..a4100ea 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
@@ -266,7 +266,7 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
         }
 
         // Validate 'file ID' operations.
-        assertEquals(ROOT_ID, mgr.fileId(new IgfsPath("/")));
+        assertEquals(ROOT_ID, mgr.fileId(IgfsPath.ROOT));
         assertEquals(a.id(), mgr.fileId(new IgfsPath("/a")));
         assertEquals(b.id(), mgr.fileId(new IgfsPath("/a/b")));
         assertEquals(f1.id(), mgr.fileId(new IgfsPath("/f1")));
@@ -285,7 +285,7 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
         assertNull(mgr.fileId(a.id(), "f5"));
         assertNull(mgr.fileId(b.id(), "f6"));
 
-        assertEquals(Arrays.asList(ROOT_ID), mgr.fileIds(new IgfsPath("/")));
+        assertEquals(Arrays.asList(ROOT_ID), mgr.fileIds(IgfsPath.ROOT));
         assertEquals(Arrays.asList(ROOT_ID, a.id()), mgr.fileIds(new IgfsPath("/a")));
         assertEquals(Arrays.asList(ROOT_ID, a.id(), b.id()), mgr.fileIds(new IgfsPath("/a/b")));
         assertEquals(Arrays.asList(ROOT_ID, f1.id()), mgr.fileIds(new IgfsPath("/f1")));

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
index bd7e413..7932660 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
@@ -69,7 +69,7 @@ public class IgfsModeResolverSelfTest extends TestCase {
      * @throws Exception If failed.
      */
     public void testResolve() throws Exception {
-        assertEquals(DUAL_SYNC, reslvr.resolveMode(new IgfsPath("/")));
+        assertEquals(DUAL_SYNC, reslvr.resolveMode(IgfsPath.ROOT));
         assertEquals(DUAL_SYNC, reslvr.resolveMode(new IgfsPath("/a")));
         assertEquals(DUAL_SYNC, reslvr.resolveMode(new IgfsPath("/a/1")));
 
@@ -161,7 +161,7 @@ public class IgfsModeResolverSelfTest extends TestCase {
         assertEquals(set, new HashSet<IgfsPath>() {{
             add(new IgfsPath("/a/b"));
             add(new IgfsPath("/a/b/x"));
-            add(new IgfsPath("/"));
+            add(IgfsPath.ROOT);
         }});
 
         set = new HashSet<>();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0852baee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
index 44560e3..8c6cf57 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
@@ -47,7 +47,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 import java.util.UUID;
@@ -192,13 +191,12 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest {
      * @throws Exception In case of exception.
      */
     public void testCreateFile() throws Exception {
-        IgfsPath root = new IgfsPath("/");
         IgfsPath path = new IgfsPath("/asdf");
 
         long max = 100L * CFG_BLOCK_SIZE / WRITING_THREADS_CNT;
 
         for (long size = 0; size <= max; size = size * 15 / 10 + 1) {
-            assertTrue(F.isEmpty(fs.listPaths(root)));
+            assertTrue(F.isEmpty(fs.listPaths(IgfsPath.ROOT)));
 
             testCreateFile(path, size, new Random().nextInt());
         }


Mime
View raw message