Package org.apache.hadoop.dfs

Examples of org.apache.hadoop.dfs.DFSTestUtil$MyFile


   *
   * @throws Exception
   */
  public void testReadWrite() throws Exception {

    DFSTestUtil util = new DFSTestUtil("TestFTPFileSystem", 20, 3, 1024 * 1024);
    localFs.setWorkingDirectory(workDir);
    Path localData = new Path(workDir, "srcData");
    Path remoteData = new Path("srcData");

    util.createFiles(localFs, localData.toUri().getPath());

    boolean dataConsistency = util.checkFiles(localFs, localData.getName());
    assertTrue("Test data corrupted", dataConsistency);

    // Copy files and directories recursively to FTP file system.
    boolean filesCopied = FileUtil.copy(localFs, localData, ftpFs, remoteData,
        false, defaultConf);
    assertTrue("Copying to FTPFileSystem failed", filesCopied);

    // Rename the remote copy
    Path renamedData = new Path("Renamed");
    boolean renamed = ftpFs.rename(remoteData, renamedData);
    assertTrue("Rename failed", renamed);

    // Copy files and directories from FTP file system and delete remote copy.
    filesCopied = FileUtil.copy(ftpFs, renamedData, localFs, workDir, true,
        defaultConf);
    assertTrue("Copying from FTPFileSystem fails", filesCopied);

    // Check if the data was received completely without any corruption.
    dataConsistency = util.checkFiles(localFs, renamedData.getName());
    assertTrue("Invalid or corrupted data recieved from FTP Server!",
        dataConsistency);

    // Delete local copies
    boolean deleteSuccess = localFs.delete(renamedData, true)
View Full Code Here

TOP

Related Classes of org.apache.hadoop.dfs.DFSTestUtil$MyFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.