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

The following examples show how to use org.apache.hadoop.fs.swift.util.SwiftTestUtils#writeTextFile() . 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: TestSwiftFileSystemBlocksize.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testBlocksizeNonZeroForFile() throws Throwable {
  Path smallfile = new Path("/test/smallfile");
  SwiftTestUtils.writeTextFile(fs, smallfile, "blocksize", true);
  createFile(smallfile);
  FileStatus status = getFs().getFileStatus(smallfile);
  assertTrue("Zero blocksize in " + status,
             status.getBlockSize() != 0L);
  assertTrue("Zero replication in " + status,
             status.getReplication() != 0L);
}
 
Example 2
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 testMultiByteFilesAreFiles() throws Exception {
  Path src = path("/test/testMultiByteFilesAreFiles");
  SwiftTestUtils.writeTextFile(fs, src, "testMultiByteFilesAreFiles", false);
  assertIsFile(src);
  FileStatus status = fs.getFileStatus(src);
  assertFalse(status.isDir());
}
 
Example 3
Source File: TestV2LsOperations.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testListFilesRootDir() throws Throwable {
  Path dir = path("/");
  Path child = new Path(dir, "test");
  fs.delete(child, true);
  SwiftTestUtils.writeTextFile(fs, child, "text", false);
  assertListFilesFinds(fs, dir, child, false);
}
 
Example 4
Source File: TestV2LsOperations.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testListFilesSubDir() throws Throwable {
  createTestSubdirs();
  Path dir = path("/test/subdir");
  Path child = new Path(dir, "text.txt");
  SwiftTestUtils.writeTextFile(fs, child, "text", false);
  assertListFilesFinds(fs, dir, child, false);
}
 
Example 5
Source File: TestV2LsOperations.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testListFilesRecursive() throws Throwable {
  createTestSubdirs();
  Path dir = path("/test/recursive");
  Path child = new Path(dir, "hadoop/a/a.txt");
  SwiftTestUtils.writeTextFile(fs, child, "text", false);
  assertListFilesFinds(fs, dir, child, true);
}
 
Example 6
Source File: TestSwiftFileSystemBlocksize.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testBlocksizeNonZeroForFile() throws Throwable {
  Path smallfile = new Path("/test/smallfile");
  SwiftTestUtils.writeTextFile(fs, smallfile, "blocksize", true);
  createFile(smallfile);
  FileStatus status = getFs().getFileStatus(smallfile);
  assertTrue("Zero blocksize in " + status,
             status.getBlockSize() != 0L);
  assertTrue("Zero replication in " + status,
             status.getReplication() != 0L);
}
 
Example 7
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 testMultiByteFilesAreFiles() throws Exception {
  Path src = path("/test/testMultiByteFilesAreFiles");
  SwiftTestUtils.writeTextFile(fs, src, "testMultiByteFilesAreFiles", false);
  assertIsFile(src);
  FileStatus status = fs.getFileStatus(src);
  assertFalse(status.isDir());
}
 
Example 8
Source File: TestV2LsOperations.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testListFilesRootDir() throws Throwable {
  Path dir = path("/");
  Path child = new Path(dir, "test");
  fs.delete(child, true);
  SwiftTestUtils.writeTextFile(fs, child, "text", false);
  assertListFilesFinds(fs, dir, child, false);
}
 
Example 9
Source File: TestV2LsOperations.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testListFilesSubDir() throws Throwable {
  createTestSubdirs();
  Path dir = path("/test/subdir");
  Path child = new Path(dir, "text.txt");
  SwiftTestUtils.writeTextFile(fs, child, "text", false);
  assertListFilesFinds(fs, dir, child, false);
}
 
Example 10
Source File: TestV2LsOperations.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testListFilesRecursive() throws Throwable {
  createTestSubdirs();
  Path dir = path("/test/recursive");
  Path child = new Path(dir, "hadoop/a/a.txt");
  SwiftTestUtils.writeTextFile(fs, child, "text", false);
  assertListFilesFinds(fs, dir, child, true);
}
 
Example 11
Source File: TestSwiftFileSystemBlocksize.java    From sahara-extra with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testBlocksizeNonZeroForFile() throws Throwable {
  Path smallfile = new Path("/test/smallfile");
  SwiftTestUtils.writeTextFile(fs, smallfile, "blocksize", true);
  createFile(smallfile);
  FileStatus status = getFs().getFileStatus(smallfile);
  assertTrue("Zero blocksize in " + status,
             status.getBlockSize() != 0L);
  assertTrue("Zero replication in " + status,
             status.getReplication() != 0L);
}
 
Example 12
Source File: TestSwiftFileSystemDirectories.java    From sahara-extra 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 testMultiByteFilesAreFiles() throws Exception {
  Path src = path("/test/testMultiByteFilesAreFiles");
  SwiftTestUtils.writeTextFile(fs, src, "testMultiByteFilesAreFiles", false);
  assertIsFile(src);
  FileStatus status = fs.getFileStatus(src);
  assertFalse(status.isDir());
}