AdministrationAgent implements InitializingBean { public void receiveClusterToBeManaged(Long clusterId) { if (clusterId == null) { logger.debug("Received a null as clusterId to be processed"); return; } ClusterVO clusterToManage = clusterService.findById(clusterId); if (clusterToManage == null) { logger.debug(String.format("Received a cluster [id=%d] to be managed that was not found on database.", clusterId)); return; } ClusterAdministrationHeuristicAlgorithm administrationAlgorithm = autonomicManagementHeuristicService.getAdministrationAlgorithm(); workOnCluster(clusterToManage, administrationAlgorithm); }  void receiveClusterToBeManaged(Long clusterId); Long searchClusterToBeManaged(); List<ClusterResourcesUp> createAllClustersResourcesUp(); @Override void afterPropertiesSet();  }
@Test public void receiveClusterToBeManagedTestClusterIdNull() { administrationAgent.receiveClusterToBeManaged(null); verifyReceiveClusterToBeManaged(0, 0); }
@Test public void receiveClusterToBeManagedTestClusterIdNotNullButClusterWasNotFound() { administrationAgent.receiveClusterToBeManaged(1l); verifyReceiveClusterToBeManaged(1, 0); }