Search in sources :

Example 1 with TestEventFactory

use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.

the class EventEnricherShould method createEvent.

private static Event createEvent(Message msg) {
    final TestEventFactory eventFactory = newInstance(EventEnricherShould.class);
    final Event event = eventFactory.createEvent(msg);
    return event;
}
Also used : TestEventFactory(io.spine.server.command.TestEventFactory) Event(io.spine.core.Event) GivenEvent(io.spine.server.event.given.EventEnricherTestEnv.GivenEvent)

Example 2 with TestEventFactory

use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.

the class IntegrationBusTestEnv method projectStarted.

public static Event projectStarted() {
    final ProjectId projectId = projectId();
    final TestEventFactory eventFactory = newInstance(pack(projectId), IntegrationBusTestEnv.class);
    return eventFactory.createEvent(ItgProjectStarted.newBuilder().setProjectId(projectId).build());
}
Also used : TestEventFactory(io.spine.server.command.TestEventFactory) ProjectId(io.spine.test.integration.ProjectId)

Example 3 with TestEventFactory

use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.

the class ProjectionRepositoryShould method checkDispatchesEvent.

private void checkDispatchesEvent(Message eventMessage) {
    final TestEventFactory eventFactory = newEventFactory(tenantId(), PRODUCER_ID);
    final Event event = eventFactory.createEvent(eventMessage);
    keepTenantIdFromEvent(boundedContext, event);
    repository().dispatch(EventEnvelope.of(event));
    assertTrue(TestProjection.processed(eventMessage));
}
Also used : TestEventFactory(io.spine.server.command.TestEventFactory) GivenEvent(io.spine.core.given.GivenEvent) Event(io.spine.core.Event)

Example 4 with TestEventFactory

use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.

the class ProjectionEventDeliveryTestEnv method projectCreated.

public static Event projectCreated() {
    final ProjectId projectId = projectId();
    final TestEventFactory eventFactory = TestEventFactory.newInstance(pack(projectId), ProjectionEventDeliveryTestEnv.class);
    final PrjProjectCreated msg = PrjProjectCreated.newBuilder().setProjectId(projectId).build();
    final Event result = eventFactory.createEvent(msg);
    return result;
}
Also used : PrjProjectCreated(io.spine.test.projection.event.PrjProjectCreated) TestEventFactory(io.spine.server.command.TestEventFactory) ProjectId(io.spine.test.projection.ProjectId) Event(io.spine.core.Event)

Example 5 with TestEventFactory

use of io.spine.server.command.TestEventFactory in project core-java by SpineEventEngine.

the class DelegatingEventDispatcherShould method delegate_onError.

@Test
public void delegate_onError() {
    final TestEventFactory factory = TestEventFactory.newInstance(getClass());
    final EventEnvelope envelope = EventEnvelope.of(factory.createEvent(newUuidValue()));
    final RuntimeException exception = new RuntimeException("test delegating onError");
    delegatingDispatcher.onError(envelope, exception);
    assertTrue(delegate.onErrorCalled());
    assertEquals(exception, delegate.getLastException());
}
Also used : EventEnvelope(io.spine.core.EventEnvelope) TestEventFactory(io.spine.server.command.TestEventFactory) Test(org.junit.Test)

Aggregations

TestEventFactory (io.spine.server.command.TestEventFactory)16 Event (io.spine.core.Event)10 Test (org.junit.Test)8 EventEnvelope (io.spine.core.EventEnvelope)4 StringValue (com.google.protobuf.StringValue)3 ProjectId (io.spine.test.aggregate.ProjectId)2 AggProjectArchived (io.spine.test.aggregate.event.AggProjectArchived)2 ProjectId (io.spine.test.integration.ProjectId)2 NullPointerTester (com.google.common.testing.NullPointerTester)1 Duration (com.google.protobuf.Duration)1 FloatValue (com.google.protobuf.FloatValue)1 Int32Value (com.google.protobuf.Int32Value)1 Timestamp (com.google.protobuf.Timestamp)1 TestActorRequestFactory (io.spine.client.TestActorRequestFactory)1 Command (io.spine.core.Command)1 MessageEnvelope (io.spine.core.MessageEnvelope)1 Version (io.spine.core.Version)1 GivenEvent (io.spine.core.given.GivenEvent)1 AggregateEventRecord (io.spine.server.aggregate.AggregateEventRecord)1 FailingAggregateRepository (io.spine.server.aggregate.given.AggregateRepositoryTestEnv.FailingAggregateRepository)1