@Override public Void call() throws Exception { delegate.stop(); return null; } });
@Override public Void call() throws Exception { delegate.stop(); return null; } });
public void cleanup() throws IOException { try { deployableContainer.stop(); } catch (LifecycleException e) { throw new RuntimeException(e); } }
@Override public void kill(Container container) throws Exception { log.warning("Triggering default implementation of a server kill() command => using stop() internally"); container.getDeployableContainer().stop(); } }
@Override public void kill(Container container) throws Exception { log.warning("Triggering default implementation of a server kill() command => using stop() internally"); container.getDeployableContainer().stop(); } }
@Override public void stopContainer() throws LifecycleException { if(mssContainer.isStarted()){ deployableContainer.stop(); } } @Override
@Override public void stop() throws LifecycleException { event.fire(new BeforeStop(deployableContainer)); try { deployableContainer.stop(); setState(Container.State.STOPPED); } catch (LifecycleException e) { setState(State.STOPPED_FAILED); failureCause = e; throw e; } event.fire(new AfterStop(deployableContainer)); }
@Test public void shouldNotStopCustomContainersInRegistry() throws Exception { registry.create(container5, serviceLoader).setState(Container.State.STARTED); fire(new StopClassContainers()); verify(deployableContainer, times(0)).stop(); fire(new StopSuiteContainers()); verify(deployableContainer, times(0)).stop(); Assert.assertEquals(Container.State.STARTED, registry.getContainer(CONTAINER_5_NAME).getState()); }
@Override public void stop() throws LifecycleException { event.fire(new BeforeStop(deployableContainer)); try { deployableContainer.stop(); setState(Container.State.STOPPED); } catch (LifecycleException e) { setState(State.STOPPED_FAILED); failureCause = e; throw e; } event.fire(new AfterStop(deployableContainer)); }
@Test public void shouldStopAllSuiteContainersInRegistry() throws Exception { registry.create(container1, serviceLoader); registry.create(container2, serviceLoader); registry.create(container5, serviceLoader); //we need to manually set this since we don't actually start them for (Container c : registry.getContainers()) { c.setState(Container.State.STARTED); } fire(new StopSuiteContainers()); assertEventFiredInContext(StopContainer.class, ContainerContext.class); assertEventFired(StopContainer.class, 2); assertEventFiredInContext(BeforeStop.class, ContainerContext.class); assertEventFired(BeforeStop.class, 2); assertEventFiredInContext(AfterStop.class, ContainerContext.class); assertEventFired(AfterStop.class, 2); verify(deployableContainer, times(2)).stop(); }
@Test public void shouldStopAllClassContainersInRegistry() throws Exception { registry.create(container1, serviceLoader); registry.create(container2, serviceLoader); registry.create(container3, serviceLoader); registry.create(container4, serviceLoader); registry.create(container5, serviceLoader); //we need to manually set this since we don't actually start them for (Container c : registry.getContainers()) { c.setState(Container.State.STARTED); } fire(new StopClassContainers()); assertEventFiredInContext(StopContainer.class, ContainerContext.class); assertEventFired(StopContainer.class, 2); assertEventFiredInContext(BeforeStop.class, ContainerContext.class); assertEventFired(BeforeStop.class, 2); assertEventFiredInContext(AfterStop.class, ContainerContext.class); assertEventFired(AfterStop.class, 2); verify(deployableContainer, times(2)).stop(); }