Search in sources :

Example 11 with DynamicClassLoaderManager

use of org.apache.sling.commons.classloader.DynamicClassLoaderManager in project acs-aem-commons by Adobe-Consulting-Services.

the class EntryNodeMapVisitorTest method getMockedNodeMapVisitor.

private EntryNodeMapVisitor getMockedNodeMapVisitor() throws Exception {
    final DynamicClassLoaderManager dclm = mock(DynamicClassLoaderManager.class);
    final EntryNodeMapVisitor visitor = new EntryNodeMapVisitor(11, dclm);
    final EntryNodeMapVisitor spy = spy(visitor);
    when(spy, "getCacheContent", any(Node.class)).thenAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            return generateRandomCacheContent();
        }
    });
    when(spy, "getCacheKey", any(Node.class)).thenAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            return generateRandomCacheKey();
        }
    });
    return spy;
}
Also used : InvocationOnMock(org.mockito.invocation.InvocationOnMock) DynamicClassLoaderManager(org.apache.sling.commons.classloader.DynamicClassLoaderManager)

Aggregations

DynamicClassLoaderManager (org.apache.sling.commons.classloader.DynamicClassLoaderManager)11 CacheKey (com.adobe.acs.commons.httpcache.keys.CacheKey)2 SlingBindings (org.apache.sling.api.scripting.SlingBindings)2 SlingScriptHelper (org.apache.sling.api.scripting.SlingScriptHelper)2 HttpCacheConfig (com.adobe.acs.commons.httpcache.config.HttpCacheConfig)1 URL (java.net.URL)1 Item (javax.jcr.Item)1 HelperData (org.apache.sling.jcr.resource.internal.HelperData)1 SlingContextFactory (org.apache.sling.scripting.javascript.helper.SlingContextFactory)1 SlingWrapFactory (org.apache.sling.scripting.javascript.helper.SlingWrapFactory)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 Context (org.mozilla.javascript.Context)1 ContextFactory (org.mozilla.javascript.ContextFactory)1 Bundle (org.osgi.framework.Bundle)1 BundleContext (org.osgi.framework.BundleContext)1 ComponentContext (org.osgi.service.component.ComponentContext)1 Activate (org.osgi.service.component.annotations.Activate)1