Java Code Examples for org.apache.hadoop.fs.swift.util.SwiftTestUtils#assertIsDirectory()

The following examples show how to use org.apache.hadoop.fs.swift.util.SwiftTestUtils#assertIsDirectory() . 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 5 votes vote down vote up
/**
 * Asserts that a zero byte file has a status of file and not
 * directory or symlink
 *
 * @throws Exception on failures
 */
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testZeroByteFilesAreDirectories() throws Exception {
  Path src = path("/test/testZeroByteFilesAreFiles");
  //create a zero byte file
  SwiftTestUtils.touch(fs, src);
  SwiftTestUtils.assertIsDirectory(fs, src);
}
 
Example 2
Source File: TestSwiftFileSystemBlockLocation.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLocateDirectory() throws Throwable {
  describe("verify that locating a directory is an error");
  createFile(path("/test/filename"));
  FileStatus status = fs.getFileStatus(path("/test"));
  LOG.info("Filesystem is " + fs + "; target is " + status);
  SwiftTestUtils.assertIsDirectory(status);
  BlockLocation[] locations;
  locations = getFs().getFileBlockLocations(status,
                                            0,
                                            1);
  assertEmptyBlockLocations(locations);
}
 
Example 3
Source File: TestSwiftFileSystemBlockLocation.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLocateRootDirectory() throws Throwable {
  describe("verify that locating the root directory is an error");
  FileStatus status = fs.getFileStatus(path("/"));
  SwiftTestUtils.assertIsDirectory(status);
  BlockLocation[] locations;
  locations = getFs().getFileBlockLocations(status,
                                            0,
                                            1);
  assertEmptyBlockLocations(locations);
}
 
Example 4
Source File: TestSwiftFileSystemDirectories.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Asserts that a zero byte file has a status of file and not
 * directory or symlink
 *
 * @throws Exception on failures
 */
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testZeroByteFilesAreDirectories() throws Exception {
  Path src = path("/test/testZeroByteFilesAreFiles");
  //create a zero byte file
  SwiftTestUtils.touch(fs, src);
  SwiftTestUtils.assertIsDirectory(fs, src);
}
 
Example 5
Source File: TestSwiftFileSystemBlockLocation.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLocateDirectory() throws Throwable {
  describe("verify that locating a directory is an error");
  createFile(path("/test/filename"));
  FileStatus status = fs.getFileStatus(path("/test"));
  LOG.info("Filesystem is " + fs + "; target is " + status);
  SwiftTestUtils.assertIsDirectory(status);
  BlockLocation[] locations;
  locations = getFs().getFileBlockLocations(status,
                                            0,
                                            1);
  assertEmptyBlockLocations(locations);
}
 
Example 6
Source File: TestSwiftFileSystemBlockLocation.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLocateRootDirectory() throws Throwable {
  describe("verify that locating the root directory is an error");
  FileStatus status = fs.getFileStatus(path("/"));
  SwiftTestUtils.assertIsDirectory(status);
  BlockLocation[] locations;
  locations = getFs().getFileBlockLocations(status,
                                            0,
                                            1);
  assertEmptyBlockLocations(locations);
}
 
Example 7
Source File: TestSwiftFileSystemRename.java    From sahara-extra with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testRenamePseudoDir() throws Throwable {
  assumeRenameSupported();

  // create file directory (don't create directory file)
  SwiftRestClient client;
  client = SwiftRestClient.getInstance(fs.getUri(), fs.getConf());
  SwiftObjectPath path = SwiftObjectPath.fromPath(fs.getUri(), new Path("/test/olddir/file"));
  client.upload(path, new ByteArrayInputStream(new byte[0]), 0);

  rename(path("/test/olddir"), path("/test/newdir"), true, false, true);
  SwiftTestUtils.assertIsDirectory(fs, path("/test/newdir"));
  assertIsFile(path("/test/newdir/file"));
}
 
Example 8
Source File: TestSwiftFileSystemBlockLocation.java    From sahara-extra with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLocateDirectory() throws Throwable {
  describe("verify that locating a directory is an error");
  createFile(path("/test/filename"));
  FileStatus status = fs.getFileStatus(path("/test"));
  LOG.info("Filesystem is " + fs + "; target is " + status);
  SwiftTestUtils.assertIsDirectory(status);
  BlockLocation[] locations;
  locations = getFs().getFileBlockLocations(status,
                                            0,
                                            1);
  assertEmptyBlockLocations(locations);
}
 
Example 9
Source File: TestSwiftFileSystemBlockLocation.java    From sahara-extra with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLocateRootDirectory() throws Throwable {
  describe("verify that locating the root directory is an error");
  FileStatus status = fs.getFileStatus(path("/"));
  SwiftTestUtils.assertIsDirectory(status);
  BlockLocation[] locations;
  locations = getFs().getFileBlockLocations(status,
                                            0,
                                            1);
  assertEmptyBlockLocations(locations);
}