Lease Renewal Service Tests

Test Name & Motivation | Description | Categorization | Specification Requirements
# EqualsTest Tests the LRS equals method. Matrix ID 1. | Register two LRS services with a lookup (service #1 and service #2) Obtain two proxies for service #1 and one proxy for service #2. Assert that the two proxies from service #1 return true from the “equals” method. Assert that the proxy from service #1 and the proxy from service #2 return false from the “equals” method. Create an Integer object new Integer(99). Assert that service #1 equals the integer returns false. | A1, M1 | LRS section 9.3 pg. 107
# AddRemoveTest Tests that the addLease and removeLease methods work as expected. Matrix ID 26. | Create a lease renewal set with a lease of forever. Create a valid lease or obtain one from a service with a duration value of forever. Add the lease to the set using the addLease method with a membership duration of forever. Remove the lease using the removeLease method. Assert that the lease returned by removeLease is equal to the lease that was added to the set. Attempt to remove the lease from the set again. Assert that removeLease returns a null value. | A1, M1 | LRS section 9.3 pg. 109-110
# ExpireRemoveTest Assert that a lease whose membership expiration has expired is removed from the set and that no further attempts to renew the lease are made for at least half the lease duration time, after the lease has expired. Matrix ID 2, 3, 13 | Create a lease renewal set with a lease of forever. Create a special lease that maintains a count of renewal attempts with a duration value of 60000 milliseconds. Add the lease to the set using the addLease method with a membership duration of 30000 milliseconds. Sleep for 40000 milliseconds. Attempt to remove the lease from the set. Assert that the call to removeLease returns a null value. Assert that no lease renewal attempts have been made on the lease. | A1, M1 | LRS section 9.3 pg. 108
# ExpireSetSleepTest Assert that a lease renewal set is nullified when its lease expires or is cancelled but the leases it holds remain unaffected. Matrix ID 4, 10, 19 | Create a lease renewal set with a lease of 30000 milliseconds. Create 3 valid leases with durations of 50000, 100000, and 150000 milliseconds respectively. Add leases to the lease renewal set with membership duration of forever. Sleep for 35000 milliseconds. Use the getLease method to assert that the lease has expired. Assert that the three original leases are still active and that their expiration times have not changed. Assert that attempts to remove one of the three original leases fails with a NoSuchObjectException. Assert that an attempt to add a lease fails with a NoSuchObjectException. | A1, M1 | LRS section 9.3 pg. 108
# ExpireSetCancelTest Assert that a lease renewal set is nullified when its lease expires or is cancelled but the leases it holds remain unaffected. Matrix ID 4, 10, 19 | Create a lease renewal set with a lease of 30000 milliseconds. Create 3 valid leases with durations of 50000, 100000, and 150000 milliseconds respectively. Add leases to the lease renewal set with membership duration of forever. Call cancel on the renewal set’s lease. Use the getLease method to assert that the lease has expired. Assert that the three original leases are still active and that their expiration times have not changed. Assert that attempts to remove one of the three original leases fails with a NoSuchObjectException. Assert that an attempt to add a lease fails with a NoSuchObjectException. Perform the above 8 steps again except in step #4 cancel the set’s lease instead of sleeping. | A1, M1 | LRS section 9.3 pg. 108
# ExpirationListenerTest Assert the following: An event gets delivered to a RemoteEventListener before a lease in the lease renewal set expires. The handback in the ExpirationWarningEvent is rational The listener must be non-null. The minWarning must be 0 or greater. A minWarning value that exceeds the current duration of the set’s lease causes immediate delivery of the ExpirationWarningEvent. Matrix ID 5, 30, 31, 32, 33, 34, 35, 36 | Create a special RemoteEventListener which will log the times when it receives notify callbacks. Create a lease renewal set with lease of 120000 milliseconds. Create a MarshalledObject from “new Integer(99)” to serve as the handback arg. Pass the listener to the set’s setExpirationWarningListener method with a minWarning of 60000 milliseconds. Use the MarshalledObject created in step 3 as the handback. Wait until the renewal set lease has expired. Assert that the event notification was logged and the current time is approximately lease expiration time minus 60000 milliseconds. Assert that the MarshalledObject handed back in the ExpirationWarningEvent is equal to the original object handed in. Use the MarshalledObject equals method to make this determination. Create a lease renewal set with lease of 120000 milliseconds. Assert that an attempt to call the setExpirationWarningListener method with a null listener throws a NullPointerException. Assert that an attempt to call the setExpirationWarningListener method with a minWarning value of less than 0 throws an IllegalArgumentException. Assert that an attempt to call the setExpirationWarningListener method with a minWarning value of 0 does not throw an IllegalArgumentException. Assert that an attempt to call the setExpirationWarningListener method with a minWarning of 120000 milliseconds the event is logged immediately (minus some slop for propagation time). | A1, M1 | LRS section 9.3 pg. 108
RenewalFailureListenerTest Assert that an event gets delivered to a RemoteEventListener when a lease expires before its expiration time runs out. The handback in the RnewalFailureEvent is rational Assert that the lease for the EventRegistration is the same as the set’s lease. The listener must be non-null. Matrix ID 7, 44, 45, 46, 47, 49 | Create a special lease (duration of 20000 milliseconds) that will throw a definite exception when any attempt is made to renew it. Create a lease renewal set with a lease of forever. Create a special RemoteEventListener which will log the times when it receives notify callbacks. Create a MarshalledObject from “new Integer(99)” to serve as the handback arg. Establish the listener using the set’s setRenewalFailureListener method and the handback arg. Save the EventRegistration object (eventReg). Add lease to the set with membership duration of forever. Assert that eventReg getLease() equals set getLease(). Wait 30000 milliseconds for the listener to send notification. Assert that the event notification was logged before lease expiration time. Assert that the MarshalledObject handed back in the RenewalFailureEvent is equal to the original object handed in. Use the MarshalledObject equals method to make this determination. Assert that an attempt to call the setRenewalFailureListener method with a null listener throws a NullPointerException. | A1, M1 | LRS section 9.3 pg. 108
# RenewalFailureIndefiniteTest Assert that an event gets delivered for an indefinite exception only after the expiration time of the lease. Not in matrix. | Create a special lease (duration of 30000 milliseconds) that will throw an indefinite exception when any attempt is made to renew it and will count the number of times it has been renewed. Create a lease renewal set with a lease of forever. Create a special RemoteEventListener which will log the times when it receives notify callbacks. Establish the listener using the set’s setRenewalFailureListener method. Add lease to the set with membership duration of forever. Wait 40000 milliseconds for the listener to send notification. Assert that the event notification was logged at some time at or after the lease expiration time. | A1, M1 | LRS section 9.3 pg. 113-114
RemovalTest Assert that that removal of a lease actually results in it being removed (according to the remove method) and no further action is taken on the lease for a period up to and including its expiration time plus one half. Matrix ID 11. | Create a special lease (duration of 30000 milliseconds) that will count the number of times it has been renewed. Create a lease renewal set with a lease of 50000 milliseconds. Add the lease to the set with membership duration of forever. Remove the lease from the set. Sleep for 35000 milliseconds to allow the set to expire. Assert that there have been no renewals made on the lease. Assert that a call to remove the lease again returns a null value. Sleep for 25000 milliseconds to allow the managed lease to expire. Assert that attempts to renew the lease result in an UnknownLeaseException and that no other renewal attempts have been made. | A1, M1 | LRS section 9.3 pg. 108
LeaseExpirationTest Assert that that expiration of a lease actually results in it being removed (according to the remove method) and no further action is taken on the lease for a period up to and including its expiration time. The only way that a lease can expire while being managed by the LRS is for the grantor of the lease to throw an Exception. Matrix ID 12, 14 | Create a special lease (duration of 30000 milliseconds) that will count the number of times it has been renewed and throw a definite exception every time it’s renew method is called. Create a lease renewal set with a lease of forever. Add the lease to the set with membership duration of forever. Sleep for 35000 milliseconds to allow the managed lease to expire. Assert that there have been no renewals made on the lease. Assert that a call to remove the lease returns a null value . Create a special lease (duration of 30000 milliseconds) that will throw an indefinite exception every time it’s renew method is called. Create a lease renewal set with a lease of forever. Add the lease to the set with membership duration of forever. Sleep for 35000 milliseconds to allow the managed lease to expire. Assert that there have been no renewals made on the lease. Assert that a call to remove the lease returns a null value. | A1, M1 | LRS section 9.3 pg. 108
# LeaseDurationTest Assert that for a range of lease duration values given to the createLeaseRenewalSet method, the LRS will only grant times less than or equal to the amount requested. Matrix ID 16. | Create lease renewal sets with the following lease duration values: 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 milliseconds. Assert that the duration times for the leases returned are less than or equal to the amount requested or a LeaseDeniedException is thrown. Create a lease renewal set with a duration time of Lease.ANY. Assert that the expiration time of the lease returned is in the future. Create a lease renewal set with a duration time of Lease.FOREVER. Assert that the expiration time of the lease returned is in the future. | A1, M1 | LRS section 9.3 pg.
# ValidLeaseDurationTest Assert that a lease duration time of 0 or less will cause the createLeaseRenewalSet method to throw an IllegalArgumentException. Also assert that a positive number, Lease.FOREVER, and Lease.ANY do not generate IllegalArgumentExceptions. Matrix ID 17 | Create lease renewal sets with the following lease duration values: 0, -99 milliseconds. Assert that in each case an IllegalArgumentException is thrown. Create lease renewal sets with the following lease duration values: Lease.FOREVER, Lease.ANY. Assert that IllegalArgumentException is not thrown. Create a lease renewal set with a value of 1024 milliseconds. Assert that IllegalArgumentException is not thrown. | A1, M1 | LRS section 9.3 pg. 109
# SetEqualsTest Assert that two lease renewal set proxies are equal only if they are proxies for the same set created by the same LeaseRenewalService. Matrix ID 18. | Obtain two LRS services proxies (service #1 and service #2) Using service #1 create one lease renewal set (set #1). Using service #2 create one lease renewal set (set #2). Using service #1 create one lease renewal set (set #3). Assert that set #1.equals(set #2) returns a value of false. Assert that set #1.equals(set #3) returns a value of true. Create a MarshalledObject from set #1. Unmarshall the MarshalledObject into set #4. Assert that set #1 == set #4 returns a value of false. Assert that set #1.equals(set #4) returns a value of true. | A1, M1 | LRS section 9.3 pg. 109
# IlegalLeaseTest Assert that attempts to add a set’s lease to itself or a lease that is currently a member of another set throws an IllegalArgumentException. Matrix ID #21, 22 | Create a lease renewal set #1 with a lease of forever. Use the getLease method to obtain a reference to the set’s lease. Assert that an attempt to pass the lease to the set #1’s addLease method generates an IllegalArgumentException. Assert that an attempt to pass the lease to the set #2’s addLease method generates an IllegalArgumentException. Create a lease renewal set #2 with a lease of forever. Obtain or create a valid lease with duration of forever. Add the lease to set #1. Assert that an attempt to pass the lease to set #2’s addLease method generates an IllegalArgumentException. | A1, M1 | LRS section 9.3 pg. 110
# MembershipDurationTest Assert that the membership duration argument to the addLease method is interpreted correctly. Matrix ID 23, 24 | Create a lease renewal set with a lease of forever. Obtain or create a lease with duration of forever. Assert that when the lease is added to the set with a membership duration of 0 an IllegalArgumentException is thrown. Assert that an attempt to remove the lease from the set returns a null value. Assert that when the lease is added to the set with a membership duration of 1 millisecond, no IllegalArgumentException is thrown. Assert that when the lease is added to the set with a membership duration of Long.MAX_VALUE, no IllegalArgumentException is thrown. Assert that an attempt to remove the lease from the set returns a reference to the lease itself. Assert that when the lease is added to the set with a membership duration of 30000 milliseconds., no IllegalArgumentException is thrown. | A1, M1 | LRS section 9.3 pg. 111
ReAddLeaseTest Assert that when a lease is added to a set in which it already resides that the membership duration is updated appropriately. Matrix ID 25 | Create a lease renewal set with a lease of forever. Obtain or create a lease with duration of forever. Add lease to the set with membership duration value of 20000 milliseconds. Sleep for 10000 milliseconds. Add the lease to the set again with a membership duration of 30000 milliseconds. Sleep 25000 milliseconds. Assert that an attempt to remove the lease from the set results in a non-null return value. Sleep 10000 milliseconds. Assert that an attempt to remove the lease from the set results in a null value being returned. Add lease to the set with membership duration value of 60000 milliseconds. Sleep 10000 milliseconds. Add lease to the set again with membership duration of 20000 milliseconds. Sleep 25000 milliseconds. Assert that an attempt to remove the lease from the set results in a null value being returned. | A1, M1 | LRS section 9.3 pg. 111
RemoveCancelTest Assert that removal of a lease from a set will not cancel the lease. Matrix ID 26 | Create a lease renewal set with a lease of forever. Create a special lease that counts the number of times cancel has been called. Add lease to the set with membership duration of forever. Remove lease from the set. Assert that the cancel method has not been called. | A1, M1 | LRS section 9.3 pg. 111
# RenewalTimeTest Assert that the expiration time of a returned lease reflects either the original time or the time set as a result of the last successful renewal. Matrix ID 27. | Create a lease renewal set with a lease of forever. Create a lease with a duration value of 60000 milliseconds. Add lease to the set with membership duration of forever. Sleep for 20000 milliseconds. Assert that the lease obtained from the remove method still has the original expiration time. Create a lease with a duration value of 60000 milliseconds. Add the lease to the set with membership duration of 90000 milliseconds. Sleep 75000 milliseconds. Assert that the lease obtained from the remove method has an expiration time equal to approximately the original expiration time + 30000 millisecond. |  |
# LeaseNotInSetTest Assert that the remove method returns null when the lease is not in the set. Matrix ID 28. | Create a lease renewal set with a lease of forever. Create a lease with a duration value of forever. Assert that the set’s remove method returns a null value when an attempt is made to remove the lease. | A1, M1 | LRS section 9.3 pg. 111
# GetLeaseTest Assert that the getLease method returns the lease of the set itself. Matrix ID 29 | Create a lease renewal set with a lease of forever. Save a reference to the lease as lease #1. Using the set’s getLease method save reference to the returned lease as lease #2. Assert lease #1 equals (lease #2). | A1, M1 | LRS section 9.3 pg. 111
# EventRegistrationTest Assert the following: An event registration and the set from which it is generated share the same lease. An event registration is valid with respect to all other active registrations generated by the same LRS. (weak test because only 40 cases are tested. It would be impractical to test all cases exhaustively.) Assert that when a registration is replaced it is replaced with a new one that has the same event ID. Matrix ID 37, 38, 39, 40, 48, 50 | Create 20 lease renewal sets #1 - #20 with a lease of forever. Create 20 RemoteEventListener objects #1 - #20. Save a reference to the lease of renewal set #1as lease #1. Register RemoteEventListener #1 with renewal set #1 to receive ExpirationWarningEvents. Save a reference to the event registration object returned from a call to the setExpirationWarningListener method. Using the EventRegistration object’s getLease() method save a reference to the registration’s lease as lease #2. Assert lease #1 equals (lease #2). Register RemoteEventListener #1 with renewal set #1 to receive RenewalFailureEvents Events. Save a reference to the event registration object returned from a call to the setRenewalFailureListener method. Using the EventRegistration’s object’s getLease() method save a reference to the registration’s lease as lease #3. Assert lease #1 equals (lease #3). Register each listener with its corresponding set for both ExpirationWarningEvents and RenewalFailureEvents and save references to each registrations warnReg #1-#20 and failReg #1 - #20. Assert that the event ID of each registration is unique with respect to each of the others. Create a RemoteEventListener newListener. Install newListener into set #1 by using the set’s setExpirationWarningListener method. Capture the registration as newWarnReg. Assert that warnReg #1 getLease() equals newWarnReg getLease() returns a value of false. Assert warnReg #1 getID() == newWarnReg getID(). Install newListener into set #1 by using its setRenewalFailureListener method. Capture the registration as newFailReg. Assert that failReg #1 getLease() equals newFailReg getLease() returns a value of false. Assert failReg #1 getID() == newFailReg getID(). | A1, M1 | LRS section 9.3 pg. 112-113
# EventSequenceWarnTest Assert that events of the WarningExpirationEvent type sent to a newly registered listener are in the same sequence as those sent to the previously registered listener. (weak test : because partial failure may cause the test to fail when it really should succeed. This is because retransmission of events is valid and in some cases it is impossible to tell if two events with the same sequence number are in fact the same event or different). Matrix ID 41 | Create two RemoteEventListeners, listener #1 and listener #2. The notify methods will automatically renew the lease of the set for 30000 milliseconds and save each event received. Create a lease renewal set with a lease of 30000 milliseconds. Register listener #1 to receive ExpirationWarningEvents with a minWarning of 10000 milliseconds. After listener #1 has received three events register listener #2 in its place. After listener #2 has received three events then call the set’s clearExpirationWarningListener method. Assert that the sequence numbers for the events received by listener #1 are all in the proper sequence with no gaps. Assert that the sequence numbers of the events received by listener #2 have no gaps and do not overlap with those of listener #1. | A1, M1 | LRS section 9.3 pg. 113
# EventSequenceFailTest Assert that events of the RenewalFailureEvent type sent to a newly registered listener are in the same sequence as those sent to the previously registered listener. (Note: This test is stronger than the EventSequenceWarnTest because the RenewalFailureEvent carries a reference to the lease whose renewal failed and thus imparts to the event an identity that can be used to distinguish between two different events that might have the same sequence number). Matrix ID 51 | Create two RemoteEventListeners, listener #1 and listener #2. The notify methods will save each event received. Create a lease renewal set with a lease of forever. Create 6 leases (lease #1 – lease #6) that will throw a definite exception when their renew methods are called. Use a duration value of 30000 * N milliseconds for each. Add each lease to the renewal set with membership duration value of forever. Register listener #1 to receive RenewalFailureEvents. After listener #1 has received three events register listener #2 in its place. After listener #2 has received three events then call the set’s clearRenewalFailureListener. Assert that the sequence numbers for the events received by listener #1 are all in the proper sequence with no gaps. Assert that the sequence numbers of the events received by listener #2 have no gaps and do not overlap with those of listener #1 where the leases of any two overlapping events are the different. | A1, M1 | LRS section 9.3 pg. 113
# ClearWarningListenerTest Assert that the clearExpirationWarningListener method operates as expected. Assert that this method may be called multiple times with no ill effect. Matrix ID 42, 43 | Create a RemoteEventListener whose notify method will log the number of times it has been called and will automatically renew the lease of the set for 30000 milliseconds. Create a lease renewal set with a lease of 30000 milliseconds. Register the listener to receive ExpirationWarningEvents with a minWarning of 10000 milliseconds. Sleep for 35000 milliseconds. Call the set’s clearExpirationWarningListener method. Assert that only one call to notify has been made. Sleep for 60000 milliseconds. Assert that only one call to notify has been made. Assert that the set’s lease has expired. Assert that the set’s clearExpirationWarningListener method can be called 10 more times without generating any definite exceptions. | A1, M1 | LRS section 9.3 pg. 112
# ClearFailureListenerTest Assert that the clearRenewalFailureListener method operates as expected. Assert that this method may be called multiple times with no ill effect. Matrix ID 52, 53. | Create a RemoteEventListener whose notify method will log the number of times it has been called and will automatically renew the lease of the set for 30000 milliseconds. Create a lease renewal set with a lease of forever. Register the listener to receive RenewalFailureEvents . Create 6 leases (lease #1 – lease #6) that will throw definite exceptions each time their renew methods are called. Create leases #1 - #3 with a lease duration value of 30000 milliseconds and the remaining 3 with a lease duration value of 60000 milliseconds. Sleep for 35000 milliseconds. Call the set’s clearRenewalFailureListener method. Assert that only three calls to notify has been made. Sleep for 60000 milliseconds. Assert that only three calls to notify has been made. Assert that the leases #4 - #6 can successfully be removed from the set. Assert that the set’s clearRenewalFailureListener method can be called 10 more times without generating any definite exceptions | A1, M1 | LRS section 9.3 pg. 113
# EventLeaseTest Assert that when a RemoteEventListener’s notify method is called that the event contains the expected lease. This test covers both ExpirationWarningEvents and RenewalFailureEvents. Assert that the expiration time will reflect the expiration of the lease when the event occurred. In the case of the lease encapsulated in an ExpirationWarningEvent, assert that the expiration time is correct. Assert that the Throwable object encapsulated by the RenewalFailureEvent is of the correct type. Assert that the lease that caused the renewal failure event is removed from the renewal set. Matrix ID 54, 55, 57, 58, 59, 62 | Create two RemoteEventListeners, listener #1 to receive ExpirationWarningEvents and listener #2 to receive RenewalFailureEvents Create a special lease #1 (duration of 30000 milliseconds) that will throw a definite exception when any attempt is made to renew it. Create a lease renewal set with a lease of 60000 milliseconds and save a reference to the lease as lease #2. Register listener #1 using the set’s setExpirationWarningListener method with a minWarning of 10000 milliseconds. Register listener #2 using the set’s setRenewalFailureListener. In the notify method of listener #1 assert that the lease returned by the event’s getLease() method is equal to lease #1 and the expiration times are also equal. In the notify method of listener #1 assert that the lease returned in the event object is no longer in the lease renewal set (use the remove method). In the notify method of listener #2 assert that the lease returned by the event’s getLease() method is equal to lease #2 . In the notify method of listener #2 assert that the Throwable object returned by getThrowable method of the event object is the correct type of Exception based upon the definite exception thrown by the lease. | A1, M3 | LRS section 9.3 pg. 113
# LeaseRenewalTest Assert that if the renewal service was able to renew the lease before the event occurred, the lease’s expiration will reflect the result of the last successful renewal call. Matrix ID 61 | Create a listener to receive RenewalFailureEvents. Create a lease renewal set with a lease of forever. Create a special lease with a duration value of 30000 milliseconds that will throw a definite exception after allowing one successful call to renew. Save a reference to the lease as lease #1. Register the listener to receive RenewalFailureEvents. Add the lease to the set with duration of forever. Assert in notify method of the listener that the lease encapsulated in the event object has an expiration time later than that of lease #1. | A1, M4 | LRS section 9.3 pg. 113 Note: This test is categorized as M4 because it is not certain that every implementation will allow for 3 failures before a renewal is granted.
# IndefiniteRenewalTest Assert that if the renewal service was unable to call renew before the lease expired, then the Throwable returned in the event object is null. Matrix ID 62 | Create a listener to receive RenewalFailureEvents. Create a lease renewal set with a lease of forever. Create a test lease with a duration of 10000 milliseconds. Sleep for 20000 milliseconds to allow the lease to expire. Register the listener to receive RenewalFailureEvents. Add the lease to the set with duration of forever. Assert in notify method of the listener that the value returned by the getThrowable method of the event is null. | A1, M4 | LRS section 9.3 pg. 114 This test is categorized M4 because it is not certain from the specification that the LRS must send a RenewalFailureEvent in the case where an expired lease is added to the renewal set, althrough Norm does this.
# EventSequenceTest Assert that events arrive in strictly increasing order. (This is a weak test because it is possible to fail if events are lost on the network and the test is not and can not be exhaustive.) Matrix ID 63 | Create 10 lease renewal sets each with a lease of 40000 milliseconds. Create a listener to receive ExpirationWarningEvents. For each set register the listener to receive events with a minWarning of 10000 milliseconds. In the notify method of the listener collect each sequence number as it comes in. Sort the sequence numbers. Assert that there are 10 sequence numbers and that they are strictly increasing. Create a listener to receive RenewalFailureEvents. Create a lease renewal set with a lease of forever. Register the listener with the set. Create 10 leases with duration values of 30000 milliseconds that will throw definite exceptions when attempts are made to renew them. Add each lease to the set. In the notify method of the listener collect each sequence number as it comes in. Sort the sequence numbers. Assert that there are 10 sequence numbers and that they are strictly increasing. | A1, M1 | LRS section 9.3 pg. 114
# MaxMembershipTest Assert that if a lease is added to a set with a membership duration of Long.MAX_VALUE then its membership expiration is Long.MAX_VALUE. Matrix ID 64 | Create a lease renewal set with a lease of forever. Create a test lease with duration value of 30000 milliseconds. Add the test lease to the set with a membership duration of Long.MAX_LONG. Sleep until the test lease expires and is renewed by the LRS. Remove the test lease from the renewal set. Assert that the expiration time on the lease is Long.MAX_VALUE. | A1, M1 | LRS section 9.3 pg. 113
# DurationExpirationTest Assert that if the membership duration of a managed lease is less than its expiration time then the lease will not be renewed but it will remain in the set. Matrix ID 65 | Create a lease renewal set with a lease of forever. Create a test lease with duration of 60000 milliseconds. Add the test lease to the set with a membership duration value of 30000 milliseconds. Sleep 25000 milliseconds. Assert that the array returned from the getLeases method is of size one and contains the test lease. Assert that the expiration time of the test lease has not changed. Sleep 10000 milliseconds. Assert that the array returned from the getLeases method is of size 0. | A1, M1 | LRS section 9.3.1 pg. 113
# GetLeasesTest Assert that the getLeases method returns all the client leases in the set at the time of the call as an array of type Lease. Matrix ID 66 | Create a lease renewal set with a lease of forever. Create a test lease #1 with duration of 30000. Create a test lease #2 with duration of 60000. Create a test lease #3 with duration of 90000. Add all three leases to the renewal set each with a membership duration of 10000 milliseconds. Obtain an array #1 of leases using the getLeases method. Sleep 35000 milliseconds. Obtain an array #2 of leases using the getLeases method. Sleep 35000 milliseconds. Obtain an array #3 of leases using the getLeases method. Sleep 35000 milliseconds. Obtain an array #4 of leases using the getLeases method. Assert that array #1 has exactly 3 leases no two of which are the same. Assert that array #2 has exactly 2 different test leases that are equal to test lease #2 and test lease #3. Assert that array #3 has exactly 1 test lease that is equal to test lease #3. Assert that array #4 is empty. | A1, M1 | LRS section 9.3.1 pg. 113
# LeaseUnmarshalExceptionTest Assert that if one or more of the leases in the array can not be de-serialized a LeaseUnmarshalException is thrown and the getMarshalledLeases, getStillMarshalledLeases, and getExceptions methods work as advertised. Matrix ID 67, 68, 70 | Create a lease renewal set with a lease of forever. Create two special test leases (called specialLease01 and specialLease02) with duration of forever that has the property of throwing an exception when an attempt is made to de-serialize it. Create three test leases (called testLease01, testLease02 and testLease03) with duration of forever. Add all the leases to the set with a membership duration of forever. Obtain an array of leases by calling the getLeases method. Assert that a LeaseUnmarshalException is thrown. Assert that the array returned from the getUnmarshalledLeases method of the exception has a size of 3 and contains exactly testLease01, testLease02, and testLease03. Assert that the array returned from the getStillMarshalledLeases method of the exception has a size of 2 and contains exactly the marshalled representation of specialLease01 and speciallease02. Assert that the array returned from the getExceptions method of the exception has a size of 2 and contains exactly two Throwable objects that where the original cause of the de-serialization errors and the order of their appearance in the array parallels the order of the array returned from getStillMarshalledLeases. | A1, M1 | LRS section 9.3.1 pg. 113
# LeaseUnmarshalNoneTest Assert that if none of the leases in the array can be de-serialized a LeaseUnmarshalException is thrown and the getMarshalledLeases method returns a 0 length array. Matrix ID 69 | Create a lease renewal set with a lease of forever. Create two special test leases (called specialLease01 and specialLease02) with duration of forever that has the property of throwing an exception when an attempt is made to de-serialize it. Add all the leases to the set with a membership duration of forever. Obtain an array of leases by calling the getLeases method. Assert that a LeaseUnmarshalException is thrown. Assert that the array returned from the getUnmarshalledLeases method of the exception has a size of 0. | A1, M1 | LRS 9.3.1 pg. 113
# AssocExpWarnSetTest Each event generated by the lease renewal service has as its source the renewal set that the event is associated with. In the case of an expiration warning event this is the set which is about to expire. Matrix ID 71 | Create two lease renewal sets (set01 and set02) with leases for forever. Create a lease renewal set (set03) with a lease of 30000 milliseconds. Create a listener to receive ExpirationWarningEvents.. Register the listener with the set to receive events with a minWarning of 10000 milliseconds. Sleep for 30000 milliseconds. In the notify method of the ExpirationWarningEvent listener assert that the source of the event is equal to the set set03. | A1, M1 | LRS 9.3.1 pg. 113
# AssocRenewalFailSetTest Each event generated by the lease renewal service has as its source the renewal set that the event is associated with. In the case of a renewal failure event this is the set the client lease was in when the event occurred. Matrix ID 71 | Create a lease renewal set with a lease of forever, Create a listener to receive RenewalFailureEvents.. Register the listener with the to receive events. Create a special test lease called specialLease01 with duration of 30000 that has the property of throwing an exception when an attempt is made to renew it. Create a test lease called testLease01 with duration of 30000 milliseconds. Add testLease01 to the set with membership duration values of forever. Add specialLease01 to the set with membership duration value of forever. Sleep for 30000 milliseconds. In the notify method of the RenewalFailureEvent listener assert that the source of the event is equal to the set. | A1, M1 | LRS 9.3.1 pg. 113
# EventIDWarnTest Because a given set will only have one expiration warning event registration at a given time all expiration warning events will have the same event ID, LeaseRenewalSet.EXPIRATION_WARNING_EVENT_ID. Matrix ID 72 | Create three lease renewal sets with a lease of 40000 milliseconds (called set01, set02 and set03). Create a listener to receive ExpirationWarningEvents.. Register the listener with the set01, set02, and set03 to receive events with a minWarning of 10000 milliseconds. Sleep for 80000 milliseconds. In the notify method of the ExpirationWarningEvent listener assert that the event id of all events received is LeaseRenwalSet.EXPIRATION_WARNING_EVENT_ID. As an extra measure assert that the number of events received by the listener is 3. | A1, M1 | LRS 9.3.1 pg. 113
# EventIDFailTest Because a given set will only have one renewal failure event registration at a given time all renewal failure events will have the same event ID, LeaseRenewalSet.RENEWAL_FAILURE_EVENT_ID. Matrix ID 72 | Create a lease renewal sets with a lease of forever. Create a listener to receive RenewalFailureEvents.. Register the listener with the set to receive events. Create 3 special test lease called specialLease01, specialLease02 and specialLease03 with duration of 40000 that has the property of throwing an exception when an attempt is made to renew it. Add specialLease01, specialLease02, and specialLease03 to set with membership duration values of forever. Sleep for 80000 milliseconds. In the notify method of the RenewalFailureEvent listener assert that the event is of all events received is LeaseRenwalSet.RENEWAL_FAILURE_EVENT_ID. As an extra measure assert that the number of events received by the listener is 3. | A1, M1 | LRS 9.3.1 pg. 113
# ClearEventRegistrationTest If a RemoteListener registered for a renewal failure or an expiration warning event throws an UnknownEventException, this will only clear the specific event registration, it will not cancel the lease on the renewal set, or affect any other event registration on the set. Matrix ID 73 | Create two lease renewal sets with a lease of 100000 milliseconds (called set01 and set02). Create a special listener (specialListener01) to receive ExpirationWarningEvents that will throw an UnknownEventException from its notify method as well as count the number of times the notify method has been called. Create a listener (normalListener01) to receive ExpirationWarningEvents that counts the number of times its notify method has been called. Register the specialListener01 with the set01 to receive events with a minWarning of 40000 milliseconds. Register the normalListener01 with the set02 to receive events with a minWarning of 25000 milliseconds. Create a special listener (specialListener02) to receive RenewalFailureEvents that will throw an UnknownEventException from its notify method as well as count the number of times the notify method has been called. Create a listener (normalListener02) to receive RenewalFailureEvents that counts the number of times its notify method has been called. Register the specialListener02 with the set02. Register the normalListener02 with the set01. Create three special leases (specialLease01, specialLease02 and specialLease03 with duration values of 30000, 50000 and 600000 milliseconds respectively) that will throw a definite exception when any attempt is made to renew it. Add specialLease01 to set01 and specialLease02 to set02 with membership duration values of forever. Sleep for 80000 milliseconds. Renew each lease for 60000 milliseconds. Assert that renewals on both lease sets do not result in an UnknownLeaseException. Assert that calls to remove on set01 and set02 do not result in a NoSuchObjectException. Add specialLease03 to set02. Sleep for 60000 milliseconds. Assert that exactly one call to notify was made to specialListener01 and specialListener02. Assert that exactly two calls were made to normalListener01 and normalListener02. | A1, M1 | LRS 9.3.1 pg. 113
# NewListenerEventTest If an event listener is replaced, and one or more event delivery attempts on the original listener failed or were indeterminate, implementations may chose to send some or all of these events to the new listener. Matrix ID 74 | Create a lease renewal set with a lease of forever. Create a special listener (specialListener01) to receive renewal failure events whose notify method throws an exception. Create a normal listener (normalListener01) to receive renewal failure events. Register specialListener01 with the lease renewal set. Create 3 special leases (duration value 40000 milliseconds) whose renew method will throw a definite exception each time it is called. Add the leases to the set with membership duration of forever. Sleep 60000 milliseconds. Register normalListener01 to receive renewal failure events. Sleep 60000 milliseconds. Assert that at lease one event was received by normalListener01. | A1, M4 | LRS 9.3.1 pg. 114
NormalEventReturnTest Both the getLease and getThrowable methods are declared to throw IOException and ClassNotFoundException, this delcaration allows implementations to delay unmarshalling this state until it is actually needed. Once either method of a given RenewalFailureEvent object returns normally, future calls on that method must return the same object and may not throw an exception. Matrix ID 75 | Create a lease renewal set with a lease of forever. Create a listener to receive renewal failure events. Register the listener with the set. Create a lease whose renew method will throw a definite exception each time it is called. Add the lease to the set with membership duration of 30000 milliseconds. Sleep 90000 milliseconds. In the notify method of the listener assert that multiple calls to getLease and getThrowable always return the same object and they throw no exceptions. | A1, M1 | LRS 9.3.1 pg. 116
# RenewalFailureEventTest ## RenewalFailureEventIndefiniteTest # The RenewalFailureEvent is a subclass of RemoteEvent, adding two additional items of abstract state – the client lease which could not be renewed before expiration and the Throwable object that was thrown by the first failed renewal attempt in the last series of consecutive failures. Matrix ID 76 | Create a lease renewal set with a lease of forever. Create a listener to receive renewal failure events. This listener saves the last event received by its notify method in an accessible instance variable. Register the listener with the set. Create a special lease that will throw a ServerErrorException when its renew method is called for the first time and a RemoteException every time after that. Create it with a duration value of 60000 milliseconds. Add lease to the set with membership duration of forever. Sleep 70000 milliseconds. Assert that the getThrowable method of the event returns a ServerErrorException. Assert the the getLease method returns the lease being used for the test. | A1, M1 | LRS 9.3.1 pg. 115
# RenewAtIntervalTest Assert that the renewFor/3 method causes leases to be renewed with a value that is equal to the lease duration specified in the call (3RD argument). Not in Matrix | Create a lease renewal set with a lease of forever. Create 3 leases (lease01, lease02, lease03) with renewal times of 30000, 60000, and 90000 milliseconds respectively. Add them to the renewal set using the renewFor/4 method with a lease duration of 75000 milliseconds. Wait until lease01 expires. Remove lease01 from the set. Assert that lease01 has an expiration time that is greater than the original expiration time of lease01 but not greater than the original expiration time + 75000 milliseconds. Repeat steps 4 through 6 for lease02 and lease03. |  | LS2.0 pg 193-194