HypervisorManager { public void shutdownHost(HostVO hostVo) { if (!Host.Type.Routing.equals(hostVo.getType())) { return; } for (HypervisorHost currentHypervisorHost : hypervisorHosts) { if (currentHypervisorHost.supportsHypervisor(hostVo.getHypervisorType())) { shutdown(hostVo, currentHypervisorHost); return; } } throw new CloudRuntimeException( String.format("The the hypervisor[%s] from host[id=%d] does not support shutdown to consolidate", hostVo.getHypervisorType(), hostVo.getId())); }  void shutdownHost(HostVO hostVo);  }
@Test public void shutdownHostTestFull() { HostVO host = setTestOfShutdownHost(Host.Type.Routing, true); hypervisorManager.shutdownHost(host); verifyShutdownHostCalledMethods(1, 1); }
@Test public void shutdownHostTestNotRoutingHost() { HostVO host = setTestOfShutdownHost(Host.Type.ConsoleProxy, true); hypervisorManager.shutdownHost(host); verifyShutdownHostCalledMethods(0, 0); }
@Test(expected = CloudRuntimeException.class) public void shutdownHostTestNotXenServer() { HostVO host = setTestOfShutdownHost(Host.Type.Routing, false); hypervisorManager.shutdownHost(host); verifyShutdownHostCalledMethods(1, 0); }