Class TestProcessingUnitRunner<T extends IProcessingUnit>
- java.lang.Object
-
- com.github.toolarium.processing.unit.runtime.test.TestProcessingUnitRunner<T>
-
- All Implemented Interfaces:
java.io.Serializable
public class TestProcessingUnitRunner<T extends IProcessingUnit> 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 java.lang.StringgetId()Get the runnable idjava.lang.StringgetName()Get the runnable name or nulljava.util.List<Parameter>getParameterList()Get the processing parameter list.TgetProcesingUnit()Get the processing unit.ProcessingActionStatusgetProcessingActionStatus()Get the processing action statusProcessingRuntimeStatusgetProcessingRuntimeStatus()Get the processing runtime statuscom.github.toolarium.common.bandwidth.IBandwidthThrottlinggetProcessingUnitThrottling()Get the processing unit throttlingIProcessStatusgetProcessStatus()Gets the last process statusjava.util.List<java.lang.String>getStatusMessageList()Get the status message listintgetSuspendCounter()Gets the suspend counterIProcessingUnitRuntimeTimeMeasurementgetTimeMeasurement()Get the time measurementlongrun(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, long suspendAfterCycles, long suspendSleepTime, int maxNumberOfSuspends)Run processing unitlongrunWithSuspendAndResume(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, long suspendAfterCycles, long suspendSleepTime, int maxNumberOfSuspends, java.lang.Long maxNumberOfProcessingUnitCallsPerSecond)Run processing unitlongrunWithThrottling(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, java.lang.Long maxNumberOfProcessingUnitCallsPerSecond)Run processing unit and abort after some cyclesjava.lang.StringtoString()
-
-
-
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
-
runWithThrottling
public long runWithThrottling(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, java.lang.Long maxNumberOfProcessingUnitCallsPerSecond) throws ValidationException, ProcessingException
Run processing unit and abort after some cycles- Parameters:
processingUnitClass- the processing unit classparameterList- the parameter listmaxNumberOfProcessingUnitCallsPerSecond- the max number of calls per second of the processing unit- 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, long suspendAfterCycles, long suspendSleepTime, int 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
-
runWithSuspendAndResume
public long runWithSuspendAndResume(java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, long suspendAfterCycles, long suspendSleepTime, int maxNumberOfSuspends, java.lang.Long maxNumberOfProcessingUnitCallsPerSecond) 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 suspendsmaxNumberOfProcessingUnitCallsPerSecond- the max number of calls per second of the processing unit- 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
-
getId
public java.lang.String getId()
Get the runnable id- Returns:
- the runnable id
-
getName
public java.lang.String getName()
Get the runnable name or null- Returns:
- the name or null
-
getProcessingActionStatus
public ProcessingActionStatus getProcessingActionStatus()
Get the processing action status- Returns:
- the processing action status
-
getProcessStatus
public IProcessStatus getProcessStatus()
Gets the last process status- Returns:
- the last process status
-
getProcessingRuntimeStatus
public ProcessingRuntimeStatus getProcessingRuntimeStatus()
Get the processing runtime status- Returns:
- the processing runtime status
-
getStatusMessageList
public java.util.List<java.lang.String> getStatusMessageList()
Get the status message list- Returns:
- the status message list
-
getTimeMeasurement
public IProcessingUnitRuntimeTimeMeasurement getTimeMeasurement()
Get the time measurement- Returns:
- the time measurement
-
getProcesingUnit
public T getProcesingUnit()
Get the processing unit. IMPORTANT: Only to verify some results- Returns:
- the processing unit
-
getParameterList
public java.util.List<Parameter> getParameterList()
Get the processing parameter list.- Returns:
- the processing parameter list
-
getProcessingUnitThrottling
public com.github.toolarium.common.bandwidth.IBandwidthThrottling getProcessingUnitThrottling()
Get the processing unit throttling- Returns:
- the processing unit throttling
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
-