|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.emarsys.ecommon.time.schedule.mock.MockSchedulable
public class MockSchedulable
Mock implementation of SchedulableQueueElement
for
unit testing purposes.
Field Summary | |
---|---|
protected java.util.Calendar |
lastProcessing
|
protected java.util.Calendar |
maxScheduleDate
|
protected int |
minSchedulingInterval
|
protected java.util.Calendar |
nextProcessing
|
protected java.util.Calendar |
queueingDate
|
protected int |
scheduledCount
|
Constructor Summary | |
---|---|
MockSchedulable()
|
Method Summary | |
---|---|
MockSchedulable |
getConcreteInstance()
|
java.util.Calendar |
getLastProcessing()
Returns the schedulable's last processing date. |
java.util.Calendar |
getMaxScheduleDate()
Returns the maximum schedule date which defines a date in the future and must not be exceeded on reschedulings. |
int |
getMinSchedulingInterval()
Returns the minimal scheduling interval in milliseconds that is compulsory for this SchedulableQueueElement . |
java.util.Calendar |
getNextProcessing()
Returns the next scheduled date which a priori is null . |
java.util.Calendar |
getQueueingDate()
Returns the schedulable's queueing date. |
java.util.Calendar |
getScheduled(QueueScheduler<MockSchedulable> scheduler)
(Re)schedules this queue element using the passed QueueScheduler . |
int |
getScheduledCount()
Returns this queue element's scheduled count. |
java.util.Calendar |
now()
Returns the schedulables notion of the current time. |
void |
setLastProcessing(java.util.Calendar lastProcessing)
|
void |
setMaxScheduleDate(java.util.Calendar maxScheduleDate)
|
void |
setMinSchedulingInterval(int minSchedulingInterval)
|
void |
setNextProcessing(java.util.Calendar nextProcessing)
|
void |
setQueueingDate(java.util.Calendar queueingDate)
|
void |
setScheduledCount(int scheduledCount)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int scheduledCount
protected int minSchedulingInterval
protected java.util.Calendar queueingDate
protected java.util.Calendar lastProcessing
protected java.util.Calendar nextProcessing
protected java.util.Calendar maxScheduleDate
Constructor Detail |
---|
public MockSchedulable()
Method Detail |
---|
public java.util.Calendar getScheduled(QueueScheduler<MockSchedulable> scheduler)
SchedulableQueueElement
(Re)schedules this queue element using the passed
QueueScheduler
.
The passed QueueScheduler
will be used to retrieve
a QueueSchedulingStrategy
for this
SchedulableQueueElement
that will be used to
calculate the date of the next processing
which will be set to the new value, see SchedulableQueueElement.getNextProcessing()
.
Futhermore the last processing date will be set to the current
time.
The SchedulableQueueElement
must not set its next
processing date to a value that's not at least
SchedulableQueueElement.getMinSchedulingInterval()
millis after the
last processing date
(which is SchedulableQueueElement.now()
during
SchedulableQueueElement.getScheduled(QueueScheduler)
).
getScheduled
in interface SchedulableQueueElement<MockSchedulable>
scheduler
- - the QueueScheduler
responsible for
scheduling this instance.
QueueScheduler
.SchedulableQueueElement.getScheduled(com.emarsys.ecommon.time.schedule.QueueScheduler)
public java.util.Calendar getLastProcessing()
SchedulableQueueElement
Returns the schedulable's last processing date.
The last scheduled date refers to the time of the
last rescheduling, i.e. on the last call to
SchedulableQueueElement.getScheduled(QueueScheduler)
this value should
have been set to SchedulableQueueElement.now()
.
A priori the last scheduled date is null
.
getLastProcessing
in interface SchedulableQueueElement<MockSchedulable>
null
.SchedulableQueueElement.now()
public void setLastProcessing(java.util.Calendar lastProcessing)
public java.util.Calendar getMaxScheduleDate()
SchedulableQueueElement
Returns the maximum schedule date which defines a date in the future and must not be exceeded on reschedulings.
getMaxScheduleDate
in interface SchedulableQueueElement<MockSchedulable>
null
if
there's no maximum restriction.public void setMaxScheduleDate(java.util.Calendar maxScheduleDate)
public java.util.Calendar getNextProcessing()
SchedulableQueueElement
Returns the next scheduled date which a priori is null
.
getNextProcessing
in interface SchedulableQueueElement<MockSchedulable>
null
.public int getMinSchedulingInterval()
SchedulableQueueElement
Returns the minimal scheduling interval in milliseconds
that is compulsory for this SchedulableQueueElement
.
On getting scheduled (see SchedulableQueueElement.getScheduled(QueueScheduler)
)
this schedulable must not set its next processing date
either to a value >= (SchedulableQueueElement.now()
+ minSchedulingInterval)
or to null
(which is actually the dequeueing of
the schedulable queue element).
getMinSchedulingInterval
in interface SchedulableQueueElement<MockSchedulable>
SchedulableQueueElement.getMinSchedulingInterval()
public void setMinSchedulingInterval(int minSchedulingInterval)
minSchedulingInterval
- the minSchedulingInterval to setpublic void setNextProcessing(java.util.Calendar nextProcessing)
public java.util.Calendar getQueueingDate()
SchedulableQueueElement
Returns the schedulable's queueing date.
The queueing date represents the timestamp when this
SchedulableQueueElement
has been added to the
queuing mechanism.
getQueueingDate
in interface SchedulableQueueElement<MockSchedulable>
Calendar
instance representing
a date in the past, must not be null
.public void setQueueingDate(java.util.Calendar queueingDate)
public int getScheduledCount()
SchedulableQueueElement
Returns this queue element's scheduled count.
The scheduled count specifies the number of times this
SchedulableQueueElement
got rescheduled, i.e. the
number of calls to SchedulableQueueElement.getScheduled(QueueScheduler)
.
Thus a priori the scheduled count is 0.
getScheduledCount
in interface SchedulableQueueElement<MockSchedulable>
SchedulableQueueElement
has been (re-)scheduled.public void setScheduledCount(int scheduledCount)
public java.util.Calendar now()
SchedulableQueueElement
Returns the schedulables notion of the current time.
Might be a clone of the queueing date.
now
in interface SchedulableQueueElement<MockSchedulable>
Calendar
with the schedulables current time
in its TimeZone
.public MockSchedulable getConcreteInstance()
getConcreteInstance
in interface GenericAdapter<MockSchedulable>
T
.GenericAdapter.getConcreteInstance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |