-
Notifications
You must be signed in to change notification settings - Fork 469
Removing connection property - fipsProvider #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,8 +52,7 @@ public void fipsTrustServerCertificateTest() throws Exception { | |
| } | ||
| catch (SQLServerException e) { | ||
| Assertions.assertTrue( | ||
| e.getMessage().contains("Could not enable FIPS due to either encrypt is not true or using trusted certificate settings."), | ||
| "Should create exception for invalid TrustServerCertificate value"); | ||
| e.getMessage().contains("Unable to verify FIPS mode settings.")); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any specific reason for removing |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -72,31 +71,11 @@ public void fipsEncryptTest() throws Exception { | |
| } | ||
| catch (SQLServerException e) { | ||
| Assertions.assertTrue( | ||
| e.getMessage().contains("Could not enable FIPS due to either encrypt is not true or using trusted certificate settings."), | ||
| e.getMessage().contains("Unable to verify FIPS mode settings."), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest getting these same String error messages from SQLServerResource.java in test cases, such that your code becomes:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah.. I missed that, in that case we need a custom resource bundle for our test framework. I have created issue #466 to track this change. |
||
| "Should create exception for invalid encrypt value"); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test after removing FIPS PROVIDER | ||
| * | ||
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void fipsProviderTest() throws Exception { | ||
| try { | ||
| Properties props = buildConnectionProperties(); | ||
| props.remove("fipsProvider"); | ||
| props.setProperty("trustStore", "/SOME_PATH"); | ||
| Connection con = PrepUtil.getConnection(connectionString, props); | ||
| Assertions.fail("It should fail as we are not passing appropriate params"); | ||
| } | ||
| catch (SQLServerException e) { | ||
| Assertions.assertTrue(e.getMessage().contains("Could not enable FIPS due to invalid FIPSProvider or TrustStoreType"), | ||
| "Should create exception for invalid FIPSProvider"); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test after removing fips, encrypt & trustStore it should work appropriately. | ||
| * | ||
|
|
@@ -124,7 +103,6 @@ public void fipsDataSourcePropertyTest() throws Exception { | |
| SQLServerDataSource ds = new SQLServerDataSource(); | ||
| setDataSourceProperties(ds); | ||
| ds.setFIPS(false); | ||
| ds.setFIPSProvider(""); | ||
| ds.setEncrypt(false); | ||
| ds.setTrustStoreType("JKS"); | ||
| Connection con = ds.getConnection(); | ||
|
|
@@ -148,32 +126,11 @@ public void fipsDatSourceEncrypt() { | |
| } | ||
| catch (SQLServerException e) { | ||
| Assertions.assertTrue( | ||
| e.getMessage().contains("Could not enable FIPS due to either encrypt is not true or using trusted certificate settings."), | ||
| e.getMessage().contains("Unable to verify FIPS mode settings."), | ||
| "Should create exception for invalid encrypt value"); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test after removing FIPS PROVIDER | ||
| * | ||
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void fipsDataSourceProviderTest() throws Exception { | ||
| try { | ||
| SQLServerDataSource ds = new SQLServerDataSource(); | ||
| setDataSourceProperties(ds); | ||
| ds.setFIPSProvider(""); | ||
| ds.setTrustStore("/SOME_PATH"); | ||
| Connection con = ds.getConnection(); | ||
| Assertions.fail("It should fail as we are not passing appropriate params"); | ||
| } | ||
| catch (SQLServerException e) { | ||
| Assertions.assertTrue(e.getMessage().contains("Could not enable FIPS due to invalid FIPSProvider or TrustStoreType"), | ||
| "Should create exception for invalid FIPSProvider"); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test after setting TrustServerCertificate as true. | ||
| * | ||
|
|
@@ -190,7 +147,7 @@ public void fipsDataSourceTrustServerCertificateTest() throws Exception { | |
| } | ||
| catch (SQLServerException e) { | ||
| Assertions.assertTrue( | ||
| e.getMessage().contains("Could not enable FIPS due to either encrypt is not true or using trusted certificate settings."), | ||
| e.getMessage().contains("Unable to verify FIPS mode settings."), | ||
| "Should create exception for invalid TrustServerCertificate value"); | ||
| } | ||
| } | ||
|
|
@@ -216,7 +173,6 @@ private void setDataSourceProperties(SQLServerDataSource ds) { | |
| ds.setTrustServerCertificate(false); | ||
| ds.setIntegratedSecurity(false); | ||
| ds.setTrustStoreType("PKCS12"); | ||
| ds.setFIPSProvider("BCFIPS"); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -235,7 +191,6 @@ private Properties buildConnectionProperties() { | |
|
|
||
| // For New Code | ||
| connectionProps.setProperty("trustStoreType", "PKCS12"); | ||
| connectionProps.setProperty("fipsProvider", "BCFIPS"); | ||
| connectionProps.setProperty("fips", "true"); | ||
|
|
||
| return connectionProps; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/requiered/required/