String message = "ExpirationWarningEvent was never received.";
throw new TestException(message);
}
// capture the expiration time of the warning event
ExpirationWarningEvent warnEvent =
(ExpirationWarningEvent) warnListener.getEvents()[0];
long warnEventExpiration =
prepareLease(warnEvent.getRenewalSetLease()).getExpiration();
// wait for renewal failure event
failWaitThread.join(maxWaitTime);
// if the thread is still alive then the event was never received.
if (failWaitThread.isAlive() == true) {
String message = "RenewalFailureEvent was never received.";
throw new TestException(message);
}
// capture the expiration time of the renewal failure event
RenewalFailureEvent failEvent =
(RenewalFailureEvent) failListener.getEvents()[0];
long failEventExpiration = failEvent.getLease().getExpiration();
logger.log(Level.FINE, "Number of failure events = " +
warnListener.getEvents().length);
logger.log(Level.FINE, "Number of warning events = " +
failListener.getEvents().length);
/* ASSERTION #1 :
assert that the leases are the ones we expect */
if (warnLease.equals(prepareLease(warnEvent.getRenewalSetLease())) == false) {
String message = "Assertion #1 failed.\n" +
"Expiration warning lease does not match\n" +
"the lease encapsulated in the ExpirationWarningEvent " +
"object.";
throw new TestException(message);