public class StubAggregateLifecycle
extends org.axonframework.modelling.command.AggregateLifecycle
activate()
) and deactivated (see close()
) at will. Events
applied while it is active are stored and can be retrieved using getAppliedEvents()
or
getAppliedEventPayloads()
.
When using with JUnit, consider using the StubAggregateLifecycleRule
with @Rule
instead, as it is easier and safer to use.
Constructor and Description |
---|
StubAggregateLifecycle() |
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates this lifecycle instance.
|
void |
close()
Closes this lifecycle instance, restoring to the situation prior to this lifecycle being started.
|
protected <T> org.axonframework.modelling.command.ApplyMore |
doApply(T payload,
org.axonframework.messaging.MetaData metaData) |
protected <T> org.axonframework.modelling.command.Aggregate<T> |
doCreateNew(Class<T> aggregateType,
Callable<T> factoryMethod) |
protected void |
doMarkDeleted() |
List<Object> |
getAppliedEventPayloads()
Returns the payloads of the Events applied while this lifecycle instance was active.
|
List<org.axonframework.eventhandling.EventMessage<?>> |
getAppliedEvents()
Returns the list of applied Events for this lifecycle instance.
|
protected boolean |
getIsLive() |
protected Object |
identifier() |
boolean |
isMarkedDeleted()
Indicates whether an Aggregate has invoked "markDeleted" while this lifecycle was active.
|
protected String |
type() |
protected Long |
version() |
apply, apply, createNew, describeScope, execute, getInstance, getVersion, isLive, markDeleted
public void activate()
close()
is called.public void close()
protected boolean getIsLive()
getIsLive
in class org.axonframework.modelling.command.AggregateLifecycle
protected <T> org.axonframework.modelling.command.Aggregate<T> doCreateNew(Class<T> aggregateType, Callable<T> factoryMethod) throws Exception
doCreateNew
in class org.axonframework.modelling.command.AggregateLifecycle
Exception
protected String type()
type
in class org.axonframework.modelling.command.AggregateLifecycle
protected Object identifier()
identifier
in class org.axonframework.modelling.command.AggregateLifecycle
protected Long version()
version
in class org.axonframework.modelling.command.AggregateLifecycle
protected void doMarkDeleted()
doMarkDeleted
in class org.axonframework.modelling.command.AggregateLifecycle
protected <T> org.axonframework.modelling.command.ApplyMore doApply(T payload, org.axonframework.messaging.MetaData metaData)
doApply
in class org.axonframework.modelling.command.AggregateLifecycle
public List<org.axonframework.eventhandling.EventMessage<?>> getAppliedEvents()
Note that this list is not reset when activating or deactivating the lifecycle.
public List<Object> getAppliedEventPayloads()
AggregateLifecycle.apply(Object)
method.public boolean isMarkedDeleted()
true
if AggregateLifecycle.markDeleted()
was invoked, otherwise false
Copyright © 2010–2024. All rights reserved.