Search in sources :

Example 1 with AttemptResults

use of com.dyngr.core.AttemptResults in project cloudbreak by hortonworks.

the class FreeIpaPollerServiceTest method testStartAttachedFreeipaInstancesWhenFreeipaStopped.

@Test
void testStartAttachedFreeipaInstancesWhenFreeipaStopped() {
    DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse();
    freeipaResponse.setAvailabilityStatus(AvailabilityStatus.UNAVAILABLE);
    freeipaResponse.setStatus(Status.STOPPED);
    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(1)).startFreeIpa(ENV_CRN);
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) AttemptResults(com.dyngr.core.AttemptResults) Test(org.junit.jupiter.api.Test)

Example 2 with AttemptResults

use of com.dyngr.core.AttemptResults in project cloudbreak by hortonworks.

the class FreeIpaPollerServiceTest method testSyncUsersWhenFreeIpaAvailable.

@Test
void testSyncUsersWhenFreeIpaAvailable() {
    DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse();
    freeipaResponse.setAvailabilityStatus(AvailabilityStatus.AVAILABLE);
    freeipaResponse.setStatus(Status.AVAILABLE);
    when(freeIpaService.describe(ENV_CRN)).thenReturn(Optional.of(freeipaResponse));
    when(freeIpaService.synchronizeAllUsersInEnvironment(ENV_CRN)).thenReturn(createStatus(SynchronizationStatus.REQUESTED, ""));
    when(freeipaPollerProvider.syncUsersPoller(ENV_ID, ENV_CRN, OPERATION)).thenReturn(AttemptResults::justFinish);
    underTest.waitForSynchronizeUsers(ENV_ID, ENV_CRN);
    verify(freeIpaService, times(1)).synchronizeAllUsersInEnvironment(ENV_CRN);
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) AttemptResults(com.dyngr.core.AttemptResults) Test(org.junit.jupiter.api.Test)

Example 3 with AttemptResults

use of com.dyngr.core.AttemptResults in project cloudbreak by hortonworks.

the class FreeIpaPollerServiceTest method testStopAttachedFreeipaInstancesWhenFreeipaStopped.

@Test
void testStopAttachedFreeipaInstancesWhenFreeipaStopped() {
    DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse();
    freeipaResponse.setAvailabilityStatus(AvailabilityStatus.UNAVAILABLE);
    freeipaResponse.setStatus(Status.STOPPED);
    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(0)).stopFreeIpa(ENV_CRN);
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) AttemptResults(com.dyngr.core.AttemptResults) Test(org.junit.jupiter.api.Test)

Example 4 with AttemptResults

use of com.dyngr.core.AttemptResults 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);
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) AttemptResults(com.dyngr.core.AttemptResults) Test(org.junit.jupiter.api.Test)

Example 5 with AttemptResults

use of com.dyngr.core.AttemptResults 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);
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) AttemptResults(com.dyngr.core.AttemptResults) Test(org.junit.jupiter.api.Test)

Aggregations

AttemptResults (com.dyngr.core.AttemptResults)5 DescribeFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse)5 Test (org.junit.jupiter.api.Test)5