Examples of listStatus()


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

    protected int run(CommandLine cmd) throws Exception {
        User user = getUser();
        FileSystem fs = getFileSystem();

        Path dictionaryPath = new Path(directory);
        FileStatus[] files = fs.listStatus(dictionaryPath, new DictionaryPathFilter(this.extension));
        for (FileStatus fileStatus : files) {
            LOGGER.info("Importing dictionary file: " + fileStatus.getPath().toString());
            String conceptName = FilenameUtils.getBaseName(fileStatus.getPath().toString());
            conceptName = URLDecoder.decode(conceptName, "UTF-8");
            Concept concept = ontologyRepository.getConceptByIRI(conceptName);
View Full Code Here

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

        final List<Path> segments = new ArrayList<Path>();
        for (int i = 4; i < args.length; i++) {
          if (args[i].equals("-dir")) {
            Path dir = new Path(args[++i]);
            FileSystem fs = dir.getFileSystem(getConf());
            FileStatus[] fstats = fs.listStatus(dir,
                    HadoopFSUtil.getPassDirectoriesFilter(fs));
            Path[] files = HadoopFSUtil.getPaths(fstats);
            for (Path p : files) {
              segments.add(p);
            }
View Full Code Here

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

    Assert.assertEquals(status2.getModificationTime(), status1.getModificationTime());
    Assert.assertEquals(status2.getOwner(), status1.getOwner());
    Assert.assertEquals(status2.getGroup(), status1.getGroup());
    Assert.assertEquals(status2.getLen(), status1.getLen());

    FileStatus[] stati = fs.listStatus(path.getParent());
    Assert.assertEquals(stati.length, 1);
    Assert.assertEquals(stati[0].getPath().getName(), path.getName());
  }

  private void testWorkingdirectory() throws Exception {
View Full Code Here

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

      // test getVisbileLen
      DFSDataInputStream fin = (DFSDataInputStream)fs.open(file1);
      assertEquals(status.getLen(), fin.getVisibleLength());
     
      // test listStatus on a file
      FileStatus[] stats = fs.listStatus(file1);
      assertEquals(1, stats.length);
      status = stats[0];
      assertTrue(file1 + " should be a file",
          status.isDir() == false);
      assertTrue(status.getBlockSize() == blockSize);
View Full Code Here

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

      // test file status on a directory
      Path dir = new Path("/test/mkdirs");

      // test listStatus on a non-existent file/directory
      stats = fs.listStatus(dir);
      assertEquals(null, stats);
      try {
        status = fs.getFileStatus(dir);
        fail("getFileStatus of non-existent path should fail");
      } catch (FileNotFoundException fe) {
View Full Code Here

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

      assertTrue(dir + " should be zero size ", status.getLen() == 0);
      assertEquals(fs.makeQualified(dir).toString(),
          status.getPath().toString());

      // test listStatus on an empty directory
      stats = fs.listStatus(dir);
      assertEquals(dir + " should be empty", 0, stats.length);
      assertEquals(dir + " should be zero size ",
          0, fs.getContentSummary(dir).getLength());
      assertEquals(dir + " should be zero size using hftp",
          0, hftpfs.getContentSummary(dir).getLength());
View Full Code Here

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

    FileSystem fsHar = new HarFileSystem(destFs);
    String harURIPath = harPath.toUri().getPath();
    Path qualifiedPath = new Path("har://", harURIPath +
      Path.SEPARATOR + harPath.getParent().toUri().getPath());
    fsHar.initialize(qualifiedPath.toUri(), conf);
    FileStatus[] filesInHar = fsHar.listStatus(qualifiedPath);
    if (filesInHar.length == 0) {
      return 0;
    }
    int numUseless = 0;
    for (FileStatus one: filesInHar) {
View Full Code Here

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

    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    inMemFs.delete(testPath, true);
    assertTrue("nothing in the namespace", inMemFs.listStatus(new Path("/")).length == 0);
  }
 
  public void testVerifyChecksum() throws Exception {
    String TEST_ROOT_DIR
    = System.getProperty("test.build.data","build/test/data/work-dir/localfs");
View Full Code Here

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

    LocalFileSystem localFs = FileSystem.getLocal(conf);
    int count = 0;

    final FileStatus itemStatus = localFs.getFileStatus(itemToZip);
    if(itemStatus.isDir()) {
      final FileStatus[] statai = localFs.listStatus(itemToZip);

      // Add a directory entry to the zip file
      final String zipDirName = relativePathForZipEntry(itemToZip.toUri().getPath(), baseName, root);
      final ZipEntry dirZipEntry = new ZipEntry(zipDirName + Path.SEPARATOR_CHAR);
      LOG.info(String.format("Adding directory %s to zip", zipDirName));
View Full Code Here

Examples of org.apache.hadoop.hdfs.DistributedFileSystem.listStatus()

      System.out.println("Address of local minidfscluster: " + cluster.getUnderFilesystemAddress());
      Thread.sleep(10);
      DistributedFileSystem dfs = cluster.getDFSClient();
      dfs.mkdirs(new Path("/1"));
      mkdirs(cluster.getUnderFilesystemAddress() + "/1/2");
      FileStatus[] fs = dfs.listStatus(new Path(TachyonURI.SEPARATOR));
      assert fs.length != 0;
      System.out.println(fs[0].getPath().toUri());
      dfs.close();

      cluster.shutdown();
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.