use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertWithWAFeature.
@Test
public void testConvertWithWAFeature() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
FeaturesRequest fr = new FeaturesRequest();
fr.addWorkloadAnalytics(true);
telemetryRequest.setFeatures(fr);
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertWithDefaults.
@Test
public void testConvertWithDefaults() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertNull(result.getFeatures());
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertToRequest.
@Test
public void testConvertToRequest() {
// GIVEN
EnvironmentLogging logging = new EnvironmentLogging();
S3CloudStorageParameters s3Params = new S3CloudStorageParameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
EnvironmentTelemetry telemetry = new EnvironmentTelemetry();
telemetry.setLogging(logging);
// WHEN
TelemetryRequest result = underTest.convertToRequest(telemetry);
// THEN
assertNull(result.getFeatures());
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class CloudStorageValidatorTest method validateCloudStorageSetLocationBaseWhenLoggingIsConfigured.
@Test
public void validateCloudStorageSetLocationBaseWhenLoggingIsConfigured() {
when(credentialService.getByCrnForAccountId(anyString(), anyString(), any(), anyBoolean())).thenReturn(new Credential());
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
EnvironmentCloudStorageValidationRequest request = new EnvironmentCloudStorageValidationRequest();
TelemetryRequest telemetryRequest = new TelemetryRequest();
LoggingRequest loggingRequest = new LoggingRequest();
loggingRequest.setStorageLocation("s3://mybucket/location");
S3CloudStorageV1Parameters s3CloudStorageV1Parameters = new S3CloudStorageV1Parameters();
s3CloudStorageV1Parameters.setInstanceProfile("instanceProfile");
loggingRequest.setS3(s3CloudStorageV1Parameters);
telemetryRequest.setLogging(loggingRequest);
request.setTelemetry(telemetryRequest);
request.setCredentialCrn("credential");
ArgumentCaptor<ObjectStorageValidateRequest> requestCaptor = ArgumentCaptor.forClass(ObjectStorageValidateRequest.class);
when(cloudProviderServicesV4Endpoint.validateObjectStorage(requestCaptor.capture())).thenReturn(ObjectStorageValidateResponse.builder().withStatus(ResponseStatus.OK).build());
ObjectStorageValidateResponse response = underTest.validateCloudStorage("1234", request);
assertEquals(ResponseStatus.OK, response.getStatus());
assertNull(response.getError());
ObjectStorageValidateRequest objectStorageValidateRequest = requestCaptor.getValue();
assertEquals("s3://mybucket/location", objectStorageValidateRequest.getLogsLocationBase());
List<StorageIdentityBase> storageIdentities = objectStorageValidateRequest.getCloudStorageRequest().getIdentities();
assertEquals(1, storageIdentities.size());
StorageIdentityBase storageIdentity = storageIdentities.get(0);
assertEquals(CloudIdentityType.LOG, storageIdentity.getType());
assertEquals("instanceProfile", storageIdentity.getS3().getInstanceProfile());
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class EnvironmentApiConverterTest method createEnvironmentRequest.
private EnvironmentRequest createEnvironmentRequest(CloudPlatform cloudPlatform) {
EnvironmentRequest request = new EnvironmentRequest();
request.setName("test-cluster");
request.setDescription("Test description.");
request.setCredentialName(CREDENTIAL_NAME);
request.setLocation(createLocationRequest());
request.setNetwork(new EnvironmentNetworkRequest());
request.setTelemetry(new TelemetryRequest());
request.setAuthentication(createAuthenticationRequest());
request.setFreeIpa(createFreeIpaRequest());
request.setSecurityAccess(createSecurityAccessRequest());
request.setTunnel(Tunnel.CCM);
request.setIdBrokerMappingSource(IdBrokerMappingSource.IDBMMS);
request.setCloudStorageValidation(CloudStorageValidation.DISABLED);
request.setAdminGroupName("cb-admin");
request.setProxyConfigName("my-proxy");
request.setTags(Map.of("owner", "cloudbreak"));
request.setParentEnvironmentName("parent-env");
request.setCcmV2TlsType(CcmV2TlsType.ONE_WAY_TLS);
setParameters(request, cloudPlatform);
return request;
}
Aggregations