2 files changed
+20
-1
No files matched your search
@@ -2098,7 +2098,8 @@ public final class DamengAgent extends AbstractJdbcAgent {
|
|||||||
|
|
||||||
private static String buildUrl(ConnectParams params) {
|
private static String buildUrl(ConnectParams params) {
|
||||||
String connectionString = params.getConnection_string() == null ? "" : params.getConnection_string().trim();
|
String connectionString = params.getConnection_string() == null ? "" : params.getConnection_string().trim();
|
||||||
if (!connectionString.isEmpty()) {
|
if (!connectionString.isEmpty()
|
||||||
|
&& !connectionString.regionMatches(true, 0, "dm://", 0, "dm://".length())) {
|
||||||
return connectionString;
|
return connectionString;
|
||||||
}
|
}
|
||||||
String database = params.getDatabase() == null ? "" : params.getDatabase().trim();
|
String database = params.getDatabase() == null ? "" : params.getDatabase().trim();
|
||||||
|
|||||||
@@ -21,6 +21,24 @@ class DamengAgentUrlTest {
|
|||||||
Assertions.assertEquals("jdbc:dm://127.0.0.1:5236/MAIN", url);
|
Assertions.assertEquals("jdbc:dm://127.0.0.1:5236/MAIN", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void rebuildsLegacyDbxUrlFromConnectionFields() throws Exception {
|
||||||
|
ConnectParams params = new ConnectParams(
|
||||||
|
"127.0.0.1",
|
||||||
|
5236,
|
||||||
|
"MAIN",
|
||||||
|
"SYSDBA",
|
||||||
|
"pwd",
|
||||||
|
"",
|
||||||
|
"dm://SYSDBA:SYSDBA@legacy-host:5236/OLD",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
String url = invokeBuildUrl(params);
|
||||||
|
|
||||||
|
Assertions.assertEquals("jdbc:dm://127.0.0.1:5236/MAIN", url);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void usesCompleteCustomJdbcUrlWithoutRewritingIt() throws Exception {
|
void usesCompleteCustomJdbcUrlWithoutRewritingIt() throws Exception {
|
||||||
ConnectParams params = new ConnectParams(
|
ConnectParams params = new ConnectParams(
|
||||||
|
|||||||
Reference in new issue
Block a user