use of org.apache.hadoop.conf.Configuration in project hadoop by apache.
the class TestRawLocalFileSystemContract method setUp.
@Before
public void setUp() throws Exception {
Configuration conf = new Configuration();
fs = FileSystem.getLocal(conf).getRawFileSystem();
}
use of org.apache.hadoop.conf.Configuration in project hadoop by apache.
the class TestStat method testStat.
@Test(timeout = 10000)
public void testStat() throws Exception {
Assume.assumeTrue(Stat.isAvailable());
FileSystem fs = FileSystem.getLocal(new Configuration());
Path testDir = new Path(getTestRootPath(fs), "teststat");
fs.mkdirs(testDir);
Path sub1 = new Path(testDir, "sub1");
Path sub2 = new Path(testDir, "sub2");
fs.mkdirs(sub1);
fs.createSymlink(sub1, sub2, false);
FileStatus stat1 = new Stat(sub1, 4096l, false, fs).getFileStatus();
FileStatus stat2 = new Stat(sub2, 0, false, fs).getFileStatus();
assertTrue(stat1.isDirectory());
assertFalse(stat2.isDirectory());
fs.delete(testDir, true);
}
use of org.apache.hadoop.conf.Configuration in project hadoop by apache.
the class TestFsShell method testDFSWithInvalidCommmand.
@Test
public void testDFSWithInvalidCommmand() throws Throwable {
FsShell shell = new FsShell(new Configuration());
try (GenericTestUtils.SystemErrCapturer capture = new GenericTestUtils.SystemErrCapturer()) {
ToolRunner.run(shell, new String[] { "dfs -mkdirs" });
Assert.assertThat("FSShell dfs command did not print the error " + "message when invalid command is passed", capture.getOutput(), StringContains.containsString("-mkdirs: Unknown command"));
Assert.assertThat("FSShell dfs command did not print help " + "message when invalid command is passed", capture.getOutput(), StringContains.containsString("Usage: hadoop fs [generic options]"));
}
}
use of org.apache.hadoop.conf.Configuration in project hadoop by apache.
the class TestFsShellCopy method setup.
@BeforeClass
public static void setup() throws Exception {
conf = new Configuration();
shell = new FsShell(conf);
lfs = FileSystem.getLocal(conf);
testRootDir = lfs.makeQualified(new Path(GenericTestUtils.getTempPath("testFsShellCopy")));
lfs.mkdirs(testRootDir);
lfs.setWorkingDirectory(testRootDir);
srcPath = new Path(testRootDir, "srcFile");
dstPath = new Path(testRootDir, "dstFile");
}
use of org.apache.hadoop.conf.Configuration in project hadoop by apache.
the class TestFsShellList method setup.
@BeforeClass
public static void setup() throws Exception {
conf = new Configuration();
shell = new FsShell(conf);
lfs = FileSystem.getLocal(conf);
lfs.setVerifyChecksum(true);
lfs.setWriteChecksum(true);
String root = System.getProperty("test.build.data", "test/build/data");
testRootDir = lfs.makeQualified(new Path(root, "testFsShellList"));
assertThat(lfs.mkdirs(testRootDir), is(true));
}
Aggregations