AdministrationAgent implements InitializingBean { protected List<HostResources> getClusterUpHosts(ClusterVO cluster) { List<HostVO> hostsVo = hostService.listAllHostsInCluster(cluster); List<HostResources> hostsResources = new ArrayList<>(); for (HostVO host : hostsVo) { hostsResources.add(hostResourcesService.createHostResources(host)); } return hostsResources; }  void receiveClusterToBeManaged(Long clusterId); Long searchClusterToBeManaged(); List<ClusterResourcesUp> createAllClustersResourcesUp(); @Override void afterPropertiesSet();  }
@Test public void getClusterUpHostsTest() { ClusterVO cluster = createCluster(null); List<HostVO> hosts = setupGetClusterUpHostsTest(2); List<HostResources> result = administrationAgent.getClusterUpHosts(cluster); Assert.assertEquals(hosts.size(), result.size()); verifyGetClusterUpHostsCalledMethods(2); }
@Test public void getClusterUpHostsTestNoHostRunning() { ClusterVO cluster = createCluster(null); List<HostVO> hosts = setupGetClusterUpHostsTest(0); List<HostResources> result = administrationAgent.getClusterUpHosts(cluster); Assert.assertEquals(hosts.size(), result.size()); verifyGetClusterUpHostsCalledMethods(0); }