XenHypervisor implements HypervisorHost { protected void changeMasterIfNeeded(Connection conn, Host master, String hostUuid) throws BadServerResponse, XenAPIException, XmlRpcException { if (hostUuid.equals(master.getUuid(conn)) && !isLastHostOnPool(conn)) { changePoolMasterHost(conn, hostUuid); waitChangePoolMasterHost(master, conn, hostUuid); } }  @Override void shutdownHost(HostVO hostVo); @Override boolean supportsHypervisor(HypervisorType hypervisorType);  }
@Test public void changeMasterIfNeededTest() throws Exception { setupChangeMasterIfNeeded(false); xenHypervisor.changeMasterIfNeeded(conn, host, "hostUuid"); verifyChangeMasterIfNeededCalledMethods(1); }
@Test public void changeMasterIfNeededTestIsLastHostOnPool() throws Exception { setupChangeMasterIfNeeded(true); xenHypervisor.changeMasterIfNeeded(conn, host, "hostUuid"); verifyChangeMasterIfNeededCalledMethods(0); }