diff --git a/bom/parent/pom.xml b/bom/parent/pom.xml
index 6726d8e33..0c0fa888b 100644
--- a/bom/parent/pom.xml
+++ b/bom/parent/pom.xml
@@ -18,10 +18,10 @@
https://github.com/holunda-io/camunda-bpm-taskpool/
- 3.1.4
+ 3.1.5
7.20.0
- 4.8.3
+ 4.9.0
4.9.0
2.0.0
diff --git a/core/bus-jackson/src/test/kotlin/io/holunda/polyflow/view/query/data/DataEntryQueriesDeserializationTest.kt b/core/bus-jackson/src/test/kotlin/io/holunda/polyflow/view/query/data/DataEntryQueriesDeserializationTest.kt
index 190700dba..3feff1647 100644
--- a/core/bus-jackson/src/test/kotlin/io/holunda/polyflow/view/query/data/DataEntryQueriesDeserializationTest.kt
+++ b/core/bus-jackson/src/test/kotlin/io/holunda/polyflow/view/query/data/DataEntryQueriesDeserializationTest.kt
@@ -33,12 +33,12 @@ internal class DataEntryQueriesDeserializationTest {
DataEntriesForUserQuery(
user = User(
username = "kermit", groups = setOf("muppets")
- ), page = 1, size = 50, sort = "+name", filters = listOf("data.name=test")
+ ), page = 1, size = 50, sort = listOf("+name"), filters = listOf("data.name=test")
)
), Arguments.of(
DataEntriesForDataEntryTypeQuery::class.java,
DataEntriesForDataEntryTypeQuery(
- entryType = "domain.type", page = 1, size = 50, sort = "+name"
+ entryType = "domain.type", page = 1, size = 50, sort = listOf("+name")
)
)
)
diff --git a/core/bus-jackson/src/test/kotlin/io/holunda/polyflow/view/query/task/TaskQueriesDeserializationTest.kt b/core/bus-jackson/src/test/kotlin/io/holunda/polyflow/view/query/task/TaskQueriesDeserializationTest.kt
index 873ef505a..6a65a8e75 100644
--- a/core/bus-jackson/src/test/kotlin/io/holunda/polyflow/view/query/task/TaskQueriesDeserializationTest.kt
+++ b/core/bus-jackson/src/test/kotlin/io/holunda/polyflow/view/query/task/TaskQueriesDeserializationTest.kt
@@ -25,7 +25,7 @@ internal class TaskQueriesDeserializationTest {
AllTasksQuery(
page = 1,
size = 50,
- sort = "+name",
+ sort = listOf("+name"),
filters = listOf("task.name=test")
)
),
@@ -34,7 +34,7 @@ internal class TaskQueriesDeserializationTest {
AllTasksWithDataEntriesQuery(
page = 1,
size = 50,
- sort = "+name",
+ sort = listOf("+name"),
filters = listOf("task.name=test")
)
),
@@ -56,7 +56,7 @@ internal class TaskQueriesDeserializationTest {
user = User(username = "kermit", groups = setOf("muppets")),
page = 1,
size = 50,
- sort = "+name",
+ sort = listOf("+name"),
filters = listOf("task.name=test")
)
),
@@ -66,7 +66,7 @@ internal class TaskQueriesDeserializationTest {
user = User(username = "kermit", groups = setOf("muppets")),
page = 1,
size = 50,
- sort = "+name",
+ sort = listOf("+name"),
filters = listOf("task.name=test")
)
),
@@ -76,7 +76,7 @@ internal class TaskQueriesDeserializationTest {
user = User(username = "kermit", groups = setOf("muppets")),
page = 1,
size = 50,
- sort = "+name",
+ sort = listOf("+name"),
filters = listOf("task.name=test")
)
),
@@ -86,7 +86,7 @@ internal class TaskQueriesDeserializationTest {
user = User(username = "kermit", groups = setOf("muppets")),
page = 1,
size = 50,
- sort = "+name",
+ sort = listOf("+name"),
filters = listOf("task.name=test")
)
),
diff --git a/core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/itest/TestApplication.kt b/core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/itest/TestApplication.kt
index 97494e0f5..1a106e100 100644
--- a/core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/itest/TestApplication.kt
+++ b/core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/itest/TestApplication.kt
@@ -3,6 +3,7 @@ package io.holunda.polyflow.datapool.core.itest
import com.thoughtworks.xstream.XStream
import com.thoughtworks.xstream.security.AnyTypePermission
import io.holunda.polyflow.datapool.core.EnablePolyflowDataPool
+import org.axonframework.eventsourcing.eventstore.inmemory.InMemoryEventStorageEngine
import org.axonframework.serialization.Serializer
import org.axonframework.serialization.xml.XStreamSerializer
import org.springframework.beans.factory.annotation.Qualifier
@@ -16,4 +17,6 @@ class TestApplication {
@Qualifier("eventSerializer")
fun myEventSerializerForProcess(): Serializer = XStreamSerializer.builder().xStream(XStream().apply { addPermission(AnyTypePermission.ANY) }).build()
+ @Bean
+ fun inMemoryStorageEngine() = InMemoryEventStorageEngine()
}
diff --git a/core/spring-utils/src/main/kotlin/io/holunda/polyflow/spring/ApplicationNameBeanPostProcessor.kt b/core/spring-utils/src/main/kotlin/io/holunda/polyflow/spring/ApplicationNameBeanPostProcessor.kt
index 8bc02a619..f89b978aa 100644
--- a/core/spring-utils/src/main/kotlin/io/holunda/polyflow/spring/ApplicationNameBeanPostProcessor.kt
+++ b/core/spring-utils/src/main/kotlin/io/holunda/polyflow/spring/ApplicationNameBeanPostProcessor.kt
@@ -8,6 +8,10 @@ import org.springframework.core.annotation.AnnotationUtils
import org.springframework.core.env.get
import kotlin.reflect.KMutableProperty1
import kotlin.reflect.full.memberProperties
+import kotlin.reflect.jvm.isAccessible
+import kotlin.reflect.jvm.javaField
+import kotlin.reflect.jvm.javaGetter
+import kotlin.reflect.jvm.javaSetter
/**
* A bean post processor that inspects all [ConfigurationProperties] beans, looks for a mutable property of type `String` called `applicationName` and replaces it with the value
@@ -17,15 +21,21 @@ class ApplicationNameBeanPostProcessor(private val applicationContext: Applicati
companion object {
const val UNSET_APPLICATION_NAME = "unset-application-name"
+ val CANDIDATES = arrayOf(
+ "io.holunda.polyflow.taskpool.collector.CamundaTaskpoolCollectorProperties",
+ "io.holunda.polyflow.client.camunda.CamundaEngineClientProperties",
+ "io.holunda.polyflow.datapool.DataEntrySenderProperties",
+ )
}
private val applicationName: String by lazy { applicationContext.environment["spring.application.name"] ?: UNSET_APPLICATION_NAME }
override fun postProcessAfterInitialization(bean: Any, beanName: String): Any {
- if (AnnotationUtils.findAnnotation(bean::class.java, ConfigurationProperties::class.java) != null) {
+ if (CANDIDATES.contains(bean::class.java.name)
+ && AnnotationUtils.findAnnotation(bean::class.java, ConfigurationProperties::class.java) != null) {
@Suppress("UNCHECKED_CAST")
val applicationNameProperty =
bean::class.memberProperties.find { it.name == "applicationName" && it is KMutableProperty1 && it.returnType.classifier == String::class } as KMutableProperty1?
- if (applicationNameProperty != null) {
+ if ( applicationNameProperty != null) {
if (applicationNameProperty.get(bean) == UNSET_APPLICATION_NAME) {
applicationNameProperty.set(bean, applicationName)
}
diff --git a/core/spring-utils/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderProperties.kt b/core/spring-utils/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderProperties.kt
new file mode 100644
index 000000000..0224702fa
--- /dev/null
+++ b/core/spring-utils/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderProperties.kt
@@ -0,0 +1,7 @@
+package io.holunda.polyflow.datapool
+
+import io.holunda.polyflow.spring.ApplicationNameBeanPostProcessor
+import org.springframework.boot.context.properties.ConfigurationProperties
+
+@ConfigurationProperties(prefix = "polyflow.test")
+data class DataEntrySenderProperties(var applicationName: String = ApplicationNameBeanPostProcessor.UNSET_APPLICATION_NAME)
diff --git a/core/spring-utils/src/test/kotlin/io/holunda/polyflow/spring/ApplicationNameBeanPostProcessorTest.kt b/core/spring-utils/src/test/kotlin/io/holunda/polyflow/spring/ApplicationNameBeanPostProcessorTest.kt
index 522e876c9..de9bba661 100644
--- a/core/spring-utils/src/test/kotlin/io/holunda/polyflow/spring/ApplicationNameBeanPostProcessorTest.kt
+++ b/core/spring-utils/src/test/kotlin/io/holunda/polyflow/spring/ApplicationNameBeanPostProcessorTest.kt
@@ -1,5 +1,6 @@
package io.holunda.polyflow.spring
+import io.holunda.polyflow.datapool.DataEntrySenderProperties
import io.holunda.polyflow.spring.ApplicationNameBeanPostProcessor.Companion.UNSET_APPLICATION_NAME
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
@@ -20,20 +21,39 @@ internal class ApplicationNameBeanPostProcessorTest {
.withPropertyValues(
"spring.application.name=my-test-application"
).run {
- val testProperties = it.getBean(TestProperties::class.java)
+ val privateTestProperties = it.getBean(PrivateTestProperties::class.java)
+ assertThat(privateTestProperties).isNotNull
+ assertThat(privateTestProperties.getApplicationNamePropertyValue()).isEqualTo("unset-application-name")
+ }
+ contextRunner
+ .withPropertyValues(
+ "spring.application.name=my-test-application",
+ ).run {
+ val testProperties = it.getBean(DataEntrySenderProperties::class.java)
assertThat(testProperties).isNotNull
assertThat(testProperties.applicationName).isEqualTo("my-test-application")
}
+
}
@Test
fun `leaves application name if specifically set`() {
+ contextRunner
+ .withPropertyValues(
+ "spring.application.name=my-test-application",
+ "polyflow.test.private.application-name=my-polyflow-test-application"
+ ).run {
+ val privateTestProperties = it.getBean(PrivateTestProperties::class.java)
+ assertThat(privateTestProperties).isNotNull
+ assertThat(privateTestProperties.getApplicationNamePropertyValue()).isEqualTo("my-polyflow-test-application")
+ }
+
contextRunner
.withPropertyValues(
"spring.application.name=my-test-application",
"polyflow.test.application-name=my-polyflow-test-application"
).run {
- val testProperties = it.getBean(TestProperties::class.java)
+ val testProperties = it.getBean(DataEntrySenderProperties::class.java)
assertThat(testProperties).isNotNull
assertThat(testProperties.applicationName).isEqualTo("my-polyflow-test-application")
}
@@ -43,7 +63,13 @@ internal class ApplicationNameBeanPostProcessorTest {
fun `leaves application name at default if spring-application-name is not set`() {
contextRunner
.run {
- val testProperties = it.getBean(TestProperties::class.java)
+ val privateTestProperties = it.getBean(PrivateTestProperties::class.java)
+ assertThat(privateTestProperties).isNotNull
+ assertThat(privateTestProperties.getApplicationNamePropertyValue()).isEqualTo(UNSET_APPLICATION_NAME)
+ }
+ contextRunner
+ .run {
+ val testProperties = it.getBean(DataEntrySenderProperties::class.java)
assertThat(testProperties).isNotNull
assertThat(testProperties.applicationName).isEqualTo(UNSET_APPLICATION_NAME)
}
@@ -51,9 +77,11 @@ internal class ApplicationNameBeanPostProcessorTest {
}
@Configuration
-@EnableConfigurationProperties(TestProperties::class)
+@EnableConfigurationProperties(value = [PrivateTestProperties::class, DataEntrySenderProperties::class])
@Import(ApplicationNameBeanPostProcessor::class)
class TestConfig
-@ConfigurationProperties(prefix = "polyflow.test")
-data class TestProperties(var applicationName: String = UNSET_APPLICATION_NAME)
+@ConfigurationProperties(prefix = "polyflow.test.private")
+data class PrivateTestProperties(private var applicationName: String = UNSET_APPLICATION_NAME) {
+ fun getApplicationNamePropertyValue() = this.applicationName
+}
diff --git a/core/taskpool/taskpool-core/src/test/kotlin/io/holunda/polyflow/taskpool/core/TestApplication.kt b/core/taskpool/taskpool-core/src/test/kotlin/io/holunda/polyflow/taskpool/core/TestApplication.kt
index 9d8869350..691efbf72 100644
--- a/core/taskpool/taskpool-core/src/test/kotlin/io/holunda/polyflow/taskpool/core/TestApplication.kt
+++ b/core/taskpool/taskpool-core/src/test/kotlin/io/holunda/polyflow/taskpool/core/TestApplication.kt
@@ -2,6 +2,7 @@ package io.holunda.polyflow.taskpool.core
import com.thoughtworks.xstream.XStream
import com.thoughtworks.xstream.security.AnyTypePermission
+import org.axonframework.eventsourcing.eventstore.inmemory.InMemoryEventStorageEngine
import org.axonframework.serialization.Serializer
import org.axonframework.serialization.xml.XStreamSerializer
import org.springframework.beans.factory.annotation.Qualifier
@@ -15,4 +16,6 @@ class TestApplication {
@Qualifier("eventSerializer")
fun myEventSerializerForProcess(): Serializer = XStreamSerializer.builder().xStream(XStream().apply { addPermission(AnyTypePermission.ANY) }).build()
+ @Bean
+ fun inMemoryEventStoreEngine() = InMemoryEventStorageEngine()
}
diff --git a/pom.xml b/pom.xml
index b31fb6702..32f1e36b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
- 3.6.0
+ 3.9.0
17