use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithMonitoring.
@Test
public void testDecorateWithMonitoring() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withCrn("myClusterCrn").withType("datahub").withVersion("1.0.0").build();
MonitoringConfigView monitoringConfigView = new MonitoringConfigView.Builder().withEnabled(true).withClusterDetails(clusterDetails).build();
NodeStatusConfigView nodeStatusConfigView = new NodeStatusConfigView.Builder().withServerUsername("admin").withServerPassword("admin".toCharArray()).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
TelemetryCommonConfigView telemetryCommonConfigView = new TelemetryCommonConfigView.Builder().withClusterDetails(clusterDetails).build();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView, monitoringConfigView, nodeStatusConfigView, telemetryCommonConfigView);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "monitoring");
assertEquals(results.get("clusterType"), "datahub");
assertEquals(results.get("clusterVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView in project cloudbreak by hortonworks.
the class TelemetryDecorator method setupMetering.
private void setupMetering(Map<String, SaltPillarProperties> servicePillar, Stack stack, String serviceType, boolean meteringEnabled) {
MeteringConfigView meteringConfigView = meteringConfigService.createMeteringConfigs(meteringEnabled, stack.getCloudPlatform(), stack.getResourceCrn(), stack.getName(), getServiceTypeForMetering(stack, serviceType), getVersionForMetering(stack, version));
if (meteringConfigView.isEnabled()) {
Map<String, Object> meteringConfig = meteringConfigView.toMap();
servicePillar.put("metering", new SaltPillarProperties("/metering/init.sls", singletonMap("metering", meteringConfig)));
}
}
use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithSaasMonitoring.
@Test
public void testDecorateWithSaasMonitoring() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withCrn("myClusterCrn").withType("datahub").withVersion("1.0.0").build();
MonitoringConfigView monitoringConfigView = new MonitoringConfigView.Builder().withEnabled(true).withClusterDetails(clusterDetails).build();
NodeStatusConfigView nodeStatusConfigView = new NodeStatusConfigView.Builder().withServerUsername("admin").withServerPassword("admin".toCharArray()).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
TelemetryCommonConfigView telemetryCommonConfigView = new TelemetryCommonConfigView.Builder().withClusterDetails(clusterDetails).build();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView, monitoringConfigView, nodeStatusConfigView, telemetryCommonConfigView);
given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "monitoring");
assertEquals(results.get("clusterType"), "datahub");
assertEquals(results.get("clusterVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithMetering.
@Test
public void testDecorateWithMetering() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().withEnabled(true).withPlatform("AWS").withServiceType("DATAHUB").withServiceVersion("1.0.0").withClusterCrn("myClusterCrn").build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "metering");
assertEquals(results.get("serviceType"), "DATAHUB");
assertEquals(results.get("serviceVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
Aggregations