Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FileSystem.mkdirs()


    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Hadoop hadoop = server.get(Hadoop.class);
    FileSystem fs = hadoop.createFileSystem("u", getHadoopConf());
    Assert.assertNotNull(fs);
    fs.mkdirs(new Path("/tmp/foo"));
    hadoop.releaseFileSystem(fs);
    try {
      fs.mkdirs(new Path("/tmp/foo"));
      Assert.fail();
    }
View Full Code Here


    FileSystem fs = hadoop.createFileSystem("u", getHadoopConf());
    Assert.assertNotNull(fs);
    fs.mkdirs(new Path("/tmp/foo"));
    hadoop.releaseFileSystem(fs);
    try {
      fs.mkdirs(new Path("/tmp/foo"));
      Assert.fail();
    }
    catch (IOException ex) {
    }
    catch (Exception ex) {
View Full Code Here

    JobClient jobClient = new JobClient(conf);
    try {
      Path inputDir = new Path(getHadoopTestDir(), "input");
      Path outputDir = new Path(getHadoopTestDir(), "output");

      fs.mkdirs(inputDir);
      Writer writer = new OutputStreamWriter(fs.create(new Path(inputDir, "data.txt")));
      writer.write("a\n");
      writer.write("b\n");
      writer.write("c\n");
      writer.close();
View Full Code Here

      } catch (FileNotFoundException fe) {
        assertTrue(fe.getMessage().startsWith("File does not exist"));
      }
     
      // create the directory
      assertTrue(fs.mkdirs(dir));
      assertTrue(fs.exists(dir));
      System.out.println("Dir : \"" + dir + "\"");

      // test getFileStatus on an empty directory
      status = fs.getFileStatus(dir);
View Full Code Here

       assertEquals(file3.toString(), stats[1].getPath().toString());

      // test iterative listing
      // now dir has 2 entries, create one more
      Path dir3 = fs.makeQualified(new Path(dir, "dir3"));
      fs.mkdirs(dir3);
      dir3 = fs.makeQualified(dir3);
      stats = fs.listStatus(dir);
      assertEquals(dir + " should have three entries", 3, stats.length);
      assertEquals(dir3.toString(), stats[0].getPath().toString());
      assertEquals(file2.toString(), stats[1].getPath().toString());
View Full Code Here

      assertEquals(file2.toString(), stats[1].getPath().toString());
      assertEquals(file3.toString(), stats[2].getPath().toString());

      // now dir has 3 entries, create two more
      Path dir4 = fs.makeQualified(new Path(dir, "dir4"));
      fs.mkdirs(dir4);
      dir4 = fs.makeQualified(dir4);
      Path dir5 = fs.makeQualified(new Path(dir, "dir5"));
      fs.mkdirs(dir5);
      dir5 = fs.makeQualified(dir5);
      stats = fs.listStatus(dir);
View Full Code Here

      // now dir has 3 entries, create two more
      Path dir4 = fs.makeQualified(new Path(dir, "dir4"));
      fs.mkdirs(dir4);
      dir4 = fs.makeQualified(dir4);
      Path dir5 = fs.makeQualified(new Path(dir, "dir5"));
      fs.mkdirs(dir5);
      dir5 = fs.makeQualified(dir5);
      stats = fs.listStatus(dir);
      assertEquals(dir + " should have five entries", 5, stats.length);
      assertEquals(dir3.toString(), stats[0].getPath().toString());
      assertEquals(dir4.toString(), stats[1].getPath().toString());
View Full Code Here

  void runTests(JobConf conf, JobTracker jt) throws IOException {
    FileSystem fs = FileSystem.getLocal(mr.createJobConf());
    Path rootDir = new Path(TEST_ROOT_DIR);
    if(!fs.exists(rootDir)) {
      fs.mkdirs(rootDir);
    }
    fs.setPermission(rootDir,
        new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
    runKillingJobAndValidate(jt, conf);
    runFailingJobAndValidate(jt, conf);
View Full Code Here

        fs.delete(scriptDir, true);
      }

      // Create the directory and set open permissions so that the TT can
      // access.
      fs.mkdirs(scriptDir);
      fs.setPermission(scriptDir, new FsPermission(FsAction.ALL, FsAction.ALL,
          FsAction.ALL));

     // create shell script
     Random rm = new Random();
View Full Code Here

    FileSystem fs = FileSystem.get(conf);
    if (fs.exists(outDir)) {
      fs.delete(outDir, true);
    }
    if (!fs.exists(inDir)) {
      fs.mkdirs(inDir);
    }
    String input = "The quick brown fox\n" + "has many silly\n"
        + "red fox sox\n";
    for (int i = 0; i < numMaps; ++i) {
      DataOutputStream file = fs.create(new Path(inDir, "part-" + i));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.