use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class StorageIdentityValidatorTest method testCloudStorageValidationWithMoreThanOneStorageParameter.
@Test
void testCloudStorageValidationWithMoreThanOneStorageParameter() {
StorageIdentityBase storage = new StorageIdentityBase();
storage.setType(CloudIdentityType.LOG);
S3CloudStorageV1Parameters s3 = new S3CloudStorageV1Parameters();
s3.setInstanceProfile("instace::profile");
storage.setS3(s3);
GcsCloudStorageV1Parameters gcs = new GcsCloudStorageV1Parameters();
gcs.setServiceAccountEmail("service.account@googlecloud.com");
storage.setGcs(gcs);
Set<ConstraintViolation<StorageIdentityBase>> constraintViolations = validator.validate(storage);
assertEquals(1, constraintViolations.size());
ConstraintViolation<StorageIdentityBase> violation = constraintViolations.iterator().next();
assertEquals(ValidCloudStorage.MESSAGE, violation.getMessage());
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenS3NotNull.
@Test
public void testIsCloudStorageConfiguredWhenS3NotNull() {
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
storageIdentityBase.setS3(new S3CloudStorageV1Parameters());
cloudStorageRequest.setIdentities(List.of(storageIdentityBase));
cloudStorageRequest.setLocations(List.of(new StorageLocationBase()));
boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest);
Assert.assertTrue(actual);
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromRequest.
@Test
public void testConvertFromRequest() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
LoggingRequest logging = new LoggingRequest();
logging.setS3(new S3CloudStorageV1Parameters());
WorkloadAnalyticsRequest workloadAnalyticsRequest = new WorkloadAnalyticsRequest();
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.addClusterLogsCollection(false);
featuresRequest.addMonitoring(true);
featuresRequest.addCloudStorageLogging(false);
telemetryRequest.setLogging(logging);
telemetryRequest.setFeatures(featuresRequest);
telemetryRequest.setWorkloadAnalytics(workloadAnalyticsRequest);
// WHEN
Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
// THEN
assertNotNull(result.getFeatures().getWorkloadAnalytics());
assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
assertFalse(result.getFeatures().getCloudStorageLogging().isEnabled());
assertTrue(result.getFeatures().getMetering().isEnabled());
assertTrue(result.getFeatures().getMonitoring().isEnabled());
assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
assertTrue(result.getFeatures().getUseSharedAltusCredential().isEnabled());
assertEquals(DATABUS_ENDPOINT, result.getDatabusEndpoint());
assertEquals(DATABUS_ENDPOINT, result.getWorkloadAnalytics().getDatabusEndpoint());
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithoutWAInput.
@Test
public void testConvertFromEnvAndSdxResponseWithoutWAInput() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
LoggingResponse loggingResponse = new LoggingResponse();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
loggingResponse.setS3(s3Params);
response.setLogging(loggingResponse);
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
sdxClusterResponse.setName("sdxName");
// WHEN
TelemetryRequest result = underTest.convert(response, sdxClusterResponse);
// THEN
assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
assertEquals("sdxId", result.getWorkloadAnalytics().getAttributes().get("databus.header.sdx.id").toString());
assertEquals("sdxName", result.getWorkloadAnalytics().getAttributes().get("databus.header.sdx.name").toString());
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class BackupConverter method convertS3.
private S3CloudStorageV1Parameters convertS3(S3CloudStorageParameters s3) {
S3CloudStorageV1Parameters s3CloudStorageV1Parameters = null;
if (s3 != null) {
s3CloudStorageV1Parameters = new S3CloudStorageV1Parameters();
s3CloudStorageV1Parameters.setInstanceProfile(s3.getInstanceProfile());
return s3CloudStorageV1Parameters;
}
return s3CloudStorageV1Parameters;
}
Aggregations