logger.log(Level.FINE, "Created Set 02 with lease duration of " +
"Lease.FOREVER.");
/* assert that attempting to add the set's lease to itself
generates an IllegalArgumentException */
Lease setLease = prepareLease(set01.getRenewalSetLease());
logger.log(Level.FINE, "Lease is " + setLease);
try {
set01.renewFor(setLease, renewGrant);
String message = "An attempt to add a renewal set's lease\n";
message += " to itself has succeeded.";
throw new TestException(message);
} catch (IllegalArgumentException ex) {
// success, keep on trucking ...
}
/* assert that attempting to add the set01's lease to set02
generates an IllegalArgumentException */
try {
set02.renewFor(setLease, renewGrant);
String message = "An attempt to add a renewal set's lease\n";
message += " to another set has succeeded.";
throw new TestException(message);
} catch (IllegalArgumentException ex) {
// success, keep on trucking ...
}
// create a lease that renews normally
logger.log(Level.FINE, "Creating the lease to be managed.");
logger.log(Level.FINE, "Duration == " + renewGrant);
TestLease testLease =
leaseProvider.createNewLease(leaseOwner,
rstUtil.durToExp(renewGrant));
// add the lease to set01
set01.renewFor(testLease, renewGrant);
/* assert that attempting to add the test lease to set02
succeeds. */
try {
set02.renewFor(testLease, renewGrant);
// success
} catch (IllegalArgumentException ex) {
String message = "An attempt to add a client lease\n";
message += " to two different sets has failed.";
throw new TestException(message, ex);
}
/*
* Assert that adding set01's lease to set02 succeeds if set01's
* lease has been cancelled.
*/
setLease.cancel();
try {
set02.renewFor(setLease, renewGrant);
} catch (IllegalArgumentException ex) {
throw new TestException("Failed to add an expired set "
+ "lease to another set",