@Test public void testUpdateGreeting() { String id = "Alice"; ActorRef<HelloCommand> ref = testKit.spawn( HelloAggregate.create( new EntityContext(HelloAggregate.ENTITY_TYPE_KEY, id, null) ) ); TestProbe<HelloCommand.Confirmation> probe1 = testKit.createTestProbe(HelloCommand.Confirmation.class); ref.tell(new HelloCommand.UseGreetingMessage("Hi", probe1.getRef())); probe1.expectMessage(new HelloCommand.Accepted()); TestProbe<HelloCommand.Greeting> probe2 = testKit.createTestProbe(HelloCommand.Greeting.class); ref.tell(new HelloCommand.Hello(id,probe2.getRef())); probe2.expectMessage(new HelloCommand.Greeting("Hi, Alice!")); }
public static HelloAggregate create(EntityContext<HelloCommand> entityContext) { return new HelloAggregate(entityContext); }
HelloAggregate extends EventSourcedBehaviorWithEnforcedReplies<HelloCommand, HelloEvent, HelloState> { public static HelloAggregate create(EntityContext<HelloCommand> entityContext) { return new HelloAggregate(entityContext); } }
HelloAggregate extends EventSourcedBehaviorWithEnforcedReplies<HelloCommand, HelloEvent, HelloState> { public static HelloAggregate create(EntityContext<HelloCommand> entityContext) { return new HelloAggregate(entityContext); } HelloAggregate(EntityContext<HelloCommand> entityContext); }
HelloAggregate extends EventSourcedBehaviorWithEnforcedReplies<HelloCommand, HelloEvent, HelloState> { public static HelloAggregate create(EntityContext<HelloCommand> entityContext) { return new HelloAggregate(entityContext); } HelloAggregate(EntityContext<HelloCommand> entityContext); static HelloAggregate create(EntityContext<HelloCommand> entityContext); @Override HelloState emptyState(); @Override CommandHandlerWithReply<HelloCommand, HelloEvent, HelloState> commandHandler(); @Override EventHandler<HelloState, HelloEvent> eventHandler(); @Override Set<String> tagsFor(HelloEvent shoppingCartEvent); }
HelloAggregate extends EventSourcedBehaviorWithEnforcedReplies<HelloCommand, HelloEvent, HelloState> { public static HelloAggregate create(EntityContext<HelloCommand> entityContext) { return new HelloAggregate(entityContext); } HelloAggregate(EntityContext<HelloCommand> entityContext); static HelloAggregate create(EntityContext<HelloCommand> entityContext); @Override HelloState emptyState(); @Override CommandHandlerWithReply<HelloCommand, HelloEvent, HelloState> commandHandler(); @Override EventHandler<HelloState, HelloEvent> eventHandler(); @Override Set<String> tagsFor(HelloEvent shoppingCartEvent); static EntityTypeKey<HelloCommand> ENTITY_TYPE_KEY; }