use of io.spine.core.Event in project core-java by SpineEventEngine.
the class EventEnricherShould method enrich_event_if_enrichment_definition_is_enclosed_to_event.
@Test
public void enrich_event_if_enrichment_definition_is_enclosed_to_event() {
final ProjectStarted msg = GivenEventMessage.projectStarted();
final Event event = createEvent(msg);
eventBus.post(event);
assertEquals(getProjectName.apply(msg.getProjectId()), subscriber.projectStartedEnrichment.getProjectName());
}
use of io.spine.core.Event in project core-java by SpineEventEngine.
the class EventRootCommandIdShould method match_the_id_of_a_command_handled_by_an_aggregate.
@Test
public void match_the_id_of_a_command_handled_by_an_aggregate() {
final Command command = command(createProject(projectId(), teamId()));
postCommand(command);
final List<Event> events = readEvents();
assertEquals(command.getId(), getRootCommandId(events.get(0)));
}
use of io.spine.core.Event in project core-java by SpineEventEngine.
the class EventRootCommandIdShould method match_the_id_of_a_command_handled_by_a_process_manager.
@Test
public void match_the_id_of_a_command_handled_by_a_process_manager() {
final Command command = command(addTeamMember(teamId()));
postCommand(command);
final List<Event> events = readEvents();
assertSize(1, events);
final Event event = events.get(0);
assertEquals(command.getId(), getRootCommandId(event));
}
use of io.spine.core.Event in project core-java by SpineEventEngine.
the class EventRootCommandIdShould method match_the_id_of_a_command_handled_by_a_process_manager_for_multiple_events.
@Test
public void match_the_id_of_a_command_handled_by_a_process_manager_for_multiple_events() {
final Command command = command(inviteTeamMembers(teamId(), 3));
postCommand(command);
final List<Event> events = readEvents();
assertSize(3, events);
assertEquals(command.getId(), getRootCommandId(events.get(0)));
assertEquals(command.getId(), getRootCommandId(events.get(1)));
assertEquals(command.getId(), getRootCommandId(events.get(2)));
}
use of io.spine.core.Event in project core-java by SpineEventEngine.
the class EventRootCommandIdShould method match_the_id_of_an_external_event_handled_by_a_process_manager.
/**
* Ensures root command ID is matched by the property of the event which is created as
* a reaction to another event.
*
* <p> Two events are expected to be found in the {@linkplain EventStore} created by different
* process managers:
* <ol>
* <li>{@link io.spine.server.event.given.EventRootCommandIdTestEnv.UserSignUpProcessManager} —
* {@link EvInvitationAccepted}</li>
* <li>{@link io.spine.server.event.given.EventRootCommandIdTestEnv.TeamCreationProcessManager} —
* {@link EvTeamMemberAdded} created as a reaction to {@link EvInvitationAccepted}</li>
* </ol>
*/
@Test
public void match_the_id_of_an_external_event_handled_by_a_process_manager() {
final Command command = command(acceptInvitation(teamId()));
postCommand(command);
final List<Event> events = readEvents();
assertSize(2, events);
final Event reaction = events.get(1);
assertEquals(command.getId(), getRootCommandId(reaction));
}
Aggregations