本文整理汇总了Java中org.apache.hadoop.fs.swift.util.SwiftTestUtils类的典型用法代码示例。如果您正苦于以下问题:Java SwiftTestUtils类的具体用法?Java SwiftTestUtils怎么用?Java SwiftTestUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SwiftTestUtils类属于org.apache.hadoop.fs.swift.util包,在下文中一共展示了SwiftTestUtils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDirectoriesOffRootHaveMatchingFileStatus
import org.apache.hadoop.fs.swift.util.SwiftTestUtils; //导入依赖的package包/类
/**
* 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);
}
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestSwiftFileSystemDirectories.java
示例2: testRenamedConsistence
import org.apache.hadoop.fs.swift.util.SwiftTestUtils; //导入依赖的package包/类
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testRenamedConsistence() throws IOException {
assumeRenameSupported();
describe("verify that overwriting a file with new data doesn't impact" +
" the existing content");
final Path filePath = new Path("/test/home/user/documents/file.txt");
final Path newFilePath = new Path("/test/home/user/files/file.txt");
mkdirs(newFilePath.getParent());
int len = 1024;
byte[] dataset = dataset(len, 'A', 26);
byte[] dataset2 = dataset(len, 'a', 26);
writeDataset(fs, filePath, dataset, len, len, false);
rename(filePath, newFilePath, true, false, true);
SwiftTestUtils.writeAndRead(fs, filePath, dataset2, len, len, false, true);
byte[] dest = readDataset(fs, newFilePath, len);
compareByteArrays(dataset, dest, len);
String reread = readBytesToString(fs, newFilePath, 20);
}
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestSwiftFileSystemRename.java
示例3: testDeleteSmallPartitionedFile
import org.apache.hadoop.fs.swift.util.SwiftTestUtils; //导入依赖的package包/类
@Test(timeout = SWIFT_BULK_IO_TEST_TIMEOUT)
public void testDeleteSmallPartitionedFile() throws Throwable {
final Path path = new Path("/test/testDeleteSmallPartitionedFile");
final int len1 = 1024;
final byte[] src1 = SwiftTestUtils.dataset(len1, 'A', 'Z');
SwiftTestUtils.writeDataset(fs, path, src1, len1, 1024, false);
assertExists("Exists", path);
Path part_0001 = new Path(path, SwiftUtils.partitionFilenameFromNumber(1));
Path part_0002 = new Path(path, SwiftUtils.partitionFilenameFromNumber(2));
String ls = SwiftTestUtils.ls(fs, path);
assertExists("Partition 0001 Exists in " + ls, part_0001);
assertPathDoesNotExist("partition 0002 found under " + ls, part_0002);
assertExists("Partition 0002 Exists in " + ls, part_0001);
fs.delete(path, false);
assertPathDoesNotExist("deleted file still there", path);
ls = SwiftTestUtils.ls(fs, path);
assertPathDoesNotExist("partition 0001 file still under " + ls, part_0001);
}
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestSwiftFileSystemPartitionedUploads.java
示例4: testDeletePartitionedFile
import org.apache.hadoop.fs.swift.util.SwiftTestUtils; //导入依赖的package包/类
@Test(timeout = SWIFT_BULK_IO_TEST_TIMEOUT)
public void testDeletePartitionedFile() throws Throwable {
final Path path = new Path("/test/testDeletePartitionedFile");
SwiftTestUtils.writeDataset(fs, path, data, data.length, 1024, false);
assertExists("Exists", path);
Path part_0001 = new Path(path, SwiftUtils.partitionFilenameFromNumber(1));
Path part_0002 = new Path(path, SwiftUtils.partitionFilenameFromNumber(2));
String ls = SwiftTestUtils.ls(fs, path);
assertExists("Partition 0001 Exists in " + ls, part_0001);
assertExists("Partition 0002 Exists in " + ls, part_0001);
fs.delete(path, false);
assertPathDoesNotExist("deleted file still there", path);
ls = SwiftTestUtils.ls(fs, path);
assertPathDoesNotExist("partition 0001 file still under " + ls, part_0001);
assertPathDoesNotExist("partition 0002 file still under " + ls, part_0002);
}
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestSwiftFileSystemPartitionedUploads.java
示例5: testSeekBigFile
import org.apache.hadoop.fs.swift.util.SwiftTestUtils; //导入依赖的package包/类
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testSeekBigFile() throws Throwable {
Path testSeekFile = new Path(testPath, "bigseekfile.txt");
byte[] block = SwiftTestUtils.dataset(65536, 0, 255);
createFile(testSeekFile, block);
instream = fs.open(testSeekFile);
assertEquals(0, instream.getPos());
//expect that seek to 0 works
instream.seek(0);
int result = instream.read();
assertEquals(0, result);
assertEquals(1, instream.read());
assertEquals(2, instream.read());
//do seek 32KB ahead
instream.seek(32768);
assertEquals("@32768", block[32768], (byte) instream.read());
instream.seek(40000);
assertEquals("@40000", block[40000], (byte) instream.read());
instream.seek(8191);
assertEquals("@8191", block[8191], (byte) instream.read());
instream.seek(0);
assertEquals("@0", 0, (byte) instream.read());
}
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestSeek.java
示例6: testPositionedBulkReadDoesntChangePosition
import org.apache.hadoop.fs.swift.util.SwiftTestUtils; //导入依赖的package包/类
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testPositionedBulkReadDoesntChangePosition() throws Throwable {
Path testSeekFile = new Path(testPath, "bigseekfile.txt");
byte[] block = SwiftTestUtils.dataset(65536, 0, 255);
createFile(testSeekFile, block);
instream = fs.open(testSeekFile);
instream.seek(39999);
assertTrue(-1 != instream.read());
assertEquals (40000, instream.getPos());
byte[] readBuffer = new byte[256];
instream.read(128, readBuffer, 0, readBuffer.length);
//have gone back
assertEquals(40000, instream.getPos());
//content is the same too
assertEquals("@40000", block[40000], (byte) instream.read());
//now verify the picked up data
for (int i = 0; i < 256; i++) {
assertEquals("@" + i, block[i + 128], readBuffer[i]);
}
}
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestSeek.java
注:本文中的org.apache.hadoop.fs.swift.util.SwiftTestUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论