forked from microsoft/mssql-jdbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectionTest.java
38 lines (31 loc) · 1.25 KB
/
ConnectionTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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()) {
}
}
}