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
Fix to mend debug logging to allow programmatic level setting. #438
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
ecf4a2c
Changed property loader to avoid using a default when property not al…
whitingjr b86e07a
Update testcase to set properties where TestUtil methods look them up.
whitingjr 274f382
Restore boot time ssl property after test cases complete. Revert chan…
whitingjr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,9 +204,13 @@ public void testIsPresentWithParseURLResult() throws Exception | |
givenProperties.setProperty("user", TestUtil.getUser()); | ||
givenProperties.setProperty("password", TestUtil.getPassword()); | ||
|
||
Properties sysProperties = System.getProperties(); | ||
sysProperties.remove("ssl"); | ||
System.setProperties(sysProperties); | ||
Properties parsedProperties = Driver.parseURL(TestUtil.getURL(), givenProperties); | ||
Assert.assertFalse("SSL property should not be present", PGProperty.SSL.isPresent(parsedProperties)); | ||
|
||
System.setProperty("ssl", "true"); | ||
givenProperties.setProperty("ssl", "true"); | ||
parsedProperties = Driver.parseURL(TestUtil.getURL(), givenProperties); | ||
Assert.assertTrue("SSL property should be present", PGProperty.SSL.isPresent(parsedProperties)); | ||
|
@@ -218,4 +222,47 @@ public void testIsPresentWithParseURLResult() throws Exception | |
parsedProperties = Driver.parseURL(TestUtil.getURL() + "&ssl=true" , null); | ||
Assert.assertTrue("SSL property should be present", PGProperty.SSL.isPresent(parsedProperties)); | ||
} | ||
|
||
/** | ||
* Check whether the isPresent method really works. | ||
*/ | ||
public void testPresenceCheck() | ||
{ | ||
Properties empty = new Properties(); | ||
Object value = PGProperty.LOG_LEVEL.get(empty); | ||
assertNotNull(value); | ||
Assert.assertFalse(PGProperty.LOG_LEVEL.isPresent(empty)); | ||
} | ||
|
||
public void testNullValue() | ||
{ | ||
Properties empty = new Properties(); | ||
assertNull(PGProperty.LOG_LEVEL.getSetString(empty)); | ||
Properties withLogging = new Properties(); | ||
withLogging.setProperty(PGProperty.LOG_LEVEL.getName(), "2"); | ||
assertNotNull(PGProperty.LOG_LEVEL.getSetString(withLogging)); | ||
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. Could you please move that to separate test method? |
||
} | ||
|
||
public void setUp() | ||
{ | ||
bootSSLPropertyValue = System.getProperty("ssl"); | ||
} | ||
|
||
public void tearDown() | ||
{ | ||
if (bootSSLPropertyValue == null) { | ||
System.getProperties().remove("ssl"); | ||
} | ||
else | ||
{ | ||
System.setProperty("ssl", bootSSLPropertyValue); | ||
} | ||
} | ||
|
||
/** | ||
* Some tests modify the "ssl" system property. To not disturb | ||
* other test cases in the suite store the value of the property | ||
* and restore it. | ||
*/ | ||
private String bootSSLPropertyValue; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
seems like you should check for null before checking instanceof ?
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.
shouldn't be necessary. instanceof only works on the reference. not the object.
in the situation the reference is null then the instanceof condition returns false.