use of org.apache.sling.spi.resource.provider.ProviderContext in project sling by apache.
the class JcrResourceListenerScalabilityTest method setUp.
@SuppressWarnings("deprecation")
@Before
public void setUp() throws RepositoryException, InvalidSyntaxException {
ObservationManager observationManager = mock(ObservationManager.class);
Workspace workspace = mock(Workspace.class);
when(workspace.getObservationManager()).thenReturn(observationManager);
Session session = mock(Session.class);
when(session.getWorkspace()).thenReturn(workspace);
SlingRepository repository = mock(SlingRepository.class);
when(repository.loginAdministrative(null)).thenReturn(session);
final ProviderContext ctx = new SimpleProviderContext();
this.config = new JcrListenerBaseConfig(ctx.getObservationReporter(), RepositoryUtil.getRepository());
jcrResourceListener = new JcrResourceListener(this.config, ctx.getObservationReporter().getObserverConfigurations().get(0));
Event event = mock(MockEvent.class);
events = mock(EventIterator.class);
when(events.hasNext()).thenReturn(true);
when(event.getPath()).thenCallRealMethod();
when(event.getType()).thenReturn(Event.NODE_ADDED);
when(events.nextEvent()).thenReturn(event);
}
Aggregations