Search in sources :

Example 41 with ResourceResolverFactory

use of org.apache.sling.api.resource.ResourceResolverFactory in project sling by apache.

the class ScriptingResourceResolverProviderImplTest method setUp.

@Before
public void setUp() throws LoginException {
    delegates = Collections.synchronizedSet(new HashSet<ResourceResolver>());
    ResourceResolverFactory rrf = mock(ResourceResolverFactory.class);
    when(rrf.getServiceResourceResolver(null)).thenAnswer(new Answer<ResourceResolver>() {

        @Override
        public ResourceResolver answer(InvocationOnMock invocation) throws Throwable {
            ResourceResolver delegate = getMockedRR();
            delegates.add(delegate);
            return delegate;
        }
    });
    scriptingResourceResolverFactory = new ScriptingResourceResolverProviderImpl();
    Whitebox.setInternalState(scriptingResourceResolverFactory, "rrf", rrf);
}
Also used : ResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) HashSet(java.util.HashSet) Before(org.junit.Before)

Aggregations

ResourceResolverFactory (org.apache.sling.api.resource.ResourceResolverFactory)41 Test (org.junit.Test)26 SlingRepository (org.apache.sling.jcr.api.SlingRepository)22 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)16 DistributionRequest (org.apache.sling.distribution.DistributionRequest)13 DefaultDistributionLog (org.apache.sling.distribution.log.impl.DefaultDistributionLog)12 DistributionPackageImporter (org.apache.sling.distribution.packaging.DistributionPackageImporter)12 Before (org.junit.Before)10 Event (javax.jcr.observation.Event)8 Scheduler (org.apache.sling.commons.scheduler.Scheduler)8 DistributionEventFactory (org.apache.sling.distribution.event.impl.DistributionEventFactory)8 DistributionPackageExporter (org.apache.sling.distribution.packaging.DistributionPackageExporter)8 DistributionQueueProvider (org.apache.sling.distribution.queue.DistributionQueueProvider)8 DistributionQueueDispatchingStrategy (org.apache.sling.distribution.queue.impl.DistributionQueueDispatchingStrategy)8 DistributionPackage (org.apache.sling.distribution.packaging.DistributionPackage)7 SimpleDistributionQueue (org.apache.sling.distribution.queue.impl.simple.SimpleDistributionQueue)7 InvocationOnMock (org.mockito.invocation.InvocationOnMock)7 DistributionPackageInfo (org.apache.sling.distribution.packaging.DistributionPackageInfo)6 DistributionQueueItemStatus (org.apache.sling.distribution.queue.DistributionQueueItemStatus)6 Resource (org.apache.sling.api.resource.Resource)5