Search in sources :

Example 1 with LoggingRequest

use of com.sequenceiq.common.api.telemetry.request.LoggingRequest in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromRequest.

@Test
public void testConvertFromRequest() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    LoggingRequest logging = new LoggingRequest();
    logging.setS3(new S3CloudStorageV1Parameters());
    WorkloadAnalyticsRequest workloadAnalyticsRequest = new WorkloadAnalyticsRequest();
    FeaturesRequest featuresRequest = new FeaturesRequest();
    featuresRequest.addClusterLogsCollection(false);
    featuresRequest.addMonitoring(true);
    featuresRequest.addCloudStorageLogging(false);
    telemetryRequest.setLogging(logging);
    telemetryRequest.setFeatures(featuresRequest);
    telemetryRequest.setWorkloadAnalytics(workloadAnalyticsRequest);
    // WHEN
    Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
    // THEN
    assertNotNull(result.getFeatures().getWorkloadAnalytics());
    assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
    assertFalse(result.getFeatures().getCloudStorageLogging().isEnabled());
    assertTrue(result.getFeatures().getMetering().isEnabled());
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
    assertTrue(result.getFeatures().getUseSharedAltusCredential().isEnabled());
    assertEquals(DATABUS_ENDPOINT, result.getDatabusEndpoint());
    assertEquals(DATABUS_ENDPOINT, result.getWorkloadAnalytics().getDatabusEndpoint());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) WorkloadAnalyticsRequest(com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.Test)

Example 2 with LoggingRequest

use of com.sequenceiq.common.api.telemetry.request.LoggingRequest in project cloudbreak by hortonworks.

the class TelemetryApiConverter method createLoggingRequestFromEnvSource.

private LoggingRequest createLoggingRequestFromEnvSource(EnvironmentLogging logging) {
    LoggingRequest loggingRequest = null;
    if (logging != null) {
        loggingRequest = new LoggingRequest();
        loggingRequest.setStorageLocation(logging.getStorageLocation());
        loggingRequest.setS3(convertS3(logging.getS3()));
        loggingRequest.setAdlsGen2(convertAdlsV2(logging.getAdlsGen2()));
        loggingRequest.setGcs(convertGcs(logging.getGcs()));
        loggingRequest.setCloudwatch(CloudwatchParams.copy(logging.getCloudwatch()));
    }
    return loggingRequest;
}
Also used : LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest)

Example 3 with LoggingRequest

use of com.sequenceiq.common.api.telemetry.request.LoggingRequest in project cloudbreak by hortonworks.

the class GcpCloudProvider method loggingRequest.

@Override
public LoggingRequest loggingRequest(TelemetryTestDto dto) {
    GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
    gcsCloudStorageV1Parameters.setServiceAccountEmail(getServiceAccountEmail());
    LoggingRequest loggingRequest = new LoggingRequest();
    loggingRequest.setGcs(gcsCloudStorageV1Parameters);
    loggingRequest.setStorageLocation(getBaseLocation());
    return loggingRequest;
}
Also used : LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)

Example 4 with LoggingRequest

use of com.sequenceiq.common.api.telemetry.request.LoggingRequest in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromRequest.

@Test
public void testConvertFromRequest() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    LoggingRequest logging = new LoggingRequest();
    logging.setS3(new S3CloudStorageV1Parameters());
    FeaturesRequest featuresRequest = new FeaturesRequest();
    featuresRequest.addClusterLogsCollection(false);
    telemetryRequest.setLogging(logging);
    MonitoringRequest monitoringRequest = new MonitoringRequest();
    monitoringRequest.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
    telemetryRequest.setMonitoring(monitoringRequest);
    telemetryRequest.setFeatures(featuresRequest);
    // WHEN
    Telemetry result = underTest.convert(telemetryRequest);
    // THEN
    assertThat(result.getFeatures().getWorkloadAnalytics(), nullValue());
    assertThat(result.getFeatures().getClusterLogsCollection().isEnabled(), is(false));
    assertThat(result.getFeatures().getCloudStorageLogging().isEnabled(), is(true));
    assertThat(result.getFeatures().getMonitoring().isEnabled(), is(true));
    assertThat(result.getDatabusEndpoint(), is(DATABUS_ENDPOINT));
    assertThat(result.getMonitoring().getRemoteWriteUrl(), is(MONITORING_REMOTE_WRITE_URL));
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Example 5 with LoggingRequest

use of com.sequenceiq.common.api.telemetry.request.LoggingRequest in project cloudbreak by hortonworks.

the class LoggingRequestValidatorTest method testValidateValidBasePathUri.

@Test
public void testValidateValidBasePathUri() {
    // GIVEN
    LoggingRequest loggingRequest = new LoggingRequest();
    loggingRequest.setS3(new S3CloudStorageV1Parameters());
    loggingRequest.setStorageLocation("s3://basePath/custom");
    // WHEN
    boolean result = underTest.isValid(loggingRequest, context);
    // THEN
    assertTrue(result);
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) Test(org.junit.jupiter.api.Test)

Aggregations

LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)25 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)12 Test (org.junit.jupiter.api.Test)11 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)9 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)7 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)4 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)3 WorkloadAnalyticsRequest (com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest)3 StorageIdentityBase (com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)2 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)2 Logging (com.sequenceiq.common.api.telemetry.model.Logging)2 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)2 ObjectStorageValidateRequest (com.sequenceiq.cloudbreak.cloud.model.objectstorage.ObjectStorageValidateRequest)1 ObjectStorageValidateResponse (com.sequenceiq.cloudbreak.cloud.model.objectstorage.ObjectStorageValidateResponse)1 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)1 Features (com.sequenceiq.common.api.telemetry.model.Features)1 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)1 MonitoringResponse (com.sequenceiq.common.api.telemetry.response.MonitoringResponse)1 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)1 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)1