use of org.apache.wicket.serialize.ISerializer in project wicket by apache.
the class AsynchronousPageStoreTest method storeReturnsRestoredInstanceOnDistantPageRequest.
/**
* Store returns the restored page instance from wrapped store when there is a distant request
* for it back again.
*
* @throws InterruptedException
*/
@Test
public void storeReturnsRestoredInstanceOnDistantPageRequest() throws InterruptedException {
ISerializer serializer = new DeflatedJavaSerializer("applicationKey");
// ISerializer serializer = new DummySerializer();
IDataStore dataStore = new DiskDataStore("applicationName", new File("./target"), Bytes.bytes(10000l));
// IPageStore pageStore = new DummyPageStore(new File("target/store"));
IPageStore pageStore = spy(new DefaultPageStore(serializer, dataStore, 0));
IPageStore asyncPageStore = new AsynchronousPageStore(pageStore, 100);
int pageId = 0;
String sessionId = "sessionId";
DummyPage page = new DummyPage(pageId, 1000, 1000, sessionId);
asyncPageStore.storePage(sessionId, page);
Thread.sleep(1500);
IManageablePage pageBack = asyncPageStore.getPage(sessionId, pageId);
verify(pageStore, times(1)).getPage(sessionId, pageId);
assertNotEquals(page, pageBack);
}
Aggregations