forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure#44 from tiffanyachen/dev
Added msak tests
- Loading branch information
Showing
9 changed files
with
1,434 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target/ |
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
516 changes: 516 additions & 0 deletions
516
...eyvault/src/test/java/com/microsoft/azure/keyvault/test/ManagedStorageAccountKeyTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
azure-keyvault/src/test/java/com/microsoft/azure/keyvault/test/crudNames.json
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"roleDefUUID":"61927a2e-1dd1-4ae2-8ad1-e53fdf3ae32d","storageAccountName":"sa7333192560","vaultName":"vaultf9c58684e"} |
1 change: 1 addition & 0 deletions
1
azure-keyvault/src/test/java/com/microsoft/azure/keyvault/test/sasNames.json
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"roleDefUUID":"0c337b82-553c-4aaf-aa62-eab5dc446bb3","storageAccountName":"sa2c77808410","vaultName":"vault669612016"} |
58 changes: 58 additions & 0 deletions
58
azure-keyvault/src/test/java/resources/MockUserTokenCredentials.java
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package resources; | ||
|
||
import java.io.IOException; | ||
import java.util.Date; | ||
|
||
import com.microsoft.azure.AzureEnvironment; | ||
import com.microsoft.azure.credentials.UserTokenCredentials; | ||
import com.microsoft.aad.adal4j.AuthenticationResult; | ||
|
||
|
||
|
||
public class MockUserTokenCredentials extends UserTokenCredentials { | ||
|
||
private AuthenticationResult authenticationResult; | ||
|
||
|
||
public MockUserTokenCredentials(String clientId, String domain, String username, String password, | ||
AzureEnvironment environment) { | ||
super(clientId, domain, username, password, environment); | ||
} | ||
|
||
public MockUserTokenCredentials() { | ||
this("","","","", AzureEnvironment.AZURE); | ||
} | ||
@Override | ||
public String getToken(String resource) throws IOException { | ||
if (authenticationResult != null | ||
&& authenticationResult.getExpiresOnDate().before(new Date())) { | ||
acquireAccessTokenFromRefreshToken(); | ||
} else { | ||
acquireAccessToken(); | ||
} | ||
return authenticationResult.getAccessToken(); | ||
} | ||
|
||
private void acquireAccessToken() throws IOException { | ||
this.authenticationResult = new AuthenticationResult( | ||
null, | ||
"token1", | ||
"refresh", | ||
1, | ||
null, | ||
null, | ||
false); | ||
} | ||
|
||
private void acquireAccessTokenFromRefreshToken() throws IOException { | ||
this.authenticationResult = new AuthenticationResult( | ||
null, | ||
"token2", | ||
"refresh", | ||
1, | ||
null, | ||
null, | ||
false); | ||
} | ||
} | ||
|
443 changes: 443 additions & 0 deletions
443
...lt/target/test-classes/session-records/testCrudOperationsForManagedStorageAccountKey.json
Large diffs are not rendered by default.
Oops, something went wrong.
389 changes: 389 additions & 0 deletions
389
...t/test-classes/session-records/testSetAndGetSasDefinitionForManagedStorageAccountKey.json
Large diffs are not rendered by default.
Oops, something went wrong.
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