Examples of DirectoryListing


Examples of org.apache.hadoop.hdfs.protocol.DirectoryListing

      // insert one put to ensure a minimal size
      Put p = new Put(sb);
      p.add(sb, sb, sb);
      h.put(p);

      DirectoryListing dl = dfs.getClient().listPaths(rootDir, HdfsFileStatus.EMPTY_NAME);
      HdfsFileStatus[] hfs = dl.getPartialListing();

      // As we wrote a put, we should have at least one log file.
      Assert.assertTrue(hfs.length >= 1);
      for (HdfsFileStatus hf : hfs) {
        LOG.info("Log file found: " + hf.getLocalName() + " in " + rootDir);
View Full Code Here

Examples of org.evolizer.core.util.resourcehandling.DirectoryListing

 
  @Test
  public void testDirectoryListing() {
    try {
      String path = EvolizerCorePlugin.getAbsoluteFSPath("test_data/folder");
      DirectoryListing content = new DirectoryListing(new File(path), new IPredicate<File>() {
 
        public boolean evaluate(File f) {
          return f.getName().endsWith(".txt");
        }
       
      });
     
      Iterator<File> fileIterator = content.iterator();
      assertEquals(path + "afile.txt", fileIterator.next().getAbsolutePath());
      assertEquals(path + "subfolder/cfile.txt", fileIterator.next().getAbsolutePath());
      assertFalse(fileIterator.hasNext());
     
      content = new DirectoryListing(new File(path), new IPredicate<File>() {
       
        public boolean evaluate(File f) {
          return f.getName().endsWith(".egf");
        }
       
      });
     
      fileIterator = content.iterator();
      assertEquals(path + "subfolder/bfile.egf", fileIterator.next().getAbsolutePath());
      assertFalse(fileIterator.hasNext());
    } catch (IOException e) {
      fail();
      e.printStackTrace();
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.