当前位置: 首页>>代码示例>>Java>>正文


Java FileSystemTestUtils类代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:18,代码来源:AlluxioInterpreterTest.java

示例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());
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:19,代码来源:AlluxioInterpreterTest.java

示例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());
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:13,代码来源:AlluxioInterpreterTest.java

示例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);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:13,代码来源:AlluxioInterpreterTest.java

示例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);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:12,代码来源:AlluxioInterpreterTest.java

示例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());
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:32,代码来源:AlluxioInterpreterTest.java

示例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());
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:40,代码来源:AlluxioInterpreterTest.java


注:本文中的alluxio.client.FileSystemTestUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。