use of com.sequenceiq.datalake.entity.SdxStatusEntity in project cloudbreak by hortonworks.
the class RangerCloudIdentityServiceTest method mockSdxStatus.
private SdxStatusEntity mockSdxStatus(DatalakeStatusEnum status) {
SdxStatusEntity sdxStatusEntity = mock(SdxStatusEntity.class);
when(sdxStatusEntity.getStatus()).thenReturn(status);
return sdxStatusEntity;
}
use of com.sequenceiq.datalake.entity.SdxStatusEntity in project cloudbreak by hortonworks.
the class RangerCloudIdentityServiceTest method testSetAzureCloudIdentityMappingFailSync.
@Test
public void testSetAzureCloudIdentityMappingFailSync() throws ApiException {
ApiCommand apiCommand = mock(ApiCommand.class);
when(apiCommand.getId()).thenReturn(BigDecimal.ONE);
when(apiCommand.getSuccess()).thenReturn(false);
SdxStatusEntity sdxStatus = mockSdxStatus(DatalakeStatusEnum.RUNNING);
when(sdxStatusService.getActualStatusForSdx(any())).thenReturn(sdxStatus);
testSetAzureCloudIdentityMapping(Optional.of(apiCommand), RangerCloudIdentitySyncState.FAILED);
}
use of com.sequenceiq.datalake.entity.SdxStatusEntity in project cloudbreak by hortonworks.
the class RangerCloudIdentityServiceTest method testSetAzureCloudIdentityMappingNoApiCommand.
@Test
public void testSetAzureCloudIdentityMappingNoApiCommand() throws ApiException {
SdxStatusEntity sdxStatus = mockSdxStatus(DatalakeStatusEnum.RUNNING);
when(sdxStatusService.getActualStatusForSdx(any())).thenReturn(sdxStatus);
testSetAzureCloudIdentityMapping(Optional.empty(), RangerCloudIdentitySyncState.SUCCESS);
}
use of com.sequenceiq.datalake.entity.SdxStatusEntity in project cloudbreak by hortonworks.
the class RangerCloudIdentityServiceTest method testSetAzureCloudIdentityMappingActiveSync.
@Test
public void testSetAzureCloudIdentityMappingActiveSync() throws ApiException {
ApiCommand apiCommand = mock(ApiCommand.class);
when(apiCommand.getId()).thenReturn(BigDecimal.ONE);
when(apiCommand.getActive()).thenReturn(true);
SdxStatusEntity sdxStatus = mockSdxStatus(DatalakeStatusEnum.RUNNING);
when(sdxStatusService.getActualStatusForSdx(any())).thenReturn(sdxStatus);
testSetAzureCloudIdentityMapping(Optional.of(apiCommand), RangerCloudIdentitySyncState.ACTIVE);
}
use of com.sequenceiq.datalake.entity.SdxStatusEntity in project cloudbreak by hortonworks.
the class RangerCloudIdentityServiceTest method testSetAzureCloudIdentityMappingDatalakNotRunning.
@Test
public void testSetAzureCloudIdentityMappingDatalakNotRunning() throws ApiException {
when(sdxService.listSdxByEnvCrn(anyString())).thenReturn(List.of(mock(SdxCluster.class)));
SdxStatusEntity sdxStatus = mockSdxStatus(DatalakeStatusEnum.PROVISIONING_FAILED);
when(sdxStatusService.getActualStatusForSdx(any())).thenReturn(sdxStatus);
Map<String, String> userMapping = Map.of("user", "val1");
RangerCloudIdentitySyncStatus status = underTest.setAzureCloudIdentityMapping("env-crn", userMapping);
assertEquals(RangerCloudIdentitySyncState.NOT_APPLICABLE, status.getState());
verify(clouderaManagerRangerUtil, never()).setAzureCloudIdentityMapping(eq("stack-crn"), eq(userMapping));
}
Aggregations