Search in sources :

Example 36 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWADisabledGlobally.

@Test
public void testConvertFromEnvAndSdxResponseWithWADisabledGlobally() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
    sdxClusterResponse.setName("sdxName");
    AltusDatabusConfiguration altusDatabusConfiguration = new AltusDatabusConfiguration(DATABUS_ENDPOINT, DATABUS_S3_BUCKET, false, "", null);
    MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, null, null);
    ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(true, null, null);
    MonitoringConfiguration monitoringConfig = new MonitoringConfiguration();
    monitoringConfig.setEnabled(true);
    TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(altusDatabusConfiguration, meteringConfiguration, logCollectionConfig, monitoringConfig, null);
    TelemetryConverter converter = new TelemetryConverter(telemetryConfiguration, false, true);
    // WHEN
    TelemetryRequest result = converter.convert(response, sdxClusterResponse);
    // THEN
    assertNull(result.getWorkloadAnalytics());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) MeteringConfiguration(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration) TelemetryConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryConfiguration) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) AltusDatabusConfiguration(com.sequenceiq.cloudbreak.altus.AltusDatabusConfiguration) MonitoringConfiguration(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfiguration) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) ClusterLogsCollectionConfiguration(com.sequenceiq.cloudbreak.telemetry.logcollection.ClusterLogsCollectionConfiguration) Test(org.junit.Test)

Example 37 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithMonitoring.

@Test
public void testConvertFromEnvAndSdxResponseWithMonitoring() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    FeaturesResponse featuresResponse = new FeaturesResponse();
    featuresResponse.addMonitoring(true);
    response.setFeatures(featuresResponse);
    MonitoringResponse monitoringResponse = new MonitoringResponse();
    monitoringResponse.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
    response.setMonitoring(monitoringResponse);
    // WHEN
    TelemetryRequest result = underTest.convert(response, null);
    // THEN
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertEquals(MONITORING_REMOTE_WRITE_URL, result.getMonitoring().getRemoteWriteUrl());
}
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) MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse) Test(org.junit.Test)

Example 38 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.

the class CloudStorageDecoratorTest method testConvertWhenIdentityIsSetToNull.

@Test
void testConvertWhenIdentityIsSetToNull() {
    CloudStorageRequest request = new CloudStorageRequest();
    request.setIdentities(null);
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    TelemetryResponse telemetry = new TelemetryResponse();
    telemetry.setLogging(new LoggingResponse());
    environment.setTelemetry(telemetry);
    CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, environment);
    assertNotNull(result);
    assertEquals(1, result.getIdentities().size());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) Test(org.junit.jupiter.api.Test)

Example 39 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse 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());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Mock(org.mockito.Mock) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ArrayList(java.util.ArrayList) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Pair(org.apache.commons.lang3.tuple.Pair) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) LinkedHashSet(java.util.LinkedHashSet) InjectMocks(org.mockito.InjectMocks) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) CloudStorageCdpService(com.sequenceiq.common.model.CloudStorageCdpService) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Set(java.util.Set) Mockito.when(org.mockito.Mockito.when) Test(org.junit.jupiter.api.Test) List(java.util.List) CmCloudStorageConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.cloudstorage.CmCloudStorageConfigProvider) SdxClientService(com.sequenceiq.cloudbreak.service.datalake.SdxClientService) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) FileSystemType(com.sequenceiq.common.model.FileSystemType) ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) BlueprintService(com.sequenceiq.cloudbreak.service.blueprint.BlueprintService) CloudIdentityType(com.sequenceiq.common.model.CloudIdentityType) Mockito.mock(org.mockito.Mockito.mock) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) Test(org.junit.jupiter.api.Test)

Example 40 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse 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())));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Mock(org.mockito.Mock) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ArrayList(java.util.ArrayList) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Pair(org.apache.commons.lang3.tuple.Pair) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) LinkedHashSet(java.util.LinkedHashSet) InjectMocks(org.mockito.InjectMocks) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) CloudStorageCdpService(com.sequenceiq.common.model.CloudStorageCdpService) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Set(java.util.Set) Mockito.when(org.mockito.Mockito.when) Test(org.junit.jupiter.api.Test) List(java.util.List) CmCloudStorageConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.cloudstorage.CmCloudStorageConfigProvider) SdxClientService(com.sequenceiq.cloudbreak.service.datalake.SdxClientService) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) FileSystemType(com.sequenceiq.common.model.FileSystemType) ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) BlueprintService(com.sequenceiq.cloudbreak.service.blueprint.BlueprintService) CloudIdentityType(com.sequenceiq.common.model.CloudIdentityType) Mockito.mock(org.mockito.Mockito.mock) CloudStorageCdpService(com.sequenceiq.common.model.CloudStorageCdpService) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.jupiter.api.Test)

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