use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertWhenWorkloadAnalyticsIsNotNullThenItsAttributesShouldBePassed.
@Test
public void testConvertWhenWorkloadAnalyticsIsNotNullThenItsAttributesShouldBePassed() {
WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics();
workloadAnalytics.setDatabusEndpoint(DATABUS_ENDPOINT);
workloadAnalytics.setAttributes(Map.of("someAttributeKey", "someOtherStuffForValue"));
Telemetry input = new Telemetry();
input.setWorkloadAnalytics(workloadAnalytics);
TelemetryResponse response = underTest.convert(input);
assertNotNull(response);
assertNotNull(response.getWorkloadAnalytics());
assertEquals(input.getWorkloadAnalytics().getAttributes(), response.getWorkloadAnalytics().getAttributes());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithClusterLogsCollectionEnabled.
@Test
public void testConvertFromEnvAndSdxResponseWithClusterLogsCollectionEnabled() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
FeaturesResponse featuresResponse = new FeaturesResponse();
featuresResponse.addClusterLogsCollection(true);
response.setFeatures(featuresResponse);
// WHEN
TelemetryRequest result = underTest.convert(response, null);
// THEN
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWAEnabled.
@Test
public void testConvertFromEnvAndSdxResponseWithWAEnabled() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
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("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.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithClusterLogsCollectionDisabled.
@Test
public void testConvertFromEnvAndSdxResponseWithClusterLogsCollectionDisabled() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
FeaturesResponse featuresResponse = new FeaturesResponse();
featuresResponse.addClusterLogsCollection(false);
response.setFeatures(featuresResponse);
// WHEN
TelemetryRequest result = underTest.convert(response, null);
// THEN
assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class EnvironmentResponseConverterTest method testDtoToDetailedResponse.
@ParameterizedTest
@EnumSource(value = CloudPlatform.class, names = { "AWS", "AZURE", "GCP" })
void testDtoToDetailedResponse(CloudPlatform cloudPlatform) {
EnvironmentDto environment = createEnvironmentDto(cloudPlatform);
CredentialResponse credentialResponse = mock(CredentialResponse.class);
FreeIpaResponse freeIpaResponse = mock(FreeIpaResponse.class);
CompactRegionResponse compactRegionResponse = mock(CompactRegionResponse.class);
TelemetryResponse telemetryResponse = mock(TelemetryResponse.class);
BackupResponse backupResponse = mock(BackupResponse.class);
ProxyResponse proxyResponse = mock(ProxyResponse.class);
EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
when(credentialConverter.convert(environment.getCredential())).thenReturn(credentialResponse);
when(freeIpaConverter.convert(environment.getFreeIpaCreation())).thenReturn(freeIpaResponse);
when(regionConverter.convertRegions(environment.getRegions())).thenReturn(compactRegionResponse);
when(telemetryApiConverter.convert(environment.getTelemetry())).thenReturn(telemetryResponse);
when(backupConverter.convert(environment.getBackup())).thenReturn(backupResponse);
when(proxyConfigToProxyResponseConverter.convert((ProxyConfig) environment.getProxyConfig())).thenReturn(proxyResponse);
when(networkDtoToResponseConverter.convert(environment.getNetwork(), environment.getExperimentalFeatures().getTunnel(), true)).thenReturn(environmentNetworkResponse);
DetailedEnvironmentResponse actual = underTest.dtoToDetailedResponse(environment);
assertEquals(environment.getResourceCrn(), actual.getCrn());
assertEquals(environment.getName(), actual.getName());
assertEquals(environment.getOriginalName(), actual.getOriginalName());
assertEquals(environment.getDescription(), actual.getDescription());
assertEquals(environment.getCloudPlatform(), actual.getCloudPlatform());
assertEquals(credentialResponse, actual.getCredential());
assertEquals(environment.getStatus().getResponseStatus(), actual.getEnvironmentStatus());
assertLocation(environment.getLocation(), actual.getLocation());
assertTrue(actual.getCreateFreeIpa());
assertEquals(freeIpaResponse, actual.getFreeIpa());
assertEquals(compactRegionResponse, actual.getRegions());
assertEquals(environment.getCreator(), actual.getCreator());
assertAuthentication(environment.getAuthentication(), actual.getAuthentication());
assertEquals(environment.getStatusReason(), actual.getStatusReason());
assertEquals(environment.getCreated(), actual.getCreated());
assertEquals(environment.getTags().getUserDefinedTags(), actual.getTags().getUserDefined());
assertEquals(environment.getTags().getDefaultTags(), actual.getTags().getDefaults());
assertEquals(telemetryResponse, actual.getTelemetry());
assertEquals(environment.getExperimentalFeatures().getTunnel(), actual.getTunnel());
assertEquals(environment.getExperimentalFeatures().getIdBrokerMappingSource(), actual.getIdBrokerMappingSource());
assertEquals(environment.getExperimentalFeatures().getCloudStorageValidation(), actual.getCloudStorageValidation());
assertEquals(environment.getExperimentalFeatures().getCcmV2TlsType(), actual.getCcmV2TlsType());
assertEquals(environment.getAdminGroupName(), actual.getAdminGroupName());
assertParameters(environment, actual, cloudPlatform);
assertEquals(environment.getParentEnvironmentCrn(), actual.getParentEnvironmentCrn());
assertEquals(environment.getParentEnvironmentName(), actual.getParentEnvironmentName());
assertEquals(environment.getParentEnvironmentCloudPlatform(), actual.getParentEnvironmentCloudPlatform());
assertEquals(proxyResponse, actual.getProxyConfig());
assertEquals(environmentNetworkResponse, actual.getNetwork());
assertSecurityAccess(environment.getSecurityAccess(), actual.getSecurityAccess());
verify(credentialConverter).convert(environment.getCredential());
verify(freeIpaConverter).convert(environment.getFreeIpaCreation());
verify(regionConverter).convertRegions(environment.getRegions());
verify(telemetryApiConverter).convert(environment.getTelemetry());
verify(proxyConfigToProxyResponseConverter).convert(environment.getProxyConfig());
verify(networkDtoToResponseConverter).convert(environment.getNetwork(), environment.getExperimentalFeatures().getTunnel(), true);
}
Aggregations