Skip to content

Commit 397d3e8

Browse files
committed
removed enclave properties string to failed errors as enclave tests could be skipped
1 parent 931158f commit 397d3e8

File tree

5 files changed

+97
-148
lines changed

5 files changed

+97
-148
lines changed

src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ void checkAESetup(String serverName, String url, String protocol) throws Excepti
207207
} catch (SQLException e) {
208208
isAEv2 = false;
209209
} catch (Exception e) {
210-
fail("enclaveProperties: " + enclaveProperties + "\n" + TestResource.getResource("R_unexpectedErrorMessage")
211-
+ e.getMessage());
210+
fail(TestResource.getResource("R_unexpectedErrorMessage") + e.getMessage());
212211
}
213212
}
214213

@@ -318,7 +317,7 @@ private static void readFromFile(String inputFile, String lookupValue) throws IO
318317
}
319318
}
320319
} catch (IOException e) {
321-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
320+
fail(e.getMessage());
322321
}
323322
}
324323

@@ -347,7 +346,7 @@ protected static void createTable(String tableName, String cekName, String table
347346
stmt.execute(sql);
348347
stmt.execute("DBCC FREEPROCCACHE");
349348
} catch (SQLException e) {
350-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
349+
fail(e.getMessage());
351350
}
352351
}
353352

@@ -381,7 +380,7 @@ protected static void createPrecisionTable(String tableName, String table[][], S
381380
stmt.execute(sql);
382381
stmt.execute("DBCC FREEPROCCACHE");
383382
} catch (SQLException e) {
384-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
383+
fail(e.getMessage());
385384
}
386385
}
387386

@@ -409,7 +408,7 @@ protected static void createScaleTable(String tableName, String table[][], Strin
409408
stmt.execute(sql);
410409
stmt.execute("DBCC FREEPROCCACHE");
411410
} catch (SQLException e) {
412-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
411+
fail(e.getMessage());
413412
}
414413
}
415414

src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ private static void createSPTables(String cekName) throws SQLException {
422422
Statement stmt = con.createStatement()) {
423423
stmt.execute(sql);
424424
} catch (SQLException e) {
425-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
425+
fail(e.getMessage());
426426
}
427427

428428
sql = "create table " + table6 + " ("
@@ -439,7 +439,7 @@ private static void createSPTables(String cekName) throws SQLException {
439439
TestUtils.dropTableIfExists(table6, stmt);
440440
stmt.execute(sql);
441441
} catch (SQLException e) {
442-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
442+
fail(e.getMessage());
443443
}
444444
}
445445

@@ -617,7 +617,7 @@ private void MultiInsertionSelection() throws SQLException {
617617
results = callableStatement.getMoreResults();
618618
}
619619
} catch (SQLException e) {
620-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
620+
fail(e.getMessage());
621621
}
622622
}
623623

@@ -694,7 +694,7 @@ private void testInputProcedure(String sql, String[] values) throws SQLException
694694
assertEquals(rs.getString(1), values[3], "" + TestResource.getResource("R_inputParamFailed"));
695695
}
696696
} catch (Exception e) {
697-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
697+
fail(e.getMessage());
698698
}
699699
}
700700

@@ -746,7 +746,7 @@ private void testInputProcedure2(String sql) throws SQLException {
746746
assertEquals(rs.getString(8).trim(), charValues[8], TestResource.getResource("R_inputParamFailed"));
747747
}
748748
} catch (Exception e) {
749-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
749+
fail(e.getMessage());
750750
}
751751
}
752752

@@ -793,7 +793,7 @@ private void testOutputProcedure3RandomOrder(String sql) throws SQLException {
793793
int intValue5 = callableStatement.getInt(1);
794794
assertEquals("" + intValue5, numericValues[3], TestResource.getResource("R_outputParamFailed"));
795795
} catch (Exception e) {
796-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
796+
fail(e.getMessage());
797797
}
798798
}
799799

@@ -815,7 +815,7 @@ private void testOutputProcedure3Inorder(String sql) throws SQLException {
815815
assertEquals("" + intValue2, numericValues[3], TestResource.getResource("R_outputParamFailed"));
816816
} catch (Exception e) {
817817

818-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
818+
fail(e.getMessage());
819819
}
820820
}
821821

@@ -836,7 +836,7 @@ private void testOutputProcedure3ReverseOrder(String sql) throws SQLException {
836836
int intValue = callableStatement.getInt(1);
837837
assertEquals("" + intValue, numericValues[3], TestResource.getResource("R_outputParamFailed"));
838838
} catch (Exception e) {
839-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
839+
fail(e.getMessage());
840840
}
841841
}
842842

@@ -909,7 +909,7 @@ private void testOutputProcedure2RandomOrder(String sql, String[] values) throws
909909
int encryptedInt = callableStatement.getInt(2);
910910
assertEquals("" + encryptedInt, values[3], TestResource.getResource("R_outputParamFailed"));
911911
} catch (Exception e) {
912-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
912+
fail(e.getMessage());
913913
}
914914
}
915915

@@ -962,7 +962,7 @@ private void testOutputProcedure2Inorder(String sql, String[] values) throws SQL
962962
assertEquals("" + encryptedMoney, values[13], TestResource.getResource("R_outputParamFailed"));
963963

964964
} catch (Exception e) {
965-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
965+
fail(e.getMessage());
966966
}
967967
}
968968

@@ -1016,7 +1016,7 @@ private void testOutputProcedure2ReverseOrder(String sql, String[] values) throw
10161016
assertEquals("" + intValue, values[3], TestResource.getResource("R_outputParamFailed"));
10171017

10181018
} catch (Exception e) {
1019-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1019+
fail(e.getMessage());
10201020
}
10211021
}
10221022

@@ -1084,7 +1084,7 @@ private void testOutputProcedureRandomOrder(String sql, String[] values) throws
10841084
BigDecimal money1 = callableStatement.getMoney(7);
10851085
assertEquals("" + money1, "" + values[13], TestResource.getResource("R_outputParamFailed"));
10861086
} catch (Exception e) {
1087-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1087+
fail(e.getMessage());
10881088
}
10891089
}
10901090

@@ -1126,7 +1126,7 @@ private void testOutputProcedureInorder(String sql, String[] values) throws SQLE
11261126
assertEquals("" + money1, values[13], TestResource.getResource("R_outputParamFailed"));
11271127

11281128
} catch (Exception e) {
1129-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1129+
fail(e.getMessage());
11301130
}
11311131
}
11321132

@@ -1167,7 +1167,7 @@ private void testOutputProcedureReverseOrder(String sql, String[] values) throws
11671167
assertEquals("" + intValue2, values[3], TestResource.getResource("R_outputParamFailed"));
11681168

11691169
} catch (Exception e) {
1170-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1170+
fail(e.getMessage());
11711171
}
11721172
}
11731173

@@ -1201,7 +1201,7 @@ private void testInOutProcedure(String sql) throws SQLException {
12011201

12021202
assertEquals("" + intValue, numericValues[3], "Test for Inout parameter fails.\n");
12031203
} catch (Exception e) {
1204-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1204+
fail(e.getMessage());
12051205
}
12061206
}
12071207

@@ -1247,7 +1247,7 @@ private void testMixedProcedure(String sql) throws SQLException {
12471247
int returnedValue = callableStatement.getInt(1);
12481248
assertEquals("" + returnedValue, "" + 123, "Test for Inout parameter fails.\n");
12491249
} catch (Exception e) {
1250-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1250+
fail(e.getMessage());
12511251
}
12521252
}
12531253

@@ -1299,7 +1299,7 @@ private void testMixedProcedure2RandomOrder(String sql) throws SQLException {
12991299
assertEquals("" + floatValue3, numericValues[5], TestResource.getResource("R_outputParamFailed"));
13001300

13011301
} catch (Exception e) {
1302-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1302+
fail(e.getMessage());
13031303
}
13041304
}
13051305

@@ -1321,7 +1321,7 @@ private void testMixedProcedure2Inorder(String sql) throws SQLException {
13211321
double floatValue = callableStatement.getDouble(2);
13221322
assertEquals("" + floatValue, numericValues[5], TestResource.getResource("R_outputParamFailed"));
13231323
} catch (Exception e) {
1324-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1324+
fail(e.getMessage());
13251325
}
13261326
}
13271327

@@ -1373,7 +1373,7 @@ private void testMixedProcedure3RandomOrder(String sql) throws SQLException {
13731373
assertEquals("" + bigintValue3, numericValues[4], TestResource.getResource("R_outputParamFailed"));
13741374

13751375
} catch (Exception e) {
1376-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1376+
fail(e.getMessage());
13771377
}
13781378
}
13791379

@@ -1395,7 +1395,7 @@ private void testMixedProcedure3Inorder(String sql) throws SQLException {
13951395
double floatValue = callableStatement.getDouble(2);
13961396
assertEquals("" + floatValue, numericValues[5], TestResource.getResource("R_outputParamFailed"));
13971397
} catch (Exception e) {
1398-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1398+
fail(e.getMessage());
13991399
}
14001400
}
14011401

@@ -1417,7 +1417,7 @@ private void testMixedProcedure3ReverseOrder(String sql) throws SQLException {
14171417
long bigintValue = callableStatement.getLong(1);
14181418
assertEquals("" + bigintValue, numericValues[4], TestResource.getResource("R_outputParamFailed"));
14191419
} catch (Exception e) {
1420-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1420+
fail(e.getMessage());
14211421
}
14221422
}
14231423

@@ -1468,7 +1468,7 @@ private void testmixedProcedureNumericPrecisionScaleInorder(String sql) throws S
14681468
assertEquals(value4, new BigDecimal(numericValues[11]), "Test for input output parameter fails.\n");
14691469

14701470
} catch (Exception e) {
1471-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1471+
fail(e.getMessage());
14721472
}
14731473
}
14741474

@@ -1499,7 +1499,7 @@ private void testmixedProcedureNumericPrecisionScaleParameterName(String sql) th
14991499
assertEquals(value4, new BigDecimal(numericValues[11]), "Test for input output parameter fails.\n");
15001500

15011501
} catch (Exception e) {
1502-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1502+
fail(e.getMessage());
15031503
}
15041504
}
15051505

@@ -1570,7 +1570,7 @@ private void testOutputProcedureCharInorder(String sql) throws SQLException {
15701570
assertEquals(nvarcharValue4000, charValues[8], TestResource.getResource("R_outputParamFailed"));
15711571

15721572
} catch (Exception e) {
1573-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1573+
fail(e.getMessage());
15741574
}
15751575
}
15761576

@@ -1623,7 +1623,7 @@ private void testOutputProcedureCharInorderObject(String sql) throws SQLExceptio
16231623
assertEquals(nvarcharValue4000, charValues[8], TestResource.getResource("R_outputParamFailed"));
16241624

16251625
} catch (Exception e) {
1626-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1626+
fail(e.getMessage());
16271627
}
16281628
}
16291629

@@ -1735,7 +1735,7 @@ private void testOutputProcedureNumericInorder(String sql) throws SQLException {
17351735
TestResource.getResource("R_outputParamFailed"));
17361736

17371737
} catch (Exception e) {
1738-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1738+
fail(e.getMessage());
17391739
}
17401740
}
17411741

@@ -1955,7 +1955,7 @@ else if (value.toString().equals("0") || value.equals(false) || value.toString()
19551955
}
19561956

19571957
} catch (Exception e) {
1958-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
1958+
fail(e.getMessage());
19591959
}
19601960
}
19611961

@@ -2016,7 +2016,7 @@ private Object getxxx(int ordinal, Class<?> coercion,
20162016
return callableStatement.getDateTimeOffset(ordinal);
20172017
} else {
20182018
// Otherwise
2019-
fail("enclaveProperties: " + enclaveProperties + "\n" + "Unhandled type: " + coercion);
2019+
fail("Unhandled type: " + coercion);
20202020
}
20212021

20222022
return null;
@@ -2085,7 +2085,7 @@ private void testOutputProcedureBinaryInorder(String sql) throws SQLException {
20852085
assertEquals(received5[i], expected[i], TestResource.getResource("R_outputParamFailed"));
20862086
}
20872087
} catch (Exception e) {
2088-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2088+
fail(e.getMessage());
20892089
}
20902090
}
20912091

@@ -2120,13 +2120,13 @@ private void testOutputProcedureBinaryInorderObject(String sql) throws SQLExcept
21202120
}
21212121
}
21222122
} catch (Exception e) {
2123-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2123+
fail(e.getMessage());
21242124
} finally {
21252125
index++;
21262126
}
21272127
}
21282128
} catch (Exception e) {
2129-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2129+
fail(e.getMessage());
21302130
}
21312131
}
21322132

@@ -2162,7 +2162,7 @@ private void testOutputProcedureBinaryInorderString(String sql) throws SQLExcept
21622162
assertEquals(stringValue1.startsWith(expectedStr), true, "\nDecryption failed with getString(): "
21632163
+ stringValue1 + ".\nExpected Value: " + expectedStr);
21642164
} catch (Exception e) {
2165-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2165+
fail(e.getMessage());
21662166
} finally {
21672167
index++;
21682168
}
@@ -2233,7 +2233,7 @@ protected static void createDateTableCallableStatement(String cekName) throws SQ
22332233
stmt.execute(sql);
22342234
stmt.execute("DBCC FREEPROCCACHE");
22352235
} catch (SQLException e) {
2236-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2236+
fail(e.getMessage());
22372237
}
22382238
}
22392239

@@ -2391,7 +2391,7 @@ private void testOutputProcedureDateInorder(String sql) throws SQLException {
23912391
TestResource.getResource("R_outputParamFailed"));
23922392

23932393
} catch (Exception e) {
2394-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2394+
fail(e.getMessage());
23952395
}
23962396
}
23972397

@@ -2442,7 +2442,7 @@ private void testOutputProcedureDateInorderObject(String sql) throws SQLExceptio
24422442
TestResource.getResource("R_outputParamFailed"));
24432443

24442444
} catch (Exception e) {
2445-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2445+
fail(e.getMessage());
24462446
}
24472447
}
24482448

@@ -2492,7 +2492,7 @@ private void testOutputProcedureBatchInorder(String sql) throws SQLException {
24922492
BigDecimal smallmoneyValue = callableStatement.getSmallMoney(4);
24932493
assertEquals("" + smallmoneyValue, numericValues[12], TestResource.getResource("R_outputParamFailed"));
24942494
} catch (Exception e) {
2495-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2495+
fail(e.getMessage());
24962496
}
24972497
}
24982498

@@ -2563,7 +2563,7 @@ private void testMixedProcedureDateScaleInorder(String sql) throws SQLException
25632563
TestResource.getResource("R_outputParamFailed"));
25642564

25652565
} catch (Exception e) {
2566-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2566+
fail(e.getMessage());
25672567
}
25682568
}
25692569

@@ -2594,7 +2594,7 @@ private void testMixedProcedureDateScaleWithParameterName(String sql) throws SQL
25942594
TestResource.getResource("R_outputParamFailed"));
25952595

25962596
} catch (Exception e) {
2597-
fail("enclaveProperties: " + enclaveProperties + "\n" + e.getMessage());
2597+
fail(e.getMessage());
25982598
}
25992599
}
26002600
}

src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/EnclaveTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ public void testAEv2Disabled(String serverName, String url, String protocol) thr
208208
SQLServerStatement stmt = (SQLServerStatement) con.createStatement()) {
209209
String[] values = createCharValues(nullable);
210210
testChars(stmt, cekJks, charTable, values, TestCase.NORMAL, true);
211-
fail("enclaveProperties: " + enclaveProperties + "\n"
212-
+ TestResource.getResource("R_expectedExceptionNotThrown"));
211+
fail(TestResource.getResource("R_expectedExceptionNotThrown"));
213212
} catch (Throwable e) {
214213
// testChars called fail()
215214
assertTrue(e.getMessage().contains(TestResource.getResource("R_AlterAEv2Error")));

0 commit comments

Comments
 (0)