@Test public void testUpgradeClusterByNameWhenRequestIsEmptyAndRuntimeIsDisabled() { when(sdxRuntimeUpgradeService.isRuntimeUpgradeEnabled(USER_CRN)).thenReturn(false); SdxUpgradeRequest request = new SdxUpgradeRequest(); doAs(USER_CRN, () -> underTest.upgradeClusterByName(CLUSTER_NAME, request)); verify(sdxRuntimeUpgradeService, times(1)).triggerUpgradeByName(USER_CRN, CLUSTER_NAME, request, Crn.fromString(USER_CRN).getAccountId()); }
@Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.UPGRADE_DATALAKE) public SdxUpgradeResponse upgradeClusterByName(@ResourceName String clusterName, SdxUpgradeRequest request) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); lockComponentsIfRuntimeUpgradeIsDisabled(request, userCrn, clusterName); if (request.isDryRun() || request.isShowAvailableImagesSet()) { return sdxRuntimeUpgradeService.checkForUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } else { return sdxRuntimeUpgradeService.triggerUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } }
SdxUpgradeController implements SdxUpgradeEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.UPGRADE_DATALAKE) public SdxUpgradeResponse upgradeClusterByName(@ResourceName String clusterName, SdxUpgradeRequest request) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); lockComponentsIfRuntimeUpgradeIsDisabled(request, userCrn, clusterName); if (request.isDryRun() || request.isShowAvailableImagesSet()) { return sdxRuntimeUpgradeService.checkForUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } else { return sdxRuntimeUpgradeService.triggerUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } } }
SdxUpgradeController implements SdxUpgradeEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.UPGRADE_DATALAKE) public SdxUpgradeResponse upgradeClusterByName(@ResourceName String clusterName, SdxUpgradeRequest request) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); lockComponentsIfRuntimeUpgradeIsDisabled(request, userCrn, clusterName); if (request.isDryRun() || request.isShowAvailableImagesSet()) { return sdxRuntimeUpgradeService.checkForUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } else { return sdxRuntimeUpgradeService.triggerUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } }  }
SdxUpgradeController implements SdxUpgradeEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.UPGRADE_DATALAKE) public SdxUpgradeResponse upgradeClusterByName(@ResourceName String clusterName, SdxUpgradeRequest request) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); lockComponentsIfRuntimeUpgradeIsDisabled(request, userCrn, clusterName); if (request.isDryRun() || request.isShowAvailableImagesSet()) { return sdxRuntimeUpgradeService.checkForUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } else { return sdxRuntimeUpgradeService.triggerUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } }  @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.UPGRADE_DATALAKE) SdxUpgradeResponse upgradeClusterByName(@ResourceName String clusterName, SdxUpgradeRequest request); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.UPGRADE_DATALAKE) SdxUpgradeResponse upgradeClusterByCrn(@ResourceCrn String clusterCrn, SdxUpgradeRequest request); }
SdxUpgradeController implements SdxUpgradeEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.UPGRADE_DATALAKE) public SdxUpgradeResponse upgradeClusterByName(@ResourceName String clusterName, SdxUpgradeRequest request) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); lockComponentsIfRuntimeUpgradeIsDisabled(request, userCrn, clusterName); if (request.isDryRun() || request.isShowAvailableImagesSet()) { return sdxRuntimeUpgradeService.checkForUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } else { return sdxRuntimeUpgradeService.triggerUpgradeByName(userCrn, clusterName, request, ThreadBasedUserCrnProvider.getAccountId()); } }  @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.UPGRADE_DATALAKE) SdxUpgradeResponse upgradeClusterByName(@ResourceName String clusterName, SdxUpgradeRequest request); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.UPGRADE_DATALAKE) SdxUpgradeResponse upgradeClusterByCrn(@ResourceCrn String clusterCrn, SdxUpgradeRequest request);  }