Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.InMemoryFileSystem$RawInMemoryFileSystem$InMemoryFileStatus


 
  // cehck that the checksum file is deleted for Checksum file system.
  public void testDeletionOfCheckSum() throws Exception {
    Configuration conf = new Configuration();
    URI uri = URI.create("ramfs://mapoutput" + "_tmp");
    InMemoryFileSystem inMemFs =  (InMemoryFileSystem)FileSystem.get(uri, conf);
    Path testPath = new Path("/file_1");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    FSDataOutputStream fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    assertTrue("checksum exists", inMemFs.exists(inMemFs.getChecksumFile(testPath)));
    inMemFs.delete(testPath, true);
    assertTrue("checksum deleted", !inMemFs.exists(inMemFs.getChecksumFile(testPath)));
    // check for directories getting deleted.
    testPath = new Path("/tesdir/file_1");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    testPath = new Path("/testdir/file_2");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    inMemFs.delete(testPath, true);
    assertTrue("nothing in the namespace", inMemFs.listStatus(new Path("/")).length == 0);
  }
View Full Code Here


 
  // cehck that the checksum file is deleted for Checksum file system.
  public void testDeletionOfCheckSum() throws Exception {
    Configuration conf = new Configuration();
    URI uri = URI.create("ramfs://mapoutput" + "_tmp");
    InMemoryFileSystem inMemFs =  (InMemoryFileSystem)FileSystem.get(uri, conf);
    Path testPath = new Path("/file_1");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    FSDataOutputStream fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    assertTrue("checksum exists", inMemFs.exists(inMemFs.getChecksumFile(testPath)));
    inMemFs.delete(testPath, true);
    assertTrue("checksum deleted", !inMemFs.exists(inMemFs.getChecksumFile(testPath)));
    // check for directories getting deleted.
    testPath = new Path("/tesdir/file_1");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    testPath = new Path("/testdir/file_2");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    inMemFs.delete(testPath, true);
    assertTrue("nothing in the namespace", inMemFs.listStatus(new Path("/")).length == 0);
  }
View Full Code Here

 
  // cehck that the checksum file is deleted for Checksum file system.
  public void testDeletionOfCheckSum() throws Exception {
    Configuration conf = new Configuration();
    URI uri = URI.create("ramfs://mapoutput" + "_tmp");
    InMemoryFileSystem inMemFs =  (InMemoryFileSystem)FileSystem.get(uri, conf);
    Path testPath = new Path("/file_1");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    FSDataOutputStream fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    assertTrue("checksum exists", inMemFs.exists(inMemFs.getChecksumFile(testPath)));
    inMemFs.delete(testPath, true);
    assertTrue("checksum deleted", !inMemFs.exists(inMemFs.getChecksumFile(testPath)));
    // check for directories getting deleted.
    testPath = new Path("/tesdir/file_1");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    testPath = new Path("/testdir/file_2");
    inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
    fout = inMemFs.create(testPath);
    fout.write("testing".getBytes());
    fout.close();
    inMemFs.delete(testPath, true);
    // Filesystem is empty
    boolean expectedExceptionThrown = false;
    try {
      inMemFs.listStatus(new Path("/"));
    } catch (FileNotFoundException e) {
      expectedExceptionThrown = true;
    }
    assertTrue("Expected exception not thrown", expectedExceptionThrown);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.InMemoryFileSystem$RawInMemoryFileSystem$InMemoryFileStatus

Copyright © 2018 www.massapicom. 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.