Esempio n. 1
0
 private OFileClassic createFile(String fileName) {
   OFileClassic fileClassic = new OFileClassic();
   String path =
       storageLocal
           .getVariableParser()
           .resolveVariables(storageLocal.getStoragePath() + File.separator + fileName);
   fileClassic.init(path, storageLocal.getMode());
   return fileClassic;
 }
  private void validateFileContent(byte version, int k) throws IOException {
    String path =
        storageLocal.getConfiguration().getDirectory() + "/readWriteCacheTest" + k + ".tst";

    OFileClassic fileClassic = new OFileClassic();
    fileClassic.init(path, "r");
    fileClassic.open();

    for (int i = 0; i < PAGE_COUNT; i++) {
      byte[] content = new byte[8];
      fileClassic.read(i * (8 + systemOffset) + systemOffset, content, 8);

      Assert.assertEquals(
          content,
          new byte[] {version, 2, 3, seed, 5, 6, (byte) k, (byte) (i & 0xFF)},
          " i = " + i);
    }
    fileClassic.close();
  }