Search in sources :

Example 1 with FreeIpaServerDeletionPollerObject

use of com.sequenceiq.freeipa.service.freeipa.cleanup.FreeIpaServerDeletionPollerObject in project cloudbreak by hortonworks.

the class FreeIplaServiceDeletionListenerTaskTest method testCheckStatusFalse.

@Test
void testCheckStatusFalse() throws Exception {
    FreeIpaServerDeletionPollerObject pollerObject = new FreeIpaServerDeletionPollerObject(1L, Set.of("example1.com"));
    FreeIpaClient client = mock(FreeIpaClient.class);
    TopologySuffix suffix = new TopologySuffix();
    suffix.setCn("ca");
    TopologySegment segment = new TopologySegment();
    segment.setRightNode("example1.com");
    segment.setLeftNode("example2.com");
    when(freeIpaClientFactory.getFreeIpaClientForStackId(anyLong())).thenReturn(client);
    when(client.findAllTopologySuffixes()).thenReturn(List.of(suffix));
    when(client.findTopologySegments(any())).thenReturn(List.of(segment));
    assertFalse(underTest.checkStatus(pollerObject));
}
Also used : FreeIpaClient(com.sequenceiq.freeipa.client.FreeIpaClient) TopologySuffix(com.sequenceiq.freeipa.client.model.TopologySuffix) FreeIpaServerDeletionPollerObject(com.sequenceiq.freeipa.service.freeipa.cleanup.FreeIpaServerDeletionPollerObject) TopologySegment(com.sequenceiq.freeipa.client.model.TopologySegment) Test(org.junit.jupiter.api.Test)

Example 2 with FreeIpaServerDeletionPollerObject

use of com.sequenceiq.freeipa.service.freeipa.cleanup.FreeIpaServerDeletionPollerObject in project cloudbreak by hortonworks.

the class FreeIplaServiceDeletionListenerTaskTest method testCheckStatusTrue.

@Test
void testCheckStatusTrue() throws Exception {
    FreeIpaServerDeletionPollerObject pollerObject = new FreeIpaServerDeletionPollerObject(1L, Set.of("example0.com"));
    FreeIpaClient client = mock(FreeIpaClient.class);
    TopologySuffix suffix = new TopologySuffix();
    suffix.setCn("ca");
    TopologySegment segment = new TopologySegment();
    segment.setRightNode("example1.com");
    segment.setLeftNode("example2.com");
    when(freeIpaClientFactory.getFreeIpaClientForStackId(anyLong())).thenReturn(client);
    when(client.findAllTopologySuffixes()).thenReturn(List.of(suffix));
    when(client.findTopologySegments(any())).thenReturn(List.of(segment));
    assertTrue(underTest.checkStatus(pollerObject));
}
Also used : FreeIpaClient(com.sequenceiq.freeipa.client.FreeIpaClient) TopologySuffix(com.sequenceiq.freeipa.client.model.TopologySuffix) FreeIpaServerDeletionPollerObject(com.sequenceiq.freeipa.service.freeipa.cleanup.FreeIpaServerDeletionPollerObject) TopologySegment(com.sequenceiq.freeipa.client.model.TopologySegment) Test(org.junit.jupiter.api.Test)

Aggregations

FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)2 TopologySegment (com.sequenceiq.freeipa.client.model.TopologySegment)2 TopologySuffix (com.sequenceiq.freeipa.client.model.TopologySuffix)2 FreeIpaServerDeletionPollerObject (com.sequenceiq.freeipa.service.freeipa.cleanup.FreeIpaServerDeletionPollerObject)2 Test (org.junit.jupiter.api.Test)2