use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.
the class TelemetryConverterTest method setUp.
@Before
public void setUp() {
AltusDatabusConfiguration altusDatabusConfiguration = new AltusDatabusConfiguration(DATABUS_ENDPOINT, DATABUS_S3_BUCKET, true, "****", "****");
MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, "app", "stream");
ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(true, "app", "stream");
MonitoringConfiguration monitoringConfig = new MonitoringConfiguration();
monitoringConfig.setEnabled(true);
TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(altusDatabusConfiguration, meteringConfiguration, logCollectionConfig, monitoringConfig, null);
underTest = new TelemetryConverter(telemetryConfiguration, true, true);
}
use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithDefaultDisabled.
@Test
public void testConvertFromEnvAndSdxResponseWithDefaultDisabled() {
// GIVEN
SdxClusterResponse sdxClusterResponse = null;
AltusDatabusConfiguration altusDatabusConfiguration = new AltusDatabusConfiguration(DATABUS_ENDPOINT, DATABUS_S3_BUCKET, false, "", null);
MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, null, null);
ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(true, null, null);
MonitoringConfiguration monitoringConfig = new MonitoringConfiguration();
monitoringConfig.setEnabled(true);
TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(altusDatabusConfiguration, meteringConfiguration, logCollectionConfig, monitoringConfig, null);
TelemetryConverter converter = new TelemetryConverter(telemetryConfiguration, true, false);
// WHEN
TelemetryRequest result = converter.convert(null, sdxClusterResponse);
// THEN
assertNull(result.getWorkloadAnalytics());
assertNull(result.getFeatures().getMonitoring());
assertNotNull(result.getFeatures());
assertFalse(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method setUp.
@BeforeEach
public void setUp() {
MockitoAnnotations.openMocks(this);
AltusDatabusConfiguration altusDatabusConfiguration = new AltusDatabusConfiguration("", "", true, "****", "****");
MeteringConfiguration meteringConfiguration = new MeteringConfiguration(false, null, null);
ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(true, null, null);
MonitoringConfiguration monitoringConfig = new MonitoringConfiguration();
monitoringConfig.setEnabled(true);
monitoringConfig.setRemoteWriteUrl("http://myaddress/api/v1/receive");
TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(altusDatabusConfiguration, meteringConfiguration, logCollectionConfig, monitoringConfig, null);
underTest = new TelemetryApiConverter(telemetryConfiguration, entitlementService);
}
use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.
the class DatabusRequestConverterTest method testConvertWithoutAccountId.
@Test
public void testConvertWithoutAccountId() {
// GIVEN
MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, "CdpVmMetrics", "CdpVmMetrics");
DatabusRequest input = DatabusRequest.Builder.newBuilder().withRawBody("{}").withContext(DatabusRequestContext.Builder.newBuilder().addAdditionalDatabusHeader("third-header", "app-name").build()).build();
// WHEN
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> DatabusRequestConverter.convert(input, meteringConfiguration));
// THEN
assertTrue(exception.getMessage().contains("At least accountId needs to be filled"));
}
use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.
the class DatabusRequestConverterTest method testConvertWithoutPayload.
@Test
public void testConvertWithoutPayload() {
// GIVEN
MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, "CdpVmMetrics", "CdpVmMetrics");
DatabusRequest input = DatabusRequest.Builder.newBuilder().withContext(DatabusRequestContext.Builder.newBuilder().withAccountId("cloudera").build()).build();
// WHEN
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> DatabusRequestConverter.convert(input, meteringConfiguration));
// THEN
assertTrue(exception.getMessage().contains("At least raw body message needs to be filled"));
}
Aggregations