@@ -149,7 +149,7 @@ public void setup() throws Exception {
149149 if (!isIPAddress
150150 && (abfsConfig .getAuthType (accountName ) != AuthType .SAS )
151151 && !abfs .getIsNamespaceEnabled ()) {
152- final URI wasbUri = new URI (abfsUrlToWasbUrl (getTestUrl ()));
152+ final URI wasbUri = new URI (abfsUrlToWasbUrl (getTestUrl (), abfsConfig . isHttpsAlwaysUsed () ));
153153 final AzureNativeFileSystemStore azureNativeFileSystemStore =
154154 new AzureNativeFileSystemStore ();
155155
@@ -355,13 +355,13 @@ protected void touch(Path path) throws IOException {
355355 protected static String wasbUrlToAbfsUrl (final String wasbUrl ) {
356356 return convertTestUrls (
357357 wasbUrl , FileSystemUriSchemes .WASB_SCHEME , FileSystemUriSchemes .WASB_SECURE_SCHEME , FileSystemUriSchemes .WASB_DNS_PREFIX ,
358- FileSystemUriSchemes .ABFS_SCHEME , FileSystemUriSchemes .ABFS_SECURE_SCHEME , FileSystemUriSchemes .ABFS_DNS_PREFIX );
358+ FileSystemUriSchemes .ABFS_SCHEME , FileSystemUriSchemes .ABFS_SECURE_SCHEME , FileSystemUriSchemes .ABFS_DNS_PREFIX , false );
359359 }
360360
361- protected static String abfsUrlToWasbUrl (final String abfsUrl ) {
361+ protected static String abfsUrlToWasbUrl (final String abfsUrl , final boolean isAlwaysHttpsUsed ) {
362362 return convertTestUrls (
363363 abfsUrl , FileSystemUriSchemes .ABFS_SCHEME , FileSystemUriSchemes .ABFS_SECURE_SCHEME , FileSystemUriSchemes .ABFS_DNS_PREFIX ,
364- FileSystemUriSchemes .WASB_SCHEME , FileSystemUriSchemes .WASB_SECURE_SCHEME , FileSystemUriSchemes .WASB_DNS_PREFIX );
364+ FileSystemUriSchemes .WASB_SCHEME , FileSystemUriSchemes .WASB_SECURE_SCHEME , FileSystemUriSchemes .WASB_DNS_PREFIX , isAlwaysHttpsUsed );
365365 }
366366
367367 private static String convertTestUrls (
@@ -371,15 +371,17 @@ private static String convertTestUrls(
371371 final String fromDnsPrefix ,
372372 final String toNonSecureScheme ,
373373 final String toSecureScheme ,
374- final String toDnsPrefix ) {
374+ final String toDnsPrefix ,
375+ final boolean isAlwaysHttpsUsed ) {
375376 String data = null ;
376- if (url .startsWith (fromNonSecureScheme + "://" )) {
377+ if (url .startsWith (fromNonSecureScheme + "://" ) && isAlwaysHttpsUsed ) {
378+ data = url .replace (fromNonSecureScheme + "://" , toSecureScheme + "://" );
379+ } else if (url .startsWith (fromNonSecureScheme + "://" )) {
377380 data = url .replace (fromNonSecureScheme + "://" , toNonSecureScheme + "://" );
378381 } else if (url .startsWith (fromSecureScheme + "://" )) {
379382 data = url .replace (fromSecureScheme + "://" , toSecureScheme + "://" );
380383 }
381384
382-
383385 if (data != null ) {
384386 data = data .replace ("." + fromDnsPrefix + "." ,
385387 "." + toDnsPrefix + "." );
0 commit comments