pjfanning opened a new pull request, #2833:
URL: https://github.com/apache/pekko/pull/2833
## Summary
See #2831
Adds a standardised Technology Compatibility Kit (TCK) for
`DurableStateStore` implementations to the `persistence-tck` module. This
allows plugin authors (such as those working on `pekko-persistence-jdbc`,
`pekko-persistence-r2dbc`, and `pekko-persistence-cassandra`) to include a
consistent test suite in their projects.
## Changes
###
`persistence-tck/src/main/scala/org/apache/pekko/persistence/CapabilityFlags.scala`
- Added `DurableStateStoreCapabilityFlags` trait with a
`supportsDeleteWithRevisionCheck` capability flag, following the same pattern
as `JournalCapabilityFlags` and `SnapshotStoreCapabilityFlags`.
###
`persistence-tck/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreSpec.scala`
_(new)_
Scala TCK spec that plugin authors extend. Tests:
- `getObject` on a non-existing persistence ID returns `None`
- `upsertObject` followed by `getObject` returns the stored value and
correct revision
- Upserting twice updates the state (last write wins)
- `deleteObject(persistenceId, revision)` makes the state unavailable
- Different persistence IDs are independent of one another
- **Optional** (`supportsDeleteWithRevisionCheck`): deleting with a
mismatched revision fails and leaves the original state intact
###
`persistence-tck/src/main/scala/org/apache/pekko/persistence/japi/state/JavaDurableStateStoreSpec.scala`
_(new)_
Java/JUnit-consumable wrapper around `DurableStateStoreSpec`, following the
same pattern as `JavaJournalSpec` and `JavaSnapshotStoreSpec`.
###
`persistence-testkit/src/test/scala/…/PersistenceTestKitDurableStateStoreTCKSpec.scala`
_(new)_
Reference test implementation that exercises the new TCK using the existing
in-memory `PersistenceTestKitDurableStateStore`, verifying the TCK itself works
correctly.
## Usage by plugin authors
```scala
class MyPluginDurableStateStoreSpec
extends DurableStateStoreSpec(
ConfigFactory.parseString("""
pekko.persistence.state.plugin = "my.plugin.durable-state"
my.plugin.durable-state.class =
"com.example.MyDurableStateStoreProvider"
""")
) {
override protected def supportsDeleteWithRevisionCheck: CapabilityFlag =
CapabilityFlag.on()
}
```
Agent-Logs-Url:
https://github.com/pjfanning/incubator-pekko/sessions/77803e79-3631-4111-98a8-4a1cf6f7beca
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]