use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest in project cloudbreak by hortonworks.
the class BindUserCreateServiceTest method testOperationRejected.
@Test
public void testOperationRejected() {
BindUserCreateRequest request = createRequest();
Operation operation = new Operation();
operation.setOperationId("op");
operation.setStatus(OperationState.REJECTED);
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);
verifyNoInteractions(flowManager);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest in project cloudbreak by hortonworks.
the class BindUserCreateServiceTest method testFlowRejected.
@Test
public void testFlowRejected() {
BindUserCreateRequest request = createRequest();
Operation operation = new Operation();
operation.setOperationId("op");
operation.setStatus(OperationState.RUNNING);
Operation failedOperation = new Operation();
failedOperation.setOperationId("op");
failedOperation.setStatus(OperationState.FAILED);
when(operationService.startOperation(eq(ACCOUNT), eq(OperationType.BIND_USER_CREATE), anyCollection(), anyCollection())).thenReturn(operation);
when(operationService.failOperation(ACCOUNT, operation.getOperationId(), "Couldn't start create bind user flow: Flow failure")).thenReturn(failedOperation);
OperationStatus failedOperationStatus = new OperationStatus();
failedOperationStatus.setStatus(OperationState.FAILED);
when(operationConverter.convert(failedOperation)).thenReturn(failedOperationStatus);
when(flowManager.notify(anyString(), any(Acceptable.class))).thenThrow(new RuntimeException("Flow failure"));
OperationStatus response = underTest.createBindUser(ACCOUNT, request);
assertEquals(failedOperationStatus, response);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest in project cloudbreak by hortonworks.
the class FreeIpaUpgradeTests method createBindUser.
private void createBindUser(TestContext testContext, com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn) {
try {
BindUserCreateRequest bindUserCreateRequest = new BindUserCreateRequest();
bindUserCreateRequest.setEnvironmentCrn(environmentCrn);
bindUserCreateRequest.setBindUserNameSuffix("testuser");
String initiatorUserCrn = "__internal__actor__";
OperationStatus operationStatus = ipaClient.getFreeIpaV1Endpoint().createE2ETestBindUser(bindUserCreateRequest, initiatorUserCrn);
waitToCompleted(testContext, operationStatus.getOperationId(), "createBindUserOperation");
} catch (Exception e) {
logger.error("CREATE BIND USER test failed during upgrade", e);
throw new TestFailException("CREATE BIND USER test failed during upgrade with: " + e.getMessage(), e);
}
}
Aggregations