@Test public void testNoError() { when(sdxService.getByCrn(anyString(), anyString())).thenReturn(sdxCluster); when(stackV4Endpoint.checkForClusterUpgradeByName(anyLong(), anyString(), any(), anyString())).thenReturn(response); when(sdxUpgradeClusterConverter.upgradeResponseToSdxUpgradeResponse(response)).thenReturn(sdxUpgradeResponse); when(entitlementService.runtimeUpgradeEnabled(any(), any())).thenReturn(true); when(entitlementService.isInternalRepositoryForUpgradeAllowed(any(), any())).thenReturn(true); ImageInfoV4Response imageInfo = new ImageInfoV4Response(); imageInfo.setImageId(IMAGE_ID); response.setUpgradeCandidates(List.of(imageInfo)); sdxUpgradeResponse.setUpgradeCandidates(List.of(imageInfo)); assertDoesNotThrow(() -> ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.triggerUpgradeByCrn(USER_CRN, STACK_CRN, sdxUpgradeRequest, Crn.fromString(USER_CRN).getAccountId()))); }
public SdxUpgradeResponse triggerUpgradeByCrn(String userCrn, String clusterCrn, SdxUpgradeRequest upgradeRequest, String accountId) { SdxCluster cluster = sdxService.getByCrn(userCrn, clusterCrn); SdxUpgradeResponse sdxUpgradeResponse = checkForUpgradeByCrn(userCrn, clusterCrn, upgradeRequest, accountId); List<ImageInfoV4Response> imageInfoV4Responses = validateUpgradeCandidates(cluster.getClusterName(), sdxUpgradeResponse); return initSdxUpgrade(userCrn, imageInfoV4Responses, upgradeRequest, cluster); }
SdxRuntimeUpgradeService { public SdxUpgradeResponse triggerUpgradeByCrn(String userCrn, String clusterCrn, SdxUpgradeRequest upgradeRequest, String accountId) { SdxCluster cluster = sdxService.getByCrn(userCrn, clusterCrn); SdxUpgradeResponse sdxUpgradeResponse = checkForUpgradeByCrn(userCrn, clusterCrn, upgradeRequest, accountId); List<ImageInfoV4Response> imageInfoV4Responses = validateUpgradeCandidates(cluster.getClusterName(), sdxUpgradeResponse); return initSdxUpgrade(userCrn, imageInfoV4Responses, upgradeRequest, cluster); } }
SdxRuntimeUpgradeService { public SdxUpgradeResponse triggerUpgradeByCrn(String userCrn, String clusterCrn, SdxUpgradeRequest upgradeRequest, String accountId) { SdxCluster cluster = sdxService.getByCrn(userCrn, clusterCrn); SdxUpgradeResponse sdxUpgradeResponse = checkForUpgradeByCrn(userCrn, clusterCrn, upgradeRequest, accountId); List<ImageInfoV4Response> imageInfoV4Responses = validateUpgradeCandidates(cluster.getClusterName(), sdxUpgradeResponse); return initSdxUpgrade(userCrn, imageInfoV4Responses, upgradeRequest, cluster); }  }
SdxRuntimeUpgradeService { public SdxUpgradeResponse triggerUpgradeByCrn(String userCrn, String clusterCrn, SdxUpgradeRequest upgradeRequest, String accountId) { SdxCluster cluster = sdxService.getByCrn(userCrn, clusterCrn); SdxUpgradeResponse sdxUpgradeResponse = checkForUpgradeByCrn(userCrn, clusterCrn, upgradeRequest, accountId); List<ImageInfoV4Response> imageInfoV4Responses = validateUpgradeCandidates(cluster.getClusterName(), sdxUpgradeResponse); return initSdxUpgrade(userCrn, imageInfoV4Responses, upgradeRequest, cluster); }  SdxUpgradeResponse checkForUpgradeByName(String userCrn, String clusterName, SdxUpgradeRequest upgradeSdxClusterRequest, String accountId); SdxUpgradeResponse checkForUpgradeByCrn(String userCrn, String crn, SdxUpgradeRequest upgradeSdxClusterRequest, String accountId); SdxUpgradeResponse triggerUpgradeByName(String userCrn, String clusterName, SdxUpgradeRequest upgradeRequest, String accountId); SdxUpgradeResponse triggerUpgradeByCrn(String userCrn, String clusterCrn, SdxUpgradeRequest upgradeRequest, String accountId); boolean isRuntimeUpgradeEnabled(String userCrn); boolean isOsUpgrade(SdxUpgradeRequest request); }
SdxRuntimeUpgradeService { public SdxUpgradeResponse triggerUpgradeByCrn(String userCrn, String clusterCrn, SdxUpgradeRequest upgradeRequest, String accountId) { SdxCluster cluster = sdxService.getByCrn(userCrn, clusterCrn); SdxUpgradeResponse sdxUpgradeResponse = checkForUpgradeByCrn(userCrn, clusterCrn, upgradeRequest, accountId); List<ImageInfoV4Response> imageInfoV4Responses = validateUpgradeCandidates(cluster.getClusterName(), sdxUpgradeResponse); return initSdxUpgrade(userCrn, imageInfoV4Responses, upgradeRequest, cluster); }  SdxUpgradeResponse checkForUpgradeByName(String userCrn, String clusterName, SdxUpgradeRequest upgradeSdxClusterRequest, String accountId); SdxUpgradeResponse checkForUpgradeByCrn(String userCrn, String crn, SdxUpgradeRequest upgradeSdxClusterRequest, String accountId); SdxUpgradeResponse triggerUpgradeByName(String userCrn, String clusterName, SdxUpgradeRequest upgradeRequest, String accountId); SdxUpgradeResponse triggerUpgradeByCrn(String userCrn, String clusterCrn, SdxUpgradeRequest upgradeRequest, String accountId); boolean isRuntimeUpgradeEnabled(String userCrn); boolean isOsUpgrade(SdxUpgradeRequest request);  }