@Test public void testCleanupMachineUser() { doNothing().when(altusIAMService).clearMachineUser(any(), any(), any(), anyBoolean()); underTest.clearFluentMachineUser(stack, telemetry); verify(altusIAMService, times(1)).clearMachineUser(any(), any(), any(), anyBoolean()); }
public void clearFluentMachineUser(Stack stack, Telemetry telemetry) { if (isMeteringOrAnyDataBusBasedFeatureSupported(stack, telemetry)) { String machineUserName = getFluentDatabusMachineUserName(stack); ThreadBasedUserCrnProvider.doAsInternalActor( () -> altusIAMService.clearMachineUser( machineUserName, ThreadBasedUserCrnProvider.getUserCrn(), Crn.fromString(stack.getResourceCrn()).getAccountId(), telemetry.isUseSharedAltusCredentialEnabled())); } }
AltusMachineUserService { public void clearFluentMachineUser(Stack stack, Telemetry telemetry) { if (isMeteringOrAnyDataBusBasedFeatureSupported(stack, telemetry)) { String machineUserName = getFluentDatabusMachineUserName(stack); ThreadBasedUserCrnProvider.doAsInternalActor( () -> altusIAMService.clearMachineUser( machineUserName, ThreadBasedUserCrnProvider.getUserCrn(), Crn.fromString(stack.getResourceCrn()).getAccountId(), telemetry.isUseSharedAltusCredentialEnabled())); } } }
AltusMachineUserService { public void clearFluentMachineUser(Stack stack, Telemetry telemetry) { if (isMeteringOrAnyDataBusBasedFeatureSupported(stack, telemetry)) { String machineUserName = getFluentDatabusMachineUserName(stack); ThreadBasedUserCrnProvider.doAsInternalActor( () -> altusIAMService.clearMachineUser( machineUserName, ThreadBasedUserCrnProvider.getUserCrn(), Crn.fromString(stack.getResourceCrn()).getAccountId(), telemetry.isUseSharedAltusCredentialEnabled())); } } AltusMachineUserService(AltusIAMService altusIAMService, ClusterService clusterService); }
AltusMachineUserService { public void clearFluentMachineUser(Stack stack, Telemetry telemetry) { if (isMeteringOrAnyDataBusBasedFeatureSupported(stack, telemetry)) { String machineUserName = getFluentDatabusMachineUserName(stack); ThreadBasedUserCrnProvider.doAsInternalActor( () -> altusIAMService.clearMachineUser( machineUserName, ThreadBasedUserCrnProvider.getUserCrn(), Crn.fromString(stack.getResourceCrn()).getAccountId(), telemetry.isUseSharedAltusCredentialEnabled())); } } AltusMachineUserService(AltusIAMService altusIAMService, ClusterService clusterService); Optional<AltusCredential> generateDatabusMachineUserForFluent(Stack stack, Telemetry telemetry); void clearFluentMachineUser(Stack stack, Telemetry telemetry); DataBusCredential storeDataBusCredential(Optional<AltusCredential> altusCredential, Stack stack); boolean isDataBusCredentialStillExist(Telemetry telemetry, DataBusCredential dataBusCredential, Stack stack); boolean isMeteringOrAnyDataBusBasedFeatureSupported(Stack stack, Telemetry telemetry); }
AltusMachineUserService { public void clearFluentMachineUser(Stack stack, Telemetry telemetry) { if (isMeteringOrAnyDataBusBasedFeatureSupported(stack, telemetry)) { String machineUserName = getFluentDatabusMachineUserName(stack); ThreadBasedUserCrnProvider.doAsInternalActor( () -> altusIAMService.clearMachineUser( machineUserName, ThreadBasedUserCrnProvider.getUserCrn(), Crn.fromString(stack.getResourceCrn()).getAccountId(), telemetry.isUseSharedAltusCredentialEnabled())); } } AltusMachineUserService(AltusIAMService altusIAMService, ClusterService clusterService); Optional<AltusCredential> generateDatabusMachineUserForFluent(Stack stack, Telemetry telemetry); void clearFluentMachineUser(Stack stack, Telemetry telemetry); DataBusCredential storeDataBusCredential(Optional<AltusCredential> altusCredential, Stack stack); boolean isDataBusCredentialStillExist(Telemetry telemetry, DataBusCredential dataBusCredential, Stack stack); boolean isMeteringOrAnyDataBusBasedFeatureSupported(Stack stack, Telemetry telemetry);  }