-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c37c3b
commit 61bab85
Showing
451 changed files
with
84,312 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "maven" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" | ||
ignore: | ||
- dependency-name: "*" | ||
update-types: ["version-update:semver-major"] | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
# Check for updates to GitHub Actions every week | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Build and push | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: [ '21' ] | ||
|
||
steps: | ||
# Install the migration tool in the local repo | ||
- name: Checkout Migration Tool | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
repository: ehrbase/migration-tool | ||
ref: develop | ||
# This will be used by git in all further steps | ||
# We need a PERSONAL ACCESS TOKEN so pushes trigger other github actions | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ matrix.java }} | ||
cache: 'maven' | ||
|
||
- name: Install Migration Tool | ||
run: mvn install | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Login to GitLab | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ matrix.java }} | ||
cache: 'maven' | ||
- name: Spotless | ||
run: mvn spotless:check | ||
- name: install migration tool main | ||
run: mvn install -Dmaven.test.skip=true | ||
|
||
|
||
- name: Build with Maven | ||
run: mvn clean verify spring-boot:build-image | ||
|
||
- name: Build and push | ||
if: ${{ github.ref == 'ref/head/develop' }} || ${{ github.ref == 'ref/head/master' }} || ${{ github.ref == 'ref/head/main' }} | ||
run: | | ||
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
docker push ehrbase/migration-tool:${VERSION} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.2.5</version> | ||
<relativePath/> | ||
</parent> | ||
|
||
<groupId>org.ehrbase.migration</groupId> | ||
<artifactId>migration-application</artifactId> | ||
<version>1.1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>EHRbase Migration Tool Application</name> | ||
|
||
<properties> | ||
<image.name>dockerhub.io/ehrbase/migration-tool</image.name> | ||
<image.tag>${project.version}</image.tag> | ||
<maven.compiler.source>21</maven.compiler.source> | ||
<maven.compiler.target>21</maven.compiler.target> | ||
<java.version>21</java.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.ehrbase.migration</groupId> | ||
<artifactId>migration-bom</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.ehrbase.migration</groupId> | ||
<artifactId>migration-service</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wiremock</groupId> | ||
<artifactId>wiremock</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.jsonwebtoken</groupId> | ||
<artifactId>jjwt-impl</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.jsonwebtoken</groupId> | ||
<artifactId>jjwt-jackson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mock-server</groupId> | ||
<artifactId>mockserver-junit-jupiter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.nimbusds</groupId> | ||
<artifactId>nimbus-jose-jwt</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>migration-tool</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<compilerArgs> | ||
<arg>-parameters</arg> | ||
</compilerArgs> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.diffplug.spotless</groupId> | ||
<artifactId>spotless-maven-plugin</artifactId> | ||
<version>2.43.0</version> | ||
<configuration> | ||
<java> | ||
<toggleOffOn> | ||
<off>@format:off</off> | ||
<on>@format:on</on> | ||
</toggleOffOn> | ||
<palantirJavaFormat> | ||
<version>2.40.0</version> | ||
</palantirJavaFormat> | ||
<licenseHeader> | ||
<file>../spotless-lic-header</file> | ||
</licenseHeader> | ||
</java> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<mainClass>org.ehrbase.migration.application.MigrationTool</mainClass> | ||
<image> | ||
<name>${image.name}:${image.tag}</name> | ||
<env> | ||
<BP_DEBUG_ENABLED>true</BP_DEBUG_ENABLED> | ||
</env> | ||
</image> | ||
<skip>false</skip> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>0.8.12</version> | ||
<executions> | ||
<!-- SET ARG LINE PROPERTY FOR SUREFIRE --> | ||
<execution> | ||
<id>agent for unit tests</id> | ||
<goals> | ||
<goal>prepare-agent</goal> | ||
</goals> | ||
<configuration> | ||
<propertyName>surefireArgLine</propertyName> | ||
</configuration> | ||
</execution> | ||
<!-- SET ARG LINE PROPERTY FOR FAILSAFE --> | ||
<execution> | ||
<id>agent for integration tests</id> | ||
<goals> | ||
<goal>prepare-agent-integration</goal> | ||
</goals> | ||
<configuration> | ||
<propertyName>failsafeArgLine</propertyName> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<!-- SETS THE VM ARGUMENT LINE USED WHEN UNIT TESTS ARE RUN. --> | ||
<argLine>@{surefireArgLine}</argLine> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>test</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>integration-test</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<!-- SETS THE VM ARGUMENT LINE USED WHEN INTEGRATION TESTS ARE RUN. --> | ||
<argLine>@{failsafeArgLine}</argLine> | ||
<includes> | ||
<include>**/*IT.java</include> | ||
</includes> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.3.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>test-jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
81 changes: 81 additions & 0 deletions
81
application/src/main/java/org/ehrbase/migration/application/MigrationTool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (c) 2023 vitasystems GmbH | ||
* | ||
* This file is part of project EHRbase Migration Tool | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.ehrbase.migration.application; | ||
|
||
import org.ehrbase.migration.service.ProcessService; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.WebApplicationType; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.builder.SpringApplicationBuilder; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
|
||
@SpringBootApplication(scanBasePackages = "org.ehrbase.migration") | ||
public class MigrationTool implements CommandLineRunner { | ||
|
||
public enum MigrationMode { | ||
DB2DB, | ||
IMPORT, | ||
EXPORT, | ||
NONE | ||
} | ||
|
||
@Value("${mode}") | ||
private MigrationMode mode; | ||
|
||
@Value("${terminate:true}") | ||
private boolean terminate; | ||
|
||
private static Logger LOG = LoggerFactory.getLogger(MigrationTool.class); | ||
|
||
private final ConfigurableApplicationContext context; | ||
|
||
private final ProcessService processService; | ||
|
||
public MigrationTool(ProcessService processService, ConfigurableApplicationContext context) { | ||
this.processService = processService; | ||
this.context = context; | ||
} | ||
|
||
public static void main(String[] args) { | ||
LOG.info("STARTING THE APPLICATION"); | ||
new SpringApplicationBuilder(MigrationTool.class) | ||
.web(WebApplicationType.NONE) | ||
.run(args); | ||
} | ||
|
||
@Override | ||
public void run(String... args) { | ||
|
||
switch (mode) { | ||
case DB2DB -> processService.db2db(); | ||
case IMPORT -> processService.importFromFile(); | ||
case EXPORT -> processService.exportToFile(); | ||
case NONE -> LOG.info("Migration mode NONE: Skipping"); | ||
} | ||
if (terminate) { | ||
LOG.debug("Shutting down"); | ||
int exitCode = SpringApplication.exit(context); | ||
LOG.info("APPLICATION FINISHED"); | ||
System.exit(exitCode); | ||
} | ||
} | ||
} |
Oops, something went wrong.