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

Feature/liquibase configuration #340

Draft
wants to merge 65 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0bc6d9f
devon4j mannual correction
dixyushi Dec 1, 2020
2f66b73
fixed casesc -> cases
hohwille Dec 4, 2020
31b8375
Merge branch 'develop' into develop
hohwille Dec 4, 2020
50ec86c
Merge remote-tracking branch 'upstream/master' into master
dixyushi Jan 27, 2021
899e978
changed configuration of flyway into liquibase
dixyushi Feb 5, 2021
7023dc6
added both flyway and liquibase configuration
dixyushi Feb 15, 2021
27adf36
Merge remote-tracking branch 'upstream/master' into master
Mar 26, 2021
805b5ea
Merge remote-tracking branch 'upstream/master' into master
Apr 7, 2021
2005578
Merge remote-tracking branch 'upstream/master' into master
Apr 8, 2021
94b38ab
Merge branch 'master' of https://github.com/dixyushi/devon4j into master
Apr 8, 2021
c2ba0aa
Merge remote-tracking branch 'upstream/master' into master
Apr 12, 2021
1c9b7f8
resolved testcleanerplugin issue
Apr 12, 2021
2a797ae
resolved conflicts
Apr 13, 2021
af85a10
Merge remote-tracking branch 'upstream/master' into master
Apr 13, 2021
96ce077
Merge branch 'master' into feature/liquibase-configuration
dixyushi Apr 14, 2021
32ba73d
Merge branch 'master' into feature/liquibase-configuration
hohwille Apr 16, 2021
b461dfb
added conditions for dbMigration in testDBConfig
Apr 20, 2021
2f14c02
merged conflicts solved
May 11, 2021
13de274
Merge remote-tracking branch 'upstream/master' into master
May 11, 2021
8f704fd
All required configurations and changes are done to implement
May 19, 2021
42ad82e
Merge branch 'master' into feature/liquibase-configuration
dixyushi May 19, 2021
db79005
fixed review comments
May 20, 2021
163ebe9
Merge branch 'feature/liquibase-configuration' of https://github.com/…
May 20, 2021
cae564a
Update pom.xml
dixyushi May 20, 2021
e49273e
fixed the existing error of SpringBatchIntegrationTes file
May 20, 2021
6e2eb69
fixed merged conflicts
May 20, 2021
b2f1dd8
Code after review comments implementation
May 21, 2021
ee7f6a5
Update TestWebSecurityConfig.java
dixyushi May 21, 2021
d2d0e0e
fixed review comments
May 24, 2021
80641d8
Implemented review comments
May 31, 2021
7610cb1
fixed indendation
hohwille May 31, 2021
cd8291b
fixed indendation
hohwille May 31, 2021
a6d3fea
Merge branch 'devonfw:master' into master
dixyushi Jun 1, 2021
47ef2ec
Merge branch 'master' into feature/liquibase-configuration
Jun 2, 2021
5afd20a
handled DatabaseException
Jun 2, 2021
ea8dd24
fixed merge conflicts
Jun 2, 2021
9e0f3fa
changed configuration of flyway into liquibase
dixyushi Feb 5, 2021
a46fad1
added both flyway and liquibase configuration
dixyushi Feb 15, 2021
77f0161
resolved testcleanerplugin issue
Apr 12, 2021
49a7d71
resolved conflicts
Apr 13, 2021
50c91ae
added conditions for dbMigration in testDBConfig
Apr 20, 2021
8233899
All required configurations and changes are done to implement
May 19, 2021
3b9d0ea
fixed review comments
May 20, 2021
9a4b7a1
fixed the existing error of SpringBatchIntegrationTes file
May 20, 2021
c17e4f3
Update pom.xml
dixyushi May 20, 2021
89c23b8
Update TestWebSecurityConfig.java
dixyushi May 21, 2021
4042d7a
fixed review comments
May 24, 2021
246a4d7
Implemented review comments
May 31, 2021
8bfb77f
handled DatabaseException
Jun 2, 2021
2f6f5fe
fixed merging conflicts
Jun 2, 2021
7014b49
resolved syncing issue with master
Jun 2, 2021
679b970
removed commented code
dixyushi Jun 2, 2021
f850517
Cleared the formatting
dixyushi Jun 2, 2021
6c39c54
Cleared the formatting
dixyushi Jun 2, 2021
3d50fe3
removed EAR as a key and cleared the formatting
Jun 2, 2021
9ba5ef5
Merge branch 'feature/liquibase-configuration' of https://github.com/…
Jun 2, 2021
4540198
modified Groovy scripts
Jun 3, 2021
b29c704
removed commented code from Groovy
Jun 4, 2021
dc54073
rearranged as per review comment
dixyushi Jun 4, 2021
dabd4c8
after rethrowing the error-fixed error handling
Jun 7, 2021
bab5a5f
fixed runtime exception and Added proper injects
Jun 8, 2021
e00c2e7
review comment-minor change on Qualifier implemented
Jun 10, 2021
5ef5923
Fixed Liquibase bean configuration Issue
Jun 14, 2021
ee9318b
removed DbTest which is not required
Jun 14, 2021
06ea818
Merge branch 'master' into feature/liquibase-configuration
hohwille Jun 18, 2021
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
6 changes: 6 additions & 0 deletions modules/test-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import javax.inject.Inject;

import org.flywaydb.core.Flyway;
import org.springframework.beans.factory.annotation.Qualifier;

/**
* Implementation of {@link TestCleanerPlugin} base on {@link Flyway}. It will {@link Flyway#clean() clean} and
* {@link Flyway#migrate() migrate} on {@link #cleanup()}. Therefore after {@link #cleanup()} only DDL and master-data
* will be left in the database.
*/
@Qualifier("testCleanerPluginflyway")
public class TestCleanerPluginFlyway implements TestCleanerPlugin {

@Inject
Expand Down
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.
*/
hohwille marked this conversation as resolved.
Show resolved Hide resolved
@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);
}
}

}
1 change: 1 addition & 0 deletions modules/test/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<!-- Minimize infrastructure debug logs -->
<logger name="com.github.dozermapper" level="INFO"/>
<logger name="org.flywaydb" level="INFO"/>
<logger name="liquibase.Liquibase" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="org.hibernate" level="INFO"/>
<logger name="kafka" level="WARN"/>
Expand Down
134 changes: 67 additions & 67 deletions pom.xml
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>
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current pom.xml has linux EOL style:

cat -ben pom.xml
     1	<?xml version="1.0" encoding="UTF-8"?>$
     2	<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"$
     3	  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">$
     4	  <modelVersion>4.0.0</modelVersion>$
....

Yours has windows encoding. Maybe something with your git setup or the editor you are using to edit XML files.

cat -ben pom.xml.ayushi
     1	<?xml version="1.0" encoding="UTF-8"?>^M$
     2	<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^M$
     3	  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">^M$
     4	  <modelVersion>4.0.0</modelVersion>^M$
...

We once had such changes that added a Byte-Order-Mark to a pom.xml that was not easily visible in the diff but broke the release as maven pull-parser can not handle BOM. That is why am a little picky about such things.

38 changes: 19 additions & 19 deletions templates/pom.xml
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"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here? No change at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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>
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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);
}
Loading