本文整理汇总了Java中alluxio.client.FileSystemTestUtils类的典型用法代码示例。如果您正苦于以下问题:Java FileSystemTestUtils类的具体用法?Java FileSystemTestUtils怎么用?Java FileSystemTestUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileSystemTestUtils类属于alluxio.client包,在下文中一共展示了FileSystemTestUtils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadDirTest
import alluxio.client.FileSystemTestUtils; //导入依赖的package包/类
@Test
public void loadDirTest() throws IOException, AlluxioException {
FileSystemTestUtils.createByteFile(fs, "/testRoot/testFileA", WriteType.CACHE_THROUGH, 10, 10);
FileSystemTestUtils.createByteFile(fs, "/testRoot/testFileB", WriteType.MUST_CACHE, 10, 10);
int memPercentageA = fs.getStatus(new AlluxioURI("/testRoot/testFileA")).getInMemoryPercentage();
int memPercentageB = fs.getStatus(new AlluxioURI("/testRoot/testFileB")).getInMemoryPercentage();
Assert.assertFalse(memPercentageA == 0);
Assert.assertTrue(memPercentageB == 100);
alluxioInterpreter.interpret("load /testRoot", null);
memPercentageA = fs.getStatus(new AlluxioURI("/testRoot/testFileA")).getInMemoryPercentage();
memPercentageB = fs.getStatus(new AlluxioURI("/testRoot/testFileB")).getInMemoryPercentage();
Assert.assertTrue(memPercentageA == 100);
Assert.assertTrue(memPercentageB == 100);
}
示例2: countTest
import alluxio.client.FileSystemTestUtils; //导入依赖的package包/类
@Test
public void countTest() throws IOException {
FileSystemTestUtils.createByteFile(fs, "/testRoot/testFileA",
WriteType.CACHE_THROUGH, 10, 10);
FileSystemTestUtils.createByteFile(fs, "/testRoot/testDir/testFileB",
WriteType.CACHE_THROUGH, 20, 20);
FileSystemTestUtils.createByteFile(fs, "/testRoot/testFileB",
WriteType.CACHE_THROUGH, 30, 30);
InterpreterResult output = alluxioInterpreter.interpret("count /testRoot", null);
String expected = "";
String format = "%-25s%-25s%-15s\n";
expected += String.format(format, "File Count", "Folder Count", "Total Bytes");
expected += String.format(format, 3, 2, 60);
expected += "\n";
Assert.assertEquals(expected, output.message().get(0).getData());
}
示例3: catTest
import alluxio.client.FileSystemTestUtils; //导入依赖的package包/类
@Test
public void catTest() throws IOException {
FileSystemTestUtils.createByteFile(fs, "/testFile", WriteType.MUST_CACHE,
10, 10);
InterpreterResult output = alluxioInterpreter.interpret("cat /testFile", null);
byte[] expected = BufferUtils.getIncreasingByteArray(10);
Assert.assertEquals(Code.SUCCESS, output.code());
Assert.assertArrayEquals(expected,
output.message().get(0).getData().substring(0, output.message().get(0).getData().length() - 1).getBytes());
}
示例4: loadFileTest
import alluxio.client.FileSystemTestUtils; //导入依赖的package包/类
@Test
public void loadFileTest() throws IOException, AlluxioException {
FileSystemTestUtils.createByteFile(fs, "/testFile", WriteType.CACHE_THROUGH, 10, 10);
int memPercentage = fs.getStatus(new AlluxioURI("/testFile")).getInMemoryPercentage();
Assert.assertFalse(memPercentage == 0);
alluxioInterpreter.interpret("load /testFile", null);
memPercentage = fs.getStatus(new AlluxioURI("/testFile")).getInMemoryPercentage();
Assert.assertTrue(memPercentage == 100);
}
示例5: copyToLocalWithBytes
import alluxio.client.FileSystemTestUtils; //导入依赖的package包/类
private void copyToLocalWithBytes(int bytes) throws IOException {
FileSystemTestUtils.createByteFile(fs, "/testFile", WriteType.MUST_CACHE, 10, 10);
InterpreterResult output = alluxioInterpreter.interpret("copyToLocal /testFile " +
mLocalAlluxioCluster.getAlluxioHome() + "/testFile", null);
Assert.assertEquals(
"Copied /testFile to " + mLocalAlluxioCluster.getAlluxioHome() + "/testFile\n\n",
output.message().get(0).getData());
fileReadTest("/testFile", 10);
}
示例6: lsTest
import alluxio.client.FileSystemTestUtils; //导入依赖的package包/类
@Test
public void lsTest() throws IOException, AlluxioException {
URIStatus[] files = new URIStatus[3];
FileSystemTestUtils.createByteFile(fs, "/testRoot/testFileA",
WriteType.MUST_CACHE, 10, 10);
FileSystemTestUtils.createByteFile(fs, "/testRoot/testDir/testFileB",
WriteType.MUST_CACHE, 20, 20);
FileSystemTestUtils.createByteFile(fs, "/testRoot/testFileC",
WriteType.THROUGH, 30, 30);
files[0] = fs.getStatus(new AlluxioURI("/testRoot/testFileA"));
files[1] = fs.getStatus(new AlluxioURI("/testRoot/testDir"));
files[2] = fs.getStatus(new AlluxioURI("/testRoot/testFileC"));
InterpreterResult output = alluxioInterpreter.interpret("ls /testRoot", null);
String expected = "";
String format = "%-10s%-25s%-15s%-5s\n";
expected += String.format(format, FormatUtils.getSizeFromBytes(10),
CommandUtils.convertMsToDate(files[0].getCreationTimeMs()), "In Memory", "/testRoot/testFileA");
expected += String.format(format, FormatUtils.getSizeFromBytes(0),
CommandUtils.convertMsToDate(files[1].getCreationTimeMs()), "", "/testRoot/testDir");
expected += String.format(format, FormatUtils.getSizeFromBytes(30),
CommandUtils.convertMsToDate(files[2].getCreationTimeMs()), "Not In Memory",
"/testRoot/testFileC");
expected += "\n";
Assert.assertEquals(Code.SUCCESS, output.code());
Assert.assertEquals(expected, output.message().get(0).getData());
}
示例7: lsRecursiveTest
import alluxio.client.FileSystemTestUtils; //导入依赖的package包/类
@Test
public void lsRecursiveTest() throws IOException, AlluxioException {
URIStatus[] files = new URIStatus[4];
FileSystemTestUtils.createByteFile(fs, "/testRoot/testFileA",
WriteType.MUST_CACHE, 10, 10);
FileSystemTestUtils.createByteFile(fs, "/testRoot/testDir/testFileB",
WriteType.MUST_CACHE, 20, 20);
FileSystemTestUtils.createByteFile(fs, "/testRoot/testFileC",
WriteType.THROUGH, 30, 30);
files[0] = fs.getStatus(new AlluxioURI("/testRoot/testFileA"));
files[1] = fs.getStatus(new AlluxioURI("/testRoot/testDir"));
files[2] = fs.getStatus(new AlluxioURI("/testRoot/testDir/testFileB"));
files[3] = fs.getStatus(new AlluxioURI("/testRoot/testFileC"));
InterpreterResult output = alluxioInterpreter.interpret("ls -R /testRoot", null);
String expected = "";
String format = "%-10s%-25s%-15s%-5s\n";
expected +=
String.format(format, FormatUtils.getSizeFromBytes(10),
CommandUtils.convertMsToDate(files[0].getCreationTimeMs()), "In Memory",
"/testRoot/testFileA");
expected +=
String.format(format, FormatUtils.getSizeFromBytes(0),
CommandUtils.convertMsToDate(files[1].getCreationTimeMs()), "", "/testRoot/testDir");
expected +=
String.format(format, FormatUtils.getSizeFromBytes(20),
CommandUtils.convertMsToDate(files[2].getCreationTimeMs()), "In Memory",
"/testRoot/testDir/testFileB");
expected +=
String.format(format, FormatUtils.getSizeFromBytes(30),
CommandUtils.convertMsToDate(files[3].getCreationTimeMs()), "Not In Memory",
"/testRoot/testFileC");
expected += "\n";
Assert.assertEquals(expected, output.message().get(0).getData());
}