use of io.spine.server.entity.rejection.StandardRejections.EntityAlreadyArchived in project core-java by SpineEventEngine.
the class ProcessManagerRepositoryShould method dispatch_rejection.
@Test
public void dispatch_rejection() {
final CommandEnvelope ce = requestFactory.generateEnvelope();
final EntityAlreadyArchived rejectionMessage = EntityAlreadyArchived.newBuilder().setEntityId(Identifier.pack(newUuid())).build();
final Rejection rejection = createRejection(rejectionMessage, ce.getCommand());
final ProjectId id = ProcessManagerRepositoryTestEnv.GivenCommandMessage.ID;
final Rejection.Builder builder = rejection.toBuilder().setContext(rejection.getContext().toBuilder().setProducerId(Identifier.pack(id)));
final RejectionEnvelope re = RejectionEnvelope.of(builder.build());
final Set<?> delivered = repository().dispatchRejection(re);
assertTrue(delivered.contains(id));
assertTrue(TestProcessManager.processed(rejectionMessage));
}
use of io.spine.server.entity.rejection.StandardRejections.EntityAlreadyArchived in project core-java by SpineEventEngine.
the class ProcessManagerShould method entityAlreadyArchived.
private static RejectionEnvelope entityAlreadyArchived(Class<? extends Message> commandMessageCls) {
final Any id = Identifier.pack(ProcessManagerShould.class.getName());
final EntityAlreadyArchived rejectionMessage = EntityAlreadyArchived.newBuilder().setEntityId(id).build();
final Command command = ACommand.withMessage(Sample.messageOfType(commandMessageCls));
final Rejection rejection = Rejections.createRejection(rejectionMessage, command);
return RejectionEnvelope.of(rejection);
}
use of io.spine.server.entity.rejection.StandardRejections.EntityAlreadyArchived in project core-java by SpineEventEngine.
the class RejectionRoutingShould method apply_custom_route.
@Test
public void apply_custom_route() {
rejectionRouting.route(EntityAlreadyArchived.class, customRoute);
final EntityAlreadyArchived rejection = EntityAlreadyArchived.newBuilder().setEntityId(thisTestAsEntity()).build();
final Set<String> ids = rejectionRouting.apply(rejection, RejectionContext.getDefaultInstance());
assertEquals(CUSTOM_ROUTE, ids);
}
Aggregations