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

Ssdk 18.0.1 update #283

Merged
merged 18 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 2 additions & 29 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,6 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @Backbase/backend-leadership
* @Backbase/backend-leadership
* @Backbase/befound

# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
# modifies JS files, only @js-owner and not the global
# owner(s) will be requested for a review.
*.js @js-owner

# You can also use email addresses if you prefer. They'll be
# used to look up users just like we do for commit author
# emails.
#*.go [email protected]

# In this example, @doctocat owns any files in the build/logs
# directory at the root of the repository and any of its
# subdirectories.
#/build/logs/ @doctocat

# The `docs/*` pattern will match files like
# `docs/getting-started.md` but not further nested files like
# `docs/build-app/troubleshooting.md`.
#docs/* [email protected]

# In this example, @octocat owns any file in an apps directory
# anywhere in your repository.
#apps/ @octocat

# In this example, @doctocat owns any file in the `/docs`
# directory in the root of your repository.
#/docs/ @doctocat
4 changes: 2 additions & 2 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
java-version: '17'
java-version: '21'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
# restore-keys: |
# ${{ runner.os }}-maven-
- uses: actions/setup-java@v2
name: Set up JDK 17
name: Set up JDK 21
with:
java-version: '17'
java-version: '21'
distribution: 'adopt'
# - name: Set up Apache Maven Central
# uses: actions/setup-java@v2
Expand All @@ -46,7 +46,7 @@ jobs:
name: Build and test project
- run: mkdir staging && cp services/product/target/*.jar staging
name: Move and upload the jar
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: Package
path: staging
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ The following are the initially required software pieces:

2. **Git**: it can be downloaded and installed from https://git-scm.com/downloads.

3. **Java 17 EA**: it can be downloaded and installed from https://jdk.java.net/17/.
3. **Java 21 EA**: it can be downloaded and installed from https://jdk.java.net/21/.

4. **Spring Boot Initializer**: This *Initializer* generates *spring* boot project with just what you need to start quickly! Start from here https://start.spring.io/.

Expand Down
30 changes: 10 additions & 20 deletions TESTCONTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,23 @@ Integrate the container management into the build. Just start the database conta
Use TestContainers and manage the database in your test code.
Let's review this approach more in deep and what steps we need to apply:

#### Add the TestContainers dependency, test scoped

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
#### TestContainers dependency is managed by spring boot

#### Add the database module you want to test, e.g. MySQL, Oracle, MSSQL, MariaDB:

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mssqlserver</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -126,18 +116,18 @@ As long as we have TestContainers and the appropriate JDBC driver on your classp
- For Spring Boot (Before version 2.3.0) you need to specify the driver manually
`spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver`

Original URL: `jdbc:mysql:5.7://somehostname:someport/databasename`
Original URL: `jdbc:mysql:8.0.36://somehostname:someport/databasename`

Insert `tc:` after `jdbc:` as follows. Note that the hostname, port and database name will be ignored; you can leave these as-is or set them to any value.

TestContainers URL with a specific version: `jdbc:tc:mysql:5.7:///databasename`
TestContainers URL with a specific version: `jdbc:tc:mysql:8.0.36:///databasename`

For multiple databases testing we can use different profiles:

# application-mysql.yaml
spring:
datasource:
url: jdbc:tc:mysql:5.7://localhost:3306/dbs
url: jdbc:tc:mysql:8.0.36://localhost:3306/dbs
username: root
password: root
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver
Expand All @@ -155,19 +145,19 @@ For multiple databases testing we can use different profiles:
##### Using a classpath init script
Testcontainers can run an init script after the database container is started, but before your code is given a connection to it. The script must be on the classpath, and is referenced as follows:

`jdbc:tc:mysql:5.7.22:///databasename?TC_INITSCRIPT=somepath/init_mysql.sql`
`jdbc:tc:mysql:8.0.36:///databasename?TC_INITSCRIPT=somepath/init_mysql.sql`

This is useful if you have a fixed script for setting up database schema, etc.

##### Using an init script from a file
If the init script path is prefixed file:, it will be loaded from a file (relative to the working directory, which will usually be the project root).

`jdbc:tc:mysql:5.7.22:///databasename?TC_INITSCRIPT=file:src/main/resources/init_mysql.sql`
`jdbc:tc:mysql:8.0.36:///databasename?TC_INITSCRIPT=file:src/main/resources/init_mysql.sql`

##### Using an init function
Instead of running a fixed script for DB setup, it may be useful to call a Java function that you define. This is intended to allow you to trigger database schema migration tools. To do this, add TC_INITFUNCTION to the URL as follows, passing a full path to the class name and method:

`jdbc:tc:mysql:5.7.22:///databasename?TC_INITFUNCTION=org.testcontainers.jdbc.JDBCDriverTest::sampleInitFunction`
`jdbc:tc:mysql:8.0.36:///databasename?TC_INITFUNCTION=org.testcontainers.jdbc.JDBCDriverTest::sampleInitFunction`

The init function must be a public static method which takes a java.sql.Connection as its only parameter, e.g.

Expand All @@ -180,7 +170,7 @@ The init function must be a public static method which takes a java.sql.Connecti
##### Running container in daemon mode
By default database container is being stopped as soon as last connection is closed. There are cases when you might need to start container and keep it running till you stop it explicitly or JVM is shutdown. To do this, add TC_DAEMON parameter to the URL as follows:

`jdbc:tc:mysql:5.7.22:///databasename?TC_DAEMON=true`
`jdbc:tc:mysql:8.0.36:///databasename?TC_DAEMON=true`

With this parameter database container will keep running even when there're no open connections.

Expand All @@ -202,14 +192,14 @@ More info: https://www.testcontainers.org/modules/databases/jdbc/
For MySQL databases, it is possible to override configuration settings using resources on the classpath.
Assuming `db/mysql_conf_override` is a directory on the classpath containing `.cnf` files, the following URL can be used:

`jdbc:tc:mysql:5.7:///databasename?TC_MY_CNF=db/mysql_conf_override`
`jdbc:tc:mysql:8.0.36:///databasename?TC_MY_CNF=db/mysql_conf_override`

##### Database container objects
In case you can't use the URL support, or need to fine-tune the container, you can instantiate it yourself.
Add a `@Rule` or `@ClassRule` to your test class, e.g.:

@ClassRule
public static MySQLContainer mysqlSQLContainer = new MySQLContainer("mysql:5.7");
public static MySQLContainer mysqlSQLContainer = new MySQLContainer("mysql:8.0");

static class Initializer
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
Expand Down
6 changes: 3 additions & 3 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<parent>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>backbase-openapi-spec-starter-parent</artifactId>
<version>16.0.1</version>
<version>18.0.1</version>
<relativePath/>
</parent>

<groupId>com.backbase.goldensample</groupId>
<artifactId>api</artifactId>
<packaging>pom</packaging>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>

<modules>
<module>product-api</module>
Expand All @@ -24,7 +24,7 @@

<properties>
<frontend-plugin.version>1.12.1</frontend-plugin.version>
<boat-maven-plugin.version>0.17.24</boat-maven-plugin.version>
<boat-maven-plugin.version>0.17.32</boat-maven-plugin.version>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion api/product-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>api</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<name>Backbase :: product-api</name>
Expand Down
2 changes: 1 addition & 1 deletion api/review-service-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>api</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<name>Backbase :: review-service-api</name>
Expand Down
2 changes: 1 addition & 1 deletion api/store-client-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>api</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<name>Backbase :: store-client-api</name>
Expand Down
2 changes: 1 addition & 1 deletion api/store-integration-enricher-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>api</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<name>Backbase :: store-integration-enricher-api</name>
Expand Down
4 changes: 2 additions & 2 deletions charts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>backbase-golden-sample</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>charts</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<name>backbase-golden-sample-chart</name>
<description>Demo project for Backbase Backend Best Practices</description>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>backbase-golden-sample</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>database</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion database/product-db/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>database</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>product-db</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion database/review-db/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>database</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>review-db</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ services:
- "61614:61614"

mysql:
image: mysql:5.7.18
image: mysql:8.0.36
# Set max_allowed_packet to 512M for provisioning
command: --max-allowed-packet=512M --performance-schema=FALSE --transaction-isolation=READ-COMMITTED --init-connect='SET collation_connection=utf8_bin' --init-connect='SET NAMES utf8;' --character-set-server=utf8 --collation-server=utf8_bin --lower-case-table-names=2 --max-connections=500
container_name: demo_mysql
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
<parent>
<artifactId>service-sdk-starter-core</artifactId>
<groupId>com.backbase.buildingblocks</groupId>
<version>16.0.1</version>
<version>18.0.1</version>
<relativePath />
</parent>

<groupId>com.backbase.goldensample</groupId>
<artifactId>backbase-golden-sample</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<name>backbase-golden-example</name>
<description>Demo project for Backbase Backend Best Practices</description>
<packaging>pom</packaging>
Expand Down
14 changes: 3 additions & 11 deletions services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>backbase-golden-sample</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>services</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand All @@ -20,8 +20,7 @@

<properties>
<properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
<testcontainers.version>1.19.1</testcontainers.version>
MalarsriA marked this conversation as resolved.
Show resolved Hide resolved
<boat-maven-plugin.version>0.17.24</boat-maven-plugin.version>
<boat-maven-plugin.version>0.17.32</boat-maven-plugin.version>
<jqno.equalsverifier.version>3.14.1</jqno.equalsverifier.version>
<docker.repo.project>experimental/golden-sample</docker.repo.project>
</properties>
Expand Down Expand Up @@ -54,13 +53,6 @@
<artifactId>mysql-connector-j</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>${testcontainers.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
8 changes: 4 additions & 4 deletions services/product/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>com.backbase.goldensample</groupId>
<artifactId>services</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>product</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Backbase :: product-service</name>

Expand Down Expand Up @@ -113,8 +113,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>bb-activemq-broker</artifactId>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions services/product/src/test/resources/application-m10y.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ backbase:
tenants:
- id: org_shop
datasource:
url: jdbc:tc:mysql:5.7:///testdb1?TC_MY_CNF=db/mysql_conf_override
url: jdbc:tc:mysql:8.0.36:///testdb1?TC_MY_CNF=db/mysql_conf_override
username: test
password: test
- id: rebrand_shop
datasource:
url: jdbc:tc:mysql:5.7:///testdb2?TC_MY_CNF=db/mysql_conf_override
url: jdbc:tc:mysql:8.0.36:///testdb2?TC_MY_CNF=db/mysql_conf_override
username: test
password: test
datasource:
Expand Down
Loading
Loading