checkLease(tgl, DURATION1);
logger.log(Level.INFO, "EventRegistration lease good until "
+ new Date(tgl.getExpiration()));
// Create two listener objects
TestListener myListener =
TestUtils.createDisableNSOListener(manager, mr);
logger.log(Level.INFO, "Got TestListener ref {0}", myListener);
int eventCount = 0;
// Generate some events
logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events");
RemoteEvent[] events = new RemoteEvent[NUM_EVENTS];
for (i = 0; i < NUM_EVENTS; i++) {
events[i] = myGen.generateEvent(evtReg.getID(), 3);
}
RemoteEvent[] bogus = {
new RemoteEvent(myGen, 9999, 9999, null),
new RemoteEvent(myGen, 5678, 1234, null),
};
// Enable the first of our listener objects
assertCount(myListener, eventCount);
logger.log(Level.INFO, "Enabling delivery to our REL" + myListener);
mr.enableDelivery(myListener);
// Add an extra delay here since we'll only block
// on the receipt of one event, but we really want
// to see if a second event is sent as well.
logger.log(Level.INFO, "sleeping for 5 sec");
try {
Thread.sleep(5000);
} catch (InterruptedException ie) {
logger.log(Level.INFO, "waking up early - interrupted");
}
logger.log(Level.INFO, "awoken");
logger.log(Level.INFO, "Wating for event delivery");
eventCount = 1;
waitForEvents(myListener, eventCount, MAX_WAIT);
logger.log(Level.INFO, "Verifying event delivery count of " + eventCount);
assertCount(myListener, eventCount);
logger.log(Level.INFO, "Verifying events ");
assertEvent(myListener, events[0]);
if(myListener.verifyEvents(bogus)) {
throw new TestException("Successfully verified bogus events");
}
mrl.cancel();
}