Search in sources :

Example 1 with ClusterModificationService

use of com.sequenceiq.cloudbreak.cluster.api.ClusterModificationService in project cloudbreak by hortonworks.

the class ClusterServiceTest method testIsRangerRazEnabledOnClusterReturnsTrueWhenCmIsRunning.

@Test
void testIsRangerRazEnabledOnClusterReturnsTrueWhenCmIsRunning() {
    Stack stack = setupStack(STACK_ID);
    ClusterApi clusterApi = mock(ClusterApi.class);
    ClusterStatusService clusterStatusService = mock(ClusterStatusService.class);
    ClusterModificationService clusterModificationService = mock(ClusterModificationService.class);
    when(clusterApiConnectors.getConnector(stack)).thenReturn(clusterApi);
    when(clusterApi.clusterStatusService()).thenReturn(clusterStatusService);
    when(clusterApi.clusterModificationService()).thenReturn(clusterModificationService);
    when(clusterStatusService.isClusterManagerRunning()).thenReturn(true);
    when(clusterModificationService.isServicePresent(anyString(), eq(RANGER_RAZ))).thenReturn(true);
    assertTrue(underTest.isRangerRazEnabledOnCluster(stack));
}
Also used : ClusterApi(com.sequenceiq.cloudbreak.cluster.api.ClusterApi) ClusterModificationService(com.sequenceiq.cloudbreak.cluster.api.ClusterModificationService) ClusterStatusService(com.sequenceiq.cloudbreak.cluster.api.ClusterStatusService) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with ClusterModificationService

use of com.sequenceiq.cloudbreak.cluster.api.ClusterModificationService in project cloudbreak by hortonworks.

the class ClusterServiceTest method testIsRangerRazEnabledOnClusterReturnsFalseIfCmIsRunning.

@Test
void testIsRangerRazEnabledOnClusterReturnsFalseIfCmIsRunning() {
    Stack stack = setupStack(STACK_ID);
    ClusterApi clusterApi = mock(ClusterApi.class);
    ClusterStatusService clusterStatusService = mock(ClusterStatusService.class);
    ClusterModificationService clusterModificationService = mock(ClusterModificationService.class);
    when(clusterApiConnectors.getConnector(stack)).thenReturn(clusterApi);
    when(clusterApi.clusterStatusService()).thenReturn(clusterStatusService);
    when(clusterApi.clusterModificationService()).thenReturn(clusterModificationService);
    when(clusterStatusService.isClusterManagerRunning()).thenReturn(true);
    when(clusterModificationService.isServicePresent(anyString(), eq(RANGER_RAZ))).thenReturn(false);
    assertFalse(underTest.isRangerRazEnabledOnCluster(stack));
}
Also used : ClusterApi(com.sequenceiq.cloudbreak.cluster.api.ClusterApi) ClusterModificationService(com.sequenceiq.cloudbreak.cluster.api.ClusterModificationService) ClusterStatusService(com.sequenceiq.cloudbreak.cluster.api.ClusterStatusService) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ClusterApi (com.sequenceiq.cloudbreak.cluster.api.ClusterApi)2 ClusterModificationService (com.sequenceiq.cloudbreak.cluster.api.ClusterModificationService)2 ClusterStatusService (com.sequenceiq.cloudbreak.cluster.api.ClusterStatusService)2 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 Test (org.junit.jupiter.api.Test)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2