New connection property: sslProtocol#422
Conversation
|
@ulvii, |
Replace tabs with spaces
Codecov Report
@@ Coverage Diff @@
## dev #422 +/- ##
============================================
+ Coverage 45.92% 46.13% +0.21%
- Complexity 2198 2206 +8
============================================
Files 108 108
Lines 25210 25246 +36
Branches 4164 4169 +5
============================================
+ Hits 11577 11647 +70
+ Misses 11711 11678 -33
+ Partials 1922 1921 -1
Continue to review full report at Codecov.
|
| } | ||
| } | ||
|
|
||
| enum SSLProtocol { |
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void testConnectWithWrongProtocols() throws Exception { |
There was a problem hiding this comment.
SUGGESTION: You can use JUnit's ability of parametrized test.
In future JUnit might give (or may be available) to pass parameters from some configuration file so no need to touch test code to add extra tests just like TestNG
@DisplayName("TestForWrongValues")
@ParameterizedTest
@ValueSource(strings={"SSLv1111","SSLv2222","SSLv3111", "SSLv2Hello1111","TLSv1.11","TLSv2.4","HTTPS"})
public void testConnectWithWrongProtocol(String sslProtocol) throws Exception {
testWithUnSupportedProtocols(sslProtocol);
}
You need to upgrade JUnit 1.0.0-M4 & add following dependency
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.0.0-M4</version>
<scope>test</scope>
</dependency>
There was a problem hiding this comment.
Hi @nsidhaye,
Thank you for suggestion. I modified the test a bit to not introduce a new dependency and make it compatible with previous JUnit versions. I also agree that, we should consider using new JUnit features.
|
Link to Wiki page: https://github.com/Microsoft/mssql-jdbc/wiki/SSLProtocol |
| static SSLProtocol valueOfString(String value) throws SQLServerException { | ||
| SSLProtocol protocol = null; | ||
|
|
||
| if (value.toLowerCase(Locale.ENGLISH).equalsIgnoreCase(SSLProtocol.TLS.toString())) { |
There was a problem hiding this comment.
The toLowerCase(Locale.ENGLISH) is unnecesary since equalsIgnoreCase is used.
Adding a new connection property to let the users specify TLS protocol keyword. Possible values: "TLS", "TLSv1", "TLSv1.1", "TLSv1.2". The default is "TLS". These keywords might behave differently depending on JRE( Oracle, IBM, SAP ), so the users should read the documentation before using them.
Example use-case:
When Suite B or SP800-131a standards are used, only TLSv1.2 must be enabled.