use of io.spine.core.RejectionEnvelope in project core-java by SpineEventEngine.
the class RejectionEnvelopeShould method obtain_actor_context.
@Test
public void obtain_actor_context() {
final RejectionEnvelope rejection = toEnvelope(outerObject());
final ActorContext actorContext = rejection.getActorContext();
/* Since we're using `TestActorRequestFactory` initialized with the class of this test suite
the actor ID should be the suite class name.
*/
assertEquals(getClass().getName(), actorContext.getActor().getValue());
}
use of io.spine.core.RejectionEnvelope in project core-java by SpineEventEngine.
the class RejectionEnvelopeShould method obtain_command_message.
@Test
public void obtain_command_message() {
final Rejection rejection = outerObject();
final Command command = rejection.getContext().getCommand();
final Message commandMessage = AnyPacker.unpack(command.getMessage());
final RejectionEnvelope envelope = toEnvelope(rejection);
assertEquals(commandMessage, envelope.getCommandMessage());
}
use of io.spine.core.RejectionEnvelope in project core-java by SpineEventEngine.
the class RejectionEnvelopeShould method obtain_command_context.
@Test
public void obtain_command_context() {
final Rejection rejection = outerObject();
final Command command = rejection.getContext().getCommand();
final RejectionEnvelope envelope = toEnvelope(rejection);
assertEquals(command.getContext(), envelope.getCommandContext());
}
use of io.spine.core.RejectionEnvelope in project core-java by SpineEventEngine.
the class AggregateMessageDeliveryShould method postpone_rejections_dispatched_to_reactor_method.
@Test
public void postpone_rejections_dispatched_to_reactor_method() {
assertNull(ReactingProject.getEventReceived());
final Rejection rejection = cannotStartProject();
boundedContext.getRejectionBus().post(rejection);
assertNull(ReactingProject.getRejectionReceived());
final RejectionEnvelope expectedEnvelope = RejectionEnvelope.of(rejection);
final PostponingRejectionDelivery delivery = repository.getRejectionEndpointDelivery();
final Map<ProjectId, RejectionEnvelope> postponedRejections = delivery.getPostponedRejections();
assertTrue(postponedRejections.size() == 1 && postponedRejections.containsValue(expectedEnvelope));
final ProjectId projectId = postponedRejections.keySet().iterator().next();
delivery.deliverNow(projectId, postponedRejections.get(projectId));
final AggCannotStartArchivedProject deliveredRejectionMsg = ReactingProject.getRejectionReceived();
assertNotNull(deliveredRejectionMsg);
assertEquals(getMessage(rejection), deliveredRejectionMsg);
}
use of io.spine.core.RejectionEnvelope in project core-java by SpineEventEngine.
the class PmRejectionEndpoint method getTargets.
@Override
protected Set<I> getTargets() {
final RejectionEnvelope envelope = envelope();
final Set<I> ids = repository().getRejectionRouting().apply(envelope.getMessage(), envelope.getMessageContext());
return ids;
}
Aggregations