org.axonframework.test.saga
Class FixtureExecutionResultImpl

java.lang.Object
  extended by org.axonframework.test.saga.FixtureExecutionResultImpl
All Implemented Interfaces:
FixtureExecutionResult

public class FixtureExecutionResultImpl
extends Object
implements FixtureExecutionResult

Default implementation of FixtureExecutionResult.

Since:
1.1
Author:
Allard Buijze

Method Summary
 FixtureExecutionResult expectActiveSagas(int expected)
          Expect the given number of Sagas to be active (i.e.
 FixtureExecutionResult expectAssociationWith(String associationKey, Object associationValue)
          Asserts that at least one of the active sagas is associated with the given associationKey and associationValue.
 FixtureExecutionResult expectDispatchedCommandsEqualTo(Object... expected)
          Asserts that the given commands have been dispatched in exactly the order given.
 FixtureExecutionResult expectDispatchedCommandsMatching(org.hamcrest.Matcher<? extends Iterable<?>> matcher)
          Asserts that the sagas dispatched commands as defined by the given matcher.
 FixtureExecutionResult expectNoAssociationWith(String associationKey, Object associationValue)
          Asserts that at none of the active sagas is associated with the given associationKey and associationValue.
 FixtureExecutionResult expectNoDispatchedCommands()
          Asserts that the sagas did not dispatch any commands.
 FixtureExecutionResult expectNoScheduledEvents()
          Assert that no events are scheduled for publication.
 FixtureExecutionResult expectPublishedEvents(Object... expected)
          Assert that the saga published events on the EventBus in the exact sequence of the given expected events.
 FixtureExecutionResult expectPublishedEventsMatching(org.hamcrest.Matcher<? extends Iterable<?>> matcher)
          Assert that the saga published events on the EventBus as defined by the given matcher.
 FixtureExecutionResult expectScheduledEvent(org.joda.time.DateTime scheduledTime, Object applicationEvent)
          Asserts that an event equal to the given ApplicationEvent has been scheduled for publication at the given scheduledTime.
 FixtureExecutionResult expectScheduledEvent(org.joda.time.Duration duration, Object applicationEvent)
          Asserts that an event equal to the given ApplicationEvent has been scheduled for publication after the given duration.
 FixtureExecutionResult expectScheduledEventMatching(org.joda.time.DateTime scheduledTime, org.hamcrest.Matcher<?> matcher)
          Asserts that an event matching the given matcher has been scheduled to be published at the given scheduledTime.
 FixtureExecutionResult expectScheduledEventMatching(org.joda.time.Duration duration, org.hamcrest.Matcher<?> matcher)
          Asserts that an event matching the given matcher has been scheduled to be published after the given duration.
 FixtureExecutionResult expectScheduledEventOfType(org.joda.time.DateTime scheduledTime, Class<?> eventType)
          Asserts that an event of the given eventType has been scheduled for publication at the given scheduledTime.
 FixtureExecutionResult expectScheduledEventOfType(org.joda.time.Duration duration, Class<?> eventType)
          Asserts that an event of the given eventType has been scheduled for publication after the given duration.
 void startRecording()
          Tells this class to start monitoring activity in infrastructure classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

startRecording

public void startRecording()
Tells this class to start monitoring activity in infrastructure classes.


expectActiveSagas

public FixtureExecutionResult expectActiveSagas(int expected)
Description copied from interface: FixtureExecutionResult
Expect the given number of Sagas to be active (i.e. ready to respond to incoming events.

Specified by:
expectActiveSagas in interface FixtureExecutionResult
Parameters:
expected - the expected number of active events in the repository
Returns:
the FixtureExecutionResult for method chaining

expectAssociationWith

public FixtureExecutionResult expectAssociationWith(String associationKey,
                                                    Object associationValue)
Description copied from interface: FixtureExecutionResult
Asserts that at least one of the active sagas is associated with the given associationKey and associationValue.

Specified by:
expectAssociationWith in interface FixtureExecutionResult
Parameters:
associationKey - The key of the association to verify
associationValue - The value of the association to verify
Returns:
the FixtureExecutionResult for method chaining

expectNoAssociationWith

public FixtureExecutionResult expectNoAssociationWith(String associationKey,
                                                      Object associationValue)
Description copied from interface: FixtureExecutionResult
Asserts that at none of the active sagas is associated with the given associationKey and associationValue.

Specified by:
expectNoAssociationWith in interface FixtureExecutionResult
Parameters:
associationKey - The key of the association to verify
associationValue - The value of the association to verify
Returns:
the FixtureExecutionResult for method chaining

expectScheduledEventMatching

public FixtureExecutionResult expectScheduledEventMatching(org.joda.time.Duration duration,
                                                           org.hamcrest.Matcher<?> matcher)
Description copied from interface: FixtureExecutionResult
Asserts that an event matching the given matcher has been scheduled to be published after the given duration.

Specified by:
expectScheduledEventMatching in interface FixtureExecutionResult
Parameters:
duration - The time to wait before the event should be published
matcher - A matcher defining the event expected to be published
Returns:
the FixtureExecutionResult for method chaining

expectScheduledEvent

public FixtureExecutionResult expectScheduledEvent(org.joda.time.Duration duration,
                                                   Object applicationEvent)
Description copied from interface: FixtureExecutionResult
Asserts that an event equal to the given ApplicationEvent has been scheduled for publication after the given duration.

Note that the source attribute of the application event is ignored when comparing events. Events are compared using an "equals" check on all fields in the events.

Specified by:
expectScheduledEvent in interface FixtureExecutionResult
Parameters:
duration - The time to wait before the event should be published
applicationEvent - The expected event
Returns:
the FixtureExecutionResult for method chaining

expectScheduledEventOfType

public FixtureExecutionResult expectScheduledEventOfType(org.joda.time.Duration duration,
                                                         Class<?> eventType)
Description copied from interface: FixtureExecutionResult
Asserts that an event of the given eventType has been scheduled for publication after the given duration.

Specified by:
expectScheduledEventOfType in interface FixtureExecutionResult
Parameters:
duration - The time to wait before the event should be published
eventType - The type of the expected event
Returns:
the FixtureExecutionResult for method chaining

expectScheduledEventMatching

public FixtureExecutionResult expectScheduledEventMatching(org.joda.time.DateTime scheduledTime,
                                                           org.hamcrest.Matcher<?> matcher)
Description copied from interface: FixtureExecutionResult
Asserts that an event matching the given matcher has been scheduled to be published at the given scheduledTime.

If the scheduledTime is calculated based on the "current time", use the FixtureConfiguration.currentTime() to get the time to use as "current time".

Specified by:
expectScheduledEventMatching in interface FixtureExecutionResult
Parameters:
scheduledTime - The time at which the event should be published
matcher - A matcher defining the event expected to be published
Returns:
the FixtureExecutionResult for method chaining

expectScheduledEvent

public FixtureExecutionResult expectScheduledEvent(org.joda.time.DateTime scheduledTime,
                                                   Object applicationEvent)
Description copied from interface: FixtureExecutionResult
Asserts that an event equal to the given ApplicationEvent has been scheduled for publication at the given scheduledTime.

If the scheduledTime is calculated based on the "current time", use the FixtureConfiguration.currentTime() to get the time to use as "current time".

Note that the source attribute of the application event is ignored when comparing events. Events are compared using an "equals" check on all fields in the events.

Specified by:
expectScheduledEvent in interface FixtureExecutionResult
Parameters:
scheduledTime - The time at which the event should be published
applicationEvent - The expected event
Returns:
the FixtureExecutionResult for method chaining

expectScheduledEventOfType

public FixtureExecutionResult expectScheduledEventOfType(org.joda.time.DateTime scheduledTime,
                                                         Class<?> eventType)
Description copied from interface: FixtureExecutionResult
Asserts that an event of the given eventType has been scheduled for publication at the given scheduledTime.

If the scheduledTime is calculated based on the "current time", use the FixtureConfiguration.currentTime() to get the time to use as "current time".

Specified by:
expectScheduledEventOfType in interface FixtureExecutionResult
Parameters:
scheduledTime - The time at which the event should be published
eventType - The type of the expected event
Returns:
the FixtureExecutionResult for method chaining

expectDispatchedCommandsEqualTo

public FixtureExecutionResult expectDispatchedCommandsEqualTo(Object... expected)
Description copied from interface: FixtureExecutionResult
Asserts that the given commands have been dispatched in exactly the order given. The command objects are compared using the equals method. Only commands as a result of the event in the "when" stage of the fixture are compared.

Specified by:
expectDispatchedCommandsEqualTo in interface FixtureExecutionResult
Parameters:
expected - The expected commands
Returns:
the FixtureExecutionResult for method chaining

expectDispatchedCommandsMatching

public FixtureExecutionResult expectDispatchedCommandsMatching(org.hamcrest.Matcher<? extends Iterable<?>> matcher)
Description copied from interface: FixtureExecutionResult
Asserts that the sagas dispatched commands as defined by the given matcher. Only commands as a result of the event in the "when" stage of the fixture are matched.

Specified by:
expectDispatchedCommandsMatching in interface FixtureExecutionResult
Parameters:
matcher - The matcher that describes the expected list of commands
Returns:
the FixtureExecutionResult for method chaining

expectNoDispatchedCommands

public FixtureExecutionResult expectNoDispatchedCommands()
Description copied from interface: FixtureExecutionResult
Asserts that the sagas did not dispatch any commands. Only commands as a result of the event in the "when" stage of ths fixture are recorded.

Specified by:
expectNoDispatchedCommands in interface FixtureExecutionResult
Returns:
the FixtureExecutionResult for method chaining

expectNoScheduledEvents

public FixtureExecutionResult expectNoScheduledEvents()
Description copied from interface: FixtureExecutionResult
Assert that no events are scheduled for publication. This means that either no events were scheduled at all, all schedules have been cancelled or all scheduled events have been published already.

Specified by:
expectNoScheduledEvents in interface FixtureExecutionResult
Returns:
the FixtureExecutionResult for method chaining

expectPublishedEventsMatching

public FixtureExecutionResult expectPublishedEventsMatching(org.hamcrest.Matcher<? extends Iterable<?>> matcher)
Description copied from interface: FixtureExecutionResult
Assert that the saga published events on the EventBus as defined by the given matcher. Only events published in the "when" stage of the tests are matched.

Specified by:
expectPublishedEventsMatching in interface FixtureExecutionResult
Parameters:
matcher - The matcher that defines the expected list of published events.
Returns:
the FixtureExecutionResult for method chaining

expectPublishedEvents

public FixtureExecutionResult expectPublishedEvents(Object... expected)
Description copied from interface: FixtureExecutionResult
Assert that the saga published events on the EventBus in the exact sequence of the given expected events. Events are compared comparing their type and fields using equals. Sequence number, aggregate identifier (for domain events) and source (for application events) are ignored in the comparison.

Specified by:
expectPublishedEvents in interface FixtureExecutionResult
Parameters:
expected - The sequence of events expected to be published by the Saga
Returns:
the FixtureExecutionResult for method chaining


Copyright © 2010-2016. All Rights Reserved.