logger.log(Level.INFO, "Starting up " + this.getClass().toString());
PullEventMailbox mb = getPullMailbox();
logger.log(Level.INFO, "Got mailbox reference: {0}", mb);
MailboxPullRegistration mr1 = getPullRegistration(mb, DURATION1);
logger.log(Level.INFO, "Got mailbox registration reference: {0}", mr1);
// Exercises MailboxPullRegistration.getLease()
checkLease(getPullMailboxLease(mr1), DURATION1);
logger.log(Level.INFO, "Checked mailbox lease");
// Exercises MailboxPullRegistration.getListener()
RemoteEventListener rel = getPullMailboxListener(mr1);
logger.log(Level.INFO, "Got mailbox listener reference: {0}", rel);
// Exercises mailbox listener re-submission which is not allowed
try {
mr1.enableDelivery(rel);
throw new TestException("Successfully submitted service's "
+ "listener back to itself");
} catch (IllegalArgumentException iae) {
// ignore -- expected
}
logger.log(Level.INFO, "Unable to resubmit listener reference -- OK");
// create new listener object
rel = TestUtils.createListener(manager);
logger.log(Level.INFO, "Got test listener reference: {0}", rel);
// submit listener
mr1.enableDelivery(rel);
logger.log(Level.INFO, "Enabled listener reference");
// Exercise disableDelivery
mr1.disableDelivery();
logger.log(Level.INFO, "Disabled listener reference");
// Exercises getRemoteEvents and next
net.jini.event.RemoteEventIterator i = mr1.getRemoteEvents();
logger.log(Level.INFO, "Got event iterator: {0}", i);
if (i.next(5000L) != null) {
throw new TestException("Got event from empty registration");
}
logger.log(Level.INFO, "No received events -- OK");
// Exercises addUnknownEvents with empty set
Collection unkEvts = new ArrayList(3);
mr1.addUnknownEvents(unkEvts);
logger.log(Level.INFO, "Called addUnknownEvents with empty set.");
//Exercise iterator close
i.close();
logger.log(Level.INFO, "Closed iterator");