use of io.spine.client.TestActorRequestFactory in project core-java by SpineEventEngine.
the class EventsShould method setUp.
@Before
public void setUp() {
final TestActorRequestFactory requestFactory = TestActorRequestFactory.newInstance(getClass());
final CommandEnvelope cmd = requestFactory.generateEnvelope();
final StringValue producerId = toMessage(getClass().getSimpleName());
EventFactory eventFactory = EventFactory.on(cmd, Identifier.pack(producerId));
event = eventFactory.createEvent(Time.getCurrentTime(), Tests.<Version>nullRef());
context = event.getContext();
}
use of io.spine.client.TestActorRequestFactory in project core-java by SpineEventEngine.
the class CommandRoutingShould method apply_custom_route.
@Test
public void apply_custom_route() {
final TestActorRequestFactory factory = TestActorRequestFactory.newInstance(getClass());
// Have custom route.
commandRouting.route(StringValue.class, customRoute);
final CommandEnvelope command = factory.generateEnvelope();
final long id = commandRouting.apply(command.getMessage(), command.getCommandContext());
assertEquals(CUSTOM_ANSWER, id);
}
use of io.spine.client.TestActorRequestFactory in project core-java by SpineEventEngine.
the class CommandRoutingShould method apply_default_route.
@Test
public void apply_default_route() {
final TestActorRequestFactory factory = TestActorRequestFactory.newInstance(getClass());
// Replace the default route since we have custom command message.
commandRouting.replaceDefault(customDefault).route(StringValue.class, customRoute);
final CommandEnvelope command = CommandEnvelope.of(factory.createCommand(Time.getCurrentTime()));
final long id = commandRouting.apply(command.getMessage(), command.getCommandContext());
assertEquals(DEFAULT_ANSWER, id);
}
use of io.spine.client.TestActorRequestFactory in project core-java by SpineEventEngine.
the class ProcessManagerDispatcherShould method pass_null_tolerance_check.
@Test
public void pass_null_tolerance_check() {
TestActorRequestFactory requestFactory = TestActorRequestFactory.newInstance(getClass());
TestEventFactory eventFactory = TestEventFactory.newInstance(getClass());
final Command command = requestFactory.generateCommand();
new NullPointerTester().setDefault(CommandEnvelope.class, CommandEnvelope.of(command)).setDefault(EventEnvelope.class, EventEnvelope.of(eventFactory.createEvent(newUuidValue()))).setDefault(RejectionEnvelope.class, RejectionEnvelope.of(createRejection(newUuidValue(), command))).setDefault(ProcessManager.class, mock(ProcessManager.class)).testAllPublicStaticMethods(ProcessManagerDispatcher.class);
}
Aggregations