-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix multiple, successive connections using AKV provider (#1594)
- Loading branch information
David Engel
authored
Jun 14, 2021
1 parent
574b1e1
commit 21b8ec1
Showing
3 changed files
with
61 additions
and
25 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
38 changes: 38 additions & 0 deletions
38
src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionTest.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,38 @@ | ||
/* | ||
* Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made | ||
* available under the terms of the MIT License. See the LICENSE file in the project root for more information. | ||
*/ | ||
package com.microsoft.sqlserver.jdbc.connection; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.platform.runner.JUnitPlatform; | ||
import org.junit.runner.RunWith; | ||
|
||
import com.microsoft.sqlserver.jdbc.SQLServerDataSource; | ||
import com.microsoft.sqlserver.testframework.AbstractTest; | ||
|
||
/* | ||
* This test is for testing various connection options | ||
*/ | ||
@RunWith(JUnitPlatform.class) | ||
public class ConnectionTest extends AbstractTest { | ||
|
||
@Test | ||
public void testConnections() throws SQLException { | ||
SQLServerDataSource ds = new SQLServerDataSource(); | ||
ds.setURL(connectionString); | ||
ds.setKeyStoreAuthentication("KeyVaultClientSecret"); | ||
ds.setKeyStorePrincipalId("placeholder"); | ||
ds.setKeyStoreSecret("placeholder"); | ||
|
||
// Multiple, successive connections should not fail | ||
try (Connection con = ds.getConnection()) { | ||
} | ||
|
||
try (Connection con = ds.getConnection()) { | ||
} | ||
} | ||
} |