Search in sources :

Example 61 with Configuration

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();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) Before(org.junit.Before)

Example 62 with Configuration

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);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) Test(org.junit.Test)

Example 63 with Configuration

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]"));
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) GenericTestUtils(org.apache.hadoop.test.GenericTestUtils) Test(org.junit.Test)

Example 64 with Configuration

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");
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) BeforeClass(org.junit.BeforeClass)

Example 65 with Configuration

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));
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) BeforeClass(org.junit.BeforeClass)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)5973 Test (org.junit.Test)3243 Path (org.apache.hadoop.fs.Path)1602 FileSystem (org.apache.hadoop.fs.FileSystem)903 IOException (java.io.IOException)850 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)727 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)517 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)502 File (java.io.File)499 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)388 ArrayList (java.util.ArrayList)360 URI (java.net.URI)319 BeforeClass (org.junit.BeforeClass)275 Job (org.apache.hadoop.mapreduce.Job)272 Before (org.junit.Before)264 DistributedFileSystem (org.apache.hadoop.hdfs.DistributedFileSystem)219 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)203 HashMap (java.util.HashMap)192 FileStatus (org.apache.hadoop.fs.FileStatus)190 Properties (java.util.Properties)187