示例#1
0
  /** store() */
  @Test
  public void store() {
    generateFiles();

    StoreSettings storeSettings = new StoreSettings(null);
    java.io.File fileStoreFolder = storeSettings.getFileStoreFolder();

    dataStore = new DiskDataStore("app1", fileStoreFolder, MAX_SIZE_PER_SESSION);
    int asynchronousQueueCapacity = storeSettings.getAsynchronousQueueCapacity();
    dataStore = new AsynchronousDataStore(dataStore, asynchronousQueueCapacity);

    doTestDataStore();

    dataStore.destroy();
  }
示例#2
0
  /**
   * https://issues.apache.org/jira/browse/WICKET-4478
   *
   * <p>Tests that the folder where a session data is put is partitioned, i.e. it is put in folders
   * which names are automatically calculated on the fly.
   */
  @Test
  public void sessionFolderName() {
    StoreSettings storeSettings = new StoreSettings(null);
    java.io.File fileStoreFolder = storeSettings.getFileStoreFolder();
    DiskDataStore store =
        new DiskDataStore("sessionFolderName", fileStoreFolder, MAX_SIZE_PER_SESSION);

    String sessionId = "abcdefg";
    java.io.File sessionFolder = store.getSessionFolder(sessionId, true);
    String absolutePath = sessionFolder.getAbsolutePath();
    assertTrue(absolutePath.contains("sessionFolderName-filestore"));
    assertTrue(absolutePath.contains("7141"));
    assertTrue(absolutePath.contains("1279"));
    assertTrue(absolutePath.contains("abcdefg"));

    DiskDataStore.SessionEntry sessionEntry = new DiskDataStore.SessionEntry(store, sessionId);
    sessionEntry.unbind();
    // assert that the 'sessionId' folder and the parents two levels up are removed
    assertFalse(sessionFolder.getParentFile().getParentFile().exists());
  }