use of com.adobe.acs.commons.httpcache.store.jcr.impl.visitor.mock.RootNodeMockFactory in project acs-aem-commons by Adobe-Consulting-Services.
the class EntryNodeMapVisitorTest method test5entries.
@Test
public void test5entries() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(5);
final Node rootNode = new RootNodeMockFactory(settings).build();
final EntryNodeMapVisitor visitor = getMockedNodeMapVisitor();
visitor.visit(rootNode);
final Map<CacheKey, CacheContent> cache = visitor.getCache();
assertEquals(5, cache.size());
}
use of com.adobe.acs.commons.httpcache.store.jcr.impl.visitor.mock.RootNodeMockFactory in project acs-aem-commons by Adobe-Consulting-Services.
the class EntryNodeMapVisitorTest method test10entries.
@Test
public void test10entries() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(10);
final Node rootNode = new RootNodeMockFactory(settings).build();
final EntryNodeMapVisitor visitor = getMockedNodeMapVisitor();
visitor.visit(rootNode);
final Map<CacheKey, CacheContent> cache = visitor.getCache();
assertEquals(10, cache.size());
}
use of com.adobe.acs.commons.httpcache.store.jcr.impl.visitor.mock.RootNodeMockFactory in project acs-aem-commons by Adobe-Consulting-Services.
the class InvalidateAllNodesVisitorTest method test.
@Test
public void test() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(10);
settings.setExpiredEntryNodeCount(20);
final Node rootNode = new RootNodeMockFactory(settings).build();
final InvalidateAllNodesVisitor visitor = getMockedExpiredNodesVisitor(8);
visitor.visit(rootNode);
visitor.close();
// validate 40 evictions. 10 entries, 20 expired entries, 10 bucket nodes should be removed.
assertEquals(40, visitor.getEvictionCount());
// validate 5 saves. 40 divided by 8 equals 5.
Mockito.verify(rootNode.getSession(), Mockito.times(5)).save();
}
use of com.adobe.acs.commons.httpcache.store.jcr.impl.visitor.mock.RootNodeMockFactory in project acs-aem-commons by Adobe-Consulting-Services.
the class InvalidateAllNodesVisitorTest method testWithEmptyBuckets.
@Test
public void testWithEmptyBuckets() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(10);
settings.setExpiredEntryNodeCount(20);
settings.setEmptyBucketNodeChainCount(2);
final Node rootNode = new RootNodeMockFactory(settings).build();
final InvalidateAllNodesVisitor visitor = getMockedExpiredNodesVisitor(4);
visitor.visit(rootNode);
visitor.close();
// validate 60 evictions. 10 entries, 20 expired entries, 30 bucket nodes should be removed.
assertEquals(60, visitor.getEvictionCount());
Mockito.verify(rootNode.getSession(), Mockito.times(12)).save();
}
use of com.adobe.acs.commons.httpcache.store.jcr.impl.visitor.mock.RootNodeMockFactory in project acs-aem-commons by Adobe-Consulting-Services.
the class TotalCacheSizeVisitorTest method test.
@Test
public void test() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(10);
settings.setExpiredEntryNodeCount(20);
settings.setEnableCacheEntryBinaryContent(true);
final Node rootNode = new RootNodeMockFactory(settings).build();
final TotalCacheSizeVisitor visitor = getMockedExpiredNodesVisitor();
visitor.visit(rootNode);
assertEquals(TEST_FILE_SIZE * 30, visitor.getBytes());
}
Aggregations