Skip to content

Commit

Permalink
Merge branch 'release/3.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
zambrovski committed Jul 17, 2022
2 parents 07d07d0 + 39ac15a commit 0f49f94
Show file tree
Hide file tree
Showing 76 changed files with 1,239 additions and 254 deletions.
2 changes: 1 addition & 1 deletion bom/datapool-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

Expand Down
60 changes: 17 additions & 43 deletions bom/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-root</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand All @@ -18,19 +18,20 @@
<url>https://github.com/holunda-io/camunda-bpm-taskpool/</url>

<properties>
<springboot.version>2.7.0</springboot.version>
<springboot.version>2.7.1</springboot.version>
<camunda-commons-typed-values.version>7.17.0</camunda-commons-typed-values.version>

<axon.version>4.5.10</axon.version>
<axon-bom.version>4.5.16</axon-bom.version>

<axon-kotlin.version>0.2.0</axon-kotlin.version>
<axon-gateway-extension.version>0.0.5</axon-gateway-extension.version>
<axon-gateway-extension.version>0.1.0</axon-gateway-extension.version>

<awaitability.version>4.2.0</awaitability.version>
<mockito-kotlin.version>4.0.0</mockito-kotlin.version>
<pattern.class.itest>**/*ITest.*</pattern.class.itest>
<pattern.package.itest>**/itest/**/*.*</pattern.package.itest>
<jgiven.version>1.2.2</jgiven.version>

<pattern.class.itest>**/*ITest.*</pattern.class.itest>
<pattern.package.itest>**/itest/**/*.*</pattern.package.itest>
</properties>

<modules>
Expand Down Expand Up @@ -158,36 +159,12 @@
</dependency>

<!-- Axon Framework -->
<!-- FIXME: replace with BOM as soon as released -->
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-messaging</artifactId>
<version>${axon.version}</version>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-eventsourcing</artifactId>
<version>${axon.version}</version>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-modelling</artifactId>
<version>${axon.version}</version>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-configuration</artifactId>
<version>${axon.version}</version>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring-boot-starter</artifactId>
<version>${axon.version}</version>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring</artifactId>
<version>${axon.version}</version>
<artifactId>axon-bom</artifactId>
<version>${axon-bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<dependency>
Expand All @@ -196,12 +173,13 @@
<version>${axon-kotlin.version}</version>
</dependency>
<dependency>
<groupId>io.holixon</groupId>
<groupId>io.holixon.axon.gateway</groupId>
<artifactId>axon-gateway-extension</artifactId>
<version>${axon-gateway-extension.version}</version>
</dependency>

<dependency>
<groupId>io.holixon</groupId>
<groupId>io.holixon.axon.gateway</groupId>
<artifactId>axon-gateway-spring-boot-starter</artifactId>
<version>${axon-gateway-extension.version}</version>
</dependency>
Expand Down Expand Up @@ -232,11 +210,6 @@
<version>${springboot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-test</artifactId>
<version>${axon.version}</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down Expand Up @@ -298,7 +271,7 @@
</dependencies>

<build>
<defaultGoal>clean jacoco:prepare-agent package</defaultGoal>
<defaultGoal>clean package</defaultGoal>
<pluginManagement>
<plugins>
<!-- Coverage metering -->
Expand All @@ -309,6 +282,7 @@
<executions>
<execution>
<id>pre-unit-test</id>
<phase>initialize</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
Expand Down Expand Up @@ -605,7 +579,7 @@
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId>
<version>1.6.21</version>
<version>1.7.10</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down
7 changes: 6 additions & 1 deletion bom/taskpool-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -58,6 +58,11 @@
<artifactId>polyflow-camunda-bpm-engine-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-view-api-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-view-api</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion core/bus-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
<relativePath>../../bom/parent/pom.xml</relativePath>
</parent>

Expand All @@ -24,6 +24,11 @@
<artifactId>polyflow-taskpool-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-view-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.holunda.polyflow.bus.jackson

import com.fasterxml.jackson.databind.ObjectMapper
import io.holunda.camunda.taskpool.api.business.AuthorizationChange
import io.holunda.camunda.taskpool.api.task.SourceReference
import io.holunda.polyflow.view.filter.Criterion

/**
* Configures object mapper.
Expand All @@ -11,6 +13,8 @@ fun ObjectMapper.configurePolyflowJacksonObjectMapper(): ObjectMapper = this
.registerModule(DataEntryStateTypeMappingModule())
.apply {
addMixIn(SourceReference::class.java, KotlinTypeInfo::class.java)
addMixIn(AuthorizationChange::class.java, KotlinTypeInfo::class.java)
addMixIn(Criterion::class.java, KotlinTypeInfo::class.java)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ package io.holunda.polyflow.bus.jackson
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import io.holunda.camunda.taskpool.api.business.DataEntryState
import io.holunda.camunda.taskpool.api.business.ProcessingType
import com.fasterxml.jackson.module.kotlin.readValue
import io.holunda.camunda.taskpool.api.business.*
import io.holunda.camunda.taskpool.api.task.ProcessReference
import io.holunda.camunda.taskpool.api.task.SourceReference
import io.holunda.polyflow.view.DataEntry
import io.holunda.polyflow.view.Task
import io.holunda.polyflow.view.auth.User
import io.holunda.polyflow.view.query.data.DataEntriesForUserQuery
import io.holunda.polyflow.view.query.data.DataEntriesQuery
import org.assertj.core.api.Assertions.assertThat
import org.camunda.bpm.engine.variable.VariableMap
import org.camunda.bpm.engine.variable.Variables
Expand All @@ -21,19 +26,14 @@ class DeserializersTest {

@BeforeEach
fun initMapper() {
mapper = jacksonObjectMapper()
.configurePolyflowJacksonObjectMapper()
.addMixIn(MyStructure::class.java, KotlinTypeInfo::class.java)
mapper = jacksonObjectMapper().configurePolyflowJacksonObjectMapper().addMixIn(MyStructure::class.java, KotlinTypeInfo::class.java)
}

@Test
fun `serialize and deserialize source reference`() {

val sourceReference: SourceReference = sourceReference()

// show written JSON
println(mapper.writeValueAsString(sourceReference))

val map: Map<String, Any> = mapper.convertValue(sourceReference, object : TypeReference<Map<String, Any>>() {})
val converted = mapper.convertValue(map, ProcessReference::class.java)

Expand All @@ -45,9 +45,6 @@ class DeserializersTest {

val dataEntryState: DataEntryState = ProcessingType.IN_PROGRESS.of("test")

// show written JSON
println(mapper.writeValueAsString(dataEntryState))

val map: Map<String, Any> = mapper.convertValue(dataEntryState, object : TypeReference<Map<String, Any>>() {})
val converted = mapper.convertValue(map, DataEntryState::class.java)

Expand All @@ -59,31 +56,84 @@ class DeserializersTest {
fun `serialize and deserialize variable complex object`() {

mapper.activateDefaultTypingAsProperty(mapper.polymorphicTypeValidator, ObjectMapper.DefaultTyping.NON_FINAL, "@class")
val variables: VariableMap = Variables
.createVariables()
.putValue("simple", "value")
.putValue("complex", DataStructure("some", 1))
val variables: VariableMap = Variables.createVariables().putValue("simple", "value").putValue("complex", DataStructure("some", 1))

val original = MyStructure(
name = "foo",
variables = variables,
source = sourceReference()
name = "foo", variables = variables, source = sourceReference()
)


// show written JSON
println(mapper.writeValueAsString(original))

val variablesMap: Map<String, Any> = mapper.convertValue(variables, object : TypeReference<Map<String, Any>>() {})
val variablesConverted = mapper.convertValue(variablesMap, VariableMap::class.java)
assertThat(variablesConverted).isEqualTo(variablesMap)


val objectMap: Map<String, Any> = mapper.convertValue(original, object : TypeReference<Map<String, Any>>() {})
val objectConverted = mapper.convertValue(objectMap, MyStructure::class.java)
assertThat(objectConverted).isEqualTo(original)
}

// see https://github.com/holunda-io/camunda-bpm-taskpool/issues/609
@Test
fun `can serialize and deserialize datEntry with jackson`() {
val dataEntry = DataEntry(entryType = "A", entryId = "1", payload = Variables.putValue("x", "y"), name = "A1", type = "A", applicationName = "y")

val json = mapper.writeValueAsString(dataEntry)

val deserialized = mapper.readValue<DataEntry>(json)

assertThat(deserialized).isEqualTo(dataEntry)
}

// see https://github.com/holunda-io/camunda-bpm-taskpool/issues/609
@Test
fun `can serialize and deserialize task with jackson`() {
fun correlationMap(vararg dataEntries: DataEntry): CorrelationMap {
val correlations = newCorrelations()

dataEntries.forEach { correlations.addCorrelation(it.entryType, it.entryId) }

return correlations
}

val dataEntry1 = DataEntry(entryType = "A", entryId = "1", payload = Variables.putValue("x", "y"), name = "A1", type = "A", applicationName = "y")
val task = Task(
id = UUID.randomUUID().toString(), sourceReference = ProcessReference(
instanceId = UUID.randomUUID().toString(),
applicationName = "test application",
definitionId = "myProcess:1",
definitionKey = "myProcess",
executionId = UUID.randomUUID().toString(),
name = "My Process",
tenantId = null
), correlations = correlationMap(dataEntry1), taskDefinitionKey = "task_1"
)

val json = mapper.writeValueAsString(task)

val deserialized = mapper.readValue<Task>(json)

assertThat(deserialized).isEqualTo(task)
}

@Test
fun `can serialize and deserialize query with jackson`() {
val query = DataEntriesForUserQuery(user = User("kermit", setOf("muppets")), filters = listOf("foo"))

val json = mapper.writeValueAsString(query)

val deserialized = mapper.readValue<DataEntriesForUserQuery>(json)

assertThat(deserialized).isEqualTo(query)
}

@Test
fun `can serialize and deserialize dataEntryQuery with jackson`() {
val query = DataEntriesQuery(filters = listOf("foo"))

val json = mapper.writeValueAsString(query)

val deserialized = mapper.readValue<DataEntriesQuery>(json)

assertThat(deserialized).isEqualTo(query)
}
}

Expand All @@ -99,12 +149,9 @@ fun sourceReference(): SourceReference = ProcessReference(


data class DataStructure(
val value: String,
val another: Int
val value: String, val another: Int
)

data class MyStructure(
val name: String,
val variables: VariableMap,
val source: SourceReference
val name: String, val variables: VariableMap, val source: SourceReference
)
2 changes: 1 addition & 1 deletion core/datapool/datapool-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-datapool-parent</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
</parent>

<artifactId>polyflow-datapool-api</artifactId>
Expand Down
Loading

0 comments on commit 0f49f94

Please sign in to comment.