use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class ProcessManagerShould method throw_exception_if_dispatch_unknown_event.
@Test(expected = IllegalStateException.class)
public void throw_exception_if_dispatch_unknown_event() {
final StringValue unknownEvent = StringValue.getDefaultInstance();
final EventEnvelope envelope = EventEnvelope.of(eventFactory.createEvent(unknownEvent));
dispatch(processManager, envelope);
}
use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class ProcessManagerShould method create_iterating_router.
@Test
public void create_iterating_router() {
final StringValue commandMessage = toMessage("create_iterating_router");
final CommandContext commandContext = requestFactory.createCommandContext();
processManager.injectCommandBus(mock(CommandBus.class));
final IteratingCommandRouter router = processManager.newIteratingRouterFor(commandMessage, commandContext);
assertNotNull(router);
assertEquals(commandMessage, getMessage(router.getSource()));
assertEquals(commandContext, router.getSource().getContext());
}
use of com.google.protobuf.StringValue 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 com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class EventsShould method get_producer_from_event_context.
@Test
public void get_producer_from_event_context() {
final StringValue msg = unpack(context.getProducerId());
final String id = getProducer(context);
assertEquals(msg.getValue(), id);
}
use of com.google.protobuf.StringValue 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();
}
Aggregations