Search in sources :

Example 1 with TelemetryResponse

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

the class DiagnosticsCollectionValidatorTest method testWithValidEngDestination.

@Test
void testWithValidEngDestination() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.ENG);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setCrn(DATALAKE_CRN);
    TelemetryResponse telemetry = new TelemetryResponse();
    FeaturesResponse features = new FeaturesResponse();
    FeatureSetting featureSetting = new FeatureSetting();
    featureSetting.setEnabled(true);
    features.setClusterLogsCollection(featureSetting);
    telemetry.setFeatures(features);
    stackV4Response.setTelemetry(telemetry);
    underTest.validate(request, stackV4Response);
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) FeatureSetting(com.sequenceiq.common.api.type.FeatureSetting) Test(org.junit.jupiter.api.Test)

Example 2 with TelemetryResponse

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

the class DiagnosticsCollectionValidatorTest method testWithCloudStorageWithDisabledLogging.

@Test
void testWithCloudStorageWithDisabledLogging() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setCrn(DATALAKE_CRN);
    TelemetryResponse telemetry = new TelemetryResponse();
    stackV4Response.setTelemetry(telemetry);
    BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
    assertTrue(thrown.getMessage().contains("Cloud storage logging is disabled for Data Lake"));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 3 with TelemetryResponse

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

the class DiagnosticsCollectionValidatorTest method testWithEngDestinationAndDisabledLogCollection.

@Test
void testWithEngDestinationAndDisabledLogCollection() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.ENG);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setCrn(DATALAKE_CRN);
    TelemetryResponse telemetry = new TelemetryResponse();
    stackV4Response.setTelemetry(telemetry);
    BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
    assertTrue(thrown.getMessage().contains("Cluster log collection is not enabled for Data Lake"));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 4 with TelemetryResponse

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

the class TelemetryConverter method convert.

public TelemetryResponse convert(Telemetry telemetry) {
    TelemetryResponse response = null;
    if (freeIpaTelemetryEnabled && telemetry != null) {
        response = new TelemetryResponse();
        response.setFluentAttributes(telemetry.getFluentAttributes());
        response.setLogging(createLoggingResponseFromSource(telemetry.getLogging()));
        response.setMonitoring(createMonitoringResponseFromSource(telemetry.getMonitoring()));
        response.setFeatures(createFeaturesResponseFromSource(telemetry.getFeatures()));
        response.setRules(telemetry.getRules());
    }
    return response;
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse)

Example 5 with TelemetryResponse

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