### Question:
CloudStorageFolderResolverService { public void updateStorageLocation(Telemetry telemetry, String clusterType, String clusterName, String clusterCrn) { LOGGER.debug("Updating/enriching telemetry storage locations with cluster data."); if (telemetry != null && telemetry.getLogging() != null && StringUtils.isNotEmpty(telemetry.getLogging().getStorageLocation())) { Logging logging = telemetry.getLogging(); String storageLocation = logging.getStorageLocation(); if (logging.getS3() != null) { storageLocation = resolveS3Location(storageLocation, clusterType, clusterName, clusterCrn); } else if (logging.getAdlsGen2() != null) { storageLocation = resolveAdlsGen2Location(storageLocation, clusterType, clusterName, clusterCrn); } else if (logging.getGcs() != null) { storageLocation = resolveGcsLocation(storageLocation, clusterType, clusterName, clusterCrn); } else { LOGGER.warn("None of the telemetry logging storage location was resolved, " + "make sure storage type is set properly (currently supported: s3, abfs)"); } logging.setStorageLocation(storageLocation); } else { LOGGER.debug("Telemetry is not set, skipping cloud storage location updates."); } } CloudStorageFolderResolverService(S3ConfigGenerator s3ConfigGenerator,
            AdlsGen2ConfigGenerator adlsGen2ConfigGenerator,
            GcsConfigGenerator gcsConfigGenerator); void updateStorageLocation(Telemetry telemetry, String clusterType,
            String clusterName, String clusterCrn); String resolveS3Location(String location, String clusterType,
            String clusterName, String clusterCrn); String resolveAdlsGen2Location(String location, String clusterType,
            String clusterName, String clusterCrn); String resolveGcsLocation(String location, String clusterType,
            String clusterName, String clusterCrn);  }### Answer:
@Test public void testUpdateStorageLocationS3() { Telemetry telemetry = createTelemetry(); underTest.updateStorageLocation(telemetry, FluentClusterType.DATAHUB.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertEquals("s3: }
@Test public void testUpdateStorageLocationAdlsGen2() { Telemetry telemetry = createTelemetry(); telemetry.getLogging().setS3(null); telemetry.getLogging().setAdlsGen2(new AdlsGen2CloudStorageV1Parameters()); telemetry.getLogging().setStorageLocation("abfs: underTest.updateStorageLocation(telemetry, FluentClusterType.DATAHUB.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertEquals("abfs: }
@Test public void testUpdateStorageLocationAdlsGen2WithoutScheme() { Telemetry telemetry = createTelemetry(); telemetry.getLogging().setS3(null); telemetry.getLogging().setAdlsGen2(new AdlsGen2CloudStorageV1Parameters()); telemetry.getLogging().setStorageLocation("abfs: underTest.updateStorageLocation(telemetry, FluentClusterType.DATAHUB.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertEquals("abfs: }
@Test public void testUpdateStorageLocationWithoutScheme() { Telemetry telemetry = createTelemetry(); telemetry.getLogging().setStorageLocation("mybucket"); underTest.updateStorageLocation(telemetry, FluentClusterType.DATAHUB.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertEquals("s3: }
@Test public void testUpdateStorageLocationWithoutTelemetry() { Telemetry telemetry = null; underTest.updateStorageLocation(telemetry, null, null, null); assertNull(telemetry); }
@Test(expected = CrnParseException.class) public void testUpdateStorageLocationWithInvalidCrn() { Telemetry telemetry = createTelemetry(); underTest.updateStorageLocation(telemetry, FluentClusterType.DATAHUB.value(), "mycluster", "crn:cdp:cloudbreak:us-west:someone:stack:12345"); }