sandynz commented on code in PR #22864:
URL: https://github.com/apache/shardingsphere/pull/22864#discussion_r1048210878
##########
infra/common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/StandardJdbcUrlParser.java:
##########
@@ -31,7 +31,7 @@
*/
public final class StandardJdbcUrlParser {
- private static final String SCHEMA_PATTERN = "(?<schema>[\\w+:%]+)\\s*";
+ private static final String SCHEMA_PATTERN =
"(?<schema>[(\\w-.)+:%]+)\\s*";
Review Comment:
When I removed `(` and `)`, unit test passed. Some questions:
1, Are they required?
2, Are `(` and `)` supported in JDBC URL schema?
##########
infra/common/src/test/java/org/apache/shardingsphere/infra/database/metadata/url/StandardJdbcUrlParserTest.java:
##########
@@ -81,4 +81,23 @@ public void assertParseMicrosoftSQLServerJdbcUrl() {
public void assertParseIncorrectURL() {
new
StandardJdbcUrlParser().parse("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL");
}
+
+ @Test
+ public void assertParseTestContainersJDBCUrl() {
+ assertThat(new
StandardJdbcUrlParser().parse("jdbc:tc:mysql:5.7.34:///demo_ds").getDatabase(),
is("demo_ds"));
+ assertThat(new
StandardJdbcUrlParser().parse("jdbc:tc:postgresql:9.6.8:///demo_ds").getDatabase(),
is("demo_ds"));
+ assertThat(new
StandardJdbcUrlParser().parse("jdbc:tc:postgis:9.6-2.5:///demo_ds").getDatabase(),
is("demo_ds"));
+ assertThat(new
StandardJdbcUrlParser().parse("jdbc:tc:timescaledb:2.1.0-pg13:///demo_ds").getDatabase(),
is("demo_ds"));
+ assertThat(new
StandardJdbcUrlParser().parse("jdbc:tc:trino:352://localhost/memory/default").getDatabase(),
is("memory/default"));
Review Comment:
That's ok. It's in the [test container examples](
https://www.testcontainers.org/modules/databases/jdbc/#jdbc-url-examples ).
But I didn't find all of them. Could you add test container example links in
PR page?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]