use ref instead of pointer (#3364)
This commit is contained in:
parent
9bbd33b714
commit
9f58947056
@ -64,7 +64,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
// If Playback or Record is not set, no changes will be done to the clientOptions or credential.
|
||||
// Call this before creating the SDK client
|
||||
void PrepareClientOptions(
|
||||
std::shared_ptr<Core::Credentials::TokenCredential>** credential,
|
||||
std::shared_ptr<Core::Credentials::TokenCredential>& credential,
|
||||
Azure::Core::_internal::ClientOptions& options)
|
||||
{
|
||||
// Set up client options depending on the test-mode
|
||||
@ -74,7 +74,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
// - playback transport adapter to read and return payload from json files
|
||||
// - never-expiring test credential to never require a token
|
||||
options.Transport.Transport = m_interceptor->GetPlaybackTransport();
|
||||
**credential = m_interceptor->GetTestCredential();
|
||||
credential = m_interceptor->GetTestCredential();
|
||||
}
|
||||
else if (!m_testContext.IsLiveMode())
|
||||
{
|
||||
@ -190,12 +190,12 @@ namespace Azure { namespace Core { namespace Test {
|
||||
template <class T, class O>
|
||||
std::unique_ptr<T> InitTestClient(
|
||||
std::string const& url,
|
||||
std::shared_ptr<Core::Credentials::TokenCredential>* credential,
|
||||
std::shared_ptr<Core::Credentials::TokenCredential>& credential,
|
||||
O& options)
|
||||
{
|
||||
// Run instrumentation before creating the client
|
||||
PrepareClientOptions(&credential, options);
|
||||
return std::make_unique<T>(url, *credential, options);
|
||||
PrepareClientOptions(credential, options);
|
||||
return std::make_unique<T>(url, credential, options);
|
||||
}
|
||||
|
||||
template <class T> T InitClientOptions()
|
||||
|
||||
@ -77,7 +77,7 @@ namespace Azure {
|
||||
m_client = InitTestClient<
|
||||
Azure::Security::KeyVault::Certificates::CertificateClient,
|
||||
Azure::Security::KeyVault::Certificates::CertificateClientOptions>(
|
||||
m_keyVaultUrl, &m_credential, options);
|
||||
m_keyVaultUrl, m_credential, options);
|
||||
|
||||
// Update default time depending on test mode.
|
||||
UpdateWaitingTime(m_defaultWait);
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam
|
||||
return InitTestClient<
|
||||
Azure::Security::KeyVault::Keys::Cryptography::CryptographyClient,
|
||||
Azure::Security::KeyVault::Keys::Cryptography::CryptographyClientOptions>(
|
||||
keyId, &m_credential, options);
|
||||
keyId, m_credential, options);
|
||||
}
|
||||
|
||||
// Create
|
||||
@ -66,7 +66,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam
|
||||
// `InitTestClient` takes care of setting up Record&Playback.
|
||||
m_client = InitTestClient<
|
||||
Azure::Security::KeyVault::Keys::KeyClient,
|
||||
Azure::Security::KeyVault::Keys::KeyClientOptions>(m_keyVaultUrl, &m_credential, options);
|
||||
Azure::Security::KeyVault::Keys::KeyClientOptions>(m_keyVaultUrl, m_credential, options);
|
||||
|
||||
UpdateWaitingTime(m_testPollingIntervalMs);
|
||||
}
|
||||
@ -77,7 +77,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam
|
||||
m_client = InitTestClient<
|
||||
Azure::Security::KeyVault::Keys::KeyClient,
|
||||
Azure::Security::KeyVault::Keys::KeyClientOptions>(
|
||||
m_keyVaultHsmUrl, &m_credential, options);
|
||||
m_keyVaultHsmUrl, m_credential, options);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@ -53,7 +53,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets {
|
||||
m_client = InitTestClient<
|
||||
Azure::Security::KeyVault::Secrets::SecretClient,
|
||||
Azure::Security::KeyVault::Secrets::SecretClientOptions>(
|
||||
m_keyVaultUrl, &m_credential, options);
|
||||
m_keyVaultUrl, m_credential, options);
|
||||
|
||||
// Update default time depending on test mode.
|
||||
UpdateWaitingTime(m_defaultWait);
|
||||
|
||||
@ -475,7 +475,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
Blobs::BlobClientOptions options;
|
||||
|
||||
auto blobServiceClient1 = InitTestClient<Blobs::BlobServiceClient, Blobs::BlobClientOptions>(
|
||||
client.GetUrl(), &credential, options);
|
||||
client.GetUrl(), credential, options);
|
||||
|
||||
auto userDelegationKey = blobServiceClient1->GetUserDelegationKey(sasExpiresOn).Value;
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ namespace Azure { namespace Storage {
|
||||
Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString(
|
||||
StandardStorageConnectionString(), m_containerName)
|
||||
.GetUrl(),
|
||||
&m_credential,
|
||||
m_credential,
|
||||
options);
|
||||
}
|
||||
};
|
||||
|
||||
@ -678,7 +678,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
Azure::Storage::Files::DataLake::DataLakeDirectoryClient::CreateFromConnectionString(
|
||||
AdlsGen2ConnectionString(), m_fileSystemName, GetTestName() + "a")
|
||||
.GetUrl()),
|
||||
&credential,
|
||||
credential,
|
||||
options);
|
||||
|
||||
EXPECT_NO_THROW(clientSecretClient->Create());
|
||||
|
||||
@ -539,7 +539,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
Azure::Storage::Files::DataLake::DataLakeFileClient::CreateFromConnectionString(
|
||||
AdlsGen2ConnectionString(), m_fileSystemName, "credential")
|
||||
.GetUrl()),
|
||||
&credential,
|
||||
credential,
|
||||
options);
|
||||
|
||||
EXPECT_NO_THROW(clientSecretClient->Create());
|
||||
|
||||
@ -377,7 +377,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
Azure::Storage::Files::DataLake::DataLakeFileSystemClient::CreateFromConnectionString(
|
||||
AdlsGen2ConnectionString(), GetTestNameLowerCase())
|
||||
.GetUrl(),
|
||||
&credential,
|
||||
credential,
|
||||
options);
|
||||
|
||||
EXPECT_NO_THROW(clientSecretClient->Create());
|
||||
|
||||
@ -394,7 +394,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
GetTestName() + "withSecret",
|
||||
InitClientOptions<Files::DataLake::DataLakeClientOptions>())
|
||||
.GetUrl()),
|
||||
&credential,
|
||||
credential,
|
||||
options);
|
||||
|
||||
EXPECT_NO_THROW(clientSecretClient->Create(Files::DataLake::Models::PathResourceType::File));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user