Search in sources :

Example 1 with FeaturesRequest

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

the class TelemetryConverter method createFeaturesRequestFromSource.

private FeaturesRequest createFeaturesRequestFromSource(Telemetry telemetry) {
    FeaturesRequest featuresRequest = null;
    Features features = telemetry.getFeatures();
    if (features != null) {
        featuresRequest = new FeaturesRequest();
        featuresRequest.setWorkloadAnalytics(features.getWorkloadAnalytics());
        featuresRequest.setClusterLogsCollection(features.getClusterLogsCollection());
        featuresRequest.setMonitoring(features.getMonitoring());
        setCloudStorageLoggingOnFeaturesModel(features, featuresRequest);
    }
    return featuresRequest;
}
Also used : Features(com.sequenceiq.common.api.telemetry.model.Features) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Example 2 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());
    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 3 with FeaturesRequest

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

the class TelemetryConverterTest method testConvertFromRequestWithFeatures.

@Test
public void testConvertFromRequestWithFeatures() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    FeaturesRequest features = new FeaturesRequest();
    features.addClusterLogsCollection(true);
    telemetryRequest.setFeatures(features);
    // WHEN
    Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
    // THEN
    assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
    assertTrue(result.getFeatures().getMetering().isEnabled());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.Test)

Example 4 with FeaturesRequest

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

the class TelemetryApiConverterTest method testConvertWithDisabledMonitoringFeatureWithCdpSaas.

@Test
public void testConvertWithDisabledMonitoringFeatureWithCdpSaas() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
    FeaturesRequest featuresRequest = new FeaturesRequest();
    featuresRequest.addMonitoring(false);
    telemetryRequest.setFeatures(featuresRequest);
    // WHEN
    EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
    // THEN
    assertFalse(result.getFeatures().getMonitoring().isEnabled());
    assertNotNull(result.getMonitoring().getRemoteWriteUrl());
}
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 5 with FeaturesRequest

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

the class TelemetryApiConverterTest method testConvertWithWADisabled.

@Test
public void testConvertWithWADisabled() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    FeaturesRequest fr = new FeaturesRequest();
    fr.addWorkloadAnalytics(false);
    telemetryRequest.setFeatures(fr);
    // WHEN
    EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
    // THEN
    assertFalse(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
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)

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