ContainerDestructionWorkflow extends CancellableWorkflow<ContainerDestructionWorkflow.ContainerDestructionPhase> { public ContainerDestructionPhase DESTROY_CONTAINER() { operationTracker.addLog( "Destroying container" ); try { environment = ( LocalEnvironment ) new DestroyContainerStep( containerHost ).execute(); RelationManager relationManager = environmentManager.getRelationManager(); relationManager.removeRelation( containerHost ); saveEnvironment(); return ContainerDestructionPhase.REMOVE_HOSTNAMES; } catch ( Exception e ) { fail( e.getMessage(), e ); return null; } } ContainerDestructionWorkflow( final EnvironmentManagerImpl environmentManager,
                                         final LocalEnvironment environment, final ContainerHost containerHost,
                                         final TrackerOperation operationTracker ); ContainerDestructionPhase INIT(); ContainerDestructionPhase VALIDATE(); ContainerDestructionPhase DESTROY_CONTAINER(); ContainerDestructionPhase REMOVE_HOSTNAMES(); void FINALIZE(); @Override void fail( final String message, final Throwable e ); @Override void onCancellation();  }
@Test public void testDESTROY_CONTAINER() throws Exception { RelationManager relationManager = mock( RelationManager.class ); doReturn( relationManager ).when( environmentManager ).getRelationManager(); workflow.DESTROY_CONTAINER(); verify( environmentManager, atLeastOnce() ).update( any( LocalEnvironment.class ) ); }