use of org.apache.felix.http.base.internal.registry.EventListenerRegistry in project felix by apache.
the class ServletContextImplTest method setUp.
@Before
public void setUp() {
this.bundle = Mockito.mock(Bundle.class);
ServletContext globalContext = new MockServletContext();
this.httpContext = Mockito.mock(HttpContext.class);
this.listener = new AttributeListener();
final HandlerRegistry reg = new HandlerRegistry();
reg.init();
contextRegistry = reg.getRegistry(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID);
final EventListenerRegistry eventReg = contextRegistry.getEventListenerRegistry();
final ListenerInfo info = Mockito.mock(ListenerInfo.class);
when(info.getListenerTypes()).thenReturn(new String[] { ServletContextAttributeListener.class.getName() });
when(info.isListenerType(ServletContextAttributeListener.class.getName())).thenReturn(true);
final ListenerHandler handler = Mockito.mock(ListenerHandler.class);
when(handler.getListenerInfo()).thenReturn(info);
when(handler.getContextServiceId()).thenReturn(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID);
when(handler.getListener()).thenReturn(listener);
when(handler.init()).thenReturn(-1);
eventReg.addListeners(handler);
this.context = new ServletContextImpl(this.bundle, globalContext, this.httpContext, false, contextRegistry);
}
Aggregations