| test.compliance.timer.TimerTest
TimerTest | public class TimerTest extends TestCase implements NotificationListener(Code) | | Basic timer test.
The aim of these tests is to check the most common uses of the timer
service.
author: Adrian Brock. |
PERIOD | final public static long PERIOD(Code) | | The period for a timer notification. This needs to be small so the tests * don't take too long. * The wait needs to be long enough to be sure the monitor has enough time * to send the notification and switch the context to the handler.
|
REPEATS | final public static long REPEATS(Code) | | The number of repeats for occurances tests
|
WAIT | final public static long WAIT(Code) | | |
receivedNotifications | ArrayList receivedNotifications(Code) | | The received notifications
|
checkNotificationID | public void checkNotificationID(TimerNotification pNotification, Integer pNotificationID)(Code) | | Checks if the given Notification ID is the same as the
one of the given Notification
Parameters: pNotification - Notification to be tested Parameters: pNotificationID - Id the Notification should have |
checkTimeDifference | public void checkTimeDifference(TimerNotification pNotificationOne, TimerNotification pNotificationTwo, long pTimeDiffernce)(Code) | | Checks if the time between the two Notification is in a
+- 10% limit
Parameters: pNotificationOne - First Notification to be tested Parameters: pNotificationTwo - Second Notification to be tested Parameters: pTimeDiffernce - Expected Time Difference |
expectNotifications | public void expectNotifications(int expected) throws Exception(Code) | | Wait for the timer notification and see if we have the correct number
hopefully this should synchronize this test with the timer thread.
Parameters: expected - the number of notifications expected throws: Exception - when the notifications are incorrect |
expectNotifications | public void expectNotifications(int expected, long wait) throws Exception(Code) | | Wait for the timer notification and see if we have the correct number
hopefully this should synchronize this test with the timer thread.
Parameters: expected - the number of notifications expected Parameters: wait - time in milli seconds to wait for the notification throws: Exception - when the notifications are incorrect |
handleNotification | public void handleNotification(Notification notification, Object handback)(Code) | | Handle a notification, just add it to the list
Parameters: notification - the notification received Parameters: handback - not used |
testInfiniteNotification | public void testInfiniteNotification() throws Exception(Code) | | Test infinite notification works.
|
testRepeatedNotification | public void testRepeatedNotification() throws Exception(Code) | | Test a repeated notification works.
|
testSingleNotification | public void testSingleNotification() throws Exception(Code) | | Test a single notification works.
|
testTwoNotificationProducers | public void testTwoNotificationProducers() throws Exception(Code) | | Test two infinite notification works.
|
|
|