@Test public void triggerCloudbreakRepair() { SdxCluster cluster = new SdxCluster(); cluster.setId(CLUSTER_ID.incrementAndGet()); cluster.setInitiatorUserCrn(USER_CRN); cluster.setClusterName(CLUSTER_NAME); cluster.setAccountId("accountid"); SdxRepairRequest sdxRepairRequest = new SdxRepairRequest(); sdxRepairRequest.setHostGroupNames(List.of("master")); SdxRepairSettings sdxRepairSettings = SdxRepairSettings.from(sdxRepairRequest); doNothing().when(cloudbreakFlowService).saveLastCloudbreakFlowChainId(any(), any()); underTest.startRepairInCb(cluster, sdxRepairSettings); verify(stackV4Endpoint).repairClusterInternal(eq(0L), eq(CLUSTER_NAME), captor.capture(), nullable(String.class)); assertEquals("master", captor.getValue().getHostGroups().get(0)); verify(sdxStatusService, times(1)) .setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_IN_PROGRESS, "Datalake repair in progress", cluster); }
protected void startRepairInCb(SdxCluster sdxCluster, SdxRepairSettings repairRequest) { try { LOGGER.info("Triggering repair flow for cluster {} with hostgroups {}", sdxCluster.getClusterName(), repairRequest.getHostGroupNames()); String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn(); FlowIdentifier flowIdentifier = ThreadBasedUserCrnProvider.doAsInternalActor(() -> stackV4Endpoint .repairClusterInternal(0L, sdxCluster.getClusterName(), createRepairRequest(repairRequest), initiatorUserCrn)); cloudbreakFlowService.saveLastCloudbreakFlowChainId(sdxCluster, flowIdentifier); sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_IN_PROGRESS, "Datalake repair in progress", sdxCluster); } catch (NotFoundException e) { LOGGER.info("Can not find stack on cloudbreak side {}", sdxCluster.getClusterName()); } catch (ClientErrorException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), errorMessage, e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + errorMessage); } catch (WebApplicationException e) { LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), e.getMessage(), e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + e.getMessage()); } }
SdxRepairService { protected void startRepairInCb(SdxCluster sdxCluster, SdxRepairSettings repairRequest) { try { LOGGER.info("Triggering repair flow for cluster {} with hostgroups {}", sdxCluster.getClusterName(), repairRequest.getHostGroupNames()); String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn(); FlowIdentifier flowIdentifier = ThreadBasedUserCrnProvider.doAsInternalActor(() -> stackV4Endpoint .repairClusterInternal(0L, sdxCluster.getClusterName(), createRepairRequest(repairRequest), initiatorUserCrn)); cloudbreakFlowService.saveLastCloudbreakFlowChainId(sdxCluster, flowIdentifier); sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_IN_PROGRESS, "Datalake repair in progress", sdxCluster); } catch (NotFoundException e) { LOGGER.info("Can not find stack on cloudbreak side {}", sdxCluster.getClusterName()); } catch (ClientErrorException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), errorMessage, e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + errorMessage); } catch (WebApplicationException e) { LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), e.getMessage(), e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + e.getMessage()); } } }
SdxRepairService { protected void startRepairInCb(SdxCluster sdxCluster, SdxRepairSettings repairRequest) { try { LOGGER.info("Triggering repair flow for cluster {} with hostgroups {}", sdxCluster.getClusterName(), repairRequest.getHostGroupNames()); String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn(); FlowIdentifier flowIdentifier = ThreadBasedUserCrnProvider.doAsInternalActor(() -> stackV4Endpoint .repairClusterInternal(0L, sdxCluster.getClusterName(), createRepairRequest(repairRequest), initiatorUserCrn)); cloudbreakFlowService.saveLastCloudbreakFlowChainId(sdxCluster, flowIdentifier); sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_IN_PROGRESS, "Datalake repair in progress", sdxCluster); } catch (NotFoundException e) { LOGGER.info("Can not find stack on cloudbreak side {}", sdxCluster.getClusterName()); } catch (ClientErrorException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), errorMessage, e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + errorMessage); } catch (WebApplicationException e) { LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), e.getMessage(), e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + e.getMessage()); } }  }
SdxRepairService { protected void startRepairInCb(SdxCluster sdxCluster, SdxRepairSettings repairRequest) { try { LOGGER.info("Triggering repair flow for cluster {} with hostgroups {}", sdxCluster.getClusterName(), repairRequest.getHostGroupNames()); String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn(); FlowIdentifier flowIdentifier = ThreadBasedUserCrnProvider.doAsInternalActor(() -> stackV4Endpoint .repairClusterInternal(0L, sdxCluster.getClusterName(), createRepairRequest(repairRequest), initiatorUserCrn)); cloudbreakFlowService.saveLastCloudbreakFlowChainId(sdxCluster, flowIdentifier); sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_IN_PROGRESS, "Datalake repair in progress", sdxCluster); } catch (NotFoundException e) { LOGGER.info("Can not find stack on cloudbreak side {}", sdxCluster.getClusterName()); } catch (ClientErrorException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), errorMessage, e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + errorMessage); } catch (WebApplicationException e) { LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), e.getMessage(), e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + e.getMessage()); } }  FlowIdentifier triggerRepairByCrn(String userCrn, String clusterCrn, SdxRepairRequest clusterRepairRequest); FlowIdentifier triggerRepairByName(String userCrn, String clusterName, SdxRepairRequest clusterRepairRequest); void startSdxRepair(Long id, SdxRepairSettings repairRequest); void waitCloudbreakClusterRepair(Long id, PollingConfig pollingConfig); }
SdxRepairService { protected void startRepairInCb(SdxCluster sdxCluster, SdxRepairSettings repairRequest) { try { LOGGER.info("Triggering repair flow for cluster {} with hostgroups {}", sdxCluster.getClusterName(), repairRequest.getHostGroupNames()); String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn(); FlowIdentifier flowIdentifier = ThreadBasedUserCrnProvider.doAsInternalActor(() -> stackV4Endpoint .repairClusterInternal(0L, sdxCluster.getClusterName(), createRepairRequest(repairRequest), initiatorUserCrn)); cloudbreakFlowService.saveLastCloudbreakFlowChainId(sdxCluster, flowIdentifier); sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_IN_PROGRESS, "Datalake repair in progress", sdxCluster); } catch (NotFoundException e) { LOGGER.info("Can not find stack on cloudbreak side {}", sdxCluster.getClusterName()); } catch (ClientErrorException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), errorMessage, e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + errorMessage); } catch (WebApplicationException e) { LOGGER.info("Can not repair stack {} from cloudbreak: {}", sdxCluster.getStackId(), e.getMessage(), e); throw new RuntimeException("Can not repair stack, client error happened on Cloudbreak side: " + e.getMessage()); } }  FlowIdentifier triggerRepairByCrn(String userCrn, String clusterCrn, SdxRepairRequest clusterRepairRequest); FlowIdentifier triggerRepairByName(String userCrn, String clusterName, SdxRepairRequest clusterRepairRequest); void startSdxRepair(Long id, SdxRepairSettings repairRequest); void waitCloudbreakClusterRepair(Long id, PollingConfig pollingConfig);  }