Search in sources :

Example 21 with Find

use of org.apache.hadoop.fs.shell.find.Find in project hadoop by apache.

the class TestFind method processOptionsPrint0.

// check -print0 is handled correctly
@Test
public void processOptionsPrint0() throws IOException {
    Find find = new Find();
    find.setConf(conf);
    String args = "path -print0";
    String expected = "Print0-Print(;)";
    find.processOptions(getArgs(args));
    Expression expression = find.getRootExpression();
    assertEquals(expected, expression.toString());
}
Also used : BaseExpression(org.apache.hadoop.fs.shell.find.BaseExpression) Expression(org.apache.hadoop.fs.shell.find.Expression) Find(org.apache.hadoop.fs.shell.find.Find) Test(org.junit.Test)

Example 22 with Find

use of org.apache.hadoop.fs.shell.find.Find in project hadoop by apache.

the class TestFind method processOptionsPrint.

// check -print is handled correctly
@Test
public void processOptionsPrint() throws IOException {
    Find find = new Find();
    find.setConf(conf);
    String args = "path -print";
    String expected = "Print(;)";
    find.processOptions(getArgs(args));
    Expression expression = find.getRootExpression();
    assertEquals(expected, expression.toString());
}
Also used : BaseExpression(org.apache.hadoop.fs.shell.find.BaseExpression) Expression(org.apache.hadoop.fs.shell.find.Expression) Find(org.apache.hadoop.fs.shell.find.Find) Test(org.junit.Test)

Example 23 with Find

use of org.apache.hadoop.fs.shell.find.Find in project hadoop by apache.

the class TestFind method processOptionsNoExpression.

// check print is used as the default expression
@Test
public void processOptionsNoExpression() throws IOException {
    Find find = new Find();
    find.setConf(conf);
    String args = "path";
    String expected = "Print(;)";
    find.processOptions(getArgs(args));
    Expression expression = find.getRootExpression();
    assertEquals(expected, expression.toString());
}
Also used : BaseExpression(org.apache.hadoop.fs.shell.find.BaseExpression) Expression(org.apache.hadoop.fs.shell.find.Expression) Find(org.apache.hadoop.fs.shell.find.Find) Test(org.junit.Test)

Example 24 with Find

use of org.apache.hadoop.fs.shell.find.Find in project hadoop by apache.

the class TestFind method processOptionsFollowLinkFollowArgLink.

// check follow arg link option is recognized
@Test
public void processOptionsFollowLinkFollowArgLink() throws IOException {
    Find find = new Find();
    String args = "-L -H path";
    find.processOptions(getArgs(args));
    assertTrue(find.getOptions().isFollowLink());
    // follow link option takes precedence over follow arg link
    assertFalse(find.getOptions().isFollowArgLink());
}
Also used : Find(org.apache.hadoop.fs.shell.find.Find) Test(org.junit.Test)

Aggregations

Find (org.apache.hadoop.fs.shell.find.Find)24 Test (org.junit.Test)24 BaseExpression (org.apache.hadoop.fs.shell.find.BaseExpression)17 Expression (org.apache.hadoop.fs.shell.find.Expression)17 PrintStream (java.io.PrintStream)9 PathData (org.apache.hadoop.fs.shell.PathData)9 InOrder (org.mockito.InOrder)9 IOException (java.io.IOException)2