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 Object
implements ManagedObjectSource<None,None>
Mock implementation of the
ManagedObjectSource for testing.- Author:
- Daniel Sagenschneider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.officefloor.frame.test.MockManagedObjectSource.ManagedObjectSourceStateMockManagedObjectSource.ManagedObjectSourceState. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <F extends Enum<F>>
ManagedObjectBuilder<F>bindManagedObject(String name, ManagedObject managedObject, ManagedObjectSourceMetaData<?, F> sourceMetaData, OfficeFloorBuilder officeFloorBuilder) Convenience method to bind theManagedObjectinstance to theManagedObjectBuilder.Obtains the specification for this.init(ManagedObjectSourceContext context) Initialises theManagedObjectSource.voidSources aManagedObjectfrom thisManagedObjectSource.voidstart(ManagedObjectExecuteContext<None> context) Called once afterManagedObjectSource.init(ManagedObjectSourceContext)to indicate thisManagedObjectSourceshould start execution.voidstop()Called to notify that theOfficeFlooris being closed.
-
Field Details
-
managedObjectSourceState
protected net.officefloor.frame.test.MockManagedObjectSource.ManagedObjectSourceState managedObjectSourceStateMockManagedObjectSource.ManagedObjectSourceState.
-
-
Constructor Details
-
MockManagedObjectSource
public MockManagedObjectSource()Default constructor.
-
-
Method Details
-
bindManagedObject
public static <F extends Enum<F>> ManagedObjectBuilder<F> bindManagedObject(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
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 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:
Exception- Should theManagedObjectSourcefail to configure itself from the input properties.
-
start
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:
Exception- Should theManagedObjectSourcefail to start execution.
-
sourceManagedObject
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>
-