Esempio n. 1
0
 /** Test of isEmpty method, of class Stack. Stack is empty. */
 @Test
 public void testIsEmpty() {
   System.out.println("isEmpty");
   Stack instance = new Stack(1);
   boolean expResult = true;
   boolean result = instance.isEmpty();
   assertEquals(expResult, result);
 }
Esempio n. 2
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);
 }
Esempio n. 3
0
  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;
  }