@AfterClass
  public void afterClass() throws IOException {
    buffer.close();

    deleteUsedFiles(FILE_COUNT);

    storageLocal.delete();
  }
 private void deleteUsedFiles(int filesCount) {
   for (int k = 0; k < filesCount; k++) {
     File file =
         new File(
             storageLocal.getConfiguration().getDirectory() + "/readWriteCacheTest" + k + ".tst");
     if (file.exists()) Assert.assertTrue(file.delete());
   }
 }
  @BeforeClass
  public void beforeClass() throws IOException {

    OGlobalConfiguration.FILE_LOCK.setValue(Boolean.FALSE);

    String buildDirectory = System.getProperty("buildDirectory");
    if (buildDirectory == null) buildDirectory = ".";

    storageLocal =
        (OLocalPaginatedStorage)
            Orient.instance()
                .loadStorage("plocal:" + buildDirectory + "/ReadWriteCacheConcurrentTest");
    storageLocal.create(null);

    prepareFilesForTest(FILE_COUNT);
  }
  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();
  }