Search in sources :

Example 6 with TelemetryResponse

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());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics) Test(org.junit.Test)

Example 7 with TelemetryResponse

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());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) Test(org.junit.Test)

Example 8 with TelemetryResponse

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());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Test(org.junit.Test)

Example 9 with TelemetryResponse

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());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) Test(org.junit.Test)

Example 10 with TelemetryResponse

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);
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) CompactRegionResponse(com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse) ProxyResponse(com.sequenceiq.environment.api.v1.proxy.model.response.ProxyResponse) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) CredentialResponse(com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse) BackupResponse(com.sequenceiq.common.api.backup.response.BackupResponse) FreeIpaResponse(com.sequenceiq.environment.api.v1.environment.model.response.FreeIpaResponse) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)45 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)17 Test (org.junit.jupiter.api.Test)17 Test (org.junit.Test)16 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)14 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)10 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)10 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)9 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)8 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)8 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)8 ArrayList (java.util.ArrayList)8 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)7 CloudIdentityType (com.sequenceiq.common.model.CloudIdentityType)7 CloudStorageCdpService (com.sequenceiq.common.model.CloudStorageCdpService)7 FileSystemType (com.sequenceiq.common.model.FileSystemType)7 List (java.util.List)7 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)7 Assertions.assertNull (org.junit.jupiter.api.Assertions.assertNull)7 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)7