Hi All,
First: Great to see thing coming like the Akka-projections. Slowly but surely our ‘own’ DDD framework becomes obsolete
Now, we still use our framework and did some porting to typed actors.
With the classic actors, we use a single actor as Aggregate Root and test that with a “given”, “when”, “then” kind of approach.
The given, stores a set of events in a store (in old days using the Akka internal memory store), the “when” thereafter sends a command to the actor and the “then” allows you to test the resulting events and state.
This is the structure I’d like to enable for Typed Actors and luckily the persistence testkit is now around saving some “hacking” around the store.
Except: the storage of events that will be replayed by a persistent actor needs a bit of inside knowledge as it seems.
Let say that I have a classic persistent actor with a tag “my-aggregate” and I like to replay to its current state based on events that are already pushed into the event store
I’ll use PersistenceTestKit with persistForRecovery to store events using a string for the persistenceId like my-aggregate|id1 (type pipe aggregate id) as it is passed as a string.
Replay of the typed actor ‘id1’ will thereafter replay these events, right ?
Except that it states: ERROR a.a.SupervisorStrategy - entityId [my-aggregate|id1] contains [|] which is a reserved character
What is the best way to persist events the actor will use to startup in a test ?
And next to that: what is the best way to capture the state so it can be asserted in a test ?
For the full piece of code : https://github.com/cafienne/bounded-framework/blob/typed-support3/bounded-test/src/main/scala/io/cafienne/bounded/test/typed/TestableAggregateRoot.scala
Note that it is under construction in order to get it available next to the existing one for classic actors.
Kind regards,
Olger