Skip to content
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

Make EnterpriseDBDatabase detection less broad #2364

Merged
merged 4 commits into from Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -10,7 +10,7 @@ public class EnterpriseDBDatabase extends PostgresDatabase {
@Override
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
final String url = conn.getURL();
return url.contains("edb") || (url.contains("postgres") && url.contains(":5444"));
return url.contains(":edb:") || (url.contains(":postgres:") && url.contains(":5444"));
StevenMassaro marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Expand Down
@@ -0,0 +1,33 @@
package liquibase.database.core

import liquibase.database.MockDatabaseConnection
import spock.lang.Specification
import spock.lang.Unroll

class EnterpriseDBDatabaseTest extends Specification {

@Unroll
def "isCorrectDatabaseImplementation"() {
when:
def returnUrl = url

def conn = new MockDatabaseConnection() {
@Override
String getURL() {
return returnUrl
}
}


then:
assert new EnterpriseDBDatabase().isCorrectDatabaseImplementation(conn) == expected

where:
url | expected
"jdbc:edb:localhost" | true
"jdbc:postgres:localhost:5444" | true
"jdbc:postgres:localhost:5432" | false
"jdbc:postgresql:localhost" | false
"jdbc:db2:localhost/thedb" | false
}
}