use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class CommandsShould method extract_message_from_command.
@Test
public void extract_message_from_command() {
final StringValue message = toMessage("extract_message_from_command");
final Command command = requestFactory.createCommand(message);
assertEquals(message, Commands.getMessage(command));
}
use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class CommandsShould method obtain_type_url_of_command.
@Test
public void obtain_type_url_of_command() {
final ActorRequestFactory factory = TestActorRequestFactory.newInstance(CommandsShould.class);
final StringValue message = toMessage(Identifier.newUuid());
final Command command = factory.command().create(message);
final TypeUrl typeUrl = CommandEnvelope.of(command).getTypeName().toUrl();
assertEquals(TypeUrl.of(StringValue.class), typeUrl);
}
use of com.google.protobuf.StringValue 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);
}
use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class CommandTestShould method createAndAssertCommand.
/**
* Creates a new command and checks its content.
*
* <p>If the method completes, we assume that the passed command test
* has correctly working {@link ActorRequestFactory}.
*/
private static void createAndAssertCommand(CommandTest<StringValue> commandTest) {
final StringValue commandMessage = newUuidValue();
final Command command = commandTest.createCommand(commandMessage);
checkNotDefault(command);
assertEquals(commandMessage, Commands.getMessage(command));
checkNotDefault(command.getContext());
}
use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class EntityBuilderShould method create_entity.
@Test
public void create_entity() {
final long id = 1024L;
final int version = 100500;
final StringValue state = toMessage(getClass().getName());
final Timestamp timestamp = Time.getCurrentTime();
final VersionableEntity entity = givenEntity().withId(id).withVersion(version).withState(state).modifiedOn(timestamp).build();
assertEquals(TestEntity.class, entity.getClass());
assertEquals(id, entity.getId());
assertEquals(state, entity.getState());
assertEquals(version, entity.getVersion().getNumber());
assertEquals(timestamp, entity.getVersion().getTimestamp());
}
Aggregations