@Test public void testClusterManagerUpgradeNotNeeded() { Image currImage = createImage(CURRENT_BUILD_NUMBER, CURRENT_BUILD_NUMBER); StatedImage currentImage = StatedImage.statedImage(currImage, null, null); StatedImage targetImage = StatedImage.statedImage(currImage, null, null); boolean actualResult = underTest.upgradeClusterManager(STACK_ID, currentImage, targetImage); Assertions.assertFalse(actualResult); verify(flowMessageService).fireEventAndLog(STACK_ID, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, CURRENT_BUILD_NUMBER); verify(flowMessageService, times(0)).fireEventAndLog(STACK_ID, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); }
public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); boolean clusterManagerUpdateNeeded = isUpdateNeeded(currentCmBuildNumber, targetImage.getImage().getCmBuildNumber()); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; }
ClusterUpgradeService { public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); boolean clusterManagerUpdateNeeded = isUpdateNeeded(currentCmBuildNumber, targetImage.getImage().getCmBuildNumber()); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; } }
ClusterUpgradeService { public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); boolean clusterManagerUpdateNeeded = isUpdateNeeded(currentCmBuildNumber, targetImage.getImage().getCmBuildNumber()); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; }  }
ClusterUpgradeService { public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); boolean clusterManagerUpdateNeeded = isUpdateNeeded(currentCmBuildNumber, targetImage.getImage().getCmBuildNumber()); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; }  void initUpgradeCluster(long stackId, StatedImage targetImage); boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage); boolean upgradeCluster(long stackId, Image currentImage, Image targetImage); void clusterUpgradeFinished(long stackId, StatedImage currentImage, StatedImage targetImage); void handleUpgradeClusterFailure(long stackId, String errorReason, DetailedStackStatus detailedStatus); }
ClusterUpgradeService { public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); boolean clusterManagerUpdateNeeded = isUpdateNeeded(currentCmBuildNumber, targetImage.getImage().getCmBuildNumber()); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; }  void initUpgradeCluster(long stackId, StatedImage targetImage); boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage); boolean upgradeCluster(long stackId, Image currentImage, Image targetImage); void clusterUpgradeFinished(long stackId, StatedImage currentImage, StatedImage targetImage); void handleUpgradeClusterFailure(long stackId, String errorReason, DetailedStackStatus detailedStatus);  }