Conversation
|
@peterbae, |
Codecov Report
@@ Coverage Diff @@
## dev #404 +/- ##
============================================
+ Coverage 40.07% 45.01% +4.93%
- Complexity 1887 2132 +245
============================================
Files 107 107
Lines 24482 24661 +179
Branches 4038 4102 +64
============================================
+ Hits 9812 11101 +1289
+ Misses 12831 11693 -1138
- Partials 1839 1867 +28
Continue to review full report at Codecov.
|
| static final String cmkName = "JDBC_CMK"; | ||
| static final String cekName = "JDBC_CEK"; | ||
| static final String secretstrJks = "password"; | ||
| static final String numericTable = "JDBCEncrpytedNumericTable"; |
There was a problem hiding this comment.
can you run format on all of the file?
| * @throws SQLException | ||
| */ | ||
| static void dropTables() throws SQLException { | ||
| stmt.executeUpdate("if object_id('" + numericTable + "','U') is not null" + " drop table " + numericTable); |
There was a problem hiding this comment.
let's use Utils.dropTableIfExists
| * | ||
| * @throws Exception | ||
| * @throws TestAbortedException | ||
| * Junit test case for char set string for string values |
There was a problem hiding this comment.
same for this file. let's run format
| * @throws SQLException | ||
| */ | ||
| @Test | ||
| public void testChar_SpecificSetter() throws SQLException { |
There was a problem hiding this comment.
let's use camelCase convention, I noticed you used the right convention in the methods you introduced.
| } | ||
|
|
||
| pstmt.execute(); | ||
| } |
There was a problem hiding this comment.
missing pstmt.close in some places
There was a problem hiding this comment.
I created Util.close(ResultSet, Statement, Connection) that employs good practice for closing those 3 objects, and applied it to the test cases.
| @@ -0,0 +1,655 @@ | |||
| package com.microsoft.sqlserver.jdbc.AlwaysEncrypted; | |||
| import java.math.BigDecimal; | |||
There was a problem hiding this comment.
I suggest moving this randomData class somewhere in test framework so we can use it in other tests as well. also, could you run form format?
There was a problem hiding this comment.
yep. randomData and Util were originally for AE only, but I think they can be used elsewhere as well - i moved both of them to util package.
| private static String numberCharSet = "1234567890"; | ||
| private static String numberCharSet2 = "123456789"; | ||
|
|
||
| //-------------------numeric types-------------------------------------------- |
There was a problem hiding this comment.
Change this // to javaDocs
| return ((SQLServerConnection) connection).prepareCall(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, connection.getHoldability(), stmtColEncSetting); | ||
| } | ||
| } | ||
| /* |
There was a problem hiding this comment.
you can remove these sections if they are not needed
| keyIDs = getConfiguredProperty("keyID", "").split(";"); | ||
|
|
||
| connectionString = getConfiguredProperty("mssql_jdbc_test_connection_properties"); | ||
| connectionString = getConfiguredProperty("mssql_jdbc_test_connection_properties") |
There was a problem hiding this comment.
add the + ";sendTimeAsDateTime=false"; inside the jdbcEncryptionDecryption test
There was a problem hiding this comment.
done. I moved it to AESetup.java.
| @@ -70,23 +78,24 @@ static void setUpConnection() throws TestAbortedException, Exception { | |||
|
|
|||
| readFromFile(javaKeyStoreInputFile, "Alias name"); | |||
| con = (SQLServerConnection) DriverManager.getConnection(connectionString); | |||
There was a problem hiding this comment.
add the + ";sendTimeAsDateTime=false"; here. We don't want other tests to create connection with having this connection property.
| static final String binaryTable = "JDBCEncrpytedBinaryTable"; | ||
| static final String dateTable = "JDBCEncrpytedDateTable"; | ||
| static final String uid = "171fbe25-4331-4765-a838-b2e3eea3e7ea"; | ||
| static final String uid2 = "171fbe25-4331-4765-a838-b2e3eea3e7eb"; |
There was a problem hiding this comment.
is uid2 used anywhere?
There was a problem hiding this comment.
Nope, I removed it.
| con = (SQLServerConnection) DriverManager.getConnection(connectionString); | ||
| stmt = con.createStatement(); | ||
| stmt = (SQLServerStatement) con.createStatement(); | ||
| Utils.dropTableIfExists(numericTable, stmt); |
There was a problem hiding this comment.
since dropTables() method in afterAll() is cleaning up, let's remove this, or add all dropping tables here too.
| // if driver is for JDBC 42 and jvm version is 8 or higher, then always return as SQLServerPreparedStatement42, | ||
| // otherwise return SQLServerPreparedStatement | ||
| static boolean use42Wrapper() { | ||
| public static boolean use42Wrapper() { |
There was a problem hiding this comment.
Could you check using System.getProperty("java.specification.version"); and skipping the test if java 7 would solve the issue?
There was a problem hiding this comment.
Checking for java 7 only doesn't solve the issue - the tests being done on github uses java 8, but does not support jdbc 4.2 - we need to check for both.
…cking and moved/added functionalities to utility classes.
…ality to the Util class within the testing package
Moved JDBCEncryptionDecryption AE tests into Junit. Ran Appveyor and Travis tests against my local dev branch to ensure that the tests passed.