AutonomiccsSystemVmDeploymentService implements InitializingBean { protected HostVO searchForRandomHostInZoneToDeployAutonomiccsSystemVm(DataCenterVO dataCenterVO) { List<HostPodVO> allPodsEnabledFromZone = podService.getAllPodsEnabledFromZone(dataCenterVO.getId()); Collections.shuffle(allPodsEnabledFromZone); for (HostPodVO hostPodVO : allPodsEnabledFromZone) { HostVO host = searchForRandomHostInPodToDeployAutonomiccsSystemVm(hostPodVO); if (host != null) { return host; } } logger.info(String.format("Could not find any suitable hosts to deploy the system VM into zone [zoneId=%d, zoneName=%s]", dataCenterVO.getId(), dataCenterVO.getName())); return null; }  HostVO searchForRandomHostInCloudToDeployAutonomiccsSystemVm(); HostVO searchForRandomHostInPodToDeployAutonomiccsSystemVm(HostPodVO pod); HostVO searchForAnotherRandomHostToStartSystemVm(VMInstanceVO vmInstance); AutonomiccsSystemVm deploySystemVmWithJava(Long hostId, SystemVmType systemVmType); @Override void afterPropertiesSet();  }
@Test @PrepareForTest(AutonomiccsSystemVmDeploymentService.class) public void searchForRandomHostInZoneToDeployAutonomiccsSystemVmTest() { List<HostPodVO> allPodsEnabledFromZone = configureAllPodsEnabledFromZone(); HostVO host = Mockito.mock(HostVO.class); configureExecuteVerifySearchForRandomHostInZoneToDeployAutonomiccsSystemVmTest(allPodsEnabledFromZone, host, host, 1); }