Skip to content

Commit

Permalink
feat: upgraded versions, spring 2.7 compatibility jdk 17 and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
melistik committed Aug 6, 2024
1 parent ade0a22 commit 677fd3a
Show file tree
Hide file tree
Showing 25 changed files with 182 additions and 41 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/boot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: spring-boot-compatibility
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
spring-boot: [ '2.5.14', '2.6.12', '2.7.9' ]
name: Spring Boot ${{ matrix.spring-boot }}
steps:
- uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'

- name: Run Spring Boot tests
run: mvn -B -Dspring-boot.version=${{ matrix.spring-boot }} -PspringBootDevelopment clean test --file pom.xml
env:
TZ: UTC
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: build
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11', '17', '19' ]
name: Temurin ${{ matrix.java }}
steps:
- uses: actions/checkout@v3

- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'

- name: Run all tests
run: mvn -B clean test
env:
TZ: UTC
50 changes: 50 additions & 0 deletions .github/workflows/release-to-maven-central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: release-to-maven-central
on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
default: '1.0.0'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- run: |
echo "Release version ${{ github.event.inputs.releaseversion }}!"
- uses: actions/checkout@v2

- name: Set up Maven Central Repository
uses: actions/setup-java@v1
with:
java-version: 11
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Set projects Maven version to GitHub Action GUI set version
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}"

- name: Publish package
run: mvn --batch-mode clean deploy -P release -DskipTests=true
env:
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.releaseversion }}
release_name: ${{ github.event.inputs.releaseversion }}
body: |
New version ${{ github.event.inputs.releaseversion }} published
draft: false
prerelease: false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.rocketbase.commons.config.AuthAdapterAutoConfiguration
4 changes: 2 additions & 2 deletions commons-auth-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ SOFTWARE.
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.2.3</version>
<version>4.8.6</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.9</version>
<version>2.2.22</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public <T> T getClaimFromToken(String token, Function<Claims, T> claimsResolver)
private Claims getAllClaimsFromToken(String token) {
return Jwts.parser()
.setSigningKey(jwtProperties.getSecret())
.build()
.parseClaimsJws(token)
.getBody();
}
Expand Down
4 changes: 0 additions & 4 deletions commons-auth-email-postmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

<artifactId>commons-auth-email-postmark</artifactId>

<properties>
<postmark-spring.version>0.0.1</postmark-spring.version>
</properties>

<dependencies>
<dependency>
<groupId>io.rocketbase.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.rocketbase.commons.config.AuthEmailPostmarkAutoConfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.rocketbase.commons.config.AuthEmailSmtpAutoConfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.rocketbase.commons.config.AuthFormAutoConfiguration
2 changes: 1 addition & 1 deletion commons-auth-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ SOFTWARE.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.27.Final</version>
<version>5.6.15.Final</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.rocketbase.commons.config.AuthJpaAutoConfiguration
3 changes: 3 additions & 0 deletions commons-auth-jpa/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ spring:
username: sa
password: sa

main:
allow-circular-references: true

hibernate:
dialect: org.hibernate.dialect.H2Dialect
hbm2ddl:
Expand Down
17 changes: 15 additions & 2 deletions commons-auth-mongo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,21 @@ SOFTWARE.
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mongodb</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.rocketbase.commons.config.AuthMongoAutoConfiguration
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package io.rocketbase.commons.service;

import com.google.common.collect.ImmutableMap;
import io.rocketbase.commons.Application;
import io.rocketbase.commons.dto.appinvite.QueryAppInvite;
import io.rocketbase.commons.model.AppInviteMongoEntity;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.time.Instant;
Expand All @@ -24,10 +19,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
public class AppInviteMongoServiceImplTest {
public class AppInviteMongoServiceImplTest extends BaseIntegrationTest {

@Resource
private AppInvitePersistenceService<AppInviteMongoEntity> service;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package io.rocketbase.commons.service;

import com.google.common.collect.ImmutableMap;
import io.rocketbase.commons.Application;
import io.rocketbase.commons.dto.appuser.QueryAppUser;
import io.rocketbase.commons.model.AppUserMongoEntity;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.Arrays;
Expand All @@ -21,11 +16,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;


@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
public class AppUserMongoServiceImplTest {
public class AppUserMongoServiceImplTest extends BaseIntegrationTest {

@Resource
private AppUserPersistenceService<AppUserMongoEntity> service;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.rocketbase.commons.service;

import io.rocketbase.commons.Application;
import lombok.extern.slf4j.Slf4j;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import org.testcontainers.containers.MongoDBContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;


@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
@Testcontainers
public abstract class BaseIntegrationTest {
@Container
protected static final MongoDBContainer mongoDBContainer = new MongoDBContainer(DockerImageName.parse("mongo:4"));

@DynamicPropertySource
static void initTestContainerProperties(DynamicPropertyRegistry registry) {
mongoDBContainer.start();
log.info("Setting spring.data.mongodb.uri = {}", mongoDBContainer.getReplicaSetUrl());
registry.add("spring.data.mongodb.uri", mongoDBContainer::getReplicaSetUrl);
}
}
3 changes: 3 additions & 0 deletions commons-auth-mongo/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spring:
main:
allow-circular-references: true
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.rocketbase.commons.config.AuthServerAutoConfiguration
3 changes: 3 additions & 0 deletions commons-auth-server/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ spring:
starttls: true
test-connection: false

main:
allow-circular-references: true

logging:
level:
io.rocketbase: TRACE
Expand Down
4 changes: 0 additions & 4 deletions commons-auth-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

<artifactId>commons-auth-service</artifactId>

<properties>
<simple-java-mail.version>6.4.0</simple-java-mail.version>
</properties>

<dependencies>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
io.rocketbase.commons.config.AuthServiceAutoConfiguration
io.rocketbase.commons.config.AuthApiAutoConfiguration
3 changes: 3 additions & 0 deletions commons-auth-service/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ spring:
starttls: true
test-connection: false

main:
allow-circular-references: true

logging:
level:
io.rocketbase: TRACE
Expand Down
23 changes: 14 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,21 @@ SOFTWARE.

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<spring-boot.version>2.5.9</spring-boot.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<spring-boot.version>2.7.18</spring-boot.version>
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
<commons-rest.version>2.2.4</commons-rest.version>
<jjwt.version>0.11.2</jjwt.version>
<guava.version>30.1.1-jre</guava.version>
<passay.version>1.6.0</passay.version>
<email-template-builder.version>2.2.0</email-template-builder.version>
<jacoco.version>0.8.7</jacoco.version>
<commons-rest.version>2.5.4</commons-rest.version>
<jjwt.version>0.12.6</jjwt.version>
<guava.version>33.2.1-jre</guava.version>
<passay.version>1.6.4</passay.version>
<email-template-builder.version>2.4.0</email-template-builder.version>
<jacoco.version>0.8.12</jacoco.version>

<postmark-spring.version>0.2.0</postmark-spring.version>
<simple-java-mail.version>6.7.0</simple-java-mail.version>

<testcontainers.version>1.20.1</testcontainers.version>
</properties>

<dependencyManagement>
Expand Down

0 comments on commit 677fd3a

Please sign in to comment.