Class TestProcessingUnitRunner
- java.lang.Object
-
- com.github.toolarium.processing.unit.runtime.test.TestProcessingUnitRunner
-
- All Implemented Interfaces:
java.io.Serializable
public class TestProcessingUnitRunner extends java.lang.Object implements java.io.SerializableImplements a simple processing unit runner. It's made to use in unit tests.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTestProcessingUnitRunner()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IProcessingUnitgetProcesingUnit()Get the processing unit.IProcessStatusgetProcessStatus()Gets the last process statusintgetSuspendCounter()Gets the suspend counterlongrun(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList)Run processing unitlongrunAndAbort(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, java.lang.Integer numberOfCyclesBeforeStop)Run processing unit and abort after some cycleslongrunWithSuspendAndResume(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, java.lang.Long suspendAfterCycles, java.lang.Long suspendSleepTime, java.lang.Integer maxNumberOfSuspends)Run processing unit
-
-
-
Method Detail
-
run
public long run(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList) throws ValidationException, ProcessingException
Run processing unit- Parameters:
processingUnitClass- the processing unit classparameterList- the parameter list- Returns:
- the number of cycles
- Throws:
ValidationException- In case the processing can not be initilizedProcessingException- In case of an error in a processing
-
runAndAbort
public long runAndAbort(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, java.lang.Integer numberOfCyclesBeforeStop) throws ValidationException, ProcessingException
Run processing unit and abort after some cycles- Parameters:
processingUnitClass- the processing unit classparameterList- the parameter listnumberOfCyclesBeforeStop- the number of cycles before stop- Returns:
- the number of cycles
- Throws:
ValidationException- In case the processing can not be initilizedProcessingException- In case of an error in a processing
-
runWithSuspendAndResume
public long runWithSuspendAndResume(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, java.lang.Long suspendAfterCycles, java.lang.Long suspendSleepTime, java.lang.Integer maxNumberOfSuspends) throws ValidationException, ProcessingException
Run processing unit- Parameters:
processingUnitClass- the processing unit classparameterList- the parameter listsuspendAfterCycles- after the number of cycles it will suspendedsuspendSleepTime- the sleep time after suspending or nullmaxNumberOfSuspends- the max number of suspends- Returns:
- the number of cycles
- Throws:
ValidationException- In case the processing can not be initilizedProcessingException- In case of an error in a processing
-
getSuspendCounter
public int getSuspendCounter()
Gets the suspend counter- Returns:
- the suspend counter
-
getProcessStatus
public IProcessStatus getProcessStatus()
Gets the last process status- Returns:
- the last process status
-
getProcesingUnit
public IProcessingUnit getProcesingUnit()
Get the processing unit. IMPORTANT: Only to verify some results- Returns:
- the processing unit
-
-