use of org.apache.wicket.settings.StoreSettings in project wicket by apache.
the class DiskDataStoreTest method sessionFolderName.
/**
* https://issues.apache.org/jira/browse/WICKET-4478
*
* 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());
}
use of org.apache.wicket.settings.StoreSettings in project wicket by apache.
the class DefaultPageManagerProvider method apply.
@Override
public IPageManager apply(IPageManagerContext pageManagerContext) {
IDataStore dataStore = newDataStore();
StoreSettings storeSettings = getStoreSettings();
IPageStore pageStore;
if (dataStore.canBeAsynchronous() && storeSettings.isAsynchronous()) {
int capacity = storeSettings.getAsynchronousQueueCapacity();
dataStore = new AsynchronousDataStore(dataStore, capacity);
pageStore = newPageStore(dataStore);
if (pageStore.canBeAsynchronous()) {
pageStore = new AsynchronousPageStore(pageStore, capacity);
}
} else {
pageStore = newPageStore(dataStore);
}
return new PageStoreManager(application.getName(), pageStore, pageManagerContext);
}
use of org.apache.wicket.settings.StoreSettings in project wicket by apache.
the class DebugPageManagerProvider method newDataStore.
@Override
protected IDataStore newDataStore() {
StoreSettings storeSettings = application.getStoreSettings();
File fileStoreFolder = storeSettings.getFileStoreFolder();
Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
dataStore = new DebugDiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession);
return dataStore;
}
use of org.apache.wicket.settings.StoreSettings in project wicket by apache.
the class DiskDataStoreTest method store.
/**
* 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();
}
use of org.apache.wicket.settings.StoreSettings in project wicket by apache.
the class DefaultPageManagerProvider method newDataStore.
protected IDataStore newDataStore() {
StoreSettings storeSettings = getStoreSettings();
Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
File fileStoreFolder = storeSettings.getFileStoreFolder();
return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession);
}
Aggregations