|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.emarsys.ecommon.time.schedule.mock.MockQueueScheduler<T>
public class MockQueueScheduler<T>
Mock implementation of QueueScheduler
for unit
testing purposes.
Field Summary | |
---|---|
protected java.util.Map<SchedulableQueueElement<T>,QueueSchedulingContext<T>> |
contexts
|
protected java.util.Map<SchedulableQueueElement<T>,QueueSchedulingStrategy<T>> |
strategies
|
Constructor Summary | |
---|---|
MockQueueScheduler(java.lang.Class<T> concreteSchedulableClass)
|
Method Summary | ||
---|---|---|
QueueSchedulingContext<T> |
getContext(SchedulableQueueElement<T> schedulable)
Retrieves the QueueSchedulingContext for the
passed SchedulableQueueElement . |
|
static MockQueueScheduler<MockSchedulable> |
getInstance()
|
|
static
|
getInstance(java.lang.Class<T> concreteSchedulableClass)
|
|
QueueSchedulingStrategy<T> |
getSchedulingStrategy(SchedulableQueueElement<T> schedulable)
Will create and initialize/configure a new strategy instance if not yet present. |
|
java.util.Map<SchedulableQueueElement<T>,QueueSchedulingStrategy<T>> |
getStrategies()
|
|
java.util.Calendar |
now()
Creates a new Calendar with the schedulers current time
in its TimeZone representing the current time. |
|
QueueSchedulingStrategy<T> |
register(SchedulableQueueElement<T> schedulable,
QueueSchedulingStrategy<T> strategy)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.Map<SchedulableQueueElement<T>,QueueSchedulingStrategy<T>> strategies
protected final java.util.Map<SchedulableQueueElement<T>,QueueSchedulingContext<T>> contexts
Constructor Detail |
---|
public MockQueueScheduler(java.lang.Class<T> concreteSchedulableClass)
Method Detail |
---|
public static final MockQueueScheduler<MockSchedulable> getInstance()
public static final <T> MockQueueScheduler<T> getInstance(java.lang.Class<T> concreteSchedulableClass)
T
- concreteSchedulableClass
-
public QueueSchedulingStrategy<T> getSchedulingStrategy(SchedulableQueueElement<T> schedulable)
QueueScheduler
getSchedulingStrategy
in interface QueueScheduler<T>
QueueSchedulingStrategy
instance associated
with the passed schedulable.com.emarsys.ecommon.time.schedule.QueueScheduler#getSchedulingStrategy()
public QueueSchedulingStrategy<T> register(SchedulableQueueElement<T> schedulable, QueueSchedulingStrategy<T> strategy)
key
- value
-
public java.util.Map<SchedulableQueueElement<T>,QueueSchedulingStrategy<T>> getStrategies()
public java.util.Calendar now()
QueueScheduler
Calendar
with the schedulers current time
in its TimeZone
representing the current time.
All Calendar
instances in the context of queue scheduling
should be created through this method in order to prevent
mismatching TimeZone
s or Locale
. Furthermore
if this is used as a factory method for dates it enables
easier testing because progressing time could easily be mocked.
now
in interface QueueScheduler<T>
Calendar
with the schedulers current time
in its TimeZone
.QueueScheduler.now()
public QueueSchedulingContext<T> getContext(SchedulableQueueElement<T> schedulable)
QueueScheduler
Retrieves the QueueSchedulingContext
for the
passed SchedulableQueueElement
. If no such
context is present a new instance will be created and
registered with the QueueScheduler
.
The QueueSchedulingContext
is used to save
parameters that are associated with a specific
scheduling process.
getContext
in interface QueueScheduler<T>
schedulable
- - the SchedulableQueueElement
QueueSchedulingContext
instance
associated with this QueueScheduler
and the passed
SchedulableQueueElement
; never null
.QueueScheduler.getContext(com.emarsys.ecommon.time.schedule.SchedulableQueueElement)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |