Skip to content

Commit

Permalink
migrate to spring boot 3 and camunda 7.20
Browse files Browse the repository at this point in the history
  • Loading branch information
zambrovski committed Nov 24, 2023
1 parent 59ea3bf commit 7e4ba3e
Show file tree
Hide file tree
Showing 92 changed files with 726 additions and 622 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
run: echo ${{ github.ref }}

# Setup JDK and Maven
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
cache: maven
distribution: 'zulu'
server-id: ossrh
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,34 @@ jobs:
run: echo ${{ github.ref }}

# Setup JDK and Maven
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
cache: maven
distribution: 'zulu'
server-id: ossrh
server-username: OSS_CENTRAL_USERNAME # env variable for Maven Central
server-password: OSS_CENTRAL_PASSWORD # env variable for Maven Central

# Get GPG private key into GPG
- name: Import GPG Owner Trust
run: echo ${{ secrets.GPG_OWNERTRUST }} | base64 --decode | gpg --import-ownertrust

- name: Import GPG key
run: echo ${{ secrets.GPG_SECRET_KEYS }} | base64 --decode | gpg --import --no-tty --batch --yes

# Prepare
- name: Prepare Maven Wrapper
run: chmod +x ./mvnw

# Build
- name: Build with Maven
run: ./mvnw clean verify -U -B -T4
run: ./mvnw clean verify -U -B -T4 -ntp

# Get GPG private key into GPG
- name: Import GPG Owner Trust
run: echo ${{ secrets.GPG_OWNERTRUST }} | base64 --decode | gpg --import-ownertrust

- name: Import GPG key
run: echo ${{ secrets.GPG_SECRET_KEYS }} | base64 --decode | gpg --import --no-tty --batch --yes

# Publish release
- name: Deploy a new release version to Maven Central
run: ./mvnw clean deploy -B -DskipTests -DskipExamples -Prelease -Dgpg.keyname="${{ secrets.GPG_KEYNAME }}" -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
run: ./mvnw clean deploy -ntp -B -DskipTests -DskipExamples -Prelease -Dgpg.keyname="${{ secrets.GPG_KEYNAME }}" -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
env:
OSS_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
OSS_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.0
17
6 changes: 3 additions & 3 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
# to you 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
#
#
# http://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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.2-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

8 changes: 4 additions & 4 deletions example/camunda-7-delegate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<artifactId>camunda-bpm-worker-example-7-delegate</artifactId>

<properties>
<camunda.version.ce>7.18.0</camunda.version.ce>
<camunda.version.ee>7.18.2-ee</camunda.version.ee>
<camunda-spin.version>1.18.0</camunda-spin.version>
<camunda.version.ce>7.20.0</camunda.version.ce>
<camunda.version.ee>7.20.0-ee</camunda.version.ee>
<camunda-spin.version>1.22.0</camunda-spin.version>
</properties>

<dependencies>
Expand All @@ -32,7 +32,7 @@
<dependency>
<groupId>io.holunda</groupId>
<artifactId>camunda-platform-7-autologin</artifactId>
<version>0.0.1</version>
<version>0.1.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package io.holunda.camunda.worker.example

import com.fasterxml.jackson.databind.ObjectMapper
import io.holunda.camunda.worker.example.infrastructure.KotlinJacksonDataFormatConfigurator
import org.camunda.bpm.engine.ProcessEngine
import org.camunda.bpm.engine.ProcessEngineServices
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Primary

fun main(args: Array<String>) = runApplication<ExampleProcess7DelegateApplication>(*args).let { Unit }

Expand All @@ -16,4 +19,10 @@ class ExampleProcess7DelegateApplication {
@Bean
fun processEngineServices(processEngine: ProcessEngine): ProcessEngineServices = processEngine


@Bean
@Primary
fun objectMapper() = ObjectMapper().apply {
KotlinJacksonDataFormatConfigurator.configure(this)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.holunda.camunda.worker.example.infrastructure

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import io.github.projectmapk.jackson.module.kogera.KotlinModule
import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat
import org.camunda.spin.spi.DataFormatConfigurator

Expand All @@ -10,10 +12,21 @@ import org.camunda.spin.spi.DataFormatConfigurator
*/
class KotlinJacksonDataFormatConfigurator : DataFormatConfigurator<JacksonJsonDataFormat> {

companion object {
fun configure(objectMapper: ObjectMapper) {
objectMapper
.registerModule(
KotlinModule.Builder().build()
)
.registerModule(
JavaTimeModule()
)
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
}
}

override fun configure(dataFormat: JacksonJsonDataFormat) {
val objectMapper = dataFormat.objectMapper
objectMapper.registerModule(KotlinModule.Builder().build())
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
Companion.configure(dataFormat.objectMapper)
}

override fun getDataFormatClass(): Class<JacksonJsonDataFormat> = JacksonJsonDataFormat::class.java
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package io.holunda.camunda.worker.example.infrastructure

import io.github.projectmapk.jackson.module.kogera.readValue
import io.holunda.camunda.worker.example.ExampleProcess7DelegateApplication
import io.holunda.camunda.worker.example.adapter.`in`.rest.OrderPositionDto
import io.holunda.camunda.worker.example.adapter.`in`.rest.submit.OrderSubmissionDto
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import java.time.Instant
import java.util.*


internal class AdapterTypeSerializationTest {

private val objectMapper = ExampleProcess7DelegateApplication().objectMapper()
private val orderSubmission = OrderSubmissionDto(
created = Date.from(Instant.parse("2023-11-23T10:00:00Z")),
positions = listOf(
OrderPositionDto(
title = "pen",
netCost = "10.00",
amount = 2L
),
OrderPositionDto(
title = "pencil",
netCost = "12.00",
amount = 2L
)
)
)
private val expectedJson =
"{\"created\":\"2023-11-23T10:00:00.000+00:00\",\"positions\":[{\"title\":\"pen\",\"netCost\":\"10.00\",\"amount\":2},{\"title\":\"pencil\",\"netCost\":\"12.00\",\"amount\":2}]}"


@Test
fun `should serialize to JSON and deserialize back`() {
val json = objectMapper.writeValueAsString(orderSubmission)
assertThat(json).isEqualTo(expectedJson)
val back = objectMapper.readValue<OrderSubmissionDto>(json)
assertThat(back).isEqualTo(orderSubmission)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package io.holunda.camunda.worker.example.infrastructure

import io.github.projectmapk.jackson.module.kogera.readValue
import io.holunda.camunda.worker.example.domain.approval.Order
import io.holunda.camunda.worker.example.domain.approval.OrderId
import io.holunda.camunda.worker.example.domain.approval.OrderPosition
import org.assertj.core.api.Assertions.assertThat
import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat
import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatProvider
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import java.math.BigDecimal
import java.time.Instant
import java.util.*


internal class DomainTypeSerializationTest {

private val serverDataFormat = JacksonJsonDataFormatProvider().createInstance() as JacksonJsonDataFormat

private val order = Order(
orderId = OrderId("cdb43a24-4378-475a-8fa9-5bef51160e33"),
created = Date.from(Instant.parse("2023-11-23T10:00:00Z")),
positions = listOf(
OrderPosition(
title = "pen",
netCost = BigDecimal.valueOf(10.00),
amount = 2L
),
OrderPosition(
title = "pencil",
netCost = BigDecimal.valueOf(12.00),
amount = 2L
)
)
)
private val expectedJson =
"{\"orderId\":\"cdb43a24-4378-475a-8fa9-5bef51160e33\",\"created\":\"2023-11-23T10:00:00.000+00:00\",\"positions\":[{\"title\":\"pen\",\"netCost\":10.0,\"amount\":2},{\"title\":\"pencil\",\"netCost\":12.0,\"amount\":2}]}"


@BeforeEach
fun `init object mapper`() {
KotlinJacksonDataFormatConfigurator().configure(serverDataFormat)
}


@Test
fun `should serialize to JSON and deserialize back`() {
val objectMapper = serverDataFormat.objectMapper
val json = objectMapper.writeValueAsString(order)
assertThat(json).isEqualTo(expectedJson)
val back = objectMapper.readValue<Order>(json)
assertThat(back).isEqualTo(order)
}
}
17 changes: 13 additions & 4 deletions example/camunda-7-external-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<artifactId>camunda-bpm-worker-example-7-external-client</artifactId>

<properties>
<camunda.version.ce>7.18.0</camunda.version.ce>
<camunda.version.ee>7.18.2-ee</camunda.version.ee>
<camunda-spin.version>1.18.0</camunda-spin.version>
<camunda.version.ce>7.20.0</camunda.version.ce>
<camunda.version.ee>7.20.0-ee</camunda.version.ee>
<camunda-spin.version>1.22.0</camunda-spin.version>
</properties>

<dependencies>
Expand All @@ -23,6 +23,15 @@
<version>${project.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<!-- needed for external task client -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>


<dependency>
<groupId>io.holunda.camunda.worker</groupId>
<artifactId>camunda-bpm-worker-example-fixture</artifactId>
Expand All @@ -32,7 +41,7 @@
<dependency>
<groupId>io.holunda</groupId>
<artifactId>camunda-platform-7-autologin</artifactId>
<version>0.0.1</version>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package io.holunda.camunda.worker.example

import com.fasterxml.jackson.databind.ObjectMapper
import io.holunda.camunda.worker.example.infrastructure.KotlinJacksonDataFormatConfigurator
import org.camunda.bpm.engine.ProcessEngine
import org.camunda.bpm.engine.ProcessEngineServices
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Primary

fun main(args: Array<String>) = runApplication<ExampleProcess7ExternalTaskApplication>(*args).let { Unit }

Expand All @@ -15,4 +18,11 @@ class ExampleProcess7ExternalTaskApplication {

@Bean
fun processEngineServices(processEngine: ProcessEngine): ProcessEngineServices = processEngine

@Bean
@Primary
fun objectMapper() = ObjectMapper().apply {
KotlinJacksonDataFormatConfigurator.configure(this)
}

}
Loading

0 comments on commit 7e4ba3e

Please sign in to comment.