AutonomicClusterManagementService { public boolean isClusterBeingAdministrated(long id) { return ClusterAdministrationStatus.isClusterBeingManaged(clusterDaoJdbc.getClusterAdministrationStatus(id)); }  boolean isClusterBeingAdministrated(long id); boolean canProcessCluster(long clusterId, ClusterAdministrationHeuristicAlgorithm algorithm); @Transactional(readOnly = false) void setClusterWorkInProgress(long clusterId); @Transactional(readOnly = false) void markAdministrationStatusInClusterAsDone(long clusterId); @Transactional(readOnly = false) @Scheduled(initialDelay = ONE_MINUTE_IN_MILLISECONDS, fixedDelay = ONE_MINUTE_IN_MILLISECONDS * NUMBER_OF_MINUTES_BETWEEN_CHECKS) void removeClusterStuckProcessing();  }
@Test public void isClusterBeingAdministratedTest() { Mockito.doReturn(ClusterAdministrationStatus.InProgress).when(clusterDaoJdbc).getClusterAdministrationStatus(Mockito.anyLong()); boolean result = autonomicClusterManagementService.isClusterBeingAdministrated(0l); Mockito.verify(clusterDaoJdbc).getClusterAdministrationStatus(Mockito.anyLong()); Assert.assertTrue(result); }
@Test public void isClusterBeingAdministratedTestNotInProgress() { Mockito.doReturn(ClusterAdministrationStatus.Done).when(clusterDaoJdbc).getClusterAdministrationStatus(Mockito.anyLong()); boolean result = autonomicClusterManagementService.isClusterBeingAdministrated(0l); Mockito.verify(clusterDaoJdbc).getClusterAdministrationStatus(Mockito.anyLong()); Assert.assertFalse(result); }