/** * Add this mapper to the container and all child containers * * @param container */ private void addListeners(Container container) { container.addContainerListener(this); container.addLifecycleListener(this); for (Container child : container.findChildren()) { addListeners(child); } }
/** * Add this mapper to the container and all child containers * * @param container */ private void addListeners(Container container) { container.addContainerListener(this); container.addLifecycleListener(this); for (Container child : container.findChildren()) { addListeners(child); } }
/** * Add this mapper to the container and all child containers * * @param container */ private void addListeners(Container container) { container.addContainerListener(this); container.addLifecycleListener(this); for (Container child : container.findChildren()) { addListeners(child); } }
/** * Add this mapper to the container and all child containers * * @param container */ private void addListeners(Container container) { container.addContainerListener(this); container.addLifecycleListener(this); for (Container child : container.findChildren()) { addListeners(child); } }
/** * Add this mapper to the container and all child containers * * @param container */ private void addListeners(Container container) { container.addContainerListener(this); container.addLifecycleListener(this); for (Container child : container.findChildren()) { addListeners(child); } }
/** * Add this mapper to the container and all child containers * * @param container */ private void addListeners(Container container) { container.addContainerListener(this); container.addLifecycleListener(this); for (Container child : container.findChildren()) { addListeners(child); } }
/** * Add this mapper to the container and all child containers * * @param container */ private void addListeners(Container container) { container.addContainerListener(this); container.addLifecycleListener(this); for (Container child : container.findChildren()) { addListeners(child); } }
/** * Add this mapper to the container and all child containers * * @param container */ private void addListeners(Container container) { container.addContainerListener(this); container.addLifecycleListener(this); for (Container child : container.findChildren()) { addListeners(child); } }
private void addListeners(Server server) { // Register ourself as a listener for child services for (Service service: server.findServices()) { Container engine = service.getContainer(); engine.addContainerListener(this); ((Lifecycle) engine).addLifecycleListener(this); for (Container host: engine.findChildren()) { host.addContainerListener(this); for (Container context: host.findChildren()) { ((Lifecycle) context).addLifecycleListener(this); } } } }
protected void addListeners(Server server) { // Register ourself as a listener for child services for (Service service : server.findServices()) { Container engine = service.getContainer(); engine.addContainerListener(this); engine.addLifecycleListener(this); for (Container host : engine.findChildren()) { host.addContainerListener(this); for (Container context : host.findChildren()) { context.addLifecycleListener(this); context.addPropertyChangeListener(this); } } } }
@Override protected void addListeners(Server server) { // Register ourself as a listener for child services for (Service service : server.findServices()) { Container engine = service.getContainer(); engine.addContainerListener(this); engine.addLifecycleListener(this); for (Container host : engine.findChildren()) { host.addContainerListener(this); for (Container context : host.findChildren()) { context.addLifecycleListener(this); context.addPropertyChangeListener(this); } } } }
protected void initServer(TomcatEventHandler handler, LifecycleServer server) { Service service = mock(Service.class); LifecycleEngine engine = mock(LifecycleEngine.class); Container container = mock(Container.class); LifecycleContainer childContainer = mock(LifecycleContainer.class); Server catalinaServer = mock(Server.class); when(server.findServices()).thenReturn(new Service[] { service }); when(service.getContainer()).thenReturn(engine); when(engine.findChildren()).thenReturn(new Container[] { container }); when(container.findChildren()).thenReturn(new Container[] { childContainer }); when(this.factory.createServer(server)).thenReturn(catalinaServer); handler.lifecycleEvent(this.createAfterInitEvent(server)); verify(this.eventHandler).init(same(catalinaServer)); verify(engine).addContainerListener(handler); verify(engine).addLifecycleListener(handler); verify(container).addContainerListener(handler); verify(childContainer).addLifecycleListener(handler); reset(this.eventHandler); }
@Test public void start() { Service service = mock(Service.class); LifecycleListener listener = mock(LifecycleListener.class); LifecycleEngine engine = mock(LifecycleEngine.class); Container container = mock(Container.class); LifecycleContainer childContainer = mock(LifecycleContainer.class); Server server = mock(Server.class); TomcatEventHandler handler = this.createEventHandler(this.eventHandler, this.provider, this.factory); when(this.provider.getServer()).thenReturn(this.server); when(this.server.findLifecycleListeners()).thenReturn(new LifecycleListener[] { listener }); when(this.server.findServices()).thenReturn(new Service[] { service }); when(service.getContainer()).thenReturn(engine); when(engine.findChildren()).thenReturn(new Container[] { container }); when(container.findChildren()).thenReturn(new Container[] { childContainer }); when(this.factory.createServer(same(this.server))).thenReturn(server); handler.start(); verify(this.server).addLifecycleListener(same(handler)); verify(this.eventHandler).init(same(server)); verify(engine).addContainerListener(handler); verify(engine).addLifecycleListener(handler); verify(container).addContainerListener(handler); verify(childContainer).addLifecycleListener(handler); verify(childContainer).addPropertyChangeListener(handler); verify(this.eventHandler).start(same(server)); }
container.addContainerListener(this);
container.addContainerListener(this);
container.addContainerListener(this); Host host = (Host) event.getData(); mapper.addHost(host.getName(), host.findAliases(), host);
host.addContainerListener(this); mapper.addHost(host.getName(), ((Host) host).findAliases(), host); for (Container context : host.findChildren()) {
host.addContainerListener(this); mapper.addHost(host.getName(), ((Host) host).findAliases(), host); for (Container context : host.findChildren()) {