// Get the mailbox service provided listener
RemoteEventListener mbRel = getMailboxListener(mr);
// Create an event generator and pass it the
// mailbox's remote event listener.
TestGenerator myGen = TestUtils.createGenerator(manager);
EventRegistration evtReg =
myGen.register(EVENT_ID, // Event ID to use
null, // handback
mbRel, // Notification target
DURATION1); // Lease duration
Lease tgl = evtReg.getLease();
checkLease(tgl, DURATION1);
TestListener goodListener = TestUtils.createListener(manager);
int goodCount = 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),
};
//
// Kill event mailbox service
//
shutdown(0);
// Enable the first of our listener objects
// Enable good listener
logger.log(Level.INFO, "Enabling good listener");
mr.enableDelivery(goodListener);
goodCount = 5;
logger.log(Level.INFO, "Wating for event delivery of " + goodCount);
waitForEvents(goodListener, goodCount, MAX_WAIT);
logger.log(Level.INFO, "Asserting event count");
assertCount(goodListener, goodCount);
logger.log(Level.INFO, "Verifying events");
assertEvents(goodListener, events);
logger.log(Level.INFO, "Generating another event");
RemoteEvent re = myGen.generateEvent(evtReg.getID(), 3);
goodCount++;
logger.log(Level.INFO, "Wating for event delivery" + goodCount);
waitForEvents(goodListener, goodCount, MAX_WAIT);
logger.log(Level.INFO, "Asserting event count");
assertCount(goodListener, goodCount);