Search in sources :

Example 1 with FreeIpaV1Endpoint

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.FreeIpaV1Endpoint 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());
}
Also used : BindUserCreateRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest) AfterEach(org.junit.jupiter.api.AfterEach)

Example 2 with FreeIpaV1Endpoint

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.FreeIpaV1Endpoint in project cloudbreak by hortonworks.

the class FreeIpaCleanupServiceTest method shouldSendCleanupRequestInCaseOfKeytabNeedsToBeUpdated.

@Test
public void shouldSendCleanupRequestInCaseOfKeytabNeedsToBeUpdated() {
    Stack stack = aStack();
    Optional<KerberosConfig> kerberosConfig = Optional.of(mock(KerberosConfig.class));
    OperationStatus operationStatus = new OperationStatus(null, OperationType.CLEANUP, null, null, null, null, 0L, null);
    when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
    when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
    when(kerberosConfigService.get(ENVIRONMENT_CRN, STACK_NAME)).thenReturn(kerberosConfig);
    when(environmentConfigProvider.isChildEnvironment(ENVIRONMENT_CRN)).thenReturn(true);
    when(kerberosDetailService.keytabsShouldBeUpdated(CLOUD_PLATFORM, true, kerberosConfig)).thenReturn(true);
    when(freeIpaV1Endpoint.internalCleanup(any(CleanupRequest.class), anyString())).thenReturn(operationStatus);
    when(freeIpaOperationChecker.pollWithAbsoluteTimeout(any(), any(), anyLong(), anyLong(), anyInt())).thenReturn(pollingResult);
    victim.cleanupButIp(stack);
    verify(freeIpaV1Endpoint).internalCleanup(any(), anyString());
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.dto.KerberosConfig) OperationStatus(com.sequenceiq.freeipa.api.v1.operation.model.OperationStatus) CleanupRequest(com.sequenceiq.freeipa.api.v1.freeipa.cleanup.CleanupRequest) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Aggregations

Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 KerberosConfig (com.sequenceiq.cloudbreak.dto.KerberosConfig)1 CleanupRequest (com.sequenceiq.freeipa.api.v1.freeipa.cleanup.CleanupRequest)1 BindUserCreateRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest)1 OperationStatus (com.sequenceiq.freeipa.api.v1.operation.model.OperationStatus)1 AfterEach (org.junit.jupiter.api.AfterEach)1 Test (org.junit.jupiter.api.Test)1