use of io.spine.core.Command 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.Command 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.Command 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.Command 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));
}
use of io.spine.core.Command in project core-java by SpineEventEngine.
the class IntegrationBusTestEnv method cannotStartArchivedProject.
// used to create a rejection
@SuppressWarnings("ThrowableNotThrown")
public static Rejection cannotStartArchivedProject() {
final ProjectId projectId = projectId();
final ItgStartProject cmdMessage = ItgStartProject.newBuilder().setProjectId(projectId).build();
final Command startProjectCmd = toCommand(cmdMessage);
final io.spine.test.integration.rejection.ItgCannotStartArchivedProject throwable = new io.spine.test.integration.rejection.ItgCannotStartArchivedProject(projectId);
throwable.initProducer(AnyPacker.pack(projectId));
final Rejection rejection = toRejection(throwable, startProjectCmd);
return rejection;
}
Aggregations