use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenRequestHasNotCloudStorageLocationsAndSdxHasShouldTheSdxOnesBeUsed.
@Test
void testConvertWhenRequestHasNotCloudStorageLocationsAndSdxHasShouldTheSdxOnesBeUsed() {
CloudStorageCdpService storageLocationType = CloudStorageCdpService.RANGER_AUDIT;
SdxClusterResponse sdxReponse = new SdxClusterResponse();
String storageLocationValue = "MYBUCKET/CONTAINER2";
sdxReponse.setCloudStorageBaseLocation(storageLocationValue);
sdxReponse.setCloudStorageFileSystemType(FileSystemType.S3);
when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(List.of(sdxReponse));
ConfigQueryEntry sdxConfigQueryEntry = new ConfigQueryEntry();
sdxConfigQueryEntry.setType(storageLocationType);
sdxConfigQueryEntry.setDefaultPath(storageLocationValue);
when(blueprintService.queryFileSystemParameters(any(), any(), any(), any(), any(), eq(Boolean.TRUE), eq(Boolean.FALSE), eq(0L))).thenReturn(Set.of(sdxConfigQueryEntry));
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, null, new DetailedEnvironmentResponse());
assertNotNull(result);
assertTrue(result.getLocations().stream().anyMatch(loc -> storageLocationType.equals(loc.getType()) && storageLocationValue.equals(loc.getValue())));
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenCloudStorageLocationsIsEmptyAndEnvironmentHasTelemetryWithLogging.
@Test
void testConvertWhenCloudStorageLocationsIsEmptyAndEnvironmentHasTelemetryWithLogging() {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
environment.setTelemetry(telemetry);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, null, environment);
assertNotNull(result);
assertTrue(result.getIdentities().stream().anyMatch(id -> CloudIdentityType.LOG.equals(id.getType())));
assertTrue(result.getLocations().isEmpty());
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenEnvironmentHaveTelemetryAndStorageLocationsIsNotNullOrEmpty.
@Test
void testConvertWhenEnvironmentHaveTelemetryAndStorageLocationsIsNotNullOrEmpty() {
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setTelemetry(telemetry);
CloudStorageCdpService eStorageLocationType = CloudStorageCdpService.RANGER_AUDIT;
String eStorageLocationValue = "MYBUCKET/CONTAINER";
StorageLocationBase storageLocationBase = new StorageLocationBase();
storageLocationBase.setType(eStorageLocationType);
storageLocationBase.setValue(eStorageLocationValue);
List<StorageLocationBase> storageLocations = List.of(storageLocationBase);
CloudStorageRequest request = new CloudStorageRequest();
request.setLocations(storageLocations);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, environment);
assertNotNull(result);
assertTrue(result.getIdentities().stream().anyMatch(id -> CloudIdentityType.LOG.equals(id.getType())));
assertTrue(result.getLocations().stream().anyMatch(loc -> eStorageLocationType.equals(loc.getType()) && eStorageLocationValue.equals(loc.getValue())));
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenRequestHasCloudStorageLocationsAndSdxHasDifferentStorageLocationsShouldTheRequestLocationsBeUsed.
@Test
void testConvertWhenRequestHasCloudStorageLocationsAndSdxHasDifferentStorageLocationsShouldTheRequestLocationsBeUsed() {
CloudStorageCdpService storageLocationType = CloudStorageCdpService.RANGER_AUDIT;
String eStorageLocationValue = "MYBUCKET/CONTAINER";
StorageLocationBase storageLocationBase = new StorageLocationBase();
storageLocationBase.setType(storageLocationType);
storageLocationBase.setValue(eStorageLocationValue);
List<StorageLocationBase> storageLocations = List.of(storageLocationBase);
CloudStorageRequest request = new CloudStorageRequest();
request.setLocations(storageLocations);
SdxClusterResponse sdxReponse = new SdxClusterResponse();
String storageLocationValue = "MYBUCKET/CONTAINER2";
sdxReponse.setCloudStorageBaseLocation(storageLocationValue);
sdxReponse.setCloudStorageFileSystemType(FileSystemType.S3);
when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(List.of(sdxReponse));
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, new DetailedEnvironmentResponse());
assertNotNull(result);
assertTrue(result.getLocations().stream().anyMatch(loc -> storageLocationType.equals(loc.getType()) && eStorageLocationValue.equals(loc.getValue())));
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenEnvironmentDoesNotHaveTelemetryButCloudStorageLocationsIsNotEmpty.
@Test
void testConvertWhenEnvironmentDoesNotHaveTelemetryButCloudStorageLocationsIsNotEmpty() {
CloudStorageCdpService eStorageLocationType = CloudStorageCdpService.RANGER_AUDIT;
String eStorageLocationValue = "MYBUCKET/CONTAINER";
StorageLocationBase storageLocationBase = new StorageLocationBase();
storageLocationBase.setType(eStorageLocationType);
storageLocationBase.setValue(eStorageLocationValue);
List<StorageLocationBase> storageLocations = List.of(storageLocationBase);
CloudStorageRequest request = new CloudStorageRequest();
request.setLocations(storageLocations);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, new DetailedEnvironmentResponse());
assertNotNull(result);
assertTrue(result.getLocations().stream().anyMatch(loc -> eStorageLocationType.equals(loc.getType()) && eStorageLocationValue.equals(loc.getValue())));
}
Aggregations