org.apache.hadoop.fs.swift.snative.SwiftFileStatus Java Examples

The following examples show how to use org.apache.hadoop.fs.swift.snative.SwiftFileStatus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSwiftFileSystemDirectories.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * test that a dir off root has a listStatus() call that
 * works as expected. and that when a child is added. it changes
 *
 * @throws Exception on failures
 */
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testDirectoriesOffRootHaveMatchingFileStatus() throws Exception {
  Path test = path("/test");
  fs.delete(test, true);
  mkdirs(test);
  assertExists("created test directory", test);
  FileStatus[] statuses = fs.listStatus(test);
  String statusString = statusToString(test.toString(), statuses);
  assertEquals("Wrong number of elements in file status " + statusString, 0,
               statuses.length);

  Path src = path("/test/file");

  //create a zero byte file
  SwiftTestUtils.touch(fs, src);
  //stat it
  statuses = fs.listStatus(test);
  statusString = statusToString(test.toString(), statuses);
  assertEquals("Wrong number of elements in file status " + statusString, 1,
               statuses.length);
  SwiftFileStatus stat = (SwiftFileStatus) statuses[0];
  assertTrue("isDir(): Not a directory: " + stat, stat.isDir());
  extraStatusAssertions(stat);
}
 
Example #2
Source File: TestSwiftFileSystemDirectories.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * test that a dir off root has a listStatus() call that
 * works as expected. and that when a child is added. it changes
 *
 * @throws Exception on failures
 */
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testDirectoriesOffRootHaveMatchingFileStatus() throws Exception {
  Path test = path("/test");
  fs.delete(test, true);
  mkdirs(test);
  assertExists("created test directory", test);
  FileStatus[] statuses = fs.listStatus(test);
  String statusString = statusToString(test.toString(), statuses);
  assertEquals("Wrong number of elements in file status " + statusString, 0,
               statuses.length);

  Path src = path("/test/file");

  //create a zero byte file
  SwiftTestUtils.touch(fs, src);
  //stat it
  statuses = fs.listStatus(test);
  statusString = statusToString(test.toString(), statuses);
  assertEquals("Wrong number of elements in file status " + statusString, 1,
               statuses.length);
  SwiftFileStatus stat = (SwiftFileStatus) statuses[0];
  assertTrue("isDir(): Not a directory: " + stat, stat.isDir());
  extraStatusAssertions(stat);
}
 
Example #3
Source File: TestSwiftFileSystemDirectories.java    From sahara-extra with Apache License 2.0 6 votes vote down vote up
/**
 * test that a dir off root has a listStatus() call that
 * works as expected. and that when a child is added. it changes
 *
 * @throws Exception on failures
 */
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testDirectoriesOffRootHaveMatchingFileStatus() throws Exception {
  Path test = path("/test");
  fs.delete(test, true);
  mkdirs(test);
  assertExists("created test directory", test);
  FileStatus[] statuses = fs.listStatus(test);
  String statusString = statusToString(test.toString(), statuses);
  assertEquals("Wrong number of elements in file status " + statusString, 0,
               statuses.length);

  Path src = path("/test/file");

  //create a directory
  fs.mkdirs(src);
  //stat it
  statuses = fs.listStatus(test);
  statusString = statusToString(test.toString(), statuses);
  assertEquals("Wrong number of elements in file status " + statusString, 1,
               statuses.length);
  SwiftFileStatus stat = (SwiftFileStatus) statuses[0];
  assertTrue("isDir(): Not a directory: " + stat, stat.isDir());
  extraStatusAssertions(stat);
}
 
Example #4
Source File: TestSwiftFileSystemDirectoriesHdfs2.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * make assertions about fields that only appear in
 * FileStatus in HDFS2
 * @param stat status to look at
 */
protected void extraStatusAssertions(SwiftFileStatus stat) {
  //HDFS2
  assertTrue("isDirectory(): Not a directory: " + stat, stat.isDirectory());
  assertFalse("isFile(): declares itself a file: " + stat, stat.isFile());
  assertFalse("isFile(): declares itself a file: " + stat, stat.isSymlink());
}
 
Example #5
Source File: TestSwiftFileSystemDirectoriesHdfs2.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * make assertions about fields that only appear in
 * FileStatus in HDFS2
 * @param stat status to look at
 */
protected void extraStatusAssertions(SwiftFileStatus stat) {
  //HDFS2
  assertTrue("isDirectory(): Not a directory: " + stat, stat.isDirectory());
  assertFalse("isFile(): declares itself a file: " + stat, stat.isFile());
  assertFalse("isFile(): declares itself a file: " + stat, stat.isSymlink());
}
 
Example #6
Source File: TestSwiftFileSystemDirectories.java    From hadoop with Apache License 2.0 votes vote down vote up
/**
 * method for subclasses to add extra assertions
 * @param stat status to look at
 */
protected void extraStatusAssertions(SwiftFileStatus stat) {

}
 
Example #7
Source File: TestSwiftFileSystemDirectories.java    From big-c with Apache License 2.0 votes vote down vote up
/**
 * method for subclasses to add extra assertions
 * @param stat status to look at
 */
protected void extraStatusAssertions(SwiftFileStatus stat) {

}
 
Example #8
Source File: TestSwiftFileSystemDirectories.java    From sahara-extra with Apache License 2.0 votes vote down vote up
/**
 * method for subclasses to add extra assertions
 * @param stat status to look at
 */
protected void extraStatusAssertions(SwiftFileStatus stat) {

}