AdministrationAgent implements InitializingBean { protected void processCluster(ClusterVO cluster, ClusterAdministrationHeuristicAlgorithm administrationAlgorithm) { long clusterId = cluster.getId(); if (!autonomicClusterManagementService.canProcessCluster(clusterId, administrationAlgorithm)) { logger.debug(String.format("Method canProcessCluster returned false for cluster [id=%d]", clusterId)); return; } mapAndExecuteVMsMigrations(cluster, administrationAlgorithm); if (administrationAlgorithm.canHeuristicShutdownHosts()) { logger.info(String.format("Shutting down idle hosts for cluster [id=%d] consolidation", clusterId)); shutdownIdleHosts(cluster, administrationAlgorithm); } }  void receiveClusterToBeManaged(Long clusterId); Long searchClusterToBeManaged(); List<ClusterResourcesUp> createAllClustersResourcesUp(); @Override void afterPropertiesSet();  }
@Test public void processClusterTestCannotProcessCluster() { ClusterVO cluster = createCluster(null); processClusterSetupConditionals(false, true); administrationAgent.processCluster(cluster, clusterAdministrationHeuristicAlgorithm); verifyProcessClusterCalledMethods(1, 0, 0); }
@Test public void processClusterTestCannotShutdownHosts() { ClusterVO cluster = createCluster(null); processClusterSetupConditionals(true, false); administrationAgent.processCluster(cluster, clusterAdministrationHeuristicAlgorithm); verifyProcessClusterCalledMethods(1, 1, 0); }
@Test public void processClusterTestFullExecution() { ClusterVO cluster = createCluster(null); processClusterSetupConditionals(true, true); administrationAgent.processCluster(cluster, clusterAdministrationHeuristicAlgorithm); verifyProcessClusterCalledMethods(1, 1, 1); }