-
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 20 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,45 @@ | ||
| package com.devonfw.module.test.common.base.clean; | ||
|
|
||
| import javax.inject.Inject; | ||
| import liquibase.Liquibase; | ||
|
|
||
| /** | ||
| * @author ayudixit | ||
| * | ||
| */ | ||
| public class TestCleanerPluginLiquibase implements TestCleanerPlugin { | ||
|
|
||
| @Inject | ||
| 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 (Exception e) { | ||
| e.printStackTrace(); | ||
|
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. never use
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 change it to rethrow this exception |
||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,67 +1,73 @@ | ||
| <?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" standalone="no"?> | ||
|
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. what has been changed here? |
||
| <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> | ||
| 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> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,10 @@ | |
| <defaultValue>h2</defaultValue> | ||
| <!-- <validationRegex>h2|postgresql|mysql|mariadb|oracle|hana|db2</validationRegex> --> | ||
| </requiredProperty> | ||
| <requiredProperty key="dbMigration"> | ||
| <defaultValue>flyway</defaultValue> | ||
| <!-- <validationRegex>flyway|liquibase</validationRegex> --> | ||
| </requiredProperty> | ||
|
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. remove the commented code. |
||
| <requiredProperty key="batch"> | ||
| <defaultValue>.</defaultValue> | ||
| <validationRegex>batch|[.]</validationRegex> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,73 @@ | ||
| package ${package}.general.batch.base.test; | ||
|
|
||
| import javax.inject.Inject; | ||
|
|
||
| import org.flywaydb.core.Flyway; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.batch.core.Job; | ||
| import org.springframework.batch.core.launch.JobLauncher; | ||
| import org.springframework.batch.test.JobLauncherTestUtils; | ||
|
|
||
| import ${package}.general.common.base.test.TestUtil; | ||
| import com.devonfw.module.test.common.base.ComponentTest; | ||
|
|
||
| /** | ||
| * Base class for all spring batch integration tests. It helps to do End-to-End job tests. | ||
| */ | ||
| public abstract class SpringBatchIntegrationTest extends ComponentTest { | ||
|
|
||
| @Inject | ||
| private JobLauncher jobLauncher; | ||
|
|
||
| @Inject | ||
| private Flyway flyway; | ||
|
|
||
| @Override | ||
| protected void doSetUp() { | ||
|
|
||
| super.doSetUp(); | ||
| this.flyway.clean(); | ||
| this.flyway.migrate(); | ||
| } | ||
|
|
||
| @Override | ||
| protected void doTearDown() { | ||
|
|
||
| super.doTearDown(); | ||
| TestUtil.logout(); | ||
| } | ||
|
|
||
| /** | ||
| * @param job job to configure | ||
| * @return jobLauncherTestUtils | ||
| */ | ||
| public JobLauncherTestUtils getJobLauncherTestUtils(Job job) { | ||
|
|
||
| JobLauncherTestUtils jobLauncherTestUtils = new JobLauncherTestUtils(); | ||
| jobLauncherTestUtils.setJob(job); | ||
| jobLauncherTestUtils.setJobLauncher(this.jobLauncher); | ||
|
|
||
| return jobLauncherTestUtils; | ||
| } | ||
| } | ||
| package ${package}.general.batch.base.test; | ||
|
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. again the diff is not readable. IMHO you have a general problem with your setup of git and are changing all EOLs accidentally. Can you please change and fix this?
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 fix this setup issue and will make it work. |
||
|
|
||
| import javax.inject.Inject; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.batch.core.Job; | ||
| import org.springframework.batch.core.launch.JobLauncher; | ||
| import org.springframework.batch.test.JobLauncherTestUtils; | ||
| import ${package}.general.common.base.test.TestUtil; | ||
| import com.devonfw.module.test.common.base.ComponentTest; | ||
| #if ($dbMigration == 'liquibase') | ||
| import liquibase.Liquibase; | ||
| #else | ||
| import org.flywaydb.core.Flyway; | ||
| #end | ||
|
|
||
|
hohwille marked this conversation as resolved.
|
||
| /** | ||
| * Base class for all spring batch integration tests. It helps to do End-to-End job tests. | ||
| */ | ||
| public abstract class SpringBatchIntegrationTest extends ComponentTest { | ||
|
|
||
| @Inject | ||
| private JobLauncher jobLauncher; | ||
|
|
||
| #if ($dbMigration == 'liquibase') | ||
| @Inject | ||
| private Liquibase liquibase; | ||
| #else | ||
| @Inject | ||
| private Flyway flyway; | ||
| #end | ||
|
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. indendation with velocity is tricky: every whitespace will be written to the output. That is " " before the |
||
|
|
||
| #if ($dbMigration == 'liquibase') | ||
| @Override | ||
| protected void doSetUp() { | ||
| super.doSetUp(); | ||
| try { | ||
| this.liquibase.dropAll(); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
|
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. see |
||
| } | ||
| } | ||
| #else | ||
| @Override | ||
| protected void doSetUp() { | ||
|
|
||
| super.doSetUp(); | ||
| this.flyway.clean(); | ||
| this.flyway.migrate(); | ||
| } | ||
| #end | ||
|
|
||
|
|
||
| @Override | ||
| protected void doTearDown() { | ||
|
|
||
| super.doTearDown(); | ||
| TestUtil.logout(); | ||
| } | ||
|
|
||
| /** | ||
| * @param job job to configure | ||
| * @return jobLauncherTestUtils | ||
| */ | ||
| public JobLauncherTestUtils getJobLauncherTestUtils(Job job) { | ||
|
|
||
| JobLauncherTestUtils jobLauncherTestUtils = new JobLauncherTestUtils(); | ||
| jobLauncherTestUtils.setJob(job); | ||
| jobLauncherTestUtils.setJobLauncher(this.jobLauncher); | ||
|
|
||
| return jobLauncherTestUtils; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.