XenHypervisor implements HypervisorHost { protected void changePoolMasterHost(Connection conn, String hostUuid) throws BadServerResponse, XenAPIException, XmlRpcException { for (Host host : Host.getAll(conn)) { if (hostUuid.equals(host.getUuid(conn))) { continue; } if (hostUtils.isHostReachable(host.getAddress(conn))) { Pool.designateNewMaster(conn, host); return; } } }  @Override void shutdownHost(HostVO hostVo); @Override boolean supportsHypervisor(HypervisorType hypervisorType);  }
@Test public void changePoolMasterHostTestFulExecution() throws Exception { setChangePoolMasterHost("uuid", true); xenHypervisor.changePoolMasterHost(conn, "hostUuid"); verifyChangePoolMasterHostCalledMethods(1, 1); }
@Test public void changePoolMasterHostTestSameHostAndMasterUuid() throws Exception { setChangePoolMasterHost("hostUuid", true); xenHypervisor.changePoolMasterHost(conn, "hostUuid"); verifyChangePoolMasterHostCalledMethods(0, 0); }
@Test public void changePoolMasterHostTestHostUnreachable() throws Exception { setChangePoolMasterHost("uuid", false); xenHypervisor.changePoolMasterHost(conn, "hostUuid"); verifyChangePoolMasterHostCalledMethods(1, 0); }