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

[DAT-17418] Update groovy and spock versions #829

Merged
merged 9 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 57 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
<version>${liquibase-core.version}</version>
</dependency>
<dependency> <!-- use a specific Groovy version rather than the one specified by spock-core -->
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.5.19</version>
<version>4.0.21</version>
<type>pom</type>
<exclusions>
<exclusion>
Expand All @@ -98,12 +98,44 @@
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-swing</artifactId>
</exclusion>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.3-groovy-2.5</version>
<version>2.3-groovy-4.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<version>1.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.10.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
<version>1.10.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
Expand Down Expand Up @@ -222,7 +254,7 @@
<dependency>
<groupId>com.athaydes</groupId>
<artifactId>spock-reports</artifactId>
<version>1.7.1</version>
<version>2.5.1-groovy-4.0</version>
<scope>test</scope>
<!-- this avoids affecting your version of Groovy/Spock -->
<exclusions>
Expand Down Expand Up @@ -294,6 +326,9 @@
</goals>
</execution>
</executions>
<configuration>
<targetBytecode>1.8</targetBytecode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -395,6 +430,21 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<includes>
<!-- By default, only files ending in 'Test' will be included, so also include support for Spock style naming convention -->
<include>**/*Test</include>
<include>**/*Tests</include>
<include>**/*Spec</include>
<include>**/*Suite</include>
</includes>
</configuration>
</plugin>

</plugins>
</build>
<distributionManagement>
Expand Down Expand Up @@ -450,6 +500,9 @@
</goals>
</execution>
</executions>
<configuration>
<targetBytecode>1.8</targetBytecode>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
9 changes: 4 additions & 5 deletions src/main/groovy/liquibase/harness/AdvancedHarnessSuite.groovy
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package liquibase.harness


import liquibase.harness.generateChangelog.GenerateChangelogTest
import liquibase.harness.snapshot.SnapshotObjectTests
import org.junit.runner.RunWith
import org.junit.runners.Suite
import org.junit.platform.suite.api.SelectClasses
import org.junit.platform.suite.api.Suite

@RunWith(Suite.class)
@Suite.SuiteClasses([GenerateChangelogTest, SnapshotObjectTests])
@Suite
@SelectClasses([GenerateChangelogTest, SnapshotObjectTests])
abstract class AdvancedHarnessSuite {
}
8 changes: 4 additions & 4 deletions src/main/groovy/liquibase/harness/BaseHarnessSuite.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package liquibase.harness

import liquibase.harness.change.ChangeObjectTests
import liquibase.harness.data.ChangeDataTests
import org.junit.runner.RunWith
import org.junit.runners.Suite
import org.junit.platform.suite.api.SelectClasses
import org.junit.platform.suite.api.Suite

@RunWith(Suite.class)
@Suite.SuiteClasses([ChangeObjectTests, ChangeDataTests])
@Suite
@SelectClasses([ChangeObjectTests, ChangeDataTests])
abstract class BaseHarnessSuite {
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package liquibase.harness


import liquibase.harness.compatibility.foundational.FoundationalTest
import org.junit.runner.RunWith
import org.junit.runners.Suite
import org.junit.platform.suite.api.SelectClasses
import org.junit.platform.suite.api.Suite

@RunWith(Suite.class)
@Suite.SuiteClasses([FoundationalTest])
@Suite
@SelectClasses([FoundationalTest])
abstract class FoundationalHarnessSuite {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import liquibase.database.jvm.JdbcConnection
import liquibase.harness.config.DatabaseUnderTest
import liquibase.harness.config.TestConfig
import liquibase.harness.util.rollback.RollbackStrategy
import org.junit.Assume
import org.junit.jupiter.api.Assumptions
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll
Expand Down Expand Up @@ -44,7 +44,7 @@ class ChangeObjectTests extends Specification {

and: "ignore testcase if it's invalid for this combination of db type and/or version"
shouldRunChangeSet = !expectedSql?.toLowerCase()?.contains("invalid test")
Assume.assumeTrue(expectedSql, shouldRunChangeSet)
Assumptions.assumeTrue(shouldRunChangeSet, expectedSql)

and: "fail test if snapshot is not provided"
shouldRunChangeSet = expectedSnapshot != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import liquibase.harness.config.TestConfig
import liquibase.harness.util.rollback.RollbackStrategy
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert
import org.junit.jupiter.api.Assertions
import org.skyscreamer.jsonassert.JSONCompareMode
import spock.lang.Shared
import spock.lang.Specification
Expand Down Expand Up @@ -116,7 +116,7 @@ class FoundationalTest extends Specification {
assert compareJSONArrays(generatedResultSetArray, expectedResultSetArray, JSONCompareMode.LENIENT)
} catch (Exception exception) {
Scope.getCurrentScope().getUI().sendMessage("Error executing metadata checking sql! " + exception.printStackTrace())
Assert.fail exception.message
Assertions.fail exception.message
} finally {
newConnection == null ?: newConnection.close()

Expand All @@ -130,7 +130,7 @@ class FoundationalTest extends Specification {
// Assume test object was not created after 'update' command execution and test failed.
Scope.getCurrentScope().getUI().sendMessage("Error executing test table checking sql! " +
sqlException.printStackTrace())
Assert.fail sqlException.message
Assertions.fail sqlException.message
}
}

Expand All @@ -151,7 +151,7 @@ class FoundationalTest extends Specification {
Scope.getCurrentScope().getUI().sendMessage("ERROR!: Rollback was not successful! " +
"The object was not removed after 'rollback' command: " +
resultSet.getMetaData().getTableName(0))
Assert.fail()
Assertions.fail()
}
} catch (ignored) {
(connection.isClosed() || connection.autoCommit) ?: connection.commit()
Expand Down
5 changes: 2 additions & 3 deletions src/main/groovy/liquibase/harness/data/ChangeDataTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import liquibase.harness.util.rollback.RollbackStrategy
import liquibase.resource.ClassLoaderResourceAccessor
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert
import org.junit.Assume
import org.junit.jupiter.api.Assumptions
import org.skyscreamer.jsonassert.JSONCompareMode
import spock.lang.Shared
import spock.lang.Specification
Expand Down Expand Up @@ -59,7 +58,7 @@ class ChangeDataTests extends Specification {

and: "ignore testcase if it's invalid for this combination of db type and/or version"
shouldRunChangeSet = !expectedSql?.toLowerCase()?.contains("invalid test")
Assume.assumeTrue(expectedSql, shouldRunChangeSet)
Assumptions.assumeTrue(shouldRunChangeSet, expectedSql)

and: "fail test if expectedResultSet is not provided"
shouldRunChangeSet = expectedResultSet != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import liquibase.harness.config.DatabaseUnderTest
import liquibase.harness.config.TestConfig
import liquibase.harness.util.rollback.RollbackStrategy
import liquibase.ui.UIService
import org.junit.Assume
import org.junit.jupiter.api.Assumptions
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll
Expand Down Expand Up @@ -50,7 +50,7 @@ class GenerateChangelogTest extends Specification {

and: "ignore testcase if it's invalid for this combination of db type and/or version"
shouldRunChangeSet = !getResourceContent("/$testInput.sqlChangelogPath").toLowerCase()?.contains("invalid test")
Assume.assumeTrue("INFO: Test for $testInput.change is ignored", shouldRunChangeSet)
Assumptions.assumeTrue(shouldRunChangeSet, "INFO: Test for $testInput.change is ignored")

and: "testing generateChangelog command for all files format"
def map = new LinkedHashMap<String, String>()
Expand Down
9 changes: 4 additions & 5 deletions src/main/groovy/liquibase/harness/util/TestUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import liquibase.harness.util.rollback.RollbackByTag
import liquibase.harness.util.rollback.RollbackStrategy
import liquibase.harness.util.rollback.RollbackToDate
import liquibase.resource.SearchPathResourceAccessor
import org.junit.Assert
import org.junit.jupiter.api.Assertions

import java.nio.file.Path
import java.nio.file.Paths
import java.util.logging.Logger

import org.apache.commons.io.FileUtils
import static liquibase.harness.util.FileUtils.deleteFile

class TestUtils {

Expand Down Expand Up @@ -64,7 +63,7 @@ class TestUtils {
commandScope.getCommand().toString() + ". " + exception.printStackTrace())
Logger.getLogger(this.class.name).info("If this is expected to be invalid query for this database/version, " +
"create an 'expectedSql.sql' file that starts with 'INVALID TEST' and an explanation of why.")
Assert.fail exception.message
Assertions.fail exception.message
}
return outputStream
}
Expand Down Expand Up @@ -97,7 +96,7 @@ class TestUtils {
commandScope.getCommand().toString() + ". " + exception.printStackTrace())
Logger.getLogger(this.class.name).info("If this is expected to be invalid query for this database/version, " +
"create an 'expectedSql.sql' file that starts with 'INVALID TEST' and an explanation of why.")
Assert.fail exception.message
Assertions.fail exception.message
}
return outputStream
}
Expand Down Expand Up @@ -131,7 +130,7 @@ class TestUtils {
commandScope.getCommand().toString() + ". " + exception.printStackTrace())
Logger.getLogger(this.class.name).info("If this is expected to be invalid query for this database/version, " +
"create an 'expectedSql.sql' file that starts with 'INVALID TEST' and an explanation of why.")
Assert.fail exception.message
Assertions.fail exception.message
}
return outputStream
}
Expand Down
Loading