use of com.adobe.acs.commons.httpcache.store.jcr.impl.visitor.mock.RootNodeMockFactory in project acs-aem-commons by Adobe-Consulting-Services.
the class AllEntryNodesCountVisitorTest method test.
@Test
public void test() throws IOException, RepositoryException {
final AllEntryNodesCountVisitor visitor = new AllEntryNodesCountVisitor(11);
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(10);
final Node rootNode = new RootNodeMockFactory(settings).build();
visitor.visit(rootNode);
assertEquals(10, visitor.getTotalEntryNodeCount());
}
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 testNoEntries.
@Test
public void testNoEntries() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(0);
final Node rootNode = new RootNodeMockFactory(settings).build();
final EntryNodeMapVisitor visitor = getMockedNodeMapVisitor();
visitor.visit(rootNode);
final Map<CacheKey, CacheContent> cache = visitor.getCache();
assertTrue(cache.isEmpty());
}
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 test5BucketDepth.
@Test
public void test5BucketDepth() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(10);
settings.setBucketDepth(5);
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 EntryNodeByStringKeyVisitorTest method testNotPresent.
@Test
public void testNotPresent() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(10);
final Node rootNode = new RootNodeMockFactory(settings).build();
final EntryNodeByStringKeyVisitor visitor = getMockedEntryNodeByStringKeyVisitor("[resourcePath: /content/some/path]", false);
visitor.visit(rootNode);
assertNull(visitor.getCacheContentIfPresent());
}
use of com.adobe.acs.commons.httpcache.store.jcr.impl.visitor.mock.RootNodeMockFactory in project acs-aem-commons by Adobe-Consulting-Services.
the class ExpiredNodesVisitorTest method testEmptyBucketNodes.
@Test
public void testEmptyBucketNodes() throws Exception {
final RootNodeMockFactory.Settings settings = new RootNodeMockFactory.Settings();
settings.setEntryNodeCount(10);
settings.setExpiredEntryNodeCount(20);
settings.setEmptyBucketNodeChainCount(1);
final Node rootNode = new RootNodeMockFactory(settings).build();
final ExpiredNodesVisitor visitor = getMockedExpiredNodesVisitor(8);
visitor.visit(rootNode);
visitor.close();
assertEquals(30, visitor.getEvictionCount());
Mockito.verify(rootNode.getSession(), Mockito.times(4)).save();
}
Aggregations