forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug with DataLakeImplUtils.endpointToDesiredEndpoint (Azure#17449)
Co-authored-by: gapra <gapra@microsoft.com>
- Loading branch information
1 parent
d0fbe8d
commit 925ee8a
Showing
9 changed files
with
36 additions
and
423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 32 additions & 30 deletions
62
...azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/UrlTests.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,64 @@ | ||
package com.azure.storage.file.datalake | ||
|
||
import com.azure.storage.common.StorageSharedKeyCredential | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
class UrlTests extends APISpec { | ||
class UrlTests extends Specification { | ||
|
||
StorageSharedKeyCredential credential = new StorageSharedKeyCredential("accountname", "accountkey"); | ||
|
||
@Unroll | ||
def "test urls that should not change for datalake"() { | ||
when: | ||
DataLakeServiceClient client = new DataLakeServiceClientBuilder() | ||
.endpoint(endpoint) | ||
.credential(primaryCredential) | ||
.credential(credential) | ||
.buildClient() | ||
then: | ||
client.getAccountUrl() == client.blobServiceClient.getAccountUrl() | ||
|
||
where: | ||
endpoint | _ | ||
"https://www.customstorageurl.com" | _ | ||
"https://account.core.windows.net" | _ | ||
"https://0.0.0.0/account" | _ | ||
"https://account.file.core.windows.net" | _ | ||
endpoint | _ | ||
"https://www.customstorageurl.com" | _ | ||
"https://account.core.windows.net" | _ | ||
"https://0.0.0.0/account" | _ | ||
"https://account.file.core.windows.net" | _ | ||
"https://www.customdfsstorageurl.com" | _ | ||
"https://dfsaccount.core.windows.net" | _ | ||
"https://0.0.0.0/dfsaccount" | _ | ||
"https://dfsaccount.file.core.windows.net" | _ | ||
} | ||
|
||
@Unroll | ||
def "test correct service url set"() { | ||
when: | ||
def blobUrl = "https://account.blob.core.windows.net" | ||
def dfsUrl = "https://account.dfs.core.windows.net" | ||
|
||
def testUrl = blobUrl | ||
if (useDfsurl) { | ||
testUrl = dfsUrl | ||
} | ||
|
||
DataLakeServiceClient serviceClient = new DataLakeServiceClientBuilder() | ||
.endpoint(testUrl) | ||
.credential(primaryCredential) | ||
.endpoint(url) | ||
.credential(credential) | ||
.buildClient() | ||
DataLakeFileSystemClient fileSystemClient = new DataLakeFileSystemClientBuilder() | ||
.endpoint(testUrl + "/container") | ||
.credential(primaryCredential) | ||
.endpoint(url + "/container") | ||
.credential(credential) | ||
.buildClient() | ||
DataLakeFileClient pathClient = new DataLakePathClientBuilder() | ||
.endpoint(testUrl + "/container/blob") | ||
.credential(primaryCredential) | ||
.endpoint(url + "/container/blob") | ||
.credential(credential) | ||
.buildFileClient() | ||
then: | ||
// In either case the dfs url should be set to the dfs client and blob url set to the blob client | ||
serviceClient.getAccountUrl() == dfsUrl | ||
serviceClient.blobServiceClient.getAccountUrl() == blobUrl | ||
fileSystemClient.getFileSystemUrl() == dfsUrl + "/container" | ||
fileSystemClient.blobContainerClient.getBlobContainerUrl() == blobUrl + "/container" | ||
pathClient.getPathUrl() == dfsUrl + "/container/blob" | ||
pathClient.blockBlobClient.getBlobUrl() == blobUrl + "/container/blob" | ||
serviceClient.getAccountUrl() == expectedDfsUrl | ||
serviceClient.blobServiceClient.getAccountUrl() == expectedBlobUrl | ||
fileSystemClient.getFileSystemUrl() == expectedDfsUrl + "/container" | ||
fileSystemClient.blobContainerClient.getBlobContainerUrl() == expectedBlobUrl + "/container" | ||
pathClient.getPathUrl() == expectedDfsUrl + "/container/blob" | ||
pathClient.blockBlobClient.getBlobUrl() == expectedBlobUrl + "/container/blob" | ||
|
||
where: | ||
useDfsurl | _ | ||
true | _ | ||
false | _ | ||
url || expectedBlobUrl | expectedDfsUrl | ||
"https://account.blob.core.windows.net" || "https://account.blob.core.windows.net" | "https://account.dfs.core.windows.net" | ||
"https://dfsaccount.blob.core.windows.net" || "https://dfsaccount.blob.core.windows.net" | "https://dfsaccount.dfs.core.windows.net" | ||
"https://account.dfs.core.windows.net" || "https://account.blob.core.windows.net" | "https://account.dfs.core.windows.net" | ||
"https://dfsaccount.dfs.core.windows.net" || "https://dfsaccount.blob.core.windows.net" | "https://dfsaccount.dfs.core.windows.net" | ||
} | ||
} |
65 changes: 0 additions & 65 deletions
65
...file-datalake/src/test/resources/session-records/UrlTeststestcorrectserviceurlset[0].json
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
...file-datalake/src/test/resources/session-records/UrlTeststestcorrectserviceurlset[1].json
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
...src/test/resources/session-records/UrlTeststesturlsthatshouldnotchangefordatalake[0].json
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
...src/test/resources/session-records/UrlTeststesturlsthatshouldnotchangefordatalake[1].json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.