Search in sources :

Example 1 with MockEventAdmin

use of org.apache.sling.testing.mock.osgi.MockEventAdmin in project sling by apache.

the class ResourceResolverFactoryInitializer method ensureResourceResolverFactoryActivatorDependencies.

/**
     * Ensure dependencies for ResourceResolverFactoryActivator are present.
     * @param bundleContext Bundle context
     */
private static void ensureResourceResolverFactoryActivatorDependencies(BundleContext bundleContext) {
    Dictionary<String, Object> config = new Hashtable<String, Object>();
    config.put("user.mapping", bundleContext.getBundle().getSymbolicName() + "=admin");
    registerServiceIfNotPresent(bundleContext, ServiceUserMapper.class, new ServiceUserMapperImpl(), config);
    registerServiceIfNotPresent(bundleContext, ResourceAccessSecurityTracker.class, new ResourceAccessSecurityTracker());
    registerServiceIfNotPresent(bundleContext, EventAdmin.class, new MockEventAdmin());
}
Also used : MockEventAdmin(org.apache.sling.testing.mock.osgi.MockEventAdmin) Hashtable(java.util.Hashtable) ServiceUserMapperImpl(org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl) ResourceAccessSecurityTracker(org.apache.sling.resourceresolver.impl.ResourceAccessSecurityTracker)

Aggregations

Hashtable (java.util.Hashtable)1 ResourceAccessSecurityTracker (org.apache.sling.resourceresolver.impl.ResourceAccessSecurityTracker)1 ServiceUserMapperImpl (org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl)1 MockEventAdmin (org.apache.sling.testing.mock.osgi.MockEventAdmin)1