use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class TypeNameShould method obtain_type_name_of_event.
@Test
public void obtain_type_name_of_event() {
final Command command = requestFactory.command().create(newUuidValue());
final StringValue producerId = Wrapper.forString(getClass().getSimpleName());
final EventFactory ef = EventFactory.newBuilder().setCommandId(Commands.generateId()).setProducerId(producerId).setCommandContext(command.getContext()).build();
final Event event = ef.createEvent(Time.getCurrentTime(), Tests.<Version>nullRef());
final TypeName typeName = TypeName.ofEvent(event);
assertNotNull(typeName);
assertEquals(Timestamp.class.getSimpleName(), typeName.getSimpleName());
}
use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class ProcessManagerShould method create_router.
@Test
public void create_router() {
final StringValue commandMessage = Wrapper.forString("create_router");
final CommandContext commandContext = requestFactory.createCommandContext();
processManager.setCommandBus(mock(CommandBus.class));
final CommandRouter router = processManager.newRouterFor(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 AbstractCommandRouterShould method setUp.
@Before
public void setUp() {
final BoundedContext boundedContext = BoundedContext.newBuilder().build();
final CommandBus commandBus = boundedContext.getCommandBus();
// Register dispatcher for `StringValue` message type.
// Otherwise we won't be able to post.
commandBus.register(new CommandDispatcher() {
@Override
public Set<CommandClass> getMessageClasses() {
return CommandClass.setOf(StringValue.class);
}
@Override
public void dispatch(CommandEnvelope envelope) {
// Do nothing.
}
});
sourceMessage = Wrapper.forString(getClass().getSimpleName());
sourceContext = requestFactory.createCommandContext();
router = createRouter(commandBus, sourceMessage, sourceContext);
router.addAll(messages);
}
use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class QueryParameterShould method support_equality.
@Test
public void support_equality() {
final String param1 = "param1";
final String param2 = "param2";
final String foobar = "foobar";
final String baz = "baz";
final StringValue foobarValue = StringValue.newBuilder().setValue(foobar).build();
final QueryParameter parameter1 = eq(param1, foobar);
final QueryParameter parameter2 = eq(param1, foobarValue);
final QueryParameter parameter3 = eq(param1, baz);
final QueryParameter parameter4 = eq(param2, foobar);
new EqualsTester().addEqualityGroup(parameter1, parameter2).addEqualityGroup(parameter3).addEqualityGroup(parameter4).testEquals();
}
use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.
the class ValidateShould method check_a_message_is_default_with_parametrized_error_message.
@Test(expected = IllegalStateException.class)
public void check_a_message_is_default_with_parametrized_error_message() {
final StringValue nonDefault = newUuidValue();
checkDefault(nonDefault, "Message value: %s, Type name: %s", nonDefault, TypeName.of(nonDefault));
}
Aggregations