Skip to content

Commit

Permalink
fix msi test
Browse files Browse the repository at this point in the history
  • Loading branch information
lilgreenbird committed Feb 22, 2025
1 parent b00d27a commit 947377b
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import java.util.Properties;

import com.azure.identity.CredentialUnavailableException;
import com.azure.identity.ManagedIdentityCredential;
import com.azure.identity.ManagedIdentityCredentialBuilder;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -455,13 +458,18 @@ private void testNumericAKV(String connStr) throws SQLException {
}
}

// @BeforeEach
@BeforeEach
public void registerAKVProvider() throws Exception {
// unregister the custom providers registered in AESetup
SQLServerConnection.unregisterColumnEncryptionKeyStoreProviders();

Map<String, SQLServerColumnEncryptionKeyStoreProvider> map = new HashMap<String, SQLServerColumnEncryptionKeyStoreProvider>();
if (null != applicationClientID && null != applicationKey) {
if (null != akvProviderManagedClientId) {
ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder()
.clientId(akvProviderManagedClientId).build();
akvProvider = new SQLServerColumnEncryptionAzureKeyVaultProvider(credential);
map.put(Constants.AZURE_KEY_VAULT_NAME, akvProvider);
} else if (null != applicationClientID && null != applicationKey) {
File file = null;
try {
file = new File(Constants.MSSQL_JDBC_PROPERTIES);
Expand Down

0 comments on commit 947377b

Please sign in to comment.