Search in sources :

Example 26 with EventAdmin

use of org.osgi.service.event.EventAdmin in project sling by apache.

the class ResourceProviderTrackerTest method prepare.

@Before
public void prepare() throws Exception {
    BundleContext bundleContext = MockOsgi.newBundleContext();
    fixture = new Fixture(bundleContext);
    EventAdmin eventAdmin = mock(EventAdmin.class);
    @SuppressWarnings("unchecked") ResourceProvider<Object> rp = mock(ResourceProvider.class);
    @SuppressWarnings("unchecked") ResourceProvider<Object> rp2 = mock(ResourceProvider.class);
    @SuppressWarnings("unchecked") ResourceProvider<Object> rp3 = mock(ResourceProvider.class);
    fixture.registerResourceProvider(rp, "/", AuthType.no);
    rp2Info = fixture.registerResourceProvider(rp2, "/path", AuthType.lazy);
    fixture.registerResourceProvider(rp3, "invalid", AuthType.no);
    tracker = new ResourceProviderTracker();
    tracker.setObservationReporterGenerator(new SimpleObservationReporterGenerator(new NoDothingObservationReporter()));
    tracker.activate(bundleContext, eventAdmin, new DoNothingChangeListener());
}
Also used : EventAdmin(org.osgi.service.event.EventAdmin) Fixture(org.apache.sling.resourceresolver.impl.Fixture) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Aggregations

EventAdmin (org.osgi.service.event.EventAdmin)26 Event (org.osgi.service.event.Event)18 Hashtable (java.util.Hashtable)11 Test (org.junit.Test)7 Adaption (org.apache.sling.adapter.Adaption)4 BundleContext (org.osgi.framework.BundleContext)4 HashMap (java.util.HashMap)3 Fixture (org.apache.sling.resourceresolver.impl.Fixture)3 ServiceReference (org.osgi.framework.ServiceReference)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 FeatureEvent (org.apache.karaf.features.FeatureEvent)2 RepositoryEvent (org.apache.karaf.features.RepositoryEvent)2 AdapterFactoryDescriptor (org.apache.sling.adapter.internal.AdapterFactoryDescriptor)2 AdapterFactoryDescriptorMap (org.apache.sling.adapter.internal.AdapterFactoryDescriptorMap)2 ChangeListener (org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker.ChangeListener)2 Before (org.junit.Before)2 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1 Date (java.util.Date)1 Dictionary (java.util.Dictionary)1 EventObject (java.util.EventObject)1