@Test public void testEnrichWithSdxDataWithExistingSdxData() { Map<String, String> safetyValveMap = new HashMap<>(); WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics(); workloadAnalytics.setDatabusEndpoint("customEndpoint"); underTest.enrichWithSdxData("mySdxName", "crn:cdp:iam:us-west-1:accountId:user:mySdxId", null, workloadAnalytics, safetyValveMap); assertTrue(safetyValveMap.containsKey("databus.header.sdx.id")); assertTrue(safetyValveMap.containsKey("databus.header.sdx.name")); assertEquals(safetyValveMap.get("databus.header.sdx.id"), "mySdxId"); assertEquals(safetyValveMap.get("databus.header.sdx.name"), "mySdxName"); }
@VisibleForTesting void enrichWithSdxData(String sdxContextName, String sdxCrn, Stack stack, WorkloadAnalytics workloadAnalytics, Map<String, String> telemetrySafetyValveMap) { sdxContextName = StringUtils.isNotEmpty(sdxContextName) ? sdxContextName : String.format("%s-%s", stack.getCluster().getName(), stack.getCluster().getId().toString()); String sdxId = sdxCrn != null && Crn.fromString(sdxCrn) != null ? Crn.fromString(sdxCrn).getResource() : UUID.nameUUIDFromBytes(sdxContextName.getBytes()).toString(); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_ID, sdxId); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_NAME, sdxContextName); if (workloadAnalytics.getAttributes() != null) { for (Map.Entry<String, Object> entry : workloadAnalytics.getAttributes().entrySet()) { telemetrySafetyValveMap.put(entry.getKey(), ObjectUtils.defaultIfNull(entry.getValue().toString(), "")); } } }
ClouderaManagerMgmtTelemetryService { @VisibleForTesting void enrichWithSdxData(String sdxContextName, String sdxCrn, Stack stack, WorkloadAnalytics workloadAnalytics, Map<String, String> telemetrySafetyValveMap) { sdxContextName = StringUtils.isNotEmpty(sdxContextName) ? sdxContextName : String.format("%s-%s", stack.getCluster().getName(), stack.getCluster().getId().toString()); String sdxId = sdxCrn != null && Crn.fromString(sdxCrn) != null ? Crn.fromString(sdxCrn).getResource() : UUID.nameUUIDFromBytes(sdxContextName.getBytes()).toString(); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_ID, sdxId); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_NAME, sdxContextName); if (workloadAnalytics.getAttributes() != null) { for (Map.Entry<String, Object> entry : workloadAnalytics.getAttributes().entrySet()) { telemetrySafetyValveMap.put(entry.getKey(), ObjectUtils.defaultIfNull(entry.getValue().toString(), "")); } } } }
ClouderaManagerMgmtTelemetryService { @VisibleForTesting void enrichWithSdxData(String sdxContextName, String sdxCrn, Stack stack, WorkloadAnalytics workloadAnalytics, Map<String, String> telemetrySafetyValveMap) { sdxContextName = StringUtils.isNotEmpty(sdxContextName) ? sdxContextName : String.format("%s-%s", stack.getCluster().getName(), stack.getCluster().getId().toString()); String sdxId = sdxCrn != null && Crn.fromString(sdxCrn) != null ? Crn.fromString(sdxCrn).getResource() : UUID.nameUUIDFromBytes(sdxContextName.getBytes()).toString(); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_ID, sdxId); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_NAME, sdxContextName); if (workloadAnalytics.getAttributes() != null) { for (Map.Entry<String, Object> entry : workloadAnalytics.getAttributes().entrySet()) { telemetrySafetyValveMap.put(entry.getKey(), ObjectUtils.defaultIfNull(entry.getValue().toString(), "")); } } }  }
ClouderaManagerMgmtTelemetryService { @VisibleForTesting void enrichWithSdxData(String sdxContextName, String sdxCrn, Stack stack, WorkloadAnalytics workloadAnalytics, Map<String, String> telemetrySafetyValveMap) { sdxContextName = StringUtils.isNotEmpty(sdxContextName) ? sdxContextName : String.format("%s-%s", stack.getCluster().getName(), stack.getCluster().getId().toString()); String sdxId = sdxCrn != null && Crn.fromString(sdxCrn) != null ? Crn.fromString(sdxCrn).getResource() : UUID.nameUUIDFromBytes(sdxContextName.getBytes()).toString(); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_ID, sdxId); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_NAME, sdxContextName); if (workloadAnalytics.getAttributes() != null) { for (Map.Entry<String, Object> entry : workloadAnalytics.getAttributes().entrySet()) { telemetrySafetyValveMap.put(entry.getKey(), ObjectUtils.defaultIfNull(entry.getValue().toString(), "")); } } }  void setupTelemetryRole(final Stack stack, final ApiClient client, final ApiHostRef cmHostRef,
            final ApiRoleList mgmtRoles, final Telemetry telemetry); void updateTelemetryConfigs(final Stack stack, final ApiClient client,
            final Telemetry telemetry, final String sdxContextName,
            final String sdxStackCrn, final ProxyConfig proxyConfig); }
ClouderaManagerMgmtTelemetryService { @VisibleForTesting void enrichWithSdxData(String sdxContextName, String sdxCrn, Stack stack, WorkloadAnalytics workloadAnalytics, Map<String, String> telemetrySafetyValveMap) { sdxContextName = StringUtils.isNotEmpty(sdxContextName) ? sdxContextName : String.format("%s-%s", stack.getCluster().getName(), stack.getCluster().getId().toString()); String sdxId = sdxCrn != null && Crn.fromString(sdxCrn) != null ? Crn.fromString(sdxCrn).getResource() : UUID.nameUUIDFromBytes(sdxContextName.getBytes()).toString(); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_ID, sdxId); telemetrySafetyValveMap.put(DATABUS_HEADER_SDX_NAME, sdxContextName); if (workloadAnalytics.getAttributes() != null) { for (Map.Entry<String, Object> entry : workloadAnalytics.getAttributes().entrySet()) { telemetrySafetyValveMap.put(entry.getKey(), ObjectUtils.defaultIfNull(entry.getValue().toString(), "")); } } }  void setupTelemetryRole(final Stack stack, final ApiClient client, final ApiHostRef cmHostRef,
            final ApiRoleList mgmtRoles, final Telemetry telemetry); void updateTelemetryConfigs(final Stack stack, final ApiClient client,
            final Telemetry telemetry, final String sdxContextName,
            final String sdxStackCrn, final ProxyConfig proxyConfig);  }