Skip to content

Commit

Permalink
Initial Version of DB scripts tests with Testcontainer. (#3)
Browse files Browse the repository at this point in the history
- unifies the README formatting a bit more.
- includes a GitHub verify workflow in maven-verify.yml
- rebased on top of dependabot changes

Co-authored-by: Bernd Eckenfels <[email protected]>
  • Loading branch information
ecki and Bernd Eckenfels authored Oct 17, 2023
1 parent fd95263 commit ad1ce16
Show file tree
Hide file tree
Showing 15 changed files with 971 additions and 36 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

name: Java CI with Maven
name: "Verify Resources (java-maven CI)"

on:
push:
Expand All @@ -10,12 +10,13 @@ on:
branches: [ "main" ]

jobs:
build:
verify:

runs-on: ubuntu-latest

steps:
- name: Check our Repository

- name: Check out Repository
uses: actions/checkout@v4

- name: Set up JDK 21
Expand All @@ -24,9 +25,12 @@ jobs:
java-version: '21'
distribution: 'zulu'
cache: maven
- name: Build with Maven
run: cd tests/ && mvn -B -npr verify

- name: Run Maven (verify)
run: cd tests/ && mvn -B -V -ntp -e verify

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@c5ad0fd6b977364190852883b46728f25a9617c3
with:
directory: tests/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Official resources for SEEBURGER BIS 6.7 customers.
Official resources for *SEEBURGER BIS 6.7* customers.

## Subdirectories

* [`installation`](installation/) - scripts and templates mentioned in the *SEEBURGER BIS6 Installation Manual* and the *BIS6 System Database Manual*.
* [`installation`](installation/) - scripts and templates mentioned in the **SEEBURGER BIS6 Installation Manual** and the **BIS6 System Database Manual**.
* [`tests`](tests/) - Maven/Java project used to test some of the resources in this repository.
* [`.github/`](.github/) - CI automation control files for GitHub repository hosting.

## Project Download and Usage

Expand All @@ -12,8 +14,11 @@ You can either copy the file content in your Browser. For this it is recommended

If you need multiple files and want to keep track of changes, we recommend to use a `git` command line client and clone the project to your local project directory. You can visit the [Github Getting Started](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories) section, if you are new to Git.

If you do not want to deal with Git, Github also offers you a **Download ZIP** option on the same menu. Make sure to check for updated files regularly.
If you do not want to deal with Git source control, Github also offers you
a **Download ZIP** option on the same menu. Make sure to check for updated
files regularly.

## Contact

Customers with a valid maintenance contract can post inquiries via the SEEBURGER Service Desk (SSD).
Customers with a valid maintenance contract can post inquiries via
the SEEBURGER Service Desk (SSD).
3 changes: 2 additions & 1 deletion installation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Respources (scripts, templates) provided for installing *SEEBURGER BIS 6.7* soft

## See also

See the *SEEBURGER BIS6 Installation Manual* for an overview of the installation procedure.
See the **SEEBURGER BIS6 Installation Manual** for an overview of
the installation procedure.
18 changes: 10 additions & 8 deletions installation/systemdatabase/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
Sample scripts and templates for setting up the system database of a SEEBURGER BIS 6.7 installation.
Sample scripts and templates for setting up the system database of a *SEEBURGER BIS 6.7* installation.

## Subdirectories

Find the DB specific scripts in the following sub directories.

* [`mssql`](mssql/) - scripts for MS SQL Server as well as Azure SQL Database
* [`oracle`](oracle/) - scripts for Oracle Database
* [`postgresql`](postgresql/) - scripts for PostgreSQL database system
* [`mssql`](mssql/) - scripts for *MS SQL Server* as well as *Azure SQL Database*.
* [`oracle`](oracle/) - scripts for *Oracle Database*.
* [`postgresql`](postgresql/) - scripts for *PostgreSQL* database system.

## See Also

To understand how to execute the scripts and what parameters need adjustments, please
consult the *SEEBURGER BIS6 System Database Manual* before executing the scripts.
To understand how to execute the scripts and what parameters need adjustments,
please consult the *SEEBURGER BIS6 System Database Manual* before executing
the scripts.

The scripts are only valid for the latest release, make sure the `Revision:` date in the header
matches the date printed in the corresponding System Database manual revision.
The scripts are only valid for the latest release, make sure the `Revision:`
date in the header matches the date printed in the corresponding System
Database Manual revision.
16 changes: 8 additions & 8 deletions installation/systemdatabase/mssql/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
MS SQL Server based System Database for SEEBURGER BIS6
*MS SQL Server* based system database for *SEEBURGER BIS6*.

## See Also

This directory contains the resources mentioned in the
**System Database Manual** for **SEEBURGER BIS6** with templates
and samples to create a system database for a SEEBURGER
BIS 6.7 installation.
**BIS6 System Database Manual** with templates
and samples to create a system database for a *SEEBURGER
BIS 6.7* installation.

Please see the manual for explanation, caveats and usage
description. Make sure to understand and adjust the statements
Expand All @@ -17,10 +17,10 @@ The scripts are generally compatible with the `sqlcmd` client.

### Microsoft SQL Server

* `create-database.sql` - create a empty application database
* `create-user.sql` - create sample database user for application
* `create-database.sql` - create a empty application database.
* `create-user.sql` - create sample database user for application.

### Microsoft Azure SQL Database

* `create-database-azure.sql` - create a empty application database for Azure SQL Database
* `create-users-azure.sql` - create sample users for application for Azure SQL Database
* `create-database-azure.sql` - create a empty application database for Azure SQL Database.
* `create-users-azure.sql` - create sample users for application for Azure SQL Database.
9 changes: 4 additions & 5 deletions installation/systemdatabase/oracle/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Oracle based System Database for SEEBURGER BIS6
Oracle based system database for *SEEBURGER BIS6*.

## See Also

This directory contains the resources mentioned in the
**System Database Manual** for **SEEBURGER BIS6** with templates
and samples to create a system database for a SEEBURGER
BIS 6.7 installation.
**BIS6 System Database Manual** with templates
and samples to create a system database for a *SEEBURGER
BIS 6.7* installation.

Please see the manual for explanation, caveats and usage
description. Make sure to understand and adjust the statements
Expand All @@ -20,4 +20,3 @@ The scripts are generally compatible with the `sqlplus` client.
* `create-schema.sql` - create empty schema SEEASDB0 for application.
* `create-user.sql` - create sample runtime user SEERUN0 for application.
* `grant-runtime-user.sql` - optional assign schema permissions for runtime user.

10 changes: 5 additions & 5 deletions installation/systemdatabase/postgresql/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PostgreSQL based System Database for SEEBURGER BIS6
*PostgreSQL* based system database for *SEEBURGER BIS6*.

## See Also

This directory contains the resources mentioned in the
*System Database Manual* for *SEEBURGER BIS6* with templates
and samples to create a system database for a SEEBURGER
BIS 6.7 installation.
**BIS6 System Database Manual** with templates
and samples to create a system database for a *SEEBURGER
BIS 6.7* installation.

Please see the manual for explanation, caveats and usage
description. Make sure to understand and adjust the statements
Expand All @@ -15,4 +15,4 @@ before executing them against your database.

The scripts are generally compatible with the `psql` client.

* seetst-ddsl.sql - database, role and schema create template.
* seetst-ddl.sql - database, role and schema create template.
3 changes: 3 additions & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode/
target/
.project
25 changes: 25 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Maven/Java project used to test some of the resources in this repository.

## Files

* `pom.xml` - The Maven Project Model build file to run the tests.
* `OracleTests.java` - Tests `../installation/systemdatabase/oracle/*.sql`.
* `PostgresTests.java` - Tests `../installation/systemdatabase/postgresql/seetst-ddl.sql`.
* `MSSQLServerTests.java` - Tests non Azure `../installation/systemdatabase/mssql/*.sql`.

## Prerequisite

This requires JDK 17, a running Docker environment and Maven 3.8 or 3.9.x on the path.

## Run Tests

This is usually executed as a Github Integration test, see `/.github/workflows/maven-verify.yml`.

To manually execute the tests, use:

```
cd tests
mvn verify
```

Special thanks to the https://java.testcontainer.org project.
131 changes: 131 additions & 0 deletions tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.seeburger.doc.bis6resoures</groupId>
<artifactId>bis6resources-tests</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Testing bis6-resources (installation scripts) with Testcontainers.</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
<!-- Required as long as OraceFreeContainer is not in testcontainers-java -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
<scope>test</scope>
</dependency>
<!-- testcontainer/docker has conflicting versions -->
<dependency>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
<version>1.7.36</version>
<scope>test</scope>
</dependency>
<!-- make slf4j not complain (configure: -Dorg.slf4j.simpleLogger.defaultLogLevel=info) -->
<dependency>
<artifactId>slf4j-simple</artifactId>
<groupId>org.slf4j</groupId>
<version>1.7.36</version>
<scope>test</scope>
</dependency>

<!-- testcontainer modules for testing various RDBMS -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.19.1</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId>
<version>1.19.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.19.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mssqlserver</artifactId>
<version>1.19.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.1</version>
<scope>test</scope>
</dependency>

<!-- JDBC drivers for testing -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>23.3.0.23.09</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.4.1.jre11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<!-- since Gitub default Maven is 3.8 we need a compiler who knows release -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<!-- since Gitub default Maven is 3.8 we need a surefire who detects test -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<inceptionYear>2023</inceptionYear>
<organization>
<name>SEEBURGER AG, Germany</name>
<url>https://github.com/seeburger-ag/</url>
</organization>
<licenses>
<license>
<name>MIT License</name>
<url>https://spdx.org/licenses/MIT.html</url>
<comments>Applies to OracleFreeContainer.java</comments>
</license>
<license>
<name>ASL-2.0</name>
<comments>Applies to files in tests/ directory</comments>
<url>https://spdx.org/licenses/Apache-2.0.html</url>
</license>
<license>
<name>SEEBURGER Proprietary</name>
<distribution>manual</distribution>
<comments>See /LICENSE.txt</comments>
<url>/LICENSE.txt</url>
</license>
</licenses>
</project>
Loading

0 comments on commit ad1ce16

Please sign in to comment.