Search in sources :

Example 6 with FeaturesRequest

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

the class TelemetryTestDto method withOnlyCloudStorageLogging.

public TelemetryTestDto withOnlyCloudStorageLogging() {
    FeaturesRequest featuresRequest = new FeaturesRequest();
    featuresRequest.addClusterLogsCollection(false);
    featuresRequest.addWorkloadAnalytics(false);
    featuresRequest.addCloudStorageLogging(true);
    getRequest().setFeatures(featuresRequest);
    return this;
}
Also used : FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Example 7 with FeaturesRequest

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

the class TelemetryApiConverter method createFeaturesRequestEnvSource.

private FeaturesRequest createFeaturesRequestEnvSource(EnvironmentFeatures features) {
    FeaturesRequest featuresRequest = null;
    if (features != null) {
        featuresRequest = new FeaturesRequest();
        featuresRequest.setClusterLogsCollection(features.getClusterLogsCollection());
        featuresRequest.setMonitoring(features.getMonitoring());
        setCloudStorageLoggingOnFeaturesModel(features, featuresRequest);
        setMonitoringOnFeaturesModel(features, featuresRequest);
    }
    return featuresRequest;
}
Also used : FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Example 8 with FeaturesRequest

use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest 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 9 with FeaturesRequest

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

the class TelemetryApiConverterTest method testConvertWithDefaultFeatures.

@Test
public void testConvertWithDefaultFeatures() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    FeaturesRequest fr = new FeaturesRequest();
    telemetryRequest.setFeatures(fr);
    // WHEN
    EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
    // THEN
    assertNull(result.getFeatures().getWorkloadAnalytics());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) Features(com.sequenceiq.common.api.telemetry.model.Features) EnvironmentFeatures(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Example 10 with FeaturesRequest

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

the class TelemetryApiConverterTest method testConvert.

@Test
public void testConvert() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    LoggingRequest loggingRequest = new LoggingRequest();
    S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
    s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
    loggingRequest.setS3(s3Params);
    telemetryRequest.setLogging(loggingRequest);
    telemetryRequest.setWorkloadAnalytics(new WorkloadAnalyticsRequest());
    FeaturesRequest fr = new FeaturesRequest();
    fr.addClusterLogsCollection(true);
    fr.addWorkloadAnalytics(true);
    fr.addMonitoring(true);
    telemetryRequest.setFeatures(fr);
    given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
    // WHEN
    EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
    // THEN
    assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
    assertEquals("http://myaddress/api/v1/receive", result.getMonitoring().getRemoteWriteUrl());
    assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
    assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
    assertTrue(result.getFeatures().getUseSharedAltusCredential().isEnabled());
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertTrue(result.getFeatures().getCloudStorageLogging().isEnabled());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Features(com.sequenceiq.common.api.telemetry.model.Features) EnvironmentFeatures(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures) WorkloadAnalyticsRequest(com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Aggregations

FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)18 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)13 Test (org.junit.jupiter.api.Test)8 Features (com.sequenceiq.common.api.telemetry.model.Features)7 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)7 EnvironmentFeatures (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures)6 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)6 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)4 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)4 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)3 WorkloadAnalyticsRequest (com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest)3 Test (org.junit.Test)2 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)1 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)1 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)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 HashMap (java.util.HashMap)1