-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #5266: comma separated dbms-attribute for createProcedure-change …
…triggers validation-check (#5267) * fix #5266: comma separated dbms-attribute for createProcedure-change triggers validation-check * Null check added. * migrate DatabaseListTest to groovy --------- Co-authored-by: Daniel Mallorga <dmallorga@liquibase.com> Co-authored-by: rberezen <ruslan.berezenskyi@gmail.com>
- Loading branch information
1 parent
182ffe5
commit 7f31f3e
Showing
3 changed files
with
81 additions
and
53 deletions.
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
67 changes: 67 additions & 0 deletions
67
liquibase-standard/src/test/groovy/liquibase/database/DatabaseListTest.groovy
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package liquibase.database | ||
|
||
import liquibase.database.core.H2Database | ||
import liquibase.database.core.MSSQLDatabase | ||
import liquibase.database.core.MySQLDatabase | ||
import liquibase.database.core.OracleDatabase | ||
import liquibase.exception.ValidationErrors | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
class DatabaseListTest extends Specification { | ||
|
||
@Unroll | ||
def "check if database matches dbms definition (definition: #definition, database: #database, returnValueIfEmpty: #returnValueIfEmpty)"() { | ||
when: | ||
def result = DatabaseList.definitionMatches(definition, database, returnValueIfEmpty) | ||
then: | ||
result == expectedResult | ||
where: | ||
definition | database | returnValueIfEmpty | expectedResult | ||
"all" | new MySQLDatabase() | false | true | ||
"all, oracle" | new MySQLDatabase() | false | true | ||
"none" | new MySQLDatabase() | false | false | ||
"none, oracle" | new MySQLDatabase() | false | false | ||
"" | new OracleDatabase() | true | true | ||
"" | new OracleDatabase() | false | false | ||
(String) null | new OracleDatabase() | true | true | ||
(String) null | new OracleDatabase() | false | false | ||
" " | new OracleDatabase() | true | true | ||
" " | new OracleDatabase() | false | false | ||
"oracle" | new OracleDatabase() | false | true | ||
"oracle,mysql,mssql" | new OracleDatabase() | false | true | ||
"oracle,mysql,mssql" | new MySQLDatabase() | false | true | ||
"oracle,mysql,mssql" | new MSSQLDatabase() | false | true | ||
"oracle,mysql,mssql" | new H2Database() | false | false | ||
"!h2" | new MySQLDatabase() | false | true | ||
"!h2" | new MySQLDatabase() | true | true | ||
"!h2" | new H2Database() | false | false | ||
"!h2" | new H2Database() | true | false | ||
"!h2,mysql" | new H2Database() | false | false | ||
"!h2,mysql" | new MySQLDatabase() | false | true | ||
} | ||
@Unroll | ||
def "validate definition parameters dbms: #dbms"() { | ||
when: | ||
def vErrors = new ValidationErrors() | ||
DatabaseList.validateDefinitions(dbms, vErrors) | ||
boolean valid = !vErrors.hasErrors() | ||
then: | ||
valid == expectedResult | ||
where: | ||
dbms | expectedResult | ||
"all" | true | ||
"none" | true | ||
"mysqlll" | false | ||
"mysql" | true | ||
"mariadb" | true | ||
"mysql,mariadb" | true | ||
"mysql, mariadb" | true | ||
} | ||
} |
46 changes: 0 additions & 46 deletions
46
liquibase-standard/src/test/java/liquibase/database/DatabaseListTest.java
This file was deleted.
Oops, something went wrong.