Search in sources :

Example 6 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry 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 7 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromRequestWithDefaultFeatures.

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

Example 8 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertWhenWorkloadAnalyticsIsNotNullThenItsAttributesShouldBePassed.

@Test
public void testConvertWhenWorkloadAnalyticsIsNotNullThenItsAttributesShouldBePassed() {
    WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics();
    workloadAnalytics.setDatabusEndpoint(DATABUS_ENDPOINT);
    workloadAnalytics.setAttributes(Map.of("someAttributeKey", "someOtherStuffForValue"));
    Telemetry input = new Telemetry();
    input.setWorkloadAnalytics(workloadAnalytics);
    TelemetryResponse response = underTest.convert(input);
    assertNotNull(response);
    assertNotNull(response.getWorkloadAnalytics());
    assertEquals(input.getWorkloadAnalytics().getAttributes(), response.getWorkloadAnalytics().getAttributes());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics) Test(org.junit.Test)

Example 9 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromRequestWithAttributes.

@Test
public void testConvertFromRequestWithAttributes() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    Map<String, Object> fluentAttributes = new HashMap<>();
    fluentAttributes.put("myAttrKey", "myAttrValue");
    telemetryRequest.setFluentAttributes(fluentAttributes);
    // WHEN
    Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
    // THEN
    assertEquals(1, result.getFluentAttributes().size());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) HashMap(java.util.HashMap) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 10 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry 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)

Aggregations

Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)109 Test (org.junit.Test)55 Test (org.junit.jupiter.api.Test)31 Logging (com.sequenceiq.common.api.telemetry.model.Logging)30 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)20 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)16 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)15 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)13 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)12 Backup (com.sequenceiq.freeipa.api.model.Backup)12 HashMap (java.util.HashMap)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)10 Features (com.sequenceiq.common.api.telemetry.model.Features)10 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)8 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)8 ApiClient (com.cloudera.api.swagger.client.ApiClient)7 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)7 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)6 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)6