use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.
the class AggregateMessageDeliveryTestEnv method projectStarted.
public static Event projectStarted() {
final ProjectId projectId = projectId();
final TestEventFactory eventFactory = TestEventFactory.newInstance(pack(projectId), AggregateMessageDeliveryTestEnv.class);
final AggProjectStarted msg = AggProjectStarted.newBuilder().setProjectId(projectId).build();
final Event result = eventFactory.createEvent(msg);
return result;
}
use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.
the class IntegrationBusTestEnv method projectCreated.
public static Event projectCreated() {
final ProjectId projectId = projectId();
final TestEventFactory eventFactory = newInstance(pack(projectId), IntegrationBusTestEnv.class);
return eventFactory.createEvent(ItgProjectCreated.newBuilder().setProjectId(projectId).build());
}
use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.
the class PmMessageDeliveryTestEnv method projectStarted.
public static Event projectStarted() {
final ProjectId projectId = projectId();
final TestEventFactory eventFactory = TestEventFactory.newInstance(AnyPacker.pack(projectId), PmMessageDeliveryTestEnv.class);
final PmProjectStarted msg = PmProjectStarted.newBuilder().setProjectId(projectId).build();
final Event result = eventFactory.createEvent(msg);
return result;
}
use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.
the class ProjectionShould method expose_playing_events_to_the_package.
@Test
public void expose_playing_events_to_the_package() {
final TestEventFactory eventFactory = TestEventFactory.newInstance(getClass());
final StringValue strValue = StringValue.newBuilder().setValue("eins zwei drei").build();
final Int32Value intValue = Int32Value.newBuilder().setValue(123).build();
final Version nextVersion = Versions.increment(projection.getVersion());
final Event e1 = eventFactory.createEvent(strValue, nextVersion);
final Event e2 = eventFactory.createEvent(intValue, Versions.increment(nextVersion));
final boolean projectionChanged = Projection.play(projection, ImmutableList.of(e1, e2));
final String projectionState = projection.getState().getValue();
assertTrue(projectionChanged);
assertTrue(projectionState.contains(strValue.getValue()));
assertTrue(projectionState.contains(String.valueOf(intValue.getValue())));
}
use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.
the class AggregateMessageDispatcherShould method dispatch_event.
@Test
public void dispatch_event() {
final TestEventFactory factory = TestEventFactory.newInstance(getClass());
final float messageValue = 2017.0729f;
final FloatValue message = FloatValue.newBuilder().setValue(messageValue).build();
final EventEnvelope eventEnvelope = EventEnvelope.of(factory.createEvent(message));
final List<? extends Message> eventMessages = dispatchEvent(aggregate, eventEnvelope);
assertTrue(aggregate.getState().getValue().contains(String.valueOf(messageValue)));
assertEquals(1, eventMessages.size());
assertTrue(eventMessages.get(0) instanceof StringValue);
}
Aggregations