Skip to content

Commit

Permalink
Additional test updates for SSPAU=false
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyc committed Jan 10, 2024
1 parent 105b7a0 commit 663846d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ protected static void populateCharSetObjectWithJDBCTypes(String[] charValues) th
String sql = "insert into " + CHAR_TABLE_AE + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?,"
+ "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?" + ")";

try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) TestUtils.getPreparedStmt(con, sql,
stmtColEncSetting)) {

Expand Down Expand Up @@ -1144,7 +1144,7 @@ protected static void populateCharNullCase() throws SQLException {
String sql = "insert into " + CHAR_TABLE_AE + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?,"
+ "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?" + ")";

try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) TestUtils.getPreparedStmt(con, sql,
stmtColEncSetting)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ private void createMultiInsertionSelection() throws SQLException {
+ TestUtils.escapeSingleQuotes(multiStatementsProcedure)
+ "') and OBJECTPROPERTY(id, N'IsProcedure') = 1)" + " DROP PROCEDURE " + multiStatementsProcedure;

try (Connection con = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (Connection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
SQLServerStatement stmt = (SQLServerStatement) con.createStatement()) {
stmt.execute(sql);

Expand All @@ -556,7 +556,7 @@ private void createMultiInsertionSelection() throws SQLException {
private void MultiInsertionSelection() throws SQLException {

String sql = "{call " + multiStatementsProcedure + " (?,?,?,?,?,?)}";
try (Connection con = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (Connection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
SQLServerCallableStatement callableStatement = (SQLServerCallableStatement) TestUtils
.getCallableStmt(con, sql, stmtColEncSetting)) {

Expand Down Expand Up @@ -673,7 +673,7 @@ private void createInputProcedure2() throws SQLException {
+ TestUtils.escapeSingleQuotes(inputProcedure2) + "') and OBJECTPROPERTY(id, N'IsProcedure') = 1)"
+ " DROP PROCEDURE " + inputProcedure2;

try (Connection con = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (Connection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
SQLServerStatement stmt = (SQLServerStatement) con.createStatement()) {
stmt.execute(sql);

Expand All @@ -690,7 +690,7 @@ private void createInputProcedure2() throws SQLException {

private void testInputProcedure2(String sql) throws SQLException {

try (Connection con = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (Connection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
SQLServerCallableStatement callableStatement = (SQLServerCallableStatement) TestUtils
.getCallableStmt(con, sql, stmtColEncSetting)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void testVerifyBadJksSignature(String serverName, String url, String prot
String badTable = TestUtils.escapeSingleQuotes(
AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("testVerifyBadJksSignature")));

try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
Statement s = c.createStatement()) {
createCMK(AETestConnectionString, badCmk, Constants.JAVA_KEY_STORE_NAME, javaKeyAliases, "0x666");
createCEK(AETestConnectionString, badCmk, badCek, jksProvider);
Expand Down Expand Up @@ -256,7 +256,7 @@ public void testVerifyBadAkvSignature(String serverName, String url, String prot
String badTable = TestUtils.escapeSingleQuotes(
AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("testVerifyBadAkvSignature")));

try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
Statement s = c.createStatement()) {
createCMK(AETestConnectionString, badCmk, Constants.AZURE_KEY_VAULT_NAME, keyIDs[0], "0x666");
createCEK(AETestConnectionString, badCmk, badCek, akvProvider);
Expand Down Expand Up @@ -301,7 +301,7 @@ public void testVerifyBadWinSignature(String serverName, String url, String prot
String badTable = TestUtils.escapeSingleQuotes(
AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("testVerifyBadWinSignature")));

try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
Statement s = c.createStatement()) {
// create CMK with a bad signature
createCMK(AETestConnectionString, badCmk, Constants.WINDOWS_KEY_STORE_NAME, windowsKeyPath, "0x666");
Expand Down Expand Up @@ -397,7 +397,7 @@ public void testAEFMTOnly(String serverName, String url, String protocol) throws
@MethodSource("enclaveParams")
public void testAlter(String serverName, String url, String protocol) throws Exception {
setAEConnectionString(serverName, url, protocol);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
Statement s = c.createStatement()) {
createTable(CHAR_TABLE_AE, cekJks, varcharTableSimple);
PreparedStatement pstmt = c.prepareStatement("INSERT INTO " + CHAR_TABLE_AE + " VALUES (?,?,?)");
Expand Down Expand Up @@ -445,7 +445,7 @@ public void testNumericRichQuery(String serverName, String url, String protocol)
@MethodSource("enclaveParams")
public void testStringRichQuery(String serverName, String url, String protocol) throws Exception {
setAEConnectionString(serverName, url, protocol);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
Statement s = c.createStatement()) {
createTable(CHAR_TABLE_AE, cekJks, varcharTableSimple);

Expand Down Expand Up @@ -473,7 +473,7 @@ public void testStringRichQuery(String serverName, String url, String protocol)
@MethodSource("enclaveParams")
public void testAlterNoEncrypt(String serverName, String url, String protocol) throws Exception {
setAEConnectionString(serverName, url, protocol);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
Statement s = c.createStatement()) {
createTable(CHAR_TABLE_AE, cekJks, varcharTableSimple);
PreparedStatement pstmt = c.prepareStatement("INSERT INTO " + CHAR_TABLE_AE + " VALUES (?,?,?)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public void testStatementCustomKeyStoreProviderDuringAeQuery() throws Exception
private void insertData(String tableName, int customId, String customName) {
String sqlQuery = "INSERT INTO " + tableName + " VALUES ( ?, ? )";

try (SQLServerConnection con = PrepUtil.getConnection(AETestConnectionString, AEInfo);
try (SQLServerConnection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo);
SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) TestUtils.getPreparedStmt(con, sqlQuery,
SQLServerStatementColumnEncryptionSetting.ENABLED)) {
pstmt.setInt(1, customId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void alwaysEncrypted1(String serverName, String url, String protocol) thr
public void alwaysEncrypted2(String serverName, String url, String protocol) throws Exception {
setAEConnectionString(serverName, url, protocol);
try (Connection connection = PrepUtil
.getConnection(AETestConnectionString + ";columnEncryptionSetting=enabled;", AEInfo);
.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;columnEncryptionSetting=enabled;", AEInfo);
Statement stmt = connection.createStatement()) {
dropTables(stmt);

Expand Down

0 comments on commit 663846d

Please sign in to comment.