use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest in project cloudbreak by hortonworks.
the class StartBindUserCreationService method createRequest.
private BindUserCreateRequest createRequest(StackView stackView) {
BindUserCreateRequest request = new BindUserCreateRequest();
request.setEnvironmentCrn(stackView.getEnvironmentCrn());
request.setBindUserNameSuffix(stackView.getName());
return request;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest in project cloudbreak by hortonworks.
the class StartBindUserCreationService method invokeCreateBindUser.
private OperationStatus invokeCreateBindUser(StackView stackView) {
BindUserCreateRequest request = createRequest(stackView);
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
return ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> freeIpaV1Endpoint.createBindUser(request, userCrn));
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest in project cloudbreak by hortonworks.
the class BindUserCreateServiceTest method testCreateStartedFLowNotified.
@Test
public void testCreateStartedFLowNotified() {
BindUserCreateRequest request = createRequest();
Operation operation = new Operation();
operation.setOperationId("op");
operation.setStatus(OperationState.RUNNING);
when(operationService.startOperation(eq(ACCOUNT), eq(OperationType.BIND_USER_CREATE), anyCollection(), anyCollection())).thenReturn(operation);
OperationStatus operationStatus = new OperationStatus();
when(operationConverter.convert(operation)).thenReturn(operationStatus);
OperationStatus response = underTest.createBindUser(ACCOUNT, request);
assertEquals(operationStatus, response);
ArgumentCaptor<Acceptable> captor = ArgumentCaptor.forClass(Acceptable.class);
verify(flowManager).notify(eq(CREATE_BIND_USER_EVENT.event()), captor.capture());
Acceptable event = captor.getValue();
assertTrue(event instanceof CreateBindUserEvent);
CreateBindUserEvent bindUserEvent = (CreateBindUserEvent) event;
assertEquals(CREATE_BIND_USER_EVENT.event(), bindUserEvent.selector());
assertEquals(STACK_ID, bindUserEvent.getResourceId());
assertEquals(ACCOUNT, bindUserEvent.getAccountId());
assertEquals(operation.getOperationId(), bindUserEvent.getOperationId());
assertEquals(request.getEnvironmentCrn(), bindUserEvent.getEnvironmentCrn());
assertEquals(request.getBindUserNameSuffix(), bindUserEvent.getSuffix());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest in project cloudbreak by hortonworks.
the class StartBindUserCreationServiceTest method verifyAll.
@AfterEach
public void verifyAll() {
ArgumentCaptor<BindUserCreateRequest> argumentCaptor = ArgumentCaptor.forClass(BindUserCreateRequest.class);
verify(freeIpaV1Endpoint).createBindUser(argumentCaptor.capture(), eq(USER_CRN));
BindUserCreateRequest request = argumentCaptor.getValue();
assertEquals(ENV_CRN, request.getEnvironmentCrn());
assertEquals(STACK_NAME, request.getBindUserNameSuffix());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest in project cloudbreak by hortonworks.
the class BindUserCreateServiceTest method createRequest.
private BindUserCreateRequest createRequest() {
BindUserCreateRequest request = new BindUserCreateRequest();
request.setEnvironmentCrn(ENV_CRN);
request.setBindUserNameSuffix("suffix");
return request;
}
Aggregations