-
Notifications
You must be signed in to change notification settings - Fork 87
Feature/liquibase configuration #340
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
base: master
Are you sure you want to change the base?
Changes from all commits
0bc6d9f
2f66b73
31b8375
50ec86c
899e978
7023dc6
27adf36
805b5ea
2005578
94b38ab
c2ba0aa
1c9b7f8
2a797ae
af85a10
96ce077
32ba73d
b461dfb
2f14c02
13de274
8f704fd
42ad82e
db79005
163ebe9
cae564a
e49273e
6e2eb69
b2f1dd8
ee7f6a5
d2d0e0e
80641d8
7610cb1
cd8291b
a6d3fea
47ef2ec
5afd20a
ea8dd24
9e0f3fa
a46fad1
77f0161
49a7d71
50c91ae
8233899
3b9d0ea
9a4b7a1
c17e4f3
89c23b8
4042d7a
246a4d7
8bfb77f
2f6f5fe
7014b49
679b970
f850517
6c39c54
3d50fe3
9ba5ef5
4540198
b29c704
dc54073
dabd4c8
bab5a5f
e00c2e7
5ef5923
ee9318b
06ea818
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package com.devonfw.module.test.common.base.clean; | ||
|
|
||
| import javax.inject.Inject; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Qualifier; | ||
| import liquibase.Liquibase; | ||
| import liquibase.exception.DatabaseException; | ||
|
|
||
| /** | ||
| * Implementation of {@link TestCleanerPlugin} base on {@link Liquibase}. It will {@link Liquibase#dropAll() clean} on | ||
| * {@link #cleanup()}. Therefore after {@link #cleanup()} it will drop all database objects. | ||
| */ | ||
| @Qualifier("testCleanerPluginliquibase") | ||
| public class TestCleanerPluginLiquibase implements TestCleanerPlugin { | ||
|
|
||
| private Liquibase liquibase; | ||
|
|
||
| /** | ||
| * The constructor. | ||
| */ | ||
| public TestCleanerPluginLiquibase() { | ||
|
|
||
| super(); | ||
| } | ||
|
|
||
| /** | ||
| * The constructor. | ||
| * | ||
| * @param liquibase the {@link Liquibase} instance. | ||
| */ | ||
| public TestCleanerPluginLiquibase(Liquibase liquibase) { | ||
|
|
||
| super(); | ||
| this.liquibase = liquibase; | ||
| } | ||
|
|
||
| @Override | ||
| public void cleanup() { | ||
| try { | ||
| this.liquibase.dropAll(); | ||
| } catch(DatabaseException databaseException ) { | ||
| throw new RuntimeException(databaseException); | ||
| } | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,67 +1,67 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>com.devonfw</groupId> | ||
| <artifactId>maven-parent</artifactId> | ||
| <version>6</version> | ||
| </parent> | ||
| <groupId>com.devonfw.java.dev</groupId> | ||
| <artifactId>devon4j</artifactId> | ||
| <version>dev-SNAPSHOT</version> <!-- This POM will never be released --> | ||
| <packaging>pom</packaging> | ||
| <name>${project.artifactId}</name> | ||
| <description>Java stack of devonfw.com (devon4j): develop Java apps standardized, faster and with less risk.</description> | ||
| <inceptionYear>2014</inceptionYear> | ||
|
|
||
| <modules> | ||
| <module>boms</module> | ||
| <module>modules</module> | ||
| <module>starters</module> | ||
| <module>templates</module> | ||
| <module>documentation</module> | ||
| </modules> | ||
|
|
||
| <properties> | ||
| <revision>dev-SNAPSHOT</revision> | ||
| <github.repository>devon4j</github.repository> | ||
| <devon4j.version>${revision}</devon4j.version> | ||
| <spring.boot.version>2.4.4</spring.boot.version> | ||
| <!-- Spring boot and spring cloud version has to match --> | ||
| <spring.cloud.dependencies.version>2020.0.0</spring.cloud.dependencies.version> | ||
| <jackson.version>2.12.2</jackson.version> <!-- Overriding Jackson for fixing vulnerabilities --> | ||
| <guava.version>30.1.1-jre</guava.version> | ||
| <junit.version>5.7.1</junit.version> | ||
| <cxf.version>3.4.3</cxf.version> | ||
| <mmm.util.version>8.7.0</mmm.util.version> | ||
| <slf4j.version>1.7.30</slf4j.version> | ||
| <sonar.host.url>https://sonarcloud.io</sonar.host.url> | ||
| <sonar.organization>devonfw</sonar.organization> | ||
| </properties> | ||
|
|
||
| <build> | ||
| <plugins> | ||
|
|
||
| <!-- avoid version in local war files, exclude development properties from WARs --> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-war-plugin</artifactId> | ||
| <configuration> | ||
| <packagingExcludes>WEB-INF/classes/config/application.properties,*.jsp</packagingExcludes> | ||
| <warName>${project.artifactId}</warName> | ||
| </configuration> | ||
| </plugin> | ||
|
|
||
| </plugins> | ||
| <pluginManagement> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
| <version>${spring.boot.version}</version> | ||
| </plugin> | ||
| </plugins> | ||
| </pluginManagement> | ||
| </build> | ||
| </project> | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>com.devonfw</groupId> | ||
| <artifactId>maven-parent</artifactId> | ||
| <version>6</version> | ||
| </parent> | ||
| <groupId>com.devonfw.java.dev</groupId> | ||
| <artifactId>devon4j</artifactId> | ||
| <version>dev-SNAPSHOT</version> <!-- This POM will never be released --> | ||
| <packaging>pom</packaging> | ||
| <name>${project.artifactId}</name> | ||
| <description>Java stack of devonfw.com (devon4j): develop Java apps standardized, faster and with less risk.</description> | ||
| <inceptionYear>2014</inceptionYear> | ||
|
|
||
| <modules> | ||
| <module>boms</module> | ||
| <module>modules</module> | ||
| <module>starters</module> | ||
| <module>templates</module> | ||
| <module>documentation</module> | ||
| </modules> | ||
|
|
||
| <properties> | ||
| <revision>dev-SNAPSHOT</revision> | ||
| <github.repository>devon4j</github.repository> | ||
| <devon4j.version>${revision}</devon4j.version> | ||
| <spring.boot.version>2.4.4</spring.boot.version> | ||
| <!-- Spring boot and spring cloud version has to match --> | ||
| <spring.cloud.dependencies.version>2020.0.0</spring.cloud.dependencies.version> | ||
| <jackson.version>2.12.2</jackson.version> <!-- Overriding Jackson for fixing vulnerabilities --> | ||
| <guava.version>30.1.1-jre</guava.version> | ||
| <junit.version>5.7.1</junit.version> | ||
| <cxf.version>3.4.3</cxf.version> | ||
| <mmm.util.version>8.7.0</mmm.util.version> | ||
| <slf4j.version>1.7.30</slf4j.version> | ||
| <sonar.host.url>https://sonarcloud.io</sonar.host.url> | ||
| <sonar.organization>devonfw</sonar.organization> | ||
| </properties> | ||
|
|
||
| <build> | ||
| <plugins> | ||
|
|
||
| <!-- avoid version in local war files, exclude development properties from WARs --> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-war-plugin</artifactId> | ||
| <configuration> | ||
| <packagingExcludes>WEB-INF/classes/config/application.properties,*.jsp</packagingExcludes> | ||
| <warName>${project.artifactId}</warName> | ||
| </configuration> | ||
| </plugin> | ||
|
|
||
| </plugins> | ||
| <pluginManagement> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
| <version>${spring.boot.version}</version> | ||
| </plugin> | ||
| </plugins> | ||
| </pluginManagement> | ||
| </build> | ||
| </project> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have restored the file but still it is showing in files changed.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Current Yours has windows encoding. Maybe something with your git setup or the editor you are using to edit XML files. We once had such changes that added a Byte-Order-Mark to a |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,19 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>com.devonfw.java.dev</groupId> | ||
| <artifactId>devon4j</artifactId> | ||
| <version>dev-SNAPSHOT</version> | ||
| </parent> | ||
| <artifactId>devon4j-templates</artifactId> | ||
| <packaging>pom</packaging> | ||
| <name>${project.artifactId}</name> | ||
| <description>Templates (maven archetypes) of devon4j.</description> | ||
|
|
||
| <modules> | ||
| <module>server</module> | ||
| </modules> | ||
|
|
||
| </project> | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here? No change at all?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will review it again and restore the file if changes not required |
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>com.devonfw.java.dev</groupId> | ||
| <artifactId>devon4j</artifactId> | ||
| <version>dev-SNAPSHOT</version> | ||
| </parent> | ||
| <artifactId>devon4j-templates</artifactId> | ||
| <packaging>pom</packaging> | ||
| <name>${project.artifactId}</name> | ||
| <description>Templates (maven archetypes) of devon4j.</description> | ||
|
|
||
| <modules> | ||
| <module>server</module> | ||
| </modules> | ||
|
|
||
| </project> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have restored the file here too but still it is showing in files changed. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,51 @@ | ||
| import java.nio.file.Files | ||
| import java.nio.file.Path | ||
| import java.nio.file.Paths | ||
| import java.nio.file.LinkOption | ||
|
|
||
| // the path where the project got generated | ||
| Path projectPath = Paths.get(request.outputDirectory, request.artifactId) | ||
|
|
||
| // the properties available to the archetype | ||
| Properties properties = request.properties | ||
| String batch = properties.get("batch") | ||
|
|
||
| if (batch != "batch") { | ||
| // delete folder batch recursively | ||
| Path rootPath = projectPath.resolve("batch") | ||
| deleteDirectoryRecursion(rootPath) | ||
| } | ||
|
|
||
| void deleteDirectoryRecursion(Path path) { | ||
| if (Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS)) { | ||
| try { | ||
| for (Path entry : Files.newDirectoryStream(path)) { | ||
| deleteDirectoryRecursion(entry); | ||
| } | ||
| } catch(IOException e) { | ||
| e.printStackTrace() | ||
| } | ||
| } | ||
| Files.delete(path); | ||
| } | ||
| import java.nio.file.Files | ||
| import java.nio.file.Path | ||
| import java.nio.file.Paths | ||
| import java.nio.file.LinkOption | ||
|
|
||
| // the path where the project got generated | ||
| Path projectPath = Paths.get(request.outputDirectory, request.artifactId) | ||
|
|
||
| // the properties available to the archetype | ||
| Properties properties = request.properties | ||
|
|
||
| String batch = properties.get("batch") | ||
|
|
||
| if (batch != "batch") { | ||
| // delete folder batch recursively | ||
| Path rootPath = projectPath.resolve("batch") | ||
| deleteDirectoryRecursion(rootPath) | ||
| } | ||
|
|
||
| //dbMigration is either flyway or liquibase | ||
| String dbMigration = properties.get("dbMigration") | ||
|
|
||
| if (dbMigration == "flyway") { | ||
| //delete changelog and testchangelog folder which is not required for flyway | ||
| Path rootPath = projectPath.resolve("core/src/main/resources/db/changelog") | ||
| deleteDirectoryRecursion(rootPath) | ||
|
|
||
| Files.deleteIfExists projectPath.resolve("core/src/test/resources/db/test/changelog-master.xml") | ||
| Files.deleteIfExists projectPath.resolve("core/src/test/resources/db/test/changelog-v1.0.xml") | ||
|
|
||
| } else if(dbMigration == "liquibase") { | ||
| //delete migration and test folder which is not required for liquibase | ||
| Path rootPath = projectPath.resolve("core/src/main/resources/db/migration") | ||
| deleteDirectoryRecursion(rootPath) | ||
|
|
||
| Files.deleteIfExists projectPath.resolve("core/src/test/resources/db/test/V0001__InitDb.sql") | ||
|
|
||
| } | ||
|
|
||
| void deleteDirectoryRecursion(Path path) { | ||
| if (Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS)) { | ||
| try { | ||
| for (Path entry : Files.newDirectoryStream(path)) { | ||
| deleteDirectoryRecursion(entry); | ||
| } | ||
| } catch(IOException e) { | ||
| e.printStackTrace() | ||
| } | ||
| } | ||
| Files.delete(path); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.