[IGNITE-406]: cleanup, javadocs, etc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8a1c4e60 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8a1c4e60 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8a1c4e60 Branch: refs/heads/ignite-406 Commit: 8a1c4e60d47de468fcce8c9c518e58a628c79338 Parents: 94ed541 Author: iveselovskiy <iveselovs...@gridgain.com> Authored: Thu Mar 12 16:42:11 2015 +0300 Committer: iveselovskiy <iveselovs...@gridgain.com> Committed: Thu Mar 12 16:42:11 2015 +0300 ---------------------------------------------------------------------- .../processors/igfs/IgfsAbstractSelfTest.java | 49 +++-------- .../igfs/IgfsExUniversalFileSystemAdapter.java | 18 +++- .../igfs/UniversalFileSystemAdapter.java | 43 ++++++---- .../testframework/junits/GridAbstractTest.java | 3 +- .../processors/hadoop/igfs/HadoopIgfsIpcIo.java | 2 - .../ignite/igfs/Hadoop10DualAbstractTest.java | 59 ------------- .../ignite/igfs/Hadoop1DualAbstractTest.java | 90 ++++++++++++++++++++ .../igfs/Hadoop1OverIgfsDualAsyncTest.java | 7 +- .../igfs/Hadoop1OverIgfsDualSyncTest.java | 5 +- ...oopFileSystemUniversalFileSystemAdapter.java | 18 +++- ...oopSecondaryFileSystemConfigurationTest.java | 2 +- 11 files changed, 175 insertions(+), 121 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/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 e36a3c9..cf73c6c 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 @@ -115,10 +115,10 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { /** Primary IGFS. */ protected static IgfsImpl igfs; - /** */ + /** Secondary IGFS */ protected static IgfsSecondaryFileSystem igfsSecondaryFileSystem; - /** Secondary file system "backdoor". */ + /** Secondary file system lower layer "backdoor" wrapped in UniversalFileSystemAdapter: */ protected static UniversalFileSystemAdapter igfsSecondary; /** IGFS mode. */ @@ -159,8 +159,6 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - U.debug("============================= beforeTestsStarted()"); - igfsSecondaryFileSystem = createSecondaryFileSystemStack(); Ignite ignite = startGridWithIgfs("ignite", "igfs", mode, igfsSecondaryFileSystem, PRIMARY_REST_CFG); @@ -169,7 +167,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { } protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception { - Ignite igniteSecondary = startGridWithIgfs("ignite-secondary", "igfs-secondary", PRIMARY, null, SECONDARY_REST_CFG); + Ignite igniteSecondary = startGridWithIgfs("ignite-secondary", "igfs-secondary", PRIMARY, null, + SECONDARY_REST_CFG); IgfsEx secondaryIgfsImpl = (IgfsEx) igniteSecondary.fileSystem("igfs-secondary"); @@ -180,13 +179,11 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { - U.debug("========== afterTest()"); clear(igfs, igfsSecondary); } /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { - U.debug("============================= afterTestsStopped()"); G.stopAll(true); } @@ -2155,7 +2152,6 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public static void create(IgfsImpl igfs, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) throws Exception { - // TODO: why .asSecondary() is used there?? create(igfs.asSecondary(), dirs, files); } @@ -2365,10 +2361,11 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws IgniteCheckedException If failed. */ protected void checkExist(UniversalFileSystemAdapter uni, IgfsPath... paths) throws IgniteCheckedException { + IgfsEx ex = uni.getAdapter(IgfsEx.class); for (IgfsPath path : paths) { - // TODO: what does that mean? -// assert igfs.context().meta().fileId(path) != null : "Path doesn't exist [igfs=" + igfs.name() + -// ", path=" + path + ']'; + if (ex != null) + assert ex.context().meta().fileId(path) != null : "Path doesn't exist [igfs=" + ex.name() + + ", path=" + path + ']'; try { assert uni.exists(path.toString()) : "Path doesn't exist [igfs=" + uni.name() + ", path=" + path + ']'; @@ -2417,34 +2414,16 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ protected void checkNotExist(UniversalFileSystemAdapter uni, IgfsPath... paths) throws Exception { + IgfsEx ex = uni.getAdapter(IgfsEx.class); for (IgfsPath path : paths) { -// assert igfs.context().meta().fileId(path) == null : "Path exists [igfs=" + igfs.name() + ", path=" + -// path + ']'; + if (ex != null) + assert ex.context().meta().fileId(path) == null : "Path exists [igfs=" + ex.name() + ", path=" + + path + ']'; + assert !uni.exists(path.toString()) : "Path exists [igfs=" + uni.name() + ", path=" + path + ']'; } } -// /** -// * Ensure that the given file exists in the given IGFSs and that it has exactly the same content as provided in the -// * "data" parameter. -// * -// * @param igfs First IGFS. -// * @param igfsSecondary Second IGFS. -// * @param file File. -// * @param chunks Expected data. -// * @throws Exception If failed. -// */ -// protected void checkFile(IgfsImpl igfs, IgfsImpl igfsSecondary, IgfsPath file, -// @Nullable byte[]... chunks) throws Exception { -// checkExist(igfs, file); -// checkFileContent(igfs, file, chunks); -// -// if (dual) { -// checkExist(igfsSecondary, file); -// checkFileContent(igfsSecondary, file, chunks); -// } -// } - /** * Ensure that the given file exists in the given IGFSs and that it has exactly the same content as provided in the * "data" parameter. @@ -2641,7 +2620,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { } } - // Clear igfs. + // Clear the filesystem: uni.format(); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java index ef8f965..8b40b0b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java @@ -6,36 +6,47 @@ import java.io.*; import java.util.*; /** - * TODO + * Universal adapter over {@link IgfsEx} filesystem. */ public class IgfsExUniversalFileSystemAdapter implements UniversalFileSystemAdapter { + /** The wrapped igfs. */ private final IgfsEx igfsEx; + /** + * Constructor. + * @param igfsEx the igfs to be wrapped. + */ public IgfsExUniversalFileSystemAdapter(IgfsEx igfsEx) { this.igfsEx = igfsEx; } + /** {@inheritDoc} */ @Override public String name() { return igfsEx.name(); } + /** {@inheritDoc} */ @Override public boolean exists(String path) { return igfsEx.exists(new IgfsPath(path)); } + /** {@inheritDoc} */ @Override public void mkdirs(String path) throws IOException { igfsEx.mkdirs(new IgfsPath(path)); } + /** {@inheritDoc} */ @Override public void format() throws IOException { igfsEx.format(); } + /** {@inheritDoc} */ @Override public Map<String, String> properties(String path) { return igfsEx.info(new IgfsPath(path)).properties(); } + /** {@inheritDoc} */ @Override public boolean delete(String path, boolean recursive) throws IOException { IgfsPath igfsPath = new IgfsPath(path); @@ -44,12 +55,16 @@ public class IgfsExUniversalFileSystemAdapter implements UniversalFileSystemAdap return del; } + /** {@inheritDoc} */ @Override public InputStream openInputStream(String path) throws IOException { IgfsPath igfsPath = new IgfsPath(path); + IgfsInputStreamAdapter adapter = igfsEx.open(igfsPath); + return adapter; } + /** {@inheritDoc} */ @Override public OutputStream openOutputStream(String path, boolean append) throws IOException { IgfsPath igfsPath = new IgfsPath(path); @@ -62,6 +77,7 @@ public class IgfsExUniversalFileSystemAdapter implements UniversalFileSystemAdap return igfsOutputStream; } + /** {@inheritDoc} */ @Override public <T> T getAdapter(Class<T> clazz) { if (clazz == IgfsEx.class) return (T)igfsEx; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/UniversalFileSystemAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/UniversalFileSystemAdapter.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/UniversalFileSystemAdapter.java index 4d3570b..17a4ea9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/UniversalFileSystemAdapter.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/UniversalFileSystemAdapter.java @@ -1,7 +1,5 @@ package org.apache.ignite.internal.processors.igfs; -import org.jetbrains.annotations.*; - import java.io.*; import java.util.*; @@ -9,9 +7,9 @@ import java.util.*; * Universal interface to an underlying filesystem. * Typically used for secondary filesystem. * To be used solely in tests. - * TODO javadocs */ public interface UniversalFileSystemAdapter { + /** * Gets name of the FS. * @return name of this file system. @@ -26,8 +24,20 @@ public interface UniversalFileSystemAdapter { */ boolean exists(String path) throws IOException; + /** + * Deletes a file or directory. + * @param path the path to delete. + * @param recursive instructs to delete a directory recursively. + * @return true on success, false otherwise. + * @throws IOException On failure. + */ boolean delete(String path, boolean recursive) throws IOException; + /** + * Makes directories, creating missing parent directories as needed. + * @param path the directory to create. + * @throws IOException On failure. + */ void mkdirs(String path) throws IOException; /** @@ -38,31 +48,32 @@ public interface UniversalFileSystemAdapter { void format() throws IOException; /** - * - * @param path - * @return + * Gets properties (such as owner, group, and permissions) of a file. + * @param path the path to the file to get properties of. + * @return the properties. */ Map<String,String> properties(String path) throws IOException; /** - * @param path + * Opens input stream to read file contents. + * @param path the path to the file. */ InputStream openInputStream(String path) throws IOException; /** - * - * @param path - * @param append - * @return - * @throws IOException + * Opens output stream to write file contents. + * @param path the path to the file to be written. + * @param append if to append to the end of existing data. + * @return the OutputStream to write into. + * @throws IOException On failure. */ OutputStream openOutputStream(String path, boolean append) throws IOException; /** - * - * @param clazz - * @param <T> - * @return + * Gets an entity of the given type (class) associated with this universal adapter. + * @param clazz The class representing the type we wish to adapt to. + * @param <T> The type we need to adapt to. + * @return the adapter object of the given type. */ <T> T getAdapter(Class<T> clazz); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java index 7443337..15017dd 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java @@ -1408,7 +1408,8 @@ public abstract class GridAbstractTest extends TestCase { if (numOfTests == -1) { int cnt = 0; - for (Method m : GridAbstractTest.this.getClass().getMethods()) + Method[] mm = GridAbstractTest.this.getClass().getMethods(); + for (Method m : mm) if (m.getName().startsWith("test") && Modifier.isPublic(m.getModifiers())) cnt++; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsIpcIo.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsIpcIo.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsIpcIo.java index 62e5380..5c4d342 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsIpcIo.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsIpcIo.java @@ -22,10 +22,8 @@ import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.igfs.common.*; import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.ipc.*; import org.apache.ignite.internal.util.ipc.shmem.*; -import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop10DualAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop10DualAbstractTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop10DualAbstractTest.java deleted file mode 100644 index 265e6b2..0000000 --- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop10DualAbstractTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.ignite.igfs; - -import org.apache.hadoop.conf.*; -import org.apache.hadoop.fs.*; -import org.apache.ignite.*; -import org.apache.ignite.hadoop.fs.*; -import org.apache.ignite.igfs.secondary.*; -import org.apache.ignite.internal.processors.igfs.*; - -import java.io.*; - -import static org.apache.ignite.igfs.HadoopSecondaryFileSystemConfigurationTest.*; -import static org.apache.ignite.igfs.IgfsMode.*; - -/** - * Created by ivan on 11.03.15. - */ -public abstract class Hadoop10DualAbstractTest extends IgfsDualAbstractSelfTest { - - protected String secondaryConfFullPath; - protected String secondaryUri; - - public Hadoop10DualAbstractTest(IgfsMode mode) { - super(mode); - } - - @Override protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception { - startUnderlying(); - - prepareConfiguration(); - - IgniteHadoopIgfsSecondaryFileSystem second = - new IgniteHadoopIgfsSecondaryFileSystem(secondaryUri, secondaryConfFullPath); - - FileSystem fileSystem = second.fileSystem(); - - igfsSecondary = new HadoopFileSystemUniversalFileSystemAdapter(fileSystem); - - return second; - } - - protected void startUnderlying() throws Exception { - Ignite igniteSecondaryUnused - = startGridWithIgfs("grid_secondary", "igfs_secondary", PRIMARY, null, SECONDARY_REST_CFG); - } - - protected void prepareConfiguration() throws IOException { - // TODO: this is borrowed from ConfigTest. - // TODO: use port from SECONDARY_REST_CFG.get("port") and better arange parameter constants. - Configuration secondaryConf = configuration(IGFS_SCHEME, SECONDARY_AUTHORITY, true, true); - - secondaryConf.setInt("fs.igfs.block.size", 1024); - - secondaryConfFullPath = writeConfiguration(secondaryConf, SECONDARY_CFG_PATH); - - secondaryUri = mkUri(IGFS_SCHEME, SECONDARY_AUTHORITY); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1DualAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1DualAbstractTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1DualAbstractTest.java new file mode 100644 index 0000000..5d52664 --- /dev/null +++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1DualAbstractTest.java @@ -0,0 +1,90 @@ +package org.apache.ignite.igfs; + +import org.apache.hadoop.conf.*; +import org.apache.hadoop.fs.*; +import org.apache.ignite.hadoop.fs.*; +import org.apache.ignite.igfs.secondary.*; +import org.apache.ignite.internal.processors.igfs.*; + +import java.io.*; +import java.util.*; + +import static org.apache.ignite.igfs.HadoopSecondaryFileSystemConfigurationTest.*; +import static org.apache.ignite.igfs.IgfsMode.*; + +/** + * Abstract test for Hadoop 1.0 file system stack. + */ +public abstract class Hadoop1DualAbstractTest extends IgfsDualAbstractSelfTest { + /** Secondary grid name */ + private static final String GRID_NAME = "grid_secondary"; + + /** Secondary file system name */ + private static final String IGFS_NAME = "igfs_secondary"; + + /** Secondary file system REST endpoint port */ + private static final String PORT = "11500"; + + /** Secondary file system REST endpoint configuration map. */ + private static final Map<String, String> SECONDARY_REST_CFG = new HashMap<String, String>() {{ + put("type", "tcp"); + put("port", PORT); + }}; + + /** Secondary file system authority. */ + private static final String SECONDARY_AUTHORITY = IGFS_NAME + ":" + GRID_NAME + "@127.0.0.1:" + PORT; + + /** Secondary Fs configuration full path. */ + protected String secondaryConfFullPath; + + /** Secondary Fs URI. */ + protected String secondaryUri; + + /** Constructor. */ + public Hadoop1DualAbstractTest(IgfsMode mode) { + super(mode); + } + + /** + * Creates secondary filesystems. + * @return IgfsSecondaryFileSystem + * @throws Exception On failure. + */ + @Override protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception { + startUnderlying(); + + prepareConfiguration(); + + IgniteHadoopIgfsSecondaryFileSystem second = + new IgniteHadoopIgfsSecondaryFileSystem(secondaryUri, secondaryConfFullPath); + + FileSystem fileSystem = second.fileSystem(); + + igfsSecondary = new HadoopFileSystemUniversalFileSystemAdapter(fileSystem); + + return second; + } + + /** + * Starts underlying Ignite process. + * @throws IOException On failure. + */ + protected void startUnderlying() throws Exception { + startGridWithIgfs(GRID_NAME, IGFS_NAME, PRIMARY, null, SECONDARY_REST_CFG); + } + + /** + * Prepares Fs configuration. + * @throws IOException On failure. + */ + protected void prepareConfiguration() throws IOException { + Configuration secondaryConf = configuration(IGFS_SCHEME, SECONDARY_AUTHORITY, true, true); + + secondaryConf.setInt("fs.igfs.block.size", 1024); + + secondaryConfFullPath = writeConfiguration(secondaryConf, SECONDARY_CFG_PATH); + + secondaryUri = mkUri(IGFS_SCHEME, SECONDARY_AUTHORITY); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualAsyncTest.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualAsyncTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualAsyncTest.java index 6737ab6..5372622 100644 --- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualAsyncTest.java +++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualAsyncTest.java @@ -1,10 +1,13 @@ package org.apache.ignite.igfs; /** - * Created by ivan on 11.03.15. + * DUAL_ASYNC mode test. */ -public class Hadoop1OverIgfsDualAsyncTest extends Hadoop10DualAbstractTest { +public class Hadoop1OverIgfsDualAsyncTest extends Hadoop1DualAbstractTest { + /** + * Constructor. + */ public Hadoop1OverIgfsDualAsyncTest() { super(IgfsMode.DUAL_ASYNC); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualSyncTest.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualSyncTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualSyncTest.java index b2b8aed..18eec96 100644 --- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualSyncTest.java +++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/Hadoop1OverIgfsDualSyncTest.java @@ -3,8 +3,11 @@ package org.apache.ignite.igfs; /** * DUAL_SYNC mode. */ -public class Hadoop1OverIgfsDualSyncTest extends Hadoop10DualAbstractTest { +public class Hadoop1OverIgfsDualSyncTest extends Hadoop1DualAbstractTest { + /** + * Constructor. + */ public Hadoop1OverIgfsDualSyncTest() { super(IgfsMode.DUAL_SYNC); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java index efdcc97..936f7ac 100644 --- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java +++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java @@ -8,41 +8,50 @@ import java.io.*; import java.util.*; /** - * TODO: javadocs + * Universal adapter wrapping {@link org.apache.hadoop.fs.FileSystem} instance. */ public class HadoopFileSystemUniversalFileSystemAdapter implements UniversalFileSystemAdapter { + /** The wrapped filesystem. */ private final FileSystem fileSys; + /** + * Constructor. + * @param fs the filesystem to be wrapped. + */ public HadoopFileSystemUniversalFileSystemAdapter(FileSystem fs) { this.fileSys = fs; } + /** {@inheritDoc} */ @Override public String name() { return fileSys.getUri().toString(); } + /** {@inheritDoc} */ @Override public boolean exists(String path) throws IOException { return fileSys.exists(new Path(path)); } + /** {@inheritDoc} */ @Override public boolean delete(String path, boolean recursive) throws IOException { boolean ok = fileSys.delete(new Path(path), recursive); return ok; } + /** {@inheritDoc} */ @Override public void mkdirs(String path) throws IOException { boolean ok = fileSys.mkdirs(new Path(path)); - // TODO: questionable if (!ok) throw new IOException("Failed to mkdirs: " + path); } + /** {@inheritDoc} */ @Override public void format() throws IOException { - // TODO: questionable fileSys.delete(new Path("/"), true); } + /** {@inheritDoc} */ @Override public Map<String, String> properties(String path) throws IOException { Path p = new Path(path); FileStatus status = fileSys.getFileStatus(p); @@ -60,10 +69,12 @@ public class HadoopFileSystemUniversalFileSystemAdapter implements UniversalFile return m; } + /** {@inheritDoc} */ @Override public InputStream openInputStream(String path) throws IOException { return fileSys.open(new Path(path)); } + /** {@inheritDoc} */ @Override public OutputStream openOutputStream(String path, boolean append) throws IOException { Path p = new Path(path); if (append) @@ -72,6 +83,7 @@ public class HadoopFileSystemUniversalFileSystemAdapter implements UniversalFile return fileSys.create(p, true/*overwrite*/); } + /** {@inheritDoc} */ @Override public <T> T getAdapter(Class<T> clazz) { if (clazz == FileSystem.class) return (T)fileSys; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a1c4e60/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java index 1997ae2..1681eea 100644 --- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java +++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopSecondaryFileSystemConfigurationTest.java @@ -63,7 +63,7 @@ public class HadoopSecondaryFileSystemConfigurationTest extends IgfsCommonAbstra private static final String PRIMARY_CFG_PATH = "/work/core-site-primary-test.xml"; /** Secondary file system authority. */ - static final String SECONDARY_AUTHORITY = "igfs_secondary:grid_secondary@127.0.0.1:11500"; + private static final String SECONDARY_AUTHORITY = "igfs_secondary:grid_secondary@127.0.0.1:11500"; /** Autogenerated secondary file system configuration path. */ static final String SECONDARY_CFG_PATH = "/work/core-site-test.xml";