Example #1
0
 /** Test of push and pop method, of class Stack. */
 @Test
 public void testPop() {
   System.out.println("pop");
   Stack instance = new Stack(1);
   instance.push(1);
   int expResult = 1;
   int result = instance.pop();
   assertEquals(expResult, result);
 }
  private boolean checkDirectoryPermissions(
      FileSystem fs, String targetBase, FsPermission sourcePerm) throws IOException {
    Path base = new Path(targetBase);

    Stack<Path> stack = new Stack<Path>();
    stack.push(base);
    while (!stack.isEmpty()) {
      Path file = stack.pop();
      if (!fs.exists(file)) continue;
      FileStatus[] fStatus = fs.listStatus(file);
      if (fStatus == null || fStatus.length == 0) continue;

      for (FileStatus status : fStatus) {
        if (status.isDirectory()) {
          stack.push(status.getPath());
          Assert.assertEquals(status.getPermission(), sourcePerm);
        }
      }
    }
    return true;
  }