From 1384e6ba7a2fc1d8ba569f16a46210cdde2aa7e5 Mon Sep 17 00:00:00 2001 From: kristyldatical Date: Wed, 19 Aug 2020 21:16:44 -0500 Subject: [PATCH 1/3] Adding gmavenplus to pom + moving harness code under src/test to work with maven --- pom.xml | 28 +++++++++++-------- .../harness/ChangeObjectsTest.groovy | 0 .../harness/config/DatabaseUnderTest.groovy | 0 .../harness/config/DatabaseVersion.groovy | 0 .../harness/config/TestConfig.groovy | 0 .../liquibase/harness/config/TestInput.groovy | 0 .../util/DatabaseConnectionUtil.groovy | 0 .../harness/util/DatabaseTestContext.java | 0 .../liquibase/harness/util/FileUtils.groovy | 2 +- .../util/HarnessResourceAccessor.groovy | 0 .../harness/util/SnapshotHelpers.groovy | 0 .../liquibase/harness/util/TestUtils.groovy | 0 .../resources/changelogs/addForeignKey.xml | 0 .../changelogs/addNotNullConstraint.xml | 0 .../resources/changelogs/addPrimaryKey.xml | 0 .../changelogs/addUniqueConstraint.xml | 0 .../resources/changelogs/createIndex.xml | 0 .../resources/changelogs/createTable.xml | 0 .../resources/changelogs/createView.xml | 0 .../changelogs/mysql/5.7/createTable.xml | 0 .../changelogs/mysql/8/createView.xml | 0 .../postgresql/12/addUniqueConstraint.xml | 0 .../changelogs/postgresql/9/addForeignKey.xml | 0 .../changelogs/postgresql/9/addPrimaryKey.xml | 0 .../resources/docker/docker-compose.yml | 0 .../resources/docker/mysql-init.sql | 0 .../resources/docker/postgres-init.sh | 0 .../expectedSnapshot/mysql/addForeignKey.json | 0 .../mysql/addNotNullConstraint.json | 0 .../expectedSnapshot/mysql/addPrimaryKey.json | 0 .../mysql/addUniqueConstraint.json | 0 .../expectedSnapshot/mysql/createIndex.json | 0 .../expectedSnapshot/mysql/createTable.json | 0 .../expectedSnapshot/mysql/createView.json | 0 .../postgresql/addForeignKey.json | 0 .../postgresql/addNotNullConstraint.json | 0 .../postgresql/addPrimaryKey.json | 0 .../postgresql/addUniqueConstraint.json | 0 .../postgresql/createIndex.json | 0 .../postgresql/createTable.json | 0 .../postgresql/createView.json | 0 .../expectedSql/mysql/addForeignKey.sql | 0 .../mysql/addNotNullConstraint.sql | 0 .../expectedSql/mysql/addPrimaryKey.sql | 0 .../expectedSql/mysql/addUniqueConstraint.sql | 0 .../expectedSql/mysql/createIndex.sql | 0 .../expectedSql/mysql/createTable.sql | 0 .../expectedSql/mysql/createView.sql | 0 .../expectedSql/postgresql/addForeignKey.sql | 0 .../postgresql/addNotNullConstraint.sql | 0 .../expectedSql/postgresql/addPrimaryKey.sql | 0 .../postgresql/addUniqueConstraint.sql | 0 .../expectedSql/postgresql/createIndex.sql | 0 .../expectedSql/postgresql/createTable.sql | 0 .../expectedSql/postgresql/createView.sql | 0 src/{main => test}/resources/testConfig.yml | 0 56 files changed, 17 insertions(+), 13 deletions(-) rename src/{main => test}/groovy/liquibase/harness/ChangeObjectsTest.groovy (100%) rename src/{main => test}/groovy/liquibase/harness/config/DatabaseUnderTest.groovy (100%) rename src/{main => test}/groovy/liquibase/harness/config/DatabaseVersion.groovy (100%) rename src/{main => test}/groovy/liquibase/harness/config/TestConfig.groovy (100%) rename src/{main => test}/groovy/liquibase/harness/config/TestInput.groovy (100%) rename src/{main => test}/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy (100%) rename src/{main => test}/groovy/liquibase/harness/util/DatabaseTestContext.java (100%) rename src/{main => test}/groovy/liquibase/harness/util/FileUtils.groovy (97%) rename src/{main => test}/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy (100%) rename src/{main => test}/groovy/liquibase/harness/util/SnapshotHelpers.groovy (100%) rename src/{main => test}/groovy/liquibase/harness/util/TestUtils.groovy (100%) rename src/{main => test}/resources/changelogs/addForeignKey.xml (100%) rename src/{main => test}/resources/changelogs/addNotNullConstraint.xml (100%) rename src/{main => test}/resources/changelogs/addPrimaryKey.xml (100%) rename src/{main => test}/resources/changelogs/addUniqueConstraint.xml (100%) rename src/{main => test}/resources/changelogs/createIndex.xml (100%) rename src/{main => test}/resources/changelogs/createTable.xml (100%) rename src/{main => test}/resources/changelogs/createView.xml (100%) rename src/{main => test}/resources/changelogs/mysql/5.7/createTable.xml (100%) rename src/{main => test}/resources/changelogs/mysql/8/createView.xml (100%) rename src/{main => test}/resources/changelogs/postgresql/12/addUniqueConstraint.xml (100%) rename src/{main => test}/resources/changelogs/postgresql/9/addForeignKey.xml (100%) rename src/{main => test}/resources/changelogs/postgresql/9/addPrimaryKey.xml (100%) rename src/{main => test}/resources/docker/docker-compose.yml (100%) rename src/{main => test}/resources/docker/mysql-init.sql (100%) rename src/{main => test}/resources/docker/postgres-init.sh (100%) rename src/{main => test}/resources/expectedSnapshot/mysql/addForeignKey.json (100%) rename src/{main => test}/resources/expectedSnapshot/mysql/addNotNullConstraint.json (100%) rename src/{main => test}/resources/expectedSnapshot/mysql/addPrimaryKey.json (100%) rename src/{main => test}/resources/expectedSnapshot/mysql/addUniqueConstraint.json (100%) rename src/{main => test}/resources/expectedSnapshot/mysql/createIndex.json (100%) rename src/{main => test}/resources/expectedSnapshot/mysql/createTable.json (100%) rename src/{main => test}/resources/expectedSnapshot/mysql/createView.json (100%) rename src/{main => test}/resources/expectedSnapshot/postgresql/addForeignKey.json (100%) rename src/{main => test}/resources/expectedSnapshot/postgresql/addNotNullConstraint.json (100%) rename src/{main => test}/resources/expectedSnapshot/postgresql/addPrimaryKey.json (100%) rename src/{main => test}/resources/expectedSnapshot/postgresql/addUniqueConstraint.json (100%) rename src/{main => test}/resources/expectedSnapshot/postgresql/createIndex.json (100%) rename src/{main => test}/resources/expectedSnapshot/postgresql/createTable.json (100%) rename src/{main => test}/resources/expectedSnapshot/postgresql/createView.json (100%) rename src/{main => test}/resources/expectedSql/mysql/addForeignKey.sql (100%) rename src/{main => test}/resources/expectedSql/mysql/addNotNullConstraint.sql (100%) rename src/{main => test}/resources/expectedSql/mysql/addPrimaryKey.sql (100%) rename src/{main => test}/resources/expectedSql/mysql/addUniqueConstraint.sql (100%) rename src/{main => test}/resources/expectedSql/mysql/createIndex.sql (100%) rename src/{main => test}/resources/expectedSql/mysql/createTable.sql (100%) rename src/{main => test}/resources/expectedSql/mysql/createView.sql (100%) rename src/{main => test}/resources/expectedSql/postgresql/addForeignKey.sql (100%) rename src/{main => test}/resources/expectedSql/postgresql/addNotNullConstraint.sql (100%) rename src/{main => test}/resources/expectedSql/postgresql/addPrimaryKey.sql (100%) rename src/{main => test}/resources/expectedSql/postgresql/addUniqueConstraint.sql (100%) rename src/{main => test}/resources/expectedSql/postgresql/createIndex.sql (100%) rename src/{main => test}/resources/expectedSql/postgresql/createTable.sql (100%) rename src/{main => test}/resources/expectedSql/postgresql/createView.sql (100%) rename src/{main => test}/resources/testConfig.yml (100%) diff --git a/pom.xml b/pom.xml index fe39091db..54d6052b7 100644 --- a/pom.xml +++ b/pom.xml @@ -60,23 +60,27 @@ - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M5 - - - --illegal-access=permit - - + org.codehaus.gmavenplus + gmavenplus-plugin + 1.6.2 + + + + addTestSources + compileTests + + + org.apache.maven.plugins - maven-failsafe-plugin + maven-surefire-plugin 3.0.0-M5 - - --illegal-access=permit - + + **/*Test.java + **/*Spec.java + diff --git a/src/main/groovy/liquibase/harness/ChangeObjectsTest.groovy b/src/test/groovy/liquibase/harness/ChangeObjectsTest.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/ChangeObjectsTest.groovy rename to src/test/groovy/liquibase/harness/ChangeObjectsTest.groovy diff --git a/src/main/groovy/liquibase/harness/config/DatabaseUnderTest.groovy b/src/test/groovy/liquibase/harness/config/DatabaseUnderTest.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/config/DatabaseUnderTest.groovy rename to src/test/groovy/liquibase/harness/config/DatabaseUnderTest.groovy diff --git a/src/main/groovy/liquibase/harness/config/DatabaseVersion.groovy b/src/test/groovy/liquibase/harness/config/DatabaseVersion.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/config/DatabaseVersion.groovy rename to src/test/groovy/liquibase/harness/config/DatabaseVersion.groovy diff --git a/src/main/groovy/liquibase/harness/config/TestConfig.groovy b/src/test/groovy/liquibase/harness/config/TestConfig.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/config/TestConfig.groovy rename to src/test/groovy/liquibase/harness/config/TestConfig.groovy diff --git a/src/main/groovy/liquibase/harness/config/TestInput.groovy b/src/test/groovy/liquibase/harness/config/TestInput.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/config/TestInput.groovy rename to src/test/groovy/liquibase/harness/config/TestInput.groovy diff --git a/src/main/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy b/src/test/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy rename to src/test/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy diff --git a/src/main/groovy/liquibase/harness/util/DatabaseTestContext.java b/src/test/groovy/liquibase/harness/util/DatabaseTestContext.java similarity index 100% rename from src/main/groovy/liquibase/harness/util/DatabaseTestContext.java rename to src/test/groovy/liquibase/harness/util/DatabaseTestContext.java diff --git a/src/main/groovy/liquibase/harness/util/FileUtils.groovy b/src/test/groovy/liquibase/harness/util/FileUtils.groovy similarity index 97% rename from src/main/groovy/liquibase/harness/util/FileUtils.groovy rename to src/test/groovy/liquibase/harness/util/FileUtils.groovy index eb958d466..ad2b5244f 100644 --- a/src/main/groovy/liquibase/harness/util/FileUtils.groovy +++ b/src/test/groovy/liquibase/harness/util/FileUtils.groovy @@ -6,7 +6,7 @@ import liquibase.harness.config.TestInput import org.yaml.snakeyaml.Yaml class FileUtils { - static final String resourceBaseDir = "src/main/resources/" + static final String resourceBaseDir = "src/test/resources/" static String getFileContent (TestInput testInput, String expectedFolder, String fileExtension){ return new File(new StringBuilder(resourceBaseDir) diff --git a/src/main/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy b/src/test/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy rename to src/test/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy diff --git a/src/main/groovy/liquibase/harness/util/SnapshotHelpers.groovy b/src/test/groovy/liquibase/harness/util/SnapshotHelpers.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/util/SnapshotHelpers.groovy rename to src/test/groovy/liquibase/harness/util/SnapshotHelpers.groovy diff --git a/src/main/groovy/liquibase/harness/util/TestUtils.groovy b/src/test/groovy/liquibase/harness/util/TestUtils.groovy similarity index 100% rename from src/main/groovy/liquibase/harness/util/TestUtils.groovy rename to src/test/groovy/liquibase/harness/util/TestUtils.groovy diff --git a/src/main/resources/changelogs/addForeignKey.xml b/src/test/resources/changelogs/addForeignKey.xml similarity index 100% rename from src/main/resources/changelogs/addForeignKey.xml rename to src/test/resources/changelogs/addForeignKey.xml diff --git a/src/main/resources/changelogs/addNotNullConstraint.xml b/src/test/resources/changelogs/addNotNullConstraint.xml similarity index 100% rename from src/main/resources/changelogs/addNotNullConstraint.xml rename to src/test/resources/changelogs/addNotNullConstraint.xml diff --git a/src/main/resources/changelogs/addPrimaryKey.xml b/src/test/resources/changelogs/addPrimaryKey.xml similarity index 100% rename from src/main/resources/changelogs/addPrimaryKey.xml rename to src/test/resources/changelogs/addPrimaryKey.xml diff --git a/src/main/resources/changelogs/addUniqueConstraint.xml b/src/test/resources/changelogs/addUniqueConstraint.xml similarity index 100% rename from src/main/resources/changelogs/addUniqueConstraint.xml rename to src/test/resources/changelogs/addUniqueConstraint.xml diff --git a/src/main/resources/changelogs/createIndex.xml b/src/test/resources/changelogs/createIndex.xml similarity index 100% rename from src/main/resources/changelogs/createIndex.xml rename to src/test/resources/changelogs/createIndex.xml diff --git a/src/main/resources/changelogs/createTable.xml b/src/test/resources/changelogs/createTable.xml similarity index 100% rename from src/main/resources/changelogs/createTable.xml rename to src/test/resources/changelogs/createTable.xml diff --git a/src/main/resources/changelogs/createView.xml b/src/test/resources/changelogs/createView.xml similarity index 100% rename from src/main/resources/changelogs/createView.xml rename to src/test/resources/changelogs/createView.xml diff --git a/src/main/resources/changelogs/mysql/5.7/createTable.xml b/src/test/resources/changelogs/mysql/5.7/createTable.xml similarity index 100% rename from src/main/resources/changelogs/mysql/5.7/createTable.xml rename to src/test/resources/changelogs/mysql/5.7/createTable.xml diff --git a/src/main/resources/changelogs/mysql/8/createView.xml b/src/test/resources/changelogs/mysql/8/createView.xml similarity index 100% rename from src/main/resources/changelogs/mysql/8/createView.xml rename to src/test/resources/changelogs/mysql/8/createView.xml diff --git a/src/main/resources/changelogs/postgresql/12/addUniqueConstraint.xml b/src/test/resources/changelogs/postgresql/12/addUniqueConstraint.xml similarity index 100% rename from src/main/resources/changelogs/postgresql/12/addUniqueConstraint.xml rename to src/test/resources/changelogs/postgresql/12/addUniqueConstraint.xml diff --git a/src/main/resources/changelogs/postgresql/9/addForeignKey.xml b/src/test/resources/changelogs/postgresql/9/addForeignKey.xml similarity index 100% rename from src/main/resources/changelogs/postgresql/9/addForeignKey.xml rename to src/test/resources/changelogs/postgresql/9/addForeignKey.xml diff --git a/src/main/resources/changelogs/postgresql/9/addPrimaryKey.xml b/src/test/resources/changelogs/postgresql/9/addPrimaryKey.xml similarity index 100% rename from src/main/resources/changelogs/postgresql/9/addPrimaryKey.xml rename to src/test/resources/changelogs/postgresql/9/addPrimaryKey.xml diff --git a/src/main/resources/docker/docker-compose.yml b/src/test/resources/docker/docker-compose.yml similarity index 100% rename from src/main/resources/docker/docker-compose.yml rename to src/test/resources/docker/docker-compose.yml diff --git a/src/main/resources/docker/mysql-init.sql b/src/test/resources/docker/mysql-init.sql similarity index 100% rename from src/main/resources/docker/mysql-init.sql rename to src/test/resources/docker/mysql-init.sql diff --git a/src/main/resources/docker/postgres-init.sh b/src/test/resources/docker/postgres-init.sh similarity index 100% rename from src/main/resources/docker/postgres-init.sh rename to src/test/resources/docker/postgres-init.sh diff --git a/src/main/resources/expectedSnapshot/mysql/addForeignKey.json b/src/test/resources/expectedSnapshot/mysql/addForeignKey.json similarity index 100% rename from src/main/resources/expectedSnapshot/mysql/addForeignKey.json rename to src/test/resources/expectedSnapshot/mysql/addForeignKey.json diff --git a/src/main/resources/expectedSnapshot/mysql/addNotNullConstraint.json b/src/test/resources/expectedSnapshot/mysql/addNotNullConstraint.json similarity index 100% rename from src/main/resources/expectedSnapshot/mysql/addNotNullConstraint.json rename to src/test/resources/expectedSnapshot/mysql/addNotNullConstraint.json diff --git a/src/main/resources/expectedSnapshot/mysql/addPrimaryKey.json b/src/test/resources/expectedSnapshot/mysql/addPrimaryKey.json similarity index 100% rename from src/main/resources/expectedSnapshot/mysql/addPrimaryKey.json rename to src/test/resources/expectedSnapshot/mysql/addPrimaryKey.json diff --git a/src/main/resources/expectedSnapshot/mysql/addUniqueConstraint.json b/src/test/resources/expectedSnapshot/mysql/addUniqueConstraint.json similarity index 100% rename from src/main/resources/expectedSnapshot/mysql/addUniqueConstraint.json rename to src/test/resources/expectedSnapshot/mysql/addUniqueConstraint.json diff --git a/src/main/resources/expectedSnapshot/mysql/createIndex.json b/src/test/resources/expectedSnapshot/mysql/createIndex.json similarity index 100% rename from src/main/resources/expectedSnapshot/mysql/createIndex.json rename to src/test/resources/expectedSnapshot/mysql/createIndex.json diff --git a/src/main/resources/expectedSnapshot/mysql/createTable.json b/src/test/resources/expectedSnapshot/mysql/createTable.json similarity index 100% rename from src/main/resources/expectedSnapshot/mysql/createTable.json rename to src/test/resources/expectedSnapshot/mysql/createTable.json diff --git a/src/main/resources/expectedSnapshot/mysql/createView.json b/src/test/resources/expectedSnapshot/mysql/createView.json similarity index 100% rename from src/main/resources/expectedSnapshot/mysql/createView.json rename to src/test/resources/expectedSnapshot/mysql/createView.json diff --git a/src/main/resources/expectedSnapshot/postgresql/addForeignKey.json b/src/test/resources/expectedSnapshot/postgresql/addForeignKey.json similarity index 100% rename from src/main/resources/expectedSnapshot/postgresql/addForeignKey.json rename to src/test/resources/expectedSnapshot/postgresql/addForeignKey.json diff --git a/src/main/resources/expectedSnapshot/postgresql/addNotNullConstraint.json b/src/test/resources/expectedSnapshot/postgresql/addNotNullConstraint.json similarity index 100% rename from src/main/resources/expectedSnapshot/postgresql/addNotNullConstraint.json rename to src/test/resources/expectedSnapshot/postgresql/addNotNullConstraint.json diff --git a/src/main/resources/expectedSnapshot/postgresql/addPrimaryKey.json b/src/test/resources/expectedSnapshot/postgresql/addPrimaryKey.json similarity index 100% rename from src/main/resources/expectedSnapshot/postgresql/addPrimaryKey.json rename to src/test/resources/expectedSnapshot/postgresql/addPrimaryKey.json diff --git a/src/main/resources/expectedSnapshot/postgresql/addUniqueConstraint.json b/src/test/resources/expectedSnapshot/postgresql/addUniqueConstraint.json similarity index 100% rename from src/main/resources/expectedSnapshot/postgresql/addUniqueConstraint.json rename to src/test/resources/expectedSnapshot/postgresql/addUniqueConstraint.json diff --git a/src/main/resources/expectedSnapshot/postgresql/createIndex.json b/src/test/resources/expectedSnapshot/postgresql/createIndex.json similarity index 100% rename from src/main/resources/expectedSnapshot/postgresql/createIndex.json rename to src/test/resources/expectedSnapshot/postgresql/createIndex.json diff --git a/src/main/resources/expectedSnapshot/postgresql/createTable.json b/src/test/resources/expectedSnapshot/postgresql/createTable.json similarity index 100% rename from src/main/resources/expectedSnapshot/postgresql/createTable.json rename to src/test/resources/expectedSnapshot/postgresql/createTable.json diff --git a/src/main/resources/expectedSnapshot/postgresql/createView.json b/src/test/resources/expectedSnapshot/postgresql/createView.json similarity index 100% rename from src/main/resources/expectedSnapshot/postgresql/createView.json rename to src/test/resources/expectedSnapshot/postgresql/createView.json diff --git a/src/main/resources/expectedSql/mysql/addForeignKey.sql b/src/test/resources/expectedSql/mysql/addForeignKey.sql similarity index 100% rename from src/main/resources/expectedSql/mysql/addForeignKey.sql rename to src/test/resources/expectedSql/mysql/addForeignKey.sql diff --git a/src/main/resources/expectedSql/mysql/addNotNullConstraint.sql b/src/test/resources/expectedSql/mysql/addNotNullConstraint.sql similarity index 100% rename from src/main/resources/expectedSql/mysql/addNotNullConstraint.sql rename to src/test/resources/expectedSql/mysql/addNotNullConstraint.sql diff --git a/src/main/resources/expectedSql/mysql/addPrimaryKey.sql b/src/test/resources/expectedSql/mysql/addPrimaryKey.sql similarity index 100% rename from src/main/resources/expectedSql/mysql/addPrimaryKey.sql rename to src/test/resources/expectedSql/mysql/addPrimaryKey.sql diff --git a/src/main/resources/expectedSql/mysql/addUniqueConstraint.sql b/src/test/resources/expectedSql/mysql/addUniqueConstraint.sql similarity index 100% rename from src/main/resources/expectedSql/mysql/addUniqueConstraint.sql rename to src/test/resources/expectedSql/mysql/addUniqueConstraint.sql diff --git a/src/main/resources/expectedSql/mysql/createIndex.sql b/src/test/resources/expectedSql/mysql/createIndex.sql similarity index 100% rename from src/main/resources/expectedSql/mysql/createIndex.sql rename to src/test/resources/expectedSql/mysql/createIndex.sql diff --git a/src/main/resources/expectedSql/mysql/createTable.sql b/src/test/resources/expectedSql/mysql/createTable.sql similarity index 100% rename from src/main/resources/expectedSql/mysql/createTable.sql rename to src/test/resources/expectedSql/mysql/createTable.sql diff --git a/src/main/resources/expectedSql/mysql/createView.sql b/src/test/resources/expectedSql/mysql/createView.sql similarity index 100% rename from src/main/resources/expectedSql/mysql/createView.sql rename to src/test/resources/expectedSql/mysql/createView.sql diff --git a/src/main/resources/expectedSql/postgresql/addForeignKey.sql b/src/test/resources/expectedSql/postgresql/addForeignKey.sql similarity index 100% rename from src/main/resources/expectedSql/postgresql/addForeignKey.sql rename to src/test/resources/expectedSql/postgresql/addForeignKey.sql diff --git a/src/main/resources/expectedSql/postgresql/addNotNullConstraint.sql b/src/test/resources/expectedSql/postgresql/addNotNullConstraint.sql similarity index 100% rename from src/main/resources/expectedSql/postgresql/addNotNullConstraint.sql rename to src/test/resources/expectedSql/postgresql/addNotNullConstraint.sql diff --git a/src/main/resources/expectedSql/postgresql/addPrimaryKey.sql b/src/test/resources/expectedSql/postgresql/addPrimaryKey.sql similarity index 100% rename from src/main/resources/expectedSql/postgresql/addPrimaryKey.sql rename to src/test/resources/expectedSql/postgresql/addPrimaryKey.sql diff --git a/src/main/resources/expectedSql/postgresql/addUniqueConstraint.sql b/src/test/resources/expectedSql/postgresql/addUniqueConstraint.sql similarity index 100% rename from src/main/resources/expectedSql/postgresql/addUniqueConstraint.sql rename to src/test/resources/expectedSql/postgresql/addUniqueConstraint.sql diff --git a/src/main/resources/expectedSql/postgresql/createIndex.sql b/src/test/resources/expectedSql/postgresql/createIndex.sql similarity index 100% rename from src/main/resources/expectedSql/postgresql/createIndex.sql rename to src/test/resources/expectedSql/postgresql/createIndex.sql diff --git a/src/main/resources/expectedSql/postgresql/createTable.sql b/src/test/resources/expectedSql/postgresql/createTable.sql similarity index 100% rename from src/main/resources/expectedSql/postgresql/createTable.sql rename to src/test/resources/expectedSql/postgresql/createTable.sql diff --git a/src/main/resources/expectedSql/postgresql/createView.sql b/src/test/resources/expectedSql/postgresql/createView.sql similarity index 100% rename from src/main/resources/expectedSql/postgresql/createView.sql rename to src/test/resources/expectedSql/postgresql/createView.sql diff --git a/src/main/resources/testConfig.yml b/src/test/resources/testConfig.yml similarity index 100% rename from src/main/resources/testConfig.yml rename to src/test/resources/testConfig.yml From fd67efdb4ebea0cd359be335c7a72571d545505a Mon Sep 17 00:00:00 2001 From: Oleh Kushniryk Date: Thu, 20 Aug 2020 12:48:08 +0300 Subject: [PATCH 2/3] fixed path in resourceAccessor --- pom.xml | 3 --- .../liquibase/harness/util/HarnessResourceAccessor.groovy | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 54d6052b7..c141b22b2 100644 --- a/pom.xml +++ b/pom.xml @@ -55,9 +55,6 @@ org.apache.maven.plugins maven-compiler-plugin 3.8.1 - - 11 - org.codehaus.gmavenplus diff --git a/src/test/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy b/src/test/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy index 04619c371..dc64efccf 100644 --- a/src/test/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy +++ b/src/test/groovy/liquibase/harness/util/HarnessResourceAccessor.groovy @@ -7,7 +7,7 @@ class HarnessResourceAccessor extends ClassLoaderResourceAccessor { HarnessResourceAccessor() throws Exception { super(new URLClassLoader(new URL[]{ new File(System.getProperty("user.dir")).toURI().toURL(), - new File("src/main/resources/").toURI().toURL(), + new File("src/test/resources/").toURI().toURL(), new File(System.getProperty("java.io.tmpdir")).toURI().toURL(), })) } From 1d50e7128d18bdc0ef6461026f238b3c325f1078 Mon Sep 17 00:00:00 2001 From: Oleh Kushniryk Date: Thu, 20 Aug 2020 18:56:58 +0300 Subject: [PATCH 3/3] put required java version back, small cleanup --- .gitignore | 5 ++- pom.xml | 3 ++ .../harness/ChangeObjectsTest.groovy | 10 ++--- .../util/DatabaseConnectionUtil.groovy | 40 +++++++++---------- .../harness/util/DatabaseTestContext.java | 13 ++---- .../liquibase/harness/util/FileUtils.groovy | 6 +-- .../harness/util/SnapshotHelpers.groovy | 2 +- .../liquibase/harness/util/TestUtils.groovy | 4 -- 8 files changed, 39 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index 4411091ac..4ddbf22bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ target/ .gitignore .idea/ -*.iml \ No newline at end of file +*.iml +bin/ +.project +.DS_Store \ No newline at end of file diff --git a/pom.xml b/pom.xml index c141b22b2..54d6052b7 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,9 @@ org.apache.maven.plugins maven-compiler-plugin 3.8.1 + + 11 + org.codehaus.gmavenplus diff --git a/src/test/groovy/liquibase/harness/ChangeObjectsTest.groovy b/src/test/groovy/liquibase/harness/ChangeObjectsTest.groovy index 14f44f89f..f9b96dd96 100644 --- a/src/test/groovy/liquibase/harness/ChangeObjectsTest.groovy +++ b/src/test/groovy/liquibase/harness/ChangeObjectsTest.groovy @@ -36,13 +36,13 @@ class ChangeObjectsTest extends Specification { ArrayList expectedSqlList = TestUtils.parseValuesToList(expectedSql, "\n") when: - List generatedSql = TestUtils.toSqlFromLiquibaseChangeSets(liquibase); + List generatedSql = TestUtils.toSqlFromLiquibaseChangeSets(liquibase) then: - expectedSqlList == generatedSql; + expectedSqlList == generatedSql when: - liquibase.update(testInput.context); + liquibase.update(testInput.context) String jsonSnapshot = SnapshotHelpers.getJsonSnapshot(database, catalogAndSchemaList) liquibase.rollback(liquibase.databaseChangeLog.changeSets.size(), testInput.context) @@ -54,8 +54,8 @@ class ChangeObjectsTest extends Specification { testInput << TestUtils.buildTestInput(config) } - void snapshotMatchesSpecifiedStructure(String expected, String actual) { - JSONAssert.assertEquals(expected, actual, new SnapshotHelpers.GeneralSnapshotComparator()); + static void snapshotMatchesSpecifiedStructure(String expected, String actual) { + JSONAssert.assertEquals(expected, actual, new SnapshotHelpers.GeneralSnapshotComparator()) } } \ No newline at end of file diff --git a/src/test/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy b/src/test/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy index 3dadc964d..0a8e47f4d 100644 --- a/src/test/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy +++ b/src/test/groovy/liquibase/harness/util/DatabaseConnectionUtil.groovy @@ -1,41 +1,41 @@ package liquibase.harness.util -import liquibase.Scope; -import liquibase.changelog.ChangeLogHistoryServiceFactory; -import liquibase.database.Database; -import liquibase.database.DatabaseConnection; -import liquibase.database.DatabaseFactory; +import liquibase.Scope +import liquibase.changelog.ChangeLogHistoryServiceFactory +import liquibase.database.Database +import liquibase.database.DatabaseConnection +import liquibase.database.DatabaseFactory import liquibase.exception.DatabaseException -import liquibase.harness.config.TestInput; -import liquibase.lockservice.LockServiceFactory; -import liquibase.logging.Logger; -import liquibase.snapshot.SnapshotGeneratorFactory; +import liquibase.harness.config.TestInput +import liquibase.lockservice.LockServiceFactory +import liquibase.logging.Logger +import liquibase.snapshot.SnapshotGeneratorFactory class DatabaseConnectionUtil { - private static Logger logger = Scope.getCurrentScope().getLog(getClass()); + private static Logger logger = Scope.getCurrentScope().getLog(getClass()) static Database initializeDatabase(TestInput testInput) { try { - Database database = openConnection(testInput.url, testInput.username, testInput.password); - return init(database); + Database database = openConnection(testInput.url, testInput.username, testInput.password) + return init(database) } catch (Exception e) { - logger.severe("Unable to initialize database connection", e); - return null; + logger.severe("Unable to initialize database connection", e) + return null } } private static Database openConnection(String url, String username, String password) throws Exception { - DatabaseConnection connection = DatabaseTestContext.getInstance().getConnection(url, username, password); - return DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection); + DatabaseConnection connection = DatabaseTestContext.getInstance().getConnection(url, username, password) + return DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection) } private static Database init(Database database) throws DatabaseException { - SnapshotGeneratorFactory.resetAll(); - LockServiceFactory.getInstance().resetAll(); - LockServiceFactory.getInstance().getLockService(database).init(); - ChangeLogHistoryServiceFactory.getInstance().resetAll(); + SnapshotGeneratorFactory.resetAll() + LockServiceFactory.getInstance().resetAll() + LockServiceFactory.getInstance().getLockService(database).init() + ChangeLogHistoryServiceFactory.getInstance().resetAll() return database } diff --git a/src/test/groovy/liquibase/harness/util/DatabaseTestContext.java b/src/test/groovy/liquibase/harness/util/DatabaseTestContext.java index 69cbcb6b4..08e448d9c 100644 --- a/src/test/groovy/liquibase/harness/util/DatabaseTestContext.java +++ b/src/test/groovy/liquibase/harness/util/DatabaseTestContext.java @@ -67,8 +67,7 @@ private DatabaseConnection openConnection(final String givenUrl, if (!tempDir.endsWith(System.getProperty("file.separator"))) tempDir += System.getProperty("file.separator"); - String tempUrl = givenUrl.replace("***TEMPDIR***/", tempDir); - final String url = tempUrl; + final String url = givenUrl.replace("***TEMPDIR***/", tempDir); if (connectionsAttempted.containsKey(url)) { JdbcConnection connection = (JdbcConnection) connectionsByUrl.get(url); @@ -85,7 +84,7 @@ private DatabaseConnection openConnection(final String givenUrl, boolean shouldTest = false; String[] databasesToTest = System.getProperty(TEST_DATABASES_PROPERTY).split("\\s*,\\s*"); for (String database : databasesToTest) { - if (url.indexOf(database) >= 0) { + if (url.contains(database)) { shouldTest = true; } } @@ -144,13 +143,7 @@ private DatabaseConnection openConnection(final String givenUrl, connectionsByUrl.put(url, databaseConnection); - Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { - - @Override - public void run() { - shutdownConnection((JdbcConnection) databaseConnection); - } - })); + Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdownConnection((JdbcConnection) databaseConnection))); return databaseConnection; } diff --git a/src/test/groovy/liquibase/harness/util/FileUtils.groovy b/src/test/groovy/liquibase/harness/util/FileUtils.groovy index ad2b5244f..7ace5f846 100644 --- a/src/test/groovy/liquibase/harness/util/FileUtils.groovy +++ b/src/test/groovy/liquibase/harness/util/FileUtils.groovy @@ -39,7 +39,7 @@ class FileUtils { dir.eachFileRecurse(FileType.FILES) { file -> changeObjects.put(file.getName(), file.getPath()) } - return changeObjects; + return changeObjects } static Map getVersionSpecificChangeObjects(String dbName, String dbVersion) { @@ -53,11 +53,11 @@ class FileUtils { dir.eachFileRecurse(FileType.FILES) { file -> changeTypes.put(file.getName().substring(0, file.getName().lastIndexOf('.')),file.getPath()) } - return changeTypes; + return changeTypes } static Map mapChangeObjectsToFilePaths(List strings) { - Map changeTypeToFilePathMap = new HashMap<>(); + Map changeTypeToFilePathMap = new HashMap<>() strings.each { changeTypeToFilePathMap.put(it, resourceBaseDir + "changelogs/" + it + ".xml") } diff --git a/src/test/groovy/liquibase/harness/util/SnapshotHelpers.groovy b/src/test/groovy/liquibase/harness/util/SnapshotHelpers.groovy index 94145b935..afa900396 100644 --- a/src/test/groovy/liquibase/harness/util/SnapshotHelpers.groovy +++ b/src/test/groovy/liquibase/harness/util/SnapshotHelpers.groovy @@ -52,7 +52,7 @@ class SnapshotHelpers { result.passed() } else if (!StringUtil.equalsIgnoreCaseAndEmpty(expectedValue, actualValue)) { - result.fail(prefix, expectedValue, actualValue); + result.fail(prefix, expectedValue, actualValue) } } else { super.compareValues(prefix, expectedValue, actualValue, result) diff --git a/src/test/groovy/liquibase/harness/util/TestUtils.groovy b/src/test/groovy/liquibase/harness/util/TestUtils.groovy index 686661056..6308f6199 100644 --- a/src/test/groovy/liquibase/harness/util/TestUtils.groovy +++ b/src/test/groovy/liquibase/harness/util/TestUtils.groovy @@ -108,8 +108,4 @@ class TestUtils { return inputList } - static Map mergeChangeObjects(Map versionSpecificChangeObjects, Map changeObjects) { - changeObjects.putAll(versionSpecificChangeObjects) - return changeObjects - } }