@Test public void testStillRunning() { VirtualMachine virtualMachine = VirtualMachine.builder(). id("229").state(VirtualMachine.State.RUNNING).build(); expect(virtualMachineClient.getVirtualMachine(virtualMachine.getId())).andReturn(virtualMachine); replay(client, virtualMachineClient); assertFalse(new VirtualMachineDestroyed(client).apply(virtualMachine)); verify(client, virtualMachineClient); }
public boolean apply(VirtualMachine virtualMachine) { logger.trace("looking for state on virtualMachine %s", checkNotNull(virtualMachine, "virtualMachine")); virtualMachine = refresh(virtualMachine); if (virtualMachine == null) return true; logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.DESTROYED, virtualMachine.getState()); return virtualMachine.getState() == State.DESTROYED; }
VirtualMachineDestroyed implements Predicate<VirtualMachine> { public boolean apply(VirtualMachine virtualMachine) { logger.trace("looking for state on virtualMachine %s", checkNotNull(virtualMachine, "virtualMachine")); virtualMachine = refresh(virtualMachine); if (virtualMachine == null) return true; logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.DESTROYED, virtualMachine.getState()); return virtualMachine.getState() == State.DESTROYED; } }
VirtualMachineDestroyed implements Predicate<VirtualMachine> { public boolean apply(VirtualMachine virtualMachine) { logger.trace("looking for state on virtualMachine %s", checkNotNull(virtualMachine, "virtualMachine")); virtualMachine = refresh(virtualMachine); if (virtualMachine == null) return true; logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.DESTROYED, virtualMachine.getState()); return virtualMachine.getState() == State.DESTROYED; } @Inject  VirtualMachineDestroyed(CloudStackApi client); }
VirtualMachineDestroyed implements Predicate<VirtualMachine> { public boolean apply(VirtualMachine virtualMachine) { logger.trace("looking for state on virtualMachine %s", checkNotNull(virtualMachine, "virtualMachine")); virtualMachine = refresh(virtualMachine); if (virtualMachine == null) return true; logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.DESTROYED, virtualMachine.getState()); return virtualMachine.getState() == State.DESTROYED; } @Inject  VirtualMachineDestroyed(CloudStackApi client); boolean apply(VirtualMachine virtualMachine); }
VirtualMachineDestroyed implements Predicate<VirtualMachine> { public boolean apply(VirtualMachine virtualMachine) { logger.trace("looking for state on virtualMachine %s", checkNotNull(virtualMachine, "virtualMachine")); virtualMachine = refresh(virtualMachine); if (virtualMachine == null) return true; logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.DESTROYED, virtualMachine.getState()); return virtualMachine.getState() == State.DESTROYED; } @Inject  VirtualMachineDestroyed(CloudStackApi client); boolean apply(VirtualMachine virtualMachine);  }