use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaPollerServiceTest method testSyncUsersWhenFreeIpaStopped.
@Test
void testSyncUsersWhenFreeIpaStopped() {
DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse();
freeipaResponse.setAvailabilityStatus(AvailabilityStatus.UNAVAILABLE);
freeipaResponse.setStatus(Status.STOPPED);
when(freeIpaService.describe(ENV_CRN)).thenReturn(Optional.of(freeipaResponse));
underTest.waitForSynchronizeUsers(ENV_ID, ENV_CRN);
verify(freeIpaService, never()).synchronizeAllUsersInEnvironment(ENV_CRN);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaPollerServiceTest method testStartAttachedFreeipaInstancesWhenFreeipaAvailable.
@Test
void testStartAttachedFreeipaInstancesWhenFreeipaAvailable() {
DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse();
freeipaResponse.setAvailabilityStatus(AvailabilityStatus.AVAILABLE);
freeipaResponse.setStatus(Status.AVAILABLE);
when(freeIpaService.describe(ENV_CRN)).thenReturn(Optional.of(freeipaResponse));
when(freeipaPollerProvider.startPoller(ENV_ID, ENV_CRN)).thenReturn(AttemptResults::justFinish);
underTest.startAttachedFreeipaInstances(ENV_ID, ENV_CRN);
verify(freeIpaService, times(0)).startFreeIpa(ENV_CRN);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaPollerServiceTest method testStopAttachedFreeipaInstancesWhenFreeipaAvailable.
@Test
void testStopAttachedFreeipaInstancesWhenFreeipaAvailable() {
DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse();
freeipaResponse.setAvailabilityStatus(AvailabilityStatus.AVAILABLE);
freeipaResponse.setStatus(Status.AVAILABLE);
when(freeIpaService.describe(ENV_CRN)).thenReturn(Optional.of(freeipaResponse));
when(freeipaPollerProvider.stopPoller(ENV_ID, ENV_CRN)).thenReturn(AttemptResults::justFinish);
underTest.stopAttachedFreeipaInstances(ENV_ID, ENV_CRN);
verify(freeIpaService, times(1)).stopFreeIpa(ENV_CRN);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaServiceTest method internalDescribeFreeipaNotFoundTest.
@Test
void internalDescribeFreeipaNotFoundTest() {
ExceptionResponse exceptionResponse = new ExceptionResponse("Freeipa not found");
final Response response = mock(Response.class);
Mockito.when(response.readEntity(Mockito.any(Class.class))).thenReturn(exceptionResponse);
NotFoundException notFoundException = mock(NotFoundException.class);
when(notFoundException.getResponse()).thenReturn(response);
when(freeIpaV1Endpoint.describeInternal(eq(ENVCRN), eq("1111"))).thenThrow(notFoundException);
Optional<DescribeFreeIpaResponse> describeFreeIpaResponse = underTest.internalDescribe(ENVCRN, "1111");
assertThat(describeFreeIpaResponse.isEmpty()).isEqualTo(true);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class EnvironmentSyncServiceTest method getFreeipaResponse.
private static DescribeFreeIpaResponse getFreeipaResponse(Status status) {
DescribeFreeIpaResponse freeIpaResponse = new DescribeFreeIpaResponse();
freeIpaResponse.setStatus(status);
return freeIpaResponse;
}
Aggregations