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 theManagedObjectSourcefor testing.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected net.officefloor.frame.test.MockManagedObjectSource.ManagedObjectSourceStatemanagedObjectSourceStateMockManagedObjectSource.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 theManagedObjectinstance to theManagedObjectBuilder.ManagedObjectSourceSpecificationgetSpecification()Obtains the specification for this.ManagedObjectSourceMetaData<None,None>init(ManagedObjectSourceContext context)Initialises theManagedObjectSource.voidsourceManagedObject(ManagedObjectUser user)Sources aManagedObjectfrom thisManagedObjectSource.voidstart(ManagedObjectExecuteContext<None> context)Called once afterManagedObjectSource.init(ManagedObjectSourceContext)to indicate thisManagedObjectSourceshould start execution.voidstop()Called to notify that theOfficeFlooris 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 theManagedObjectinstance to theManagedObjectBuilder.- Type Parameters:
F- Flow type.- Parameters:
name- Name to bind under.managedObject-ManagedObjectto bind.sourceMetaData-ManagedObjectSourceMetaDatato bind.officeFloorBuilder-OfficeFloorBuilderto bindManagedObject.- Returns:
ManagedObjectBuilderfor additional configuration.
-
getSpecification
public ManagedObjectSourceSpecification getSpecification()
Description copied from interface:ManagedObjectSourceObtains 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:
getSpecificationin interfaceManagedObjectSource<None,None>- Returns:
- Specification of this.
-
init
public ManagedObjectSourceMetaData<None,None> init(ManagedObjectSourceContext context) throws java.lang.Exception
Description copied from interface:ManagedObjectSourceInitialises theManagedObjectSource.- Specified by:
initin interfaceManagedObjectSource<None,None>- Parameters:
context-ManagedObjectSourceContextto use in initialising.- Returns:
- Meta-data to describe this.
- Throws:
java.lang.Exception- Should theManagedObjectSourcefail to configure itself from the input properties.
-
start
public void start(ManagedObjectExecuteContext<None> context) throws java.lang.Exception
Description copied from interface:ManagedObjectSourceCalled once after
ManagedObjectSource.init(ManagedObjectSourceContext)to indicate thisManagedObjectSourceshould start execution.On invocation of this method,
ProcessStateinstances may be invoked via theManagedObjectExecuteContext.- Specified by:
startin interfaceManagedObjectSource<None,None>- Parameters:
context-ManagedObjectExecuteContextto use in starting thisManagedObjectSource.- Throws:
java.lang.Exception- Should theManagedObjectSourcefail to start execution.
-
sourceManagedObject
public void sourceManagedObject(ManagedObjectUser user)
Description copied from interface:ManagedObjectSourceSources aManagedObjectfrom thisManagedObjectSource.- Specified by:
sourceManagedObjectin interfaceManagedObjectSource<None,None>- Parameters:
user-ManagedObjectUserinterested in using theManagedObject.
-
stop
public void stop()
Description copied from interface:ManagedObjectSourceCalled to notify that the
OfficeFlooris being closed.On return from this method, no further
ProcessStateinstances may be invoked.- Specified by:
stopin interfaceManagedObjectSource<None,None>
-
-