-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with truststore password being removed too early for XA tra…
…nsaction (#1133) Fix | Fix issue with truststore password being removed too early for XA transaction
- Loading branch information
Showing
8 changed files
with
137 additions
and
11 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
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
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
44 changes: 44 additions & 0 deletions
44
src/test/java/com/microsoft/sqlserver/jdbc/connection/XADataSourceTest.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,44 @@ | ||
/* | ||
* 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 javax.sql.XAConnection; | ||
|
||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.platform.runner.JUnitPlatform; | ||
import org.junit.runner.RunWith; | ||
|
||
import com.microsoft.sqlserver.jdbc.SQLServerXADataSource; | ||
import com.microsoft.sqlserver.testframework.AbstractTest; | ||
import com.microsoft.sqlserver.testframework.Constants; | ||
|
||
|
||
@RunWith(JUnitPlatform.class) | ||
@Tag(Constants.reqExternalSetup) | ||
public class XADataSourceTest extends AbstractTest { | ||
private static String connectionUrlSSL = connectionString + ";encrypt=true;trustServerCertificate=false;"; | ||
|
||
/** | ||
* Tests XA connection with PKCS12 truststore that is password protected. | ||
* | ||
* Only re-populate the truststore if need arises in the future. | ||
* TestUtils.createTrustStore() can be used to create the truststore. | ||
* | ||
* @throws Exception | ||
*/ | ||
@Test | ||
public void testPKCS12() throws Exception { | ||
SQLServerXADataSource ds = new SQLServerXADataSource(); | ||
|
||
String trustStore = System.getProperty("pkcs12_truststore"); | ||
String url = connectionUrlSSL + "trustStore=" + trustStore + ";"; | ||
ds.setURL(url); | ||
ds.setTrustStorePassword(System.getProperty("pkcs12_truststore_password")); | ||
XAConnection connection = ds.getXAConnection(); | ||
connection.close(); | ||
} | ||
} |
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