@Test public void testRunningDataHubsAttached() { StackViewV4Response datahubStack1 = new StackViewV4Response(); datahubStack1.setStatus(Status.AVAILABLE); datahubStack1.setName("stack-1"); ClusterViewV4Response datahubCluster1 = new ClusterViewV4Response(); datahubCluster1.setStatus(Status.AVAILABLE); datahubStack1.setCluster(datahubCluster1); StackViewV4Response datahubStack2 = new StackViewV4Response(); datahubStack2.setStatus(Status.DELETE_COMPLETED); datahubStack2.setName("stack-2"); ClusterViewV4Response datahubCluster2 = new ClusterViewV4Response(); datahubCluster2.setStatus(Status.DELETE_COMPLETED); datahubStack2.setCluster(datahubCluster2); StackViewV4Response datahubStack3 = new StackViewV4Response(); datahubStack3.setStatus(Status.STOPPED); datahubStack3.setName("stack-3"); StackViewV4Responses stackViewV4Responses = new StackViewV4Responses(Set.of(datahubStack1, datahubStack2, datahubStack3)); UpgradeV4Response response = new UpgradeV4Response(); UpgradeV4Response actual = underTest.checkForNotAttachedClusters(stackViewV4Responses, response); assertNull(actual.getUpgradeCandidates()); assertEquals("There are attached Data Hub clusters in incorrect state: stack-1. Please stop those to be able to perform the upgrade.", actual.getReason()); }
public UpgradeV4Response checkForNotAttachedClusters(StackViewV4Responses stackViewV4Responses, UpgradeV4Response upgradeOptions) { String notStoppedAttachedClusters = stackViewV4Responses.getResponses().stream() .filter(stackViewV4Response -> !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getStatus()) || (stackViewV4Response.getCluster() != null && !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getCluster().getStatus()))) .map(StackViewV4Response::getName).collect(Collectors.joining(",")); if (!notStoppedAttachedClusters.isEmpty()) { upgradeOptions.setReason(String.format("There are attached Data Hub clusters in incorrect state: %s. " + "Please stop those to be able to perform the upgrade.", notStoppedAttachedClusters)); } return upgradeOptions; }
ClusterUpgradeAvailabilityService { public UpgradeV4Response checkForNotAttachedClusters(StackViewV4Responses stackViewV4Responses, UpgradeV4Response upgradeOptions) { String notStoppedAttachedClusters = stackViewV4Responses.getResponses().stream() .filter(stackViewV4Response -> !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getStatus()) || (stackViewV4Response.getCluster() != null && !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getCluster().getStatus()))) .map(StackViewV4Response::getName).collect(Collectors.joining(",")); if (!notStoppedAttachedClusters.isEmpty()) { upgradeOptions.setReason(String.format("There are attached Data Hub clusters in incorrect state: %s. " + "Please stop those to be able to perform the upgrade.", notStoppedAttachedClusters)); } return upgradeOptions; } }
ClusterUpgradeAvailabilityService { public UpgradeV4Response checkForNotAttachedClusters(StackViewV4Responses stackViewV4Responses, UpgradeV4Response upgradeOptions) { String notStoppedAttachedClusters = stackViewV4Responses.getResponses().stream() .filter(stackViewV4Response -> !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getStatus()) || (stackViewV4Response.getCluster() != null && !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getCluster().getStatus()))) .map(StackViewV4Response::getName).collect(Collectors.joining(",")); if (!notStoppedAttachedClusters.isEmpty()) { upgradeOptions.setReason(String.format("There are attached Data Hub clusters in incorrect state: %s. " + "Please stop those to be able to perform the upgrade.", notStoppedAttachedClusters)); } return upgradeOptions; }  }
ClusterUpgradeAvailabilityService { public UpgradeV4Response checkForNotAttachedClusters(StackViewV4Responses stackViewV4Responses, UpgradeV4Response upgradeOptions) { String notStoppedAttachedClusters = stackViewV4Responses.getResponses().stream() .filter(stackViewV4Response -> !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getStatus()) || (stackViewV4Response.getCluster() != null && !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getCluster().getStatus()))) .map(StackViewV4Response::getName).collect(Collectors.joining(",")); if (!notStoppedAttachedClusters.isEmpty()) { upgradeOptions.setReason(String.format("There are attached Data Hub clusters in incorrect state: %s. " + "Please stop those to be able to perform the upgrade.", notStoppedAttachedClusters)); } return upgradeOptions; }  UpgradeV4Response checkForUpgradesByName(Long workspaceId, String stackName, boolean lockComponents); UpgradeV4Response checkForNotAttachedClusters(StackViewV4Responses stackViewV4Responses, UpgradeV4Response upgradeOptions); void filterUpgradeOptions(UpgradeV4Response upgradeOptions, UpgradeV4Request upgradeRequest); void checkUpgradeSupported(Stack stack); }
ClusterUpgradeAvailabilityService { public UpgradeV4Response checkForNotAttachedClusters(StackViewV4Responses stackViewV4Responses, UpgradeV4Response upgradeOptions) { String notStoppedAttachedClusters = stackViewV4Responses.getResponses().stream() .filter(stackViewV4Response -> !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getStatus()) || (stackViewV4Response.getCluster() != null && !Status.getAllowedDataHubStatesForSdxUpgrade().contains(stackViewV4Response.getCluster().getStatus()))) .map(StackViewV4Response::getName).collect(Collectors.joining(",")); if (!notStoppedAttachedClusters.isEmpty()) { upgradeOptions.setReason(String.format("There are attached Data Hub clusters in incorrect state: %s. " + "Please stop those to be able to perform the upgrade.", notStoppedAttachedClusters)); } return upgradeOptions; }  UpgradeV4Response checkForUpgradesByName(Long workspaceId, String stackName, boolean lockComponents); UpgradeV4Response checkForNotAttachedClusters(StackViewV4Responses stackViewV4Responses, UpgradeV4Response upgradeOptions); void filterUpgradeOptions(UpgradeV4Response upgradeOptions, UpgradeV4Request upgradeRequest); void checkUpgradeSupported(Stack stack);  }