Skip to content

Add JDBC custom credential support for postgres#1293

Merged
rnorth merged 4 commits intotestcontainers:masterfrom
manikmagar:jdbc_param_support
Mar 17, 2019
Merged

Add JDBC custom credential support for postgres#1293
rnorth merged 4 commits intotestcontainers:masterfrom
manikmagar:jdbc_param_support

Conversation

@manikmagar
Copy link
Copy Markdown
Contributor

This PR adds custom username and password support for Postgres. It refactors the function in MySQL and MariaDB drivers to reuse. This is based on #617 .

Copy link
Copy Markdown
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have some trivial style suggestions, but otherwise this is great. Thank you very much!

String resultUser = rs.getString(1);
assertEquals("User from query param is created.", "someuser@%", resultUser);
// Not all databases (eg. Postgres) return @% at the end of user name. We just need to make sure the user name matches.
if(resultUser.endsWith("@%")) resultUser = resultUser.substring(0, resultUser.length() - 2);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(resultUser.endsWith("@%")) resultUser = resultUser.substring(0, resultUser.length() - 2);
if (resultUser.endsWith("@%")) {
resultUser = resultUser.substring(0, resultUser.length() - 2);
}

Just a small style change.

Copy link
Copy Markdown
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have some trivial style suggestions, but otherwise this is great. Thank you very much!

@manikmagar
Copy link
Copy Markdown
Contributor Author

Thanks for the review @rnorth . I have formatted the code in the latest commit. Please check when you get a chance.

Copy link
Copy Markdown
Member

@kiview kiview left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great for me, thanks!

@rnorth
Copy link
Copy Markdown
Member

rnorth commented Mar 17, 2019

Thanks @manikmagar!

@rnorth rnorth merged commit 1fe2804 into testcontainers:master Mar 17, 2019
@rnorth rnorth added this to the 1.11.0 milestone Mar 22, 2019
@rnorth
Copy link
Copy Markdown
Member

rnorth commented Mar 22, 2019

Releasing this in 1.11.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants