ClientLookupManager Tests

 

Test Name & Motivation

Description

Categorization

Specification Requirements

ClientLookupManagerIFTest (CLMIF) - Strictly tests the default interface semantics of the CLM

1.        Create 2 ClientLookupManagers with null arguments (this should create a default LookupDiscoveryManager that is configured with no locators and an instance of LeaseRenewalManager with no leases) and no running services [CLM 9 11 12]

2.        Call equals() with the same CLM object reference and verify that true is returned [CLM 3]

3.        Call equals() with the other CLM object and verify that false is returned

4.        Call getDiscoveryManager() and verify that the returned object is an instance of LookupDiscoveryManager [CLM 50]

5.        Call getLeaseRenewalManager() and verify that the returned object is an instance of LeaseRenewalManager [CLM 51]

6.        Call createLookupCache with null args and verify that a LookupCache object is returned [CLM 13, 14, 15, 17]

7.        Call lookup(null, null) and verify that it returns null [CLM 25, 26, 28, 29]

8.        Call lookup(null, null, 1000) and verify that null is returned after at least 1000 ms have elapsed [CLM 37, 38, 42, 44]

9.        Call lookup(null, null, 0) and verify that null is returned [CLM 46]

10.     Call lookup(null, null, -1) and verify that null is returned

11.     Create and start a Thread that calls lokoup(null, null, 60000)

12.     Interrupt the thread via Thread.interrupt and verify that the Thread is interrupted [CLM 39, 40]

13.     Call lookup(null, 1, null) and verify that an empty array is returned [CLM 30]

14.     Call lookup(null, 0, null) and verify that an IllegalArgumentException is thrown [CLM 47, 48]

15.     Call lookup(null, -1, null) and verify that an IllegalArgumentException is thrown

16.     Call lookup(null, 1, 1, null, 1000) and verify that an empty set is returned after at least 1000 ms have elapsed

17.     Call lookup(null, 2, 1, null, 1000 ) and verify that an IllegalArgumentException is thrown [CLM 48]

18.     Call lookup(null, 0, 1, null, 1000 ) and verify that an IllegalArgumentException is thrown

19.     Call lookup(null, 0, 0, null, 1000 ) and verify that an IllegalArgumentException is thrown

20.     Call lookup(null, 1, 0, null, 1000 ) and verify that an IllegalArgumentException is thrown

21.     Call lookup(null, -2, -1, null, 1000 ) and verify that an IllegalArgumentException is thrown

22.     Call terminate() and verify that nothing happens

A1,M1

CLM

 

LookupCacheIFTest(LCIF) - Strictly tests the default inteface semantics of the LookupCache

1.        Create 1 ClientLookupManagers with null arguments (this should create a default LookupDiscoveryManager that is configured with no locators and an instance of LeaseRenewalManager with no leases) and no running services [CLM 9 11 12]

2.        Call createLookupCache with null args and verify that a LookupCache object is returned [CLM 13, 14, 15, 17]

3.        Call LookupCache.lookup(null) and verify that a null is returned [CLM 86, 87, 88, 91]

4.        Call LookupCache.lookup(null, 1) and verify that an empty array is returned [CLM 89, 92]

5.        Call LookupCache.lookup(null, 0) and verify that an IllegalArgumentException is thrown [CLM 90]

6.        Call LookupCache.lookup(null, Integer.MAX_VALUE) and verify that an empty array is returned

7.        Call LookupCache.lookup(null, Integer.MAX_VALUE+1) and verify that an IllegalArgumentException is thrown

8.        Call LookupCache.addListener(null) and verify that nothing happens [CLM 94,99]

9.        Call LookupCache.removeListener(null) and verify that nothing happens [CLM 101,103]

10.     Call LookupCache.discard(null) and verify that nothing happens [CLM TBD]

11.     Call LookupCache.discard with a non-service object reference and verify that nothing happens [CLM TBD]

12.     Call LookupCache.terminate and verify that nothing happens

 

 

LookupCacheFunctionalTest (LCFT) - Tests functional semantics of the LookupCache

1.        Create 2 lookup services (LUS) initially configured to join no groups

2.        Create 1 ClientLookupManager(null, null) (CLM) that defaults to search for public LUS [CLM 9,11, 12]

3.        Call CLM.equals with the same reference and verify that true is returned [CLM 3]

4.        Call CLM.equals with another CLM reference and verify that true is returned

5.        Create a JoinManager (JM) with a service object, no attributes, null listener, and a null discovery & lease manager (defaults to search in public groups)

6.        Call JM.getDiscoveryManager() and add a service discovery listener (JMSDL)

7.        Configure 1 LUS to join the public group

8.        Wait for JMSDL callback

9.        Call JM.getJoinSet() and verify that there is one entry

10.     Call CLM.createLookupCache (LC) with a null template, instrumented filter (CLMF1) & instrumented listener (CLMSDL) [CLM 13, 14, 15]

11.     Note: Instrumented filter (CLMF1) verifies that neither a null ServiceItem (SI) nor SI fields are passed. [CLM 64]

12.     Verify that CLMSDL and CLMF1 are called once [CLM 19, 96]

13.     Call LC.lookup(null) and verify that the proper entry is returned [CLM 86, 88]

14.     Call LC.lookup(null, 10) and verify that one entry is returned and it matches the entry above [CLM 89]

15.     Call LC.lookup(CLMF2) and verify that an entry is returned and matches the one above [CLM 87]

16.     Call LC.lookup(CLMF2, 10) and verify that an entry is returned and matches the one above

17.     Call LC.lookup(CLMF2, 0) and verify that an IllegalArgumentException is thrown [CLM 90]

18.     Call JM.addAttributes with a Name attribute

19.     Verify that CLMSDL is called [CLM 20, 97]

20.     Call LC.lookup(null) and verify that an entry is returned

21.     Call LC.lookup(null, 5) and verify that one entry is returned and it matches the entry above

22.     Configure 2nd LUS to join the public group

23.     Wait for JMSDL to be called

24.     Call JM.getJoinSet and verify that there are 2 LUS entries

25.     Verify that CLMSDL is not called (since the same service has already been discovered) [CLM 21]

26.     Call LC.lookup(null, 5) and verify that one entry is returned

27.     Call LC.addListener with CLMSDL2 [94, 95]

28.     Verify that CLMSDL2 gets called with existing service entry

29.     Call JM.modifyAttributes and provide a new Name value

30.     Verify that CLMSDL and CLMSDL2 are called [CLM 23, 97]

31.     Configure 1 LUS to leave the public group

32.     Verify that JMSDL gets a discard event

33.     Call JM.getJoinSet and verify that only 1 LUS entry is returned

34.     Call LC.lookup(null, 5) and verify that one entry is returned

35.     Call LC.lookup(CLMF3, 5) and verify that no entry is returned (where CLMF3 returns false) [CLM 62, 63]

36.     Verify that the ServiceItem passed into CLMF3 is not null nor does it contain null fields [CLM 64]

37.     Call LC.addListener(null) and verify that nothing happens [CLM 99]

38.     Call JM.modifyAttributes and provide a new Name value

39.     Verify that CLMSDL and CLMSDL2 are called [CLM 97]

40.     Call LC.removeListener(CLMSDL2) [CLM 101]

41.     Call JM.modifyAttributes and provide a new Name value

42.     Verify that CLMSDL (only) is called

43.     Call LC.removeListener(CLMSDL2) [CLM 103]

44.     Call LC.discard with the existing service [CLM 104, 105, 106]

45.     Verify that CLMSDL (only) is called

46.     Call LC.lookup(null) and verify that null is returned [2]

47.     Verify that CLMSDL is called with rediscovered service

48.     Call LC.removeListener(CLMSDL)

49.     Call LC.discard with existing service

50.     Verify that CLMSDL doesn't get a discard notification [CLM 102]

51.     Call LC.addListener(CLMSDL)

52.     Verify that CLMSDL gets a discovery event

53.     Configure remaining LUS to leave the public group

54.     Verify that JMSDL gets a discard notification

55.     Verify that CLMSDL gets a discard notification [CLM 1, 98]

56.     Call LC.lookup(null) and verify that null is returned [CLM 91]

57.     Call LC.lookup(null, 5) and verify that an empty array is returned [CLM 92]

58.     Call LC.terminate() [CLM 107]

59.     Configure LUS to join the public group

60.     Verify that CLMSDL is not called [CLM 108]

 

 

Notes:

[1] This assumes rediscovery does not happen quickly

 

Needed versions

- non-public groups

- locators

- mixed mdoe

 

Q:

Does LUS leaving a group cause LUS to be discarded from CLM?

LookupCacheFilterTest (LCF2T) -

1.        Configure 1 lookup service (LUS) initially configured to join the public group

2.        Create 3 different TestService classes (TS1-3) and Joinmanagers (JM1-3)

3.        Create a CLM(null, null) [CLM 9, 11, 12]

4.        Create LC1 via CLM.createLookupCache(null, SIF1, CLMSDL1) where ServiceItemFilter (SIF1) {return true} [CLM 13, 14, 15, 62, 63]

5.        Create LC2 via CLM.createLookupCache(null, SIF2, CLMSDL2) where SIF2 {if SI.service instanceof(testService2) return true}

6.        Create LC3 via CLM.createLookupCache(null, SIF3, CLMSDL3) where SIF3 {if SI.attrs contains MyFlag == true return true}

7.        Note: SIF1-3 also verify that neither a null ServiceItem nor a null ServiceItem fields are passed into it from the CLM [CLM 64]

8.        Register TS1-3 via JM1-3

9.        Verify that CLMSDL1 gets serviceAdded called three times [CLM 19, 96]

10.     Verify that LC1.lookup(null, 5) returns 3 entries [CLM 88, 89]

11.     Verify that LC1.lookup(null) returns an entry [CLM 86, 88]

12.     Verify that CLMSDL2 gets serviceAdded called once

13.     Verify that LC2.lookup(null) returns an entry

14.     Verify that LC2.lookup(null, 5) returns an entry

15.     Verify that CLMSDL3 doesn't get notified

16.     Add a MyFlag = true attribute to TS3 via JM3

17.     Verify that CLMSDL1 gets a serviceChanged notification [CLM 23, 97]

18.     Verify that CLMSDL2 doesn't get notified

19.     Verify that CLMSDL3 gets a serviceAdded notification [CLM 19, 96]

20.     Call LC1.lookup(SIF1, 5) and verify that testService1-3 is returned

21.     Call LC1.lookup(SIF2, 10) and verify that testService2 is returned [CLM 62, 63]

22.     Call LC1.lookup(SIF3, 2) and verify that testService3 is returned

23.     Call LC1.lookup(null, 5) and verify that TestService1-3 are returned

 

 

Notes:

 - TestService class has a MyFlag attribute that defaults to false

 - TestService 1-3 are diff classes to avoid class matching

 

LookupCacheEventIFTest (LCEIFT) -

1.        Create 1 ClientLookupManager(null, null) (CLM) that defaults to search for public LUS [CLM 9,11, 12]

2.        Call CLM.createLookupCache (LC) with a null template, null filter & null listener [CLM 13, 14, 15, 17]

3.        Create a ServiceDiscoveryEvent(LC, ServiceItem1, ServiceItem2) (SDE) [CLM 67,68, 70]

4.        Verify that SI1 & SI2 objects haven't been modified [CLM 69]

5.        Call SDE.getPreEventServiceItem() and verify that SI1 object reference is returned unmodified [CLM 73, 77]

6.        Call SDE.getPostEventServiceItem() and verify that SI2 object reference is returned unmodified [CLM 75, 77]

7.        Create SDE(LC, null, SI2) [CLM 71]

8.        Call SDE.getPreEventServiceItem() and verify that null is returned [CLM 74]

9.        Call SDE.getPostEventServiceItem() and verify that SI2 object reference is returned unmodified

10.     Create SDE(LC, SI1, null) [CLM 71]

11.     Call SDE.getPreEventServiceItem() and verify that SI2 object reference is returned unmodified

12.     Call SDE.getPostEventServiceItem() and verify that null is returned [CLM 76]

13.     Create SDE(LC, null, null) [CLM 72]

14.     Verify that a NullPointerException is thrown

15.     Create SDE(null, SI1, SI2) [CLM TBD]

16.     Verify that a NullPointerException is thrown [1]

 

 

 

 

Notes:

[1] Not specified yet

LookupCacheEventFuncTest (LCEFT)

1.        Create 1 lookup service (LUS) initially configured to join no groups

2.        Create 2 JoinManagers (JM1 & JM2) each with a TestService (TS1 & TS2) with no associated attributes

3.        Create 1 ClientLookupManagers (CLM) with null arguments (this should create a default LookupDiscoveryManager that is configured with no locators and an instance of LeaseRenewalManager with no leases) and no running services [CLM 9 11 12]

4.        Call CLM.createLookupCache(null, null, CLMSDL1) [CLM 13, 14, 15, 17]

5.        Call LC.lookup(null) and verify that null is returned [CLM 86, 87, 88, 91]

6.        Call LC.lookup(null, 10) and verify that the empty array is returned [CLM 89, 92]

7.        Configure 1 LUS to join the public group

8.        Register TS1 via JM1 with LUS

9.        Verify that CLMSDL1's serviceAdded() method gets called [CLM 19, 78, 79, 96]

10.     Verify that SDE.getPre...() returns null [CLM 73, 74]

11.     Verify that SDE.getPost...() returns a SI that references TS1 [CLM 75]

12.     Register TS2 via JM2 w/ LUS

13.     Verify that CLMSDL1's serviceAdded() method gets called [CLM 19, 78, 79, 96]

14.     Verify that SDE.getPre...() returns null [CLM 73, 74]

15.     Verify that SDE.getPost...() returns a SI that references TS1 [CLM 75]

16.     Call LC.addListener(CLMSDL2) [CLM 94]

17.     Verify that CLMSDL2 gets 2 serviceAdded notifications [CLM 95]

18.     Verify that SDE.getPre...() returns null [CLM 73, 74]

19.     Verify that SDE.getPost...() returns a SI that references TS1 [CLM 75]

20.     Use JM1 to add attributes to TS1

21.     Verify that CLMSDl & 2 get serviceChanged notifications [CLM 20, 82, 83, 97]

22.     Verify that SDE.getPre...() returns SI w/o attrs [CLM 73]

23.     Verify that SDE.getPost...() returns a SI with attrs [CLM 75]

24.     Call LC.removeListener(CLMSDL1) [CLM 101]

25.     Call JM2.terminate()

26.     Verify that only CLMSDL2 gets a serviceRemoved notification [CLM 22, 80, 81, 98]

27.     Verify that SDE.getPre...() returns SI w attrs [CLM 73]

28.     Verify that SDE.getPost...() returns null [CLM 75, 76]

 

 

LookupCacheEventConcurrencyTest (LCECT)

1.        Configure 2 TestServices (TS) to join N LUS via 2 JoinManagers (JM)

2.        Create CLM

3.        Create instrumented CLMSDL1 & 2

4.        Call CLM.createLookupCache(null, null, CLMSDL1)

5.        Call LC.addListener(CLMSDL2)

6.        Have JM1 & JM2 update TS1 & TS2 attributes as fast as possible

7.        Verify that CLMSDL1 & 2 aren't called concurrently [CLM 85]

 

Comments:

Instrument SDL methods to use semaphores -- verify that count is 0 upon entry and exit

CLMRemoteExceptionTest1

1.        Configure LUS to join public group

2.        Create a JoinManager (JM) with a TestService (TS1) object, no attributes, null listener, and a null discovery & lease manager (defaults to search in public groups)

3.        Call JM.getDiscoveryManager() and add a service discovery listener (JMSDL)

4.        Wait for JM ServiceDiscoveryListener (JMSDL) to get notification of LUS discovery

5.        Call JM.getJoinSet() and verify that it returns a reference to LUS

6.        Call CLM.createLookupCache(tmpl, null, CLMSDL) where tmpl matches TS1

7.        Verify that CLMSDL gets a discovered call

8.        Call CLM.getDiscoverymanager (DM)

9.        Call DM.addDiscoveryListener(DMDL)

10.     Call DM.getRegistrars() and verify that a reference to LUS is returned

11.     Destroy LUS via admin interface [1]

12.     Call CLM.createLookupCache(tmpl2, null, CLMSDL) where tmpl matches TS2 (non-existant service)

13.     Verify that a RemoteException is thrown

14.     Verify that discard LUS event is sent to DMDL due to the (presumably) RemoteException [CLM 4, 5, 6]

15.     Note: variant covers [CLM 7,8]

 

Notes:

[1] Timing dependent -- Assumes 1) that CLM will reuse existing LUS reference before 2) discarding it due lack of announcement packets

 

Variants

- Use public groups, named groups, locators, and mixed mode

- Use malformed/incorrect codebase to try and get a RemoteException due to event listener export [CLM 7,8]

CLMRemoteExceptionTest2

1.        Configure LUS to join public group

2.        Create a JoinManager (JM) with a TestService (TS1) object, no attributes, null listener, and a null discovery & lease manager (defaults to search in public groups)

3.        Call JM.getDiscoveryManager() and add a service discovery listener (JMSDL)

4.        Wait for JM ServiceDiscoveryListener (JMSDL) to get notification of LUS discovery

5.        Call JM.getJoinSet() and verify that it returns a reference to LUS

6.        Call CLM.lookupe(tmpl, null, DELAY) where tmpl matches TS1

7.        Verify that a reference to TS1 is returned

8.        Call CLM.getDiscoverymanager (DM)

9.        Call DM.addDiscoveryListener(DMDL)

10.     Call DM.getRegistrars() and verify that a reference to LUS is returned

11.     Destroy LUS via admin interface [1]

12.     Call CLM.lookupe(tmpl, null, DELAY) where tmpl matches TS1

13.     Verify that a RemoteException is thrown

14.     Verify that discard LUS event is sent to DMDL due to (a presumably) RemoteException [CLM 4, 5, 6]

15.     Note: variant covers [CLM 7,8]

 

Notes:

[1] Timing dependent -- Assumes 1) that CLM will reuse existing LUS reference before 2) discarding it due lack of announcement packets

 

Variants

- Use public groups, named groups, locators, and mixed mode

- Use malformed/incorrect codebase to try and get a RemoteException due to event listener export [CLM 7,8]

CLMRemoteExceptionTest3

1.        Configure LUS to join public group

2.        Create a JoinManager (JM) with a TestService (TS1) object, no attributes, null listener, and a null discovery & lease manager (defaults to search in public groups)

3.        Call JM.getDiscoveryManager() and add a service discovery listener (JMSDL)

4.        Wait for JM ServiceDiscoveryListener (JMSDL) to get notification of LUS discovery

5.        Call JM.getJoinSet() and verify that it returns a reference to LUS

6.        Call CLM.lookup(tmpl, 2, 3, null, DELAY) where tmpl matches TS1

7.        Verify that a reference to TS1 is returned

8.        Call CLM.getDiscoverymanager (DM)

9.        Call DM.addDiscoveryListener(DMDL)

10.     Call DM.getRegistrars() and verify that a reference to LUS is returned

11.     Destroy LUS via admin interface [1]

12.     Call CLM.lookup(tmpl, 2, 3, null, DELAY) where tmpl matches TS1

13.     Verify that a RemoteException is thrown (only for "bad codebase" test variant).

14.     Verify that discard LUS event is sent to DMDL due (presumably) to a RemoteException [CLM 4, 6]

15.     Note: variant covers [CLM 5, 7,8]

 

Notes:

[1] Timing dependent -- Assumes 1) that CLM will reuse existing LUS reference before 2) discarding it due lack of announcement packets

 

Variants

- Use public groups, named groups, locators, and mixed mode

- Use malformed/incorrect codebase to try and get a RemoteException due to event listener export [CLM 7,8]

CLMIOExceptionTest (CLMIOET)

1.        Run application under test w/o appropriate socket permissions in the policy file

2.        Create a CLM(null, null) object

3.        Verify that an IOException is thrown (presumably due to an underlying SocketException) [CLM 10]

 

 

CLMCacheStateTest (CLMCST)

1.        Configure two LUS (LUS1-2)each in a unique group

2.        Construct one TestService(TS) and two JoinManagers (JM1-2) that join LUS1 and LUS2 respectively

3.        Note: Make sure to use the same ServiceID for both service registrations

4.        Create a CLM to join both LUS

5.        Call CLM.createLookupCache(tmpl, null, CLMSDL) where tmpl matches TS

6.        Verify that a service discovered event is received by CLMSDL

7.        Use JM1 to update TS attributes (add/modify/remove)

8.        Verify that a service changed event is received by CLMSDL

9.        Call LC.lookup(tmpl, null) and verify that the appropriate attribute settings have changed for TS

10.     Use JM2 to update TS attributes (add/modify/remove)

11.     Verify that a service changed event is received by CLMSDL

12.     Call LC.lookup(tmpl, 5, null) and verify that a single reference to TS is returned and that the appropriate attribute settings have changed [CLM 24]

 

 

CLMLookupTest (CLMLT)

1.        Configure N LUS (LUS1-N) where N >= 5

2.        Configure CLM to search for all LUS

3.        Call CLM.lookup(null, M+2, CLMFLT1) where M > 0

4.        Verify that the empty set returned [CLM 30]

5.        Verify that CLMFLT1 is not called [CLM 32]

6.        Call CLM.lookup(null, null) and verify that null is returned [CLM 29]

7.        Configure M (M>0) TestServices (TS1-M) and M JoinManagers (JM1-M) to join every LUS

8.        Configure TS1-M to have some null attributes

9.        Configure CLM to search all LUS

10.     Call CLM.getDiscoveryManager (DM)

11.     Call DM.addDiscoveryListener(DMDL)

12.     Use DM.getRegistrars() and/or DMDL discovery events to wait for the N LUS to be discovered

13.     Call CLM.lookup(null, M+2, null) and verify that M unique service items (SI) are returned [CLM 25, 26, 28, 31, 35]

14.     Verify that null attributes have been stripped from the returned set [CLM 34]

15.     Call CLM.lookup(null, M+2, CLMFLT2) where CLMFLT2 verifies that no null attributes are passed and verify that CLMFLT2 receives no null attributes [CLM 33]

16.     Call CLM.lookup(null, M/2, null) and verify that M/2 unique SIs are returned

17.     Verify that null attributes have been stripped

18.     Call DM.getRegistrars() and verify that N LUS references are returned

19.     Destroy one LUS

20.     Call CLM.lookup(tmpl, null) where tmpl doesn't match any of the M services

21.     Verify that null is returned [CLM 43, 44]

22.     Verify that a discard event occurs on the destroyed LUS [1] [CLM 36]

23.     Call DM.getRegistrars and verify that N-1 LUS references are returned

24.     Destroy another LUS

25.     Call CLM.lookup(tmpl, null, DELAY) where tmpl doesn't match any of the M services [CLM 37, 38, 41, 42]

26.     Verify that null is returned after at least DELAY ms have elapsed

27.     Verify that a discard event occurs on the destroyed LUS [1]

28.     Call DM.getRegistrars and verify that N-2 LUS references are returned

29.     Destroy another LUS

30.     Call CLM.lookup(tmpl, 5, null) where tmpl doesn't match any of the M services

31.     Verify that an empty array is returned

32.     Verify that a discard event occurs for the destroyed LUS [1]

33.     Call DM.getRegistrars and verify that N-3 LUS references are returned

34.      Destroy another LUS

35.     Call CLM.lookup(tmpl, 3, 5, null, DELAY) where tmpl doesn't match any of the M services [CLM 37, 38, 41, 42]

36.     Verify that an empty array is returned after at least DELAY ms have elapsed

37.     Verify that a discard event occurs on the destroyed LUS [1]

38.     Call DM.getRegistrars and verify that N-4 LUS references are returned

39.     Call CLM.lookup(null, M-2, null) and verify that M-2 references are returned

40.     Call CLM.lookup(null, M-2, M+2, null, DELAY) and verify that M references are returned immediately [CLM 45]

41.     Call CLM.lookup(null, M+2, M+5, null, 6000) and verify that M references are returned after at least DELAY ms have elapsed

42.     Call CLM.lookup(null, M+2, M+5, null, -6000) and verify that M references are returned immediately [CLM 46]

43.     Call CLM.lookup(null, -1, M+5, null, -6000) and verify that an IllegalArgumentException is thrown [CLM 47]

44.     Call CLM.lookup(null, 1, -1, null, -6000) and verify that an IllegalArgumentException is thrown

45.     Call CLM.lookup(null, -3, -1, null, -6000) and verify that an IllegalArgumentException is thrown

46.      Call CLM.lookup(null, M+2, M+1, null, -6000) and verify that an IllegalArgumentException is thrown [CLM 48]

 

Notes:

[1] Timing dependent -- Assumes 1) that CLM will reuse existing LUS reference before 2) discarding it due lack of announcement packets

 

CLMLookupConcurrencyTest (CLMLCT)

1.        Create 2 LUS initially configured to join no groups

2.        Create TS1-2 and JM1-2 which are initially configured to join non-public GROUP1-2 respectively

3.        Create CLM(null, null) with default to look in public groups

4.        Call CLM.getDiscoveryManager (DM)

5.        Call DM.addDiscoveryListener() (DL)

6.        Call DM.getRegistrars() and verify that no LUS are returned

7.        In a separate thread (T1), call CLM.lookup(tmpl, null, Long.MAX_VALUE) where tmpl only matches TS1 (thread should block)

8.        Configure LUS1 to join a group

9.        Configure JM1 to register TS1 with LUS1

10.     Verify that T1 returns with a reference to TS1 before the timeout expires [CLM 49]

11.     In a separate thread (T2), call CLM.lookup(tmpl, 1, 2, null, Long.MAX_VALUE) where tmpl only matches TS2

12.     Verify that the thread blocks on the lookup call

13.     Configure LUS2 to join a group

14.     Configure JM2 to register TS2 with LUS2

15.     Verify that T2 returns with a reference to TS2 before the timeout expires [CLM 49]

 

 

 

Notes:

[1] timing dependent

CLMTerminateTest

1.        Create LUS1-2 initially configured to join no groups

2.        Create TS1 and JM1 that is configured to join group1

3.        Create TS2 and JM2 that is configured to join group2

4.        Create TS3 and JM3 that is configured to join group3

5.        Create CLM initially configured to find group1 along with an instrumented LRM1. This LRM1 allows the tracking of the # of Leases currently being managed [1]

6.        Call CLM.createLookupCache (LC1)with (null, null, CLMSDL1)

7.        Verify that LRM1 is not managing any leases (since there aren't any available LUS)

8.        Configure LUS1 to join group1

9.        Verify that CLMSDL1 receives a service discovered event

10.     Verify that LRM1 is managing at least one lease

11.     Configure LUS1 to leave group1

12.     Verify that CLMSDL1 gets a discard event

13.     Verify that LRM1 is not managing any leases [CLM 60]

14.     Call LC1.lookup(null) and verify that null is returned [CLM 61]

15.     Call LC1.lookup(null, 5) and verify that the empty set is returned.

16.     Call CLM.lookup(Tmpl3, null, DELAY) where Tmpl3 looks for TS3 (not available) and DELAY is "long" in a separate thread Th2 [2]

17.     Call CLM.terminate() in a another thread Th3 [CLM 57]

18.     Configure LUS1 to join group2

19.     Call JM2.getJoinSet() and verify that LUS1 is returned

20.     Verify that CLMSDL1 gets a service discovered notification

21.     Interrupt Th2 and wait for it to exit (via join?)

22.     Join Th3 and wait for termination to complete

23.     Configure LUS1 to join group2 and group3

24.     Use JM2 to modify TS2 attributes

25.     Verify that CLMSDL1 doesn't get a service modification or discovery notification [CLM 52, 53]

26.     Verify that LRM1 is not managing any leases [CLM 54]

 

 

Notes:

[1] Need to duplicate LRM functionality since lease data is private in the existing LRM class

[2] Timing dependent

 

CLMLookupCacheReentrancyTest

1.        Configure LUS1 to join no groups

2.        Configure TS1 and JM1 to join group1

3.        Configure CLM to look for group1

4.        Call CLM.creatLookupCache(Tmpl, null, CLMSDL1) (LC) where Tmpl looks for TS1

5.        CLMSDL1's discovered() implementation does the following: [CLM 100]

a.        Calls LC.lookup(null) and verifies that null is returned

b.       Calls LC.lookup(null, 5) and verifies that the empty set is returned

c.        Calls addListener(CLMSDL2) where CLMSDL2's discovered() method is a no-op

d.       Calls removeListener(CLMSDL2)

e.        Calls discard(null)

6.        Configure LUS1 to join group1

7.        Verify that CLMSDL1 gets a service discovered event and that the discovered call doesn't deadlock

8.        Call LC.addListener(CLMSDL3) where CLMSDL3 discovered() does the following:

a.        Calls LC.lookup(null) and verifies that a reference to TS1 is returned

b.       Calls LC.lookup(null, 5) and verifies that a single reference to TS1 is returned

c.        Calls LC.addListener(CLMSDL4)

d.       Call LC.removeListener(null)

e.        Call LC.discard(null)

9.        CLMSDL4's discovered() impl does the following:

a.        Calls LC.lookup(null) and verifies that a reference to TS1 is returned

b.       Calls LC.lookup(null, 10) verifies that a reference to TS1 is returned

c.        Calls LC.addListener(CLMSDL2)

d.       Calls LC.discard(null)

10.     Verify that CLMSDL3 gets a discovered call and that it doesn't deadlock

11.     Verify that CLMSDL4 gets a discovered call and that it doesn't deadlock

12.     Call LC.removeListener(CLMSDL4)

13.     Call LC.removeListener(CLMSDL2)

14.     Call LC.removeListener(CLMSDL3)

15.     Call LC.addListener(CLMSDL5) where CLMSDL5's discovered method does the following:

a.        Calls LC.removeListener(CLMSDL5)

b.       Calls LC.discard(TS1)

c.        Calls LC.addListener(CLMSDL5)

16.     Verify that CLMSDL1 gets discard notice

17.     Verify that CLMSDL5 doesn't get discard notice [1]

18.     Call JM1 to modify TS1's attributes

19.     Verify that CLMSDL1's service changed method gets called where this method does

a.        Calls LC.lookup(null) and verifies that a reference to TS1 is returned

b.       Calls LC.lookup(null, 5) and verifies that a single reference to TS1 is returned

c.        Calls LC.addListener(CLMSDL2)

d.       Call LC.removeListener(CLMSDL2)

e.        Call LC.discard(null)

20.     Call LC.removeListener(CLMSDL5)

21.     Call JM1.terminte() to remove TS1 from LUS1

22.     Call LC.discard(TS1)

23.     CLMSDL1's discard method performs the following

a.        Calls lookup(null) and verifies that null is returned

b.       Calls lookup(null, 5) and verifies that the empty set is returned

c.        Calls addListener(CLMSDL2)

d.       Calls removeListener(CLMSDL2)

e.        Calls discard(TS1)

f.         Calls terminate()

 

Notes:

[1] Assumes discarding of pending notifications makes it into the spec