diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6fe4e73..97853aae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,67 +1,55 @@ -name: Build and deploy +name: Build and publish +on: push -on: [push] jobs: build: - runs-on: ubuntu-latest strategy: matrix: - java: [ '1.8', '11' ] - - name: build java ${{ matrix.java }} + java: [ '8', '11', '17' ] + name: Build on Java ${{ matrix.java }} + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up java - uses: actions/setup-java@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 with: + distribution: temurin java-version: ${{ matrix.java }} + cache: "maven" - name: Build with Maven - run: mvn -B package --no-transfer-progress --file pom.xml + run: mvn -B verify --no-transfer-progress --show-version - makeversion: - if: github.ref != 'refs/heads/main' + + publishing_parameters: needs: build + name: Publishing parameters runs-on: ubuntu-latest - name: Create version outputs: + is_release: ${{ steps.version.outputs.is_release }} version: ${{ steps.version.outputs.version }} steps: - - name: Decide on build version + - name: Determine version id: version run: | if [[ $GITHUB_REF == *"tags"* ]]; then - TAG=${GITHUB_REF#refs/tags/} + is_release=true + version=${GITHUB_REF#refs/tags/} else - TAG=${GITHUB_REF#refs/heads/}-SNAPSHOT + is_release=false + version=${GITHUB_REF#refs/heads/}-SNAPSHOT fi - echo ::set-output name=version::${TAG//\//-} + echo "is_release=${is_release//\//-}" >> $GITHUB_OUTPUT + echo "version=${version//\//-}" >> $GITHUB_OUTPUT - deploy_snapshot: - if: startsWith(github.ref, 'refs/heads/') - needs: makeversion - runs-on: ubuntu-latest - - name: Deploy snapshot - steps: - - uses: actions/checkout@v1 - - uses: digipost/action-maven-publish@1.1.0 - with: - sonatype_secrets: ${{ secrets.sonatype_secrets }} - release_version: ${{ needs.makeversion.outputs.version }} - perform_release: false - release: - if: startsWith(github.ref, 'refs/tags/') + publish: + needs: publishing_parameters + name: Publish ${{ needs.publishing_parameters.outputs.version }} runs-on: ubuntu-latest - needs: makeversion - name: Release to Sonatype steps: - - name: Check out Git repository - uses: actions/checkout@v1 - - name: Release to Central Repository - uses: digipost/action-maven-publish@1.1.0 + - uses: actions/checkout@v3 + - uses: digipost/action-maven-publish@v1 with: sonatype_secrets: ${{ secrets.sonatype_secrets }} - release_version: ${{ needs.makeversion.outputs.version }} - perform_release: true + release_version: ${{ needs.publishing_parameters.outputs.version }} + perform_release: ${{ needs.publishing_parameters.outputs.is_release }} diff --git a/NOTICE b/NOTICE index 50b85d2d..ffe5cf0a 100644 --- a/NOTICE +++ b/NOTICE @@ -12,22 +12,21 @@ specific language governing permissions and limitations under the License. This project includes: + Bean Validation API under Apache License 2.0 ClassMate under The Apache Software License, Version 2.0 Digipost Data Types under The Apache Software License, Version 2.0 - Extended StAX API under Eclipse Distribution License - v 1.0 - fastinfoset under Apache License, Version 2.0 or Eclipse Distribution License - v 1.0 + Digipost JAXB Resolver - com.sun.xml.bind under The Apache Software License, Version 2.0 + Expression Language 3.0 API under CDDL + GPLv2 with classpath exception Hibernate Validator Engine under Apache License 2.0 - istack common utility code runtime under Eclipse Distribution License - v 1.0 Jackson datatype: JSR310 under The Apache Software License, Version 2.0 Jackson-annotations under The Apache Software License, Version 2.0 Jackson-core under The Apache Software License, Version 2.0 jackson-databind under The Apache Software License, Version 2.0 - Jakarta Bean Validation API under Apache License 2.0 - Jakarta Expression Language 3.0 under EPL 2.0 or GPL2 w/ CPE - jakarta.xml.bind-api under Eclipse Distribution License - v 1.0 - JavaBeans Activation Framework API jar under EDL 1.0 - JAXB Runtime under Eclipse Distribution License - v 1.0 + Jakarta Expression Language 3.0 Implementation under EPL 2.0 or GPL2 w/ CPE + JavaBeans Activation Framework API jar under CDDL/GPLv2+CE + jaxb-api under CDDL 1.1 or GPL2 w/ CPE JBoss Logging 3 under Apache License, version 2.0 + Old JAXB Core under CDDL+GPL License + Old JAXB Runtime under Eclipse Distribution License - v 1.0 Project Lombok under The MIT License - TXW2 Runtime under Eclipse Distribution License - v 1.0 diff --git a/pom.xml b/pom.xml index 51453a81..15a06bca 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,13 @@ + + no.digipost + jaxb-resolver-com.sun.xml.bind-bom + 1.0 + pom + import + com.fasterxml.jackson jackson-bom @@ -41,7 +48,7 @@ org.projectlombok lombok - 1.18.10 + 1.18.20 provided @@ -61,37 +68,50 @@ jackson-core - jakarta.validation - jakarta.validation-api - 2.0.2 + javax.validation + validation-api + 2.0.1.Final org.hibernate.validator hibernate-validator 6.1.5.Final runtime + true - javax.validation - validation-api + jakarta.validation + jakarta.validation-api - org.glassfish - jakarta.el + com.sun.el + el-ri 3.0.4 runtime + true + + + jakarta.el + jakarta.el-api + + + + + javax.el + javax.el-api + 3.0.0 + runtime + true - jakarta.xml.bind - jakarta.xml.bind-api - 2.3.2 + javax.xml.bind + jaxb-api - org.glassfish.jaxb - jaxb-runtime - 2.3.2 + no.digipost + jaxb-resolver-com.sun.xml.bind runtime @@ -128,6 +148,18 @@ + + org.slf4j + slf4j-simple + 2.0.7 + test + + + no.digipost + jul-to-slf4j-junit-extension + 1.0 + test + @@ -142,27 +174,29 @@ maven-clean-plugin - 3.1.0 + 3.2.0 maven-resources-plugin - 3.1.0 + 3.3.1 maven-compiler-plugin - 3.8.1 + 3.11.0 + + true + maven-enforcer-plugin - 3.0.0-M2 + 3.3.0 - 3.3.1 + 3.6.3 - javax.* org.hamcrest:hamcrest-core @@ -171,33 +205,33 @@ maven-surefire-plugin - 3.0.0-M3 + 3.0.0 maven-dependency-plugin - 3.1.1 + 3.5.0 maven-jar-plugin - 3.1.2 + 3.3.0 maven-install-plugin - 3.0.0-M1 + 3.1.1 maven-deploy-plugin - 3.0.0-M1 + 3.1.1 org.codehaus.mojo versions-maven-plugin - 2.7 + 2.15.0 org.codehaus.mojo exec-maven-plugin - 1.6.0 + 3.1.0 com.github.siom79.japicmp @@ -222,7 +256,7 @@ org.projectlombok lombok-maven-plugin - 1.18.10.0 + 1.18.20.0 generate-sources diff --git a/src/main/java/no/digipost/api/datatypes/marshalling/DataTypesJsonMapper.java b/src/main/java/no/digipost/api/datatypes/marshalling/DataTypesJsonMapper.java index b2925220..16da1ca8 100644 --- a/src/main/java/no/digipost/api/datatypes/marshalling/DataTypesJsonMapper.java +++ b/src/main/java/no/digipost/api/datatypes/marshalling/DataTypesJsonMapper.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; @@ -16,7 +16,7 @@ private static ObjectMapper initMapper() { mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.setPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CAMEL_CASE); + mapper.setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE); return mapper; } diff --git a/src/test/java/no/digipost/api/datatypes/marshalling/MarshallingTest.java b/src/test/java/no/digipost/api/datatypes/marshalling/MarshallingTest.java index 0d647c71..15465781 100644 --- a/src/test/java/no/digipost/api/datatypes/marshalling/MarshallingTest.java +++ b/src/test/java/no/digipost/api/datatypes/marshalling/MarshallingTest.java @@ -36,7 +36,6 @@ void testJacksonJsonMarshallingAlltypes() { static void testJacksonJsonMarshalling(DataTypeIdentifier example) { try { ObjectMapper mapper = DataTypesJsonMapper.getMapper(); - mapper.enableDefaultTyping(); final String json = mapper.writer().writeValueAsString(example.getExample()); final DataType unmarshalled = mapper.reader().forType(example.getDataType()).readValue(json); assertThat(unmarshalled, equalTo(example.getExample())); diff --git a/src/test/java/no/digipost/api/datatypes/types/proof/TimePeriodTest.java b/src/test/java/no/digipost/api/datatypes/types/proof/TimePeriodTest.java index 67137c31..79dadb51 100644 --- a/src/test/java/no/digipost/api/datatypes/types/proof/TimePeriodTest.java +++ b/src/test/java/no/digipost/api/datatypes/types/proof/TimePeriodTest.java @@ -4,9 +4,6 @@ import org.junit.jupiter.api.Test; import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; @@ -59,8 +56,8 @@ void period() { void repeating_fra_til() { YearlyRepeatingPeriod period = new YearlyRepeatingPeriod( 2019, 2022 - , new CalendarDate(3, 1, 0, 0, "+01:00") - , new CalendarDate(10, 1, 0, 0, "+01:00") + , new CalendarDate(3, 1, 0, 0) + , new CalendarDate(10, 1, 0, 0) ); assertThat(period.getISO8601(), equalTo("R/2019-03-01T00:00/2022-10-01T00:00")); @@ -70,8 +67,8 @@ void repeating_fra_til() { void repeating_fra() { YearlyRepeatingPeriod period = new YearlyRepeatingPeriod( null, 2022 - , new CalendarDate(5, 1, 0, 0, "+01:00") - , new CalendarDate(10, 1, 0, 0, "+01:00") + , new CalendarDate(5, 1, 0, 0) + , new CalendarDate(10, 1, 0, 0) ); assertThat(period.getISO8601(), equalTo("R/05-01T00:00/2022-10-01T00:00")); @@ -81,8 +78,8 @@ void repeating_fra() { void repeating_to() { YearlyRepeatingPeriod period = new YearlyRepeatingPeriod( 2019, null - , new CalendarDate(5, 1, 0, 0, "+01:00") - , new CalendarDate(10, 1, 0, 0, "+01:00") + , new CalendarDate(5, 1, 0, 0) + , new CalendarDate(10, 1, 0, 0) ); assertThat(period.getISO8601(), equalTo("R/2019-05-01T00:00/10-01T00:00")); @@ -92,8 +89,8 @@ void repeating_to() { void repeating() { YearlyRepeatingPeriod period = new YearlyRepeatingPeriod( null, null - , new CalendarDate(5, 1, 0, 0, "+01:00") - , new CalendarDate(10, 1, 0, 0, "+01:00") + , new CalendarDate(5, 1, 0, 0) + , new CalendarDate(10, 1, 0, 0) ); assertThat(period.getISO8601(), equalTo("R/05-01T00:00/10-01T00:00")); @@ -103,8 +100,8 @@ void repeating() { void repeating_only_required() { YearlyRepeatingPeriod period = new YearlyRepeatingPeriod( null, null - , new CalendarDate(5, 1, null, null, null) - , new CalendarDate(10, 1, null, null, null) + , new CalendarDate(5, 1, null, null) + , new CalendarDate(10, 1, null, null) ); assertThat(period.getISO8601(), equalTo("R/05-01T00:00/10-01T00:00")); @@ -112,6 +109,7 @@ void repeating_only_required() { @Test void repeating_discard_esoteric_timezones() { + @SuppressWarnings("deprecation") YearlyRepeatingPeriod period = new YearlyRepeatingPeriod( null, null , new CalendarDate(5, 1, 0, 0, "+03:00") diff --git a/src/test/resources/junit-platform.properties b/src/test/resources/junit-platform.properties new file mode 100644 index 00000000..6efc0d5e --- /dev/null +++ b/src/test/resources/junit-platform.properties @@ -0,0 +1 @@ +junit.jupiter.extensions.autodetection.enabled=true diff --git a/src/test/resources/simplelogger.properties b/src/test/resources/simplelogger.properties new file mode 100644 index 00000000..cd90c2ac --- /dev/null +++ b/src/test/resources/simplelogger.properties @@ -0,0 +1 @@ +org.slf4j.simpleLogger.defaultLogLevel=warn