Package net.officefloor.frame.test
Class MockManagedObjectSource
- java.lang.Object
-
- net.officefloor.frame.test.MockManagedObjectSource
-
- All Implemented Interfaces:
ManagedObjectSource<None,None>
@TestSource public class MockManagedObjectSource extends java.lang.Object implements ManagedObjectSource<None,None>
Mock implementation of theManagedObjectSource
for testing.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected net.officefloor.frame.test.MockManagedObjectSource.ManagedObjectSourceState
managedObjectSourceState
MockManagedObjectSource.ManagedObjectSourceState
.
-
Constructor Summary
Constructors Constructor Description MockManagedObjectSource()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <F extends java.lang.Enum<F>>
ManagedObjectBuilder<F>bindManagedObject(java.lang.String name, ManagedObject managedObject, ManagedObjectSourceMetaData<?,F> sourceMetaData, OfficeFloorBuilder officeFloorBuilder)
Convenience method to bind theManagedObject
instance to theManagedObjectBuilder
.ManagedObjectSourceSpecification
getSpecification()
Obtains the specification for this.ManagedObjectSourceMetaData<None,None>
init(ManagedObjectSourceContext context)
Initialises theManagedObjectSource
.void
sourceManagedObject(ManagedObjectUser user)
Sources aManagedObject
from thisManagedObjectSource
.void
start(ManagedObjectExecuteContext<None> context)
Called once afterManagedObjectSource.init(ManagedObjectSourceContext)
to indicate thisManagedObjectSource
should start execution.void
stop()
Called to notify that theOfficeFloor
is being closed.
-
-
-
Method Detail
-
bindManagedObject
public static <F extends java.lang.Enum<F>> ManagedObjectBuilder<F> bindManagedObject(java.lang.String name, ManagedObject managedObject, ManagedObjectSourceMetaData<?,F> sourceMetaData, OfficeFloorBuilder officeFloorBuilder)
Convenience method to bind theManagedObject
instance to theManagedObjectBuilder
.- Type Parameters:
F
- Flow type.- Parameters:
name
- Name to bind under.managedObject
-ManagedObject
to bind.sourceMetaData
-ManagedObjectSourceMetaData
to bind.officeFloorBuilder
-OfficeFloorBuilder
to bindManagedObject
.- Returns:
ManagedObjectBuilder
for additional configuration.
-
getSpecification
public ManagedObjectSourceSpecification getSpecification()
Description copied from interface:ManagedObjectSource
Obtains the specification for this.
This will be called before any other methods, therefore this method must be able to return the specification immediately after a default constructor instantiation.
- Specified by:
getSpecification
in interfaceManagedObjectSource<None,None>
- Returns:
- Specification of this.
-
init
public ManagedObjectSourceMetaData<None,None> init(ManagedObjectSourceContext context) throws java.lang.Exception
Description copied from interface:ManagedObjectSource
Initialises theManagedObjectSource
.- Specified by:
init
in interfaceManagedObjectSource<None,None>
- Parameters:
context
-ManagedObjectSourceContext
to use in initialising.- Returns:
- Meta-data to describe this.
- Throws:
java.lang.Exception
- Should theManagedObjectSource
fail to configure itself from the input properties.
-
start
public void start(ManagedObjectExecuteContext<None> context) throws java.lang.Exception
Description copied from interface:ManagedObjectSource
Called once after
ManagedObjectSource.init(ManagedObjectSourceContext)
to indicate thisManagedObjectSource
should start execution.On invocation of this method,
ProcessState
instances may be invoked via theManagedObjectExecuteContext
.- Specified by:
start
in interfaceManagedObjectSource<None,None>
- Parameters:
context
-ManagedObjectExecuteContext
to use in starting thisManagedObjectSource
.- Throws:
java.lang.Exception
- Should theManagedObjectSource
fail to start execution.
-
sourceManagedObject
public void sourceManagedObject(ManagedObjectUser user)
Description copied from interface:ManagedObjectSource
Sources aManagedObject
from thisManagedObjectSource
.- Specified by:
sourceManagedObject
in interfaceManagedObjectSource<None,None>
- Parameters:
user
-ManagedObjectUser
interested in using theManagedObject
.
-
stop
public void stop()
Description copied from interface:ManagedObjectSource
Called to notify that the
OfficeFloor
is being closed.On return from this method, no further
ProcessState
instances may be invoked.- Specified by:
stop
in interfaceManagedObjectSource<None,None>
-
-