Skip to content

Commit 81d445b

Browse files
committed
Merge branch 'release/4.2.0'
2 parents 5f08e5c + f53513a commit 81d445b

File tree

73 files changed

+2861
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2861
-124
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
env:
5050
OSS_CENTRAL_USERNAME: "${{ secrets.SONATYPE_USERNAME }}"
5151
OSS_CENTRAL_PASSWORD: "${{ secrets.SONATYPE_PASSWORD }}"
52+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/snapshot-producer'
5253

5354
- name: Upload coverage information to CodeCov
5455
uses: codecov/codecov-action@v4

bom/datapool-dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.holunda.polyflow</groupId>
88
<artifactId>polyflow-parent</artifactId>
9-
<version>4.1.6</version>
9+
<version>4.2.0</version>
1010
<relativePath>../parent/pom.xml</relativePath>
1111
</parent>
1212

bom/parent/pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.holunda.polyflow</groupId>
88
<artifactId>polyflow-root</artifactId>
9-
<version>4.1.6</version>
9+
<version>4.2.0</version>
1010
<relativePath>../../pom.xml</relativePath>
1111
</parent>
1212

@@ -420,7 +420,7 @@
420420
<!-- jar -->
421421
<groupId>org.apache.maven.plugins</groupId>
422422
<artifactId>maven-jar-plugin</artifactId>
423-
<version>3.4.1</version>
423+
<version>3.4.2</version>
424424
<configuration>
425425
<archive>
426426
<manifest>
@@ -435,7 +435,7 @@
435435
<!-- for loading and unpacking artifacts -->
436436
<groupId>org.apache.maven.plugins</groupId>
437437
<artifactId>maven-dependency-plugin</artifactId>
438-
<version>3.7.0</version>
438+
<version>3.7.1</version>
439439
</plugin>
440440

441441
<plugin>
@@ -519,7 +519,7 @@
519519

520520
<plugin>
521521
<artifactId>maven-surefire-plugin</artifactId>
522-
<version>3.2.5</version>
522+
<version>3.3.0</version>
523523
<configuration>
524524
<useSystemClassLoader>false</useSystemClassLoader>
525525
<runOrder>random</runOrder>
@@ -530,7 +530,7 @@
530530
</excludes>
531531
<!-- Sets the VM argument line used when unit tests are run. -->
532532
<!-- prevent the annoying ForkedBooter process from stealing window focus on Mac OS -->
533-
<argLine>-Djava.awt.headless=true @{surefireArgLine} -XX:+StartAttachListener</argLine>
533+
<argLine>-Djava.awt.headless=true @{surefireArgLine} -XX:+StartAttachListener --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</argLine>
534534
<systemPropertyVariables>
535535
<jgiven.report.dir>${project.build.directory}/jgiven-reports</jgiven.report.dir>
536536
</systemPropertyVariables>
@@ -540,7 +540,7 @@
540540
<plugin>
541541
<groupId>org.apache.maven.plugins</groupId>
542542
<artifactId>maven-failsafe-plugin</artifactId>
543-
<version>3.2.5</version>
543+
<version>3.3.0</version>
544544
<executions>
545545
<execution>
546546
<goals>
@@ -557,7 +557,7 @@
557557
<!-- Sets the VM argument line used when integration tests are run. -->
558558
<!-- prevent the annoying ForkedBooter process from stealing window focus on Mac OS -->
559559
<!-- the add-opens is required for XStream -->
560-
<argLine>-Djava.awt.headless=true @{failsafeArgLine} -XX:+StartAttachListener --add-opens java.base/java.util=ALL-UNNAMED</argLine>
560+
<argLine>-Djava.awt.headless=true @{failsafeArgLine} -XX:+StartAttachListener --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</argLine>
561561
</configuration>
562562
</plugin>
563563

bom/taskpool-dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.holunda.polyflow</groupId>
88
<artifactId>polyflow-parent</artifactId>
9-
<version>4.1.6</version>
9+
<version>4.2.0</version>
1010
<relativePath>../parent/pom.xml</relativePath>
1111
</parent>
1212

core/bus-jackson/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.holunda.polyflow</groupId>
88
<artifactId>polyflow-parent</artifactId>
9-
<version>4.1.6</version>
9+
<version>4.2.0</version>
1010
<relativePath>../../bom/parent/pom.xml</relativePath>
1111
</parent>
1212

core/datapool/datapool-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.holunda.polyflow</groupId>
88
<artifactId>polyflow-datapool-parent</artifactId>
9-
<version>4.1.6</version>
9+
<version>4.2.0</version>
1010
</parent>
1111

1212
<artifactId>polyflow-datapool-api</artifactId>

core/datapool/datapool-api/src/main/kotlin/io/holunda/camunda/taskpool/api/business/DataEntryCommands.kt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,39 @@ data class DeleteDataEntryCommand(
5555
@TargetAggregateIdentifier
5656
val dataIdentity: String = dataIdentityString(entryType = entryType, entryId = entryId),
5757
)
58+
59+
/**
60+
* Command to anonymize the aggregate.
61+
*/
62+
data class AnonymizeDataEntryCommand(
63+
/**
64+
* Entry id.
65+
*/
66+
val entryId: EntryId,
67+
68+
/**
69+
* Entry type.
70+
*/
71+
val entryType: EntryType,
72+
73+
/**
74+
* The username that will replace the current username(s) in the protocol of the data entry
75+
*/
76+
val anonymizedUsername: String,
77+
78+
/**
79+
* Usernames that should be excluded from the anonymization. For example "SYSTEM"
80+
*/
81+
val excludedUsernames: List<String> = listOf(),
82+
83+
/**
84+
* Modification information.
85+
*/
86+
val anonymizeModification: Modification = Modification.NONE,
87+
88+
/**
89+
* Addressing information.
90+
*/
91+
@TargetAggregateIdentifier
92+
val dataIdentity: String = dataIdentityString(entryType = entryType, entryId = entryId),
93+
)

core/datapool/datapool-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.holunda.polyflow</groupId>
88
<artifactId>polyflow-datapool-parent</artifactId>
9-
<version>4.1.6</version>
9+
<version>4.2.0</version>
1010
</parent>
1111

1212
<artifactId>polyflow-datapool-core</artifactId>

core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregate.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ class DataEntryAggregate() {
7171
)
7272
}
7373

74+
/**
75+
* Handle anonymize.
76+
*/
77+
@CommandHandler
78+
fun handle(command: AnonymizeDataEntryCommand, @Autowired deletionStrategy: DeletionStrategy) {
79+
if (deletionStrategy.strictMode()) {
80+
if (deleted) {
81+
throw AggregateDeletedException(this.dataIdentity, "The data entry has already been deleted")
82+
}
83+
}
84+
AggregateLifecycle.apply(
85+
command.anonymizeEvent()
86+
)
87+
}
88+
7489
/**
7590
* React on created event.
7691
*/

core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregateTest.kt

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ package io.holunda.polyflow.datapool.core.business
22

33
import com.fasterxml.jackson.databind.ObjectMapper
44
import io.holunda.camunda.taskpool.api.business.*
5-
import io.holunda.polyflow.bus.jackson.JsonAutoDetectAnyVisibility
65
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper
76
import io.holunda.polyflow.datapool.core.DeletionStrategy
87
import io.holunda.polyflow.datapool.core.configurePolyflowJacksonObjectMapperForDatapool
9-
import org.assertj.core.api.Assertions
108
import org.assertj.core.api.Assertions.assertThat
119
import org.axonframework.eventsourcing.AggregateDeletedException
1210
import org.axonframework.test.aggregate.AggregateTestFixture
@@ -164,6 +162,113 @@ class DataEntryAggregateTest {
164162
)
165163
}
166164

165+
@Test
166+
fun `should anonymize aggregate`() {
167+
168+
val dataEntryChange = DataEntryChange(
169+
entryType = "io.holunda.My",
170+
entryId = UUID.randomUUID().toString(),
171+
applicationName = "myApp",
172+
name = "My Entry 4711",
173+
type = "My",
174+
payload = Variables.createVariables(),
175+
correlations = newCorrelations()
176+
)
177+
178+
val command = AnonymizeDataEntryCommand(
179+
entryType = dataEntryChange.entryType,
180+
entryId = dataEntryChange.entryId,
181+
anonymizedUsername = "ANONYMOUS",
182+
excludedUsernames = listOf("SYSTEM"),
183+
anonymizeModification = Modification(OffsetDateTime.now(), "kermit", "kermit decided to anonymize", logNotes = "Let us anonymize this item")
184+
)
185+
186+
fixture
187+
.registerInjectableResource(LAX_POLICY)
188+
.given(
189+
DataEntryCreatedEvent(
190+
entryId = dataEntryChange.entryId,
191+
entryType = dataEntryChange.entryType,
192+
name = "Some name",
193+
type = "Another",
194+
applicationName = "Different application",
195+
state = dataEntryChange.state,
196+
description = dataEntryChange.description,
197+
payload = dataEntryChange.payload,
198+
correlations = dataEntryChange.correlations,
199+
createModification = dataEntryChange.modification,
200+
authorizations = dataEntryChange.authorizationChanges,
201+
formKey = dataEntryChange.formKey
202+
)
203+
)
204+
.`when`(command)
205+
.expectEvents(
206+
DataEntryAnonymizedEvent(
207+
entryId = command.entryId,
208+
entryType = command.entryType,
209+
anonymizedUsername = command.anonymizedUsername,
210+
excludedUsernames = command.excludedUsernames,
211+
anonymizeModification = command.anonymizeModification,
212+
)
213+
)
214+
}
215+
216+
@Test
217+
fun `should not anonymize deleted aggregate in strict mode`() {
218+
219+
val dataEntryChange = DataEntryChange(
220+
entryType = "io.holunda.My",
221+
entryId = UUID.randomUUID().toString(),
222+
applicationName = "myApp",
223+
name = "My Entry 4711",
224+
type = "My",
225+
payload = Variables.createVariables(),
226+
correlations = newCorrelations()
227+
)
228+
229+
val deleteCommand = DeleteDataEntryCommand(
230+
entryType = dataEntryChange.entryType,
231+
entryId = dataEntryChange.entryId,
232+
modification = Modification(OffsetDateTime.now(), "kermit", "kermit decided to delete", logNotes = "Let us delete this item"),
233+
state = ProcessingType.DELETED.of("deleted as irrelevant")
234+
)
235+
236+
val anonymizeCommand = AnonymizeDataEntryCommand(
237+
entryType = dataEntryChange.entryType,
238+
entryId = dataEntryChange.entryId,
239+
anonymizedUsername = "ANONYMOUS",
240+
excludedUsernames = listOf("SYSTEM"),
241+
anonymizeModification = Modification(OffsetDateTime.now(), "kermit", "kermit decided to anonymize", logNotes = "Let us anonymize this item")
242+
)
243+
244+
fixture
245+
.registerInjectableResource(STRICT_POLICY)
246+
.given(
247+
DataEntryCreatedEvent(
248+
entryId = dataEntryChange.entryId,
249+
entryType = dataEntryChange.entryType,
250+
name = "Some name",
251+
type = "Another",
252+
applicationName = "Different application",
253+
state = dataEntryChange.state,
254+
description = dataEntryChange.description,
255+
payload = dataEntryChange.payload,
256+
correlations = dataEntryChange.correlations,
257+
createModification = dataEntryChange.modification,
258+
authorizations = dataEntryChange.authorizationChanges,
259+
formKey = dataEntryChange.formKey
260+
),
261+
DataEntryDeletedEvent(
262+
entryId = deleteCommand.entryId,
263+
entryType = deleteCommand.entryType,
264+
deleteModification = deleteCommand.modification,
265+
state = deleteCommand.state
266+
)
267+
)
268+
.`when`(anonymizeCommand)
269+
.expectException(AggregateDeletedException::class.java)
270+
}
271+
167272
@Test
168273
fun `should not delete deleted aggregate in strict mode`() {
169274

0 commit comments

Comments
 (0)