@Test public void shouldNotFireLifecycleEventsIfTryingToStopAlreadyStoppedCube() { buildablePodCube.stop(); buildablePodCube.stop(); assertEventFired(BeforeStop.class, 1); assertEventFired(AfterStop.class, 1); }
@Override public void stop() throws CubeControlException { if (state == State.STOPPED || state == State.PRE_RUNNING || state == State.DESTROYED) { return; } try { lifecycle.fire(new BeforeStop(id)); destroyPod(holder.getPod()); try { portBindings.podStopped(); } catch (Exception e) { } this.state = State.STOPPED; lifecycle.fire(new AfterStop(id)); } catch (Exception e) { this.state = State.STOP_FAILED; throw CubeControlException.failedStop(getId(), e); } }
BuildablePodCube extends BaseCube<Void> { @Override public void stop() throws CubeControlException { if (state == State.STOPPED || state == State.PRE_RUNNING || state == State.DESTROYED) { return; } try { lifecycle.fire(new BeforeStop(id)); destroyPod(holder.getPod()); try { portBindings.podStopped(); } catch (Exception e) { } this.state = State.STOPPED; lifecycle.fire(new AfterStop(id)); } catch (Exception e) { this.state = State.STOP_FAILED; throw CubeControlException.failedStop(getId(), e); } } }
BuildablePodCube extends BaseCube<Void> { @Override public void stop() throws CubeControlException { if (state == State.STOPPED || state == State.PRE_RUNNING || state == State.DESTROYED) { return; } try { lifecycle.fire(new BeforeStop(id)); destroyPod(holder.getPod()); try { portBindings.podStopped(); } catch (Exception e) { } this.state = State.STOPPED; lifecycle.fire(new AfterStop(id)); } catch (Exception e) { this.state = State.STOP_FAILED; throw CubeControlException.failedStop(getId(), e); } } BuildablePodCube(Pod resource, OpenShiftClient client, CubeOpenShiftConfiguration configuration); }
BuildablePodCube extends BaseCube<Void> { @Override public void stop() throws CubeControlException { if (state == State.STOPPED || state == State.PRE_RUNNING || state == State.DESTROYED) { return; } try { lifecycle.fire(new BeforeStop(id)); destroyPod(holder.getPod()); try { portBindings.podStopped(); } catch (Exception e) { } this.state = State.STOPPED; lifecycle.fire(new AfterStop(id)); } catch (Exception e) { this.state = State.STOP_FAILED; throw CubeControlException.failedStop(getId(), e); } } BuildablePodCube(Pod resource, OpenShiftClient client, CubeOpenShiftConfiguration configuration); @Override State state(); @Override String getId(); @Override void create(); @Override void start(); @Override void stop(); @Override void destroy(); @Override boolean isRunningOnRemote(); @Override void changeToPreRunning(); @Override Binding bindings(); @Override Binding configuredBindings(); @Override Void configuration(); }
BuildablePodCube extends BaseCube<Void> { @Override public void stop() throws CubeControlException { if (state == State.STOPPED || state == State.PRE_RUNNING || state == State.DESTROYED) { return; } try { lifecycle.fire(new BeforeStop(id)); destroyPod(holder.getPod()); try { portBindings.podStopped(); } catch (Exception e) { } this.state = State.STOPPED; lifecycle.fire(new AfterStop(id)); } catch (Exception e) { this.state = State.STOP_FAILED; throw CubeControlException.failedStop(getId(), e); } } BuildablePodCube(Pod resource, OpenShiftClient client, CubeOpenShiftConfiguration configuration); @Override State state(); @Override String getId(); @Override void create(); @Override void start(); @Override void stop(); @Override void destroy(); @Override boolean isRunningOnRemote(); @Override void changeToPreRunning(); @Override Binding bindings(); @Override Binding configuredBindings(); @Override Void configuration();  }