Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FileContext.listStatus()


    String logicalHost = fs.getUri().getHost();
    Configuration haClientConf = fs.getConf();
   
    FileContext fc = FileContext.getFileContext(haClientConf);
    Path root = new Path("/");
    fc.listStatus(root);
    fc.listStatus(fc.makeQualified(root));
    fc.getDefaultFileSystem().getCanonicalServiceName();

    // Ensure that the logical hostname was never resolved.
    Mockito.verify(spyNS, Mockito.never()).lookupAllHostAddr(Mockito.eq(logicalHost));
View Full Code Here


    Configuration haClientConf = fs.getConf();
   
    FileContext fc = FileContext.getFileContext(haClientConf);
    Path root = new Path("/");
    fc.listStatus(root);
    fc.listStatus(fc.makeQualified(root));
    fc.getDefaultFileSystem().getCanonicalServiceName();

    // Ensure that the logical hostname was never resolved.
    Mockito.verify(spyNS, Mockito.never()).lookupAllHostAddr(Mockito.eq(logicalHost));
  }
View Full Code Here

      assertTrue(status.getLen() == fileSize);
      assertEquals(file1.makeQualified(fs.getUri(),
          fs.getWorkingDirectory()).toString(),
          status.getPath().toString());
     
      Iterator<FileStatus> itor = fc.listStatus(file1);
      status = itor.next();
      assertEquals(stats[0], status);
      assertTrue(file1 + " should be a file",
          status.isDirectory() == false);
View Full Code Here

      } catch (FileNotFoundException fe) {
        assertTrue(fe.getMessage().equals("File " + dir + " does not exist."));
      }
     
      try {
        itor = fc.listStatus(dir);
        fail("listStatus of non-existent path should fail");
      } catch (FileNotFoundException fe) {
        assertTrue(fe.getMessage().equals("File " + dir + " does not exist."));
      }
      try {
View Full Code Here

      assertEquals(dir + " should be zero size ",
          0, fs.getContentSummary(dir).getLength());
      assertEquals(dir + " should be zero size using hftp",
          0, hftpfs.getContentSummary(dir).getLength());
     
      itor = fc.listStatus(dir);
      assertFalse(dir + " should be empty", itor.hasNext());

      // create another file that is smaller than a block.
      //
      Path file2 = new Path(dir, "filestatus2.dat");
View Full Code Here

      stats = fs.listStatus(dir);
      assertEquals(dir + " should have two entries", 2, stats.length);
      assertEquals(file2.toString(), stats[0].getPath().toString());
      assertEquals(file3.toString(), stats[1].getPath().toString());

      itor = fc.listStatus(dir);
      assertEquals(file2.toString(), itor.next().getPath().toString());
      assertEquals(file3.toString(), itor.next().getPath().toString());
      assertFalse(itor.hasNext());

      // test iterative listing
View Full Code Here

      assertEquals(dir + " should have three entries", 3, stats.length);
      assertEquals(dir3.toString(), stats[0].getPath().toString());
      assertEquals(file2.toString(), stats[1].getPath().toString());
      assertEquals(file3.toString(), stats[2].getPath().toString());

      itor = fc.listStatus(dir);
      assertEquals(dir3.toString(), itor.next().getPath().toString());
      assertEquals(file2.toString(), itor.next().getPath().toString());
      assertEquals(file3.toString(), itor.next().getPath().toString());
      assertFalse(itor.hasNext());
View Full Code Here

      assertEquals(dir4.toString(), stats[1].getPath().toString());
      assertEquals(dir5.toString(), stats[2].getPath().toString());
      assertEquals(file2.toString(), stats[3].getPath().toString());
      assertEquals(file3.toString(), stats[4].getPath().toString());
     
      itor = fc.listStatus(dir);
      assertEquals(dir3.toString(), itor.next().getPath().toString());
      assertEquals(dir4.toString(), itor.next().getPath().toString());
      assertEquals(dir5.toString(), itor.next().getPath().toString());
      assertEquals(file2.toString(), itor.next().getPath().toString());
      assertEquals(file3.toString(), itor.next().getPath().toString());
View Full Code Here

    String logicalHost = fs.getUri().getHost();
    Configuration haClientConf = fs.getConf();
   
    FileContext fc = FileContext.getFileContext(haClientConf);
    Path root = new Path("/");
    fc.listStatus(root);
    fc.listStatus(fc.makeQualified(root));
    fc.getDefaultFileSystem().getCanonicalServiceName();

    // Ensure that the logical hostname was never resolved.
    Mockito.verify(spyNS, Mockito.never()).lookupAllHostAddr(Mockito.eq(logicalHost));
View Full Code Here

    Configuration haClientConf = fs.getConf();
   
    FileContext fc = FileContext.getFileContext(haClientConf);
    Path root = new Path("/");
    fc.listStatus(root);
    fc.listStatus(fc.makeQualified(root));
    fc.getDefaultFileSystem().getCanonicalServiceName();

    // Ensure that the logical hostname was never resolved.
    Mockito.verify(spyNS, Mockito.never()).lookupAllHostAddr(Mockito.eq(logicalHost));
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.