@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)); }
@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 shouldNotStopAndDestroyWhenNoCubeFoundMatchingContainer() { when(container.getName()).thenReturn(MISSING_CUBE_ID); fire(new AfterStop(deployableContainer)); assertEventFired(StopCube.class, 0); assertEventFired(DestroyCube.class, 0); }
@Test public void shouldStopAndDestroyCubeDuringAfterStop() { fire(new AfterStop(deployableContainer)); assertEventFired(StopCube.class, 1); assertEventFired(DestroyCube.class, 1); }
@Test public void shouldNotStopAndDestroyWhenNoContainerFound() { fire(new AfterStop(deployableContainerNoMatch)); assertEventFired(StopCube.class, 0); assertEventFired(DestroyCube.class, 0); }
@Override public void perform(Container container) throws Exception { event.fire(new BeforeStop(container.getDeployableContainer())); try { if (container.getState().equals(Container.State.STARTED)) { CommonDeployableContainer c = (CommonDeployableContainer) container.getDeployableContainer(); c.stop(stopEvent.getTimeout()); } container.setState(Container.State.STOPPED); } catch (LifecycleException e) { container.setState(Container.State.STOPPED_FAILED); throw e; } event.fire(new AfterStop(container.getDeployableContainer())); } });
@Override public void perform(Container container) throws Exception { event.fire(new BeforeStop(container.getDeployableContainer())); try { if (container.getState().equals(Container.State.STARTED)) { CommonDeployableContainer c = (CommonDeployableContainer) container.getDeployableContainer(); c.stop(stopEvent.getTimeout()); } container.setState(Container.State.STOPPED); } catch (LifecycleException e) { container.setState(Container.State.STOPPED_FAILED); throw e; } event.fire(new AfterStop(container.getDeployableContainer())); } });