You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2013/03/05 10:22:31 UTC

svn commit: r1452708 [4/7] - in /river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini: qa/resources/ test/impl/fiddler/event/ test/share/ test/spec/discoveryservice/ test/spec/discoveryservice/event/

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnAddGroups.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnAddGroups.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnAddGroups.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnAddGroups.java Tue Mar  5 09:22:30 2013
@@ -1,178 +1,178 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.jini.test.spec.discoveryservice.event;
-
-import java.util.logging.Level;
-
-import com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
-import com.sun.jini.test.share.GroupsUtil;
-
-import net.jini.discovery.DiscoveryGroupManagement;
-
-import net.jini.core.discovery.LookupLocator;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import com.sun.jini.qa.harness.QAConfig;
-
-/**
- * This class verifies that when the <code>addGroups</code> method is used
- * to add already-discovered groups to a "late-joiner" registration, the
- * lookup discovery service sends the appropriate remote discovery events
- * to that registration's listener.
- *
- * This test was written to test the lookup discovery service when it is
- * used in the following way:
- * <p><ul>
- *   <li> a lookup service is started belonging to some group, say 'g0'
- *   <li> a second lookup service is started belonging to some group, say 'g1'
- *   <li> an initial registration is made with the lookup discovery service,
- *        requesting that group 'g0' be discovered
- *   <li> the listener for the initial registration should receive the expected
- *        remote discovery event for group 'g0'
- *   <li> addGroups is invoked on the initial registration to add group 'g1'
- *        to the set of groups to discover for that registration
- *   <li> the listener for the initial registration should receive the expected
- *        remote discovery event for group 'g1'
- *   <li> a second registration is made with the lookup discovery service,
- *        requesting that the previously discovered group 'g0' be discovered
- *   <li> the listener for the second registration should receive the expected
- *        remote discovery event for group 'g0'
- *   <li> addGroups is invoked on the second registration to add the previously
- *        discovered group 'g1' to the set of groups to discover for that
- *        second registration
- *   <li> the listener for the initial registration should receive the expected
- *        remote discovery event for group 'g1'
- * </ul><p>
- *
- * If the lookup discovery service functions as specified, then upon invoking
- * <code>addGroups</code> for each registration, the listener of each
- * registration will receive an instance of  <code>RemoteDiscoveryEvent</code>
- * which accurately reflects the correct set of member groups.
- * 
- * Specification test for LD3.2 and LD4.1.1 (Group Mutator Methods)
- * Regression test for Bug ID 4437011
- */
-public class LateRegsNotifiedOnAddGroups extends LateRegsNotifiedOn2SetGroups {
-
-    /** Executes the current test by doing the following:
-     * <p><ul>
-     * <li> creates a first set of registration(s) with the lookup discovery
-     *      service, requesting the discovery of the first set of groups,
-     *      which should equal the member groups of the first lookup service(s)
-     *      started in construct
-     * <li> verifies that the listener for the first registration(s) receives
-     *      the appropriate remote discovery event for the first set of groups
-     * <li> on each of the initial registration(s) calls addGroups, requesting
-     *      that the discovery of the second set of groups, which should equal
-     *      the member groups of the second lookup service(s) started in construct
-     * <li> verifies that the listener for the first registration(s) receive
-     *      the appropriate remote discovery event for the second set of groups
-     * <li> creates a second set of registration(s) with the lookup discovery
-     *      service, requesting the discovery of the first set of groups
-     * <li> verifies that the listener for the second registration(s) receive
-     *      the appropriate remote discovery event for the first set of groups
-     * <li> on each of the second registration(s) calls addGroups, requesting
-     *      that the discovery of the second set of groups
-     * <li> verifies that the listener for the second registration(s) receive
-     *      the appropriate remote discovery event for the second set of groups
-     * </ul>
-     */
-    public void run() throws Exception {
-        logger.log(Level.FINE, "run()");
-        LookupLocator[] noLocs = getLocatorsToDiscover(useOnlyGroupDiscovery);
-        /* create the 1st set of registrations */
-        for(int i=0;i<nRegistrations;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(groups0,noLocs,i,leaseDuration);
-        }//end loop
-        /* verify discovery of the 1st groups for the 1st registration */
-        logger.log(Level.FINE, "wait for discovery -- initial "
-                          +"groups, initial registration(s)");
-        waitForDiscovery();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete");
-
-        HashMap regMap0 = (HashMap)registrationMap.clone();
-
-        /* add to groups to discover for the 1st set of registrations */
-        logger.log(Level.FINE, "add to groups on initial "
-                          +"registration(s)");
-        addGroupsAllRegs(groups1);
-        /* verify discovery of the 2nd groups for the 1st registration */
-        logger.log(Level.FINE, "wait for discovery -- "
-                          +"additional groups, initial registration(s)");
-        waitForDiscovery();
-        /* Reset all discovery event info in preparation for the next
-         * set of registraions
-         */
-        resetAllEventInfoAllRegs();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete ... request "+nAddRegistrations
-                          +" additional registration(s)");
-        /* create 2nd set of registrations */
-        int totalRegs = nRegistrations+nAddRegistrations;
-        for(int i=nRegistrations;i<totalRegs;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(groups0,noLocs,i,leaseDuration);
-        }//end loop
-        /* verify discovery of the 1st groups for the 2nd registration */
-        logger.log(Level.FINE, "wait for discovery -- initial "
-                          +"groups, additional registration(s)");
-        waitForDiscovery();
-        /* add to groups to discover for the 2nd set of registrations */
-        logger.log(Level.FINE, "wait period complete ... "
-                          +"add to groups on additional registration(s)");
-        Set eSet = registrationMap.entrySet();
-        Iterator iter = eSet.iterator();
-        for(int i=0;iter.hasNext();i++) {
-            /* Reset & skip registrations from the initial set */
-            Map.Entry regListenerPair = (Map.Entry)iter.next();
-            if( regMap0.containsKey(regListenerPair.getKey()) ) {
-                /* Must reset discovery event info for these registrations
-                 * since their 'discoveryComplete' flag was set to true the
-                 * last time waitForDiscovery() was invoked.
-                 */
-                resetAllEventInfoOneReg(regListenerPair);
-                continue;
-            }//endif
-            addGroupsOneReg( groups1, regListenerPair );
-
-            if( groups1 == DiscoveryGroupManagement.ALL_GROUPS ) {
-                logger.log(Level.FINE, "   FAILURE -- tried to add ALL_GROUPS");
-            } else if( groups1.length <= 0 ) {
-                logger.log(Level.FINE, "    NO-OP -- tried to add NO_GROUPS");
-            } else {
-                GroupsUtil.displayGroupSet( groups1,
-                                           "   additional reg -- group",
-                                           Level.FINE);
-            }//endif
-        }//end loop
-        /* verify discovery of the 2nd groups for the 2nd registration */
-        logger.log(Level.FINE, "wait for discovery -- "
-                         +"additional groups, additional registration(s)");
-        waitForDiscovery();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete");
-    }//end run
-
-} //end class LateRegsNotifiedOnAddGroups
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.sun.jini.test.spec.discoveryservice.event;
+
+import java.util.logging.Level;
+
+import com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
+import com.sun.jini.test.share.GroupsUtil;
+
+import net.jini.discovery.DiscoveryGroupManagement;
+
+import net.jini.core.discovery.LookupLocator;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import com.sun.jini.qa.harness.QAConfig;
+
+/**
+ * This class verifies that when the <code>addGroups</code> method is used
+ * to add already-discovered groups to a "late-joiner" registration, the
+ * lookup discovery service sends the appropriate remote discovery events
+ * to that registration's listener.
+ *
+ * This test was written to test the lookup discovery service when it is
+ * used in the following way:
+ * <p><ul>
+ *   <li> a lookup service is started belonging to some group, say 'g0'
+ *   <li> a second lookup service is started belonging to some group, say 'g1'
+ *   <li> an initial registration is made with the lookup discovery service,
+ *        requesting that group 'g0' be discovered
+ *   <li> the listener for the initial registration should receive the expected
+ *        remote discovery event for group 'g0'
+ *   <li> addGroups is invoked on the initial registration to add group 'g1'
+ *        to the set of groups to discover for that registration
+ *   <li> the listener for the initial registration should receive the expected
+ *        remote discovery event for group 'g1'
+ *   <li> a second registration is made with the lookup discovery service,
+ *        requesting that the previously discovered group 'g0' be discovered
+ *   <li> the listener for the second registration should receive the expected
+ *        remote discovery event for group 'g0'
+ *   <li> addGroups is invoked on the second registration to add the previously
+ *        discovered group 'g1' to the set of groups to discover for that
+ *        second registration
+ *   <li> the listener for the initial registration should receive the expected
+ *        remote discovery event for group 'g1'
+ * </ul><p>
+ *
+ * If the lookup discovery service functions as specified, then upon invoking
+ * <code>addGroups</code> for each registration, the listener of each
+ * registration will receive an instance of  <code>RemoteDiscoveryEvent</code>
+ * which accurately reflects the correct set of member groups.
+ * 
+ * Specification test for LD3.2 and LD4.1.1 (Group Mutator Methods)
+ * Regression test for Bug ID 4437011
+ */
+public class LateRegsNotifiedOnAddGroups extends LateRegsNotifiedOn2SetGroups {
+
+    /** Executes the current test by doing the following:
+     * <p><ul>
+     * <li> creates a first set of registration(s) with the lookup discovery
+     *      service, requesting the discovery of the first set of groups,
+     *      which should equal the member groups of the first lookup service(s)
+     *      started in construct
+     * <li> verifies that the listener for the first registration(s) receives
+     *      the appropriate remote discovery event for the first set of groups
+     * <li> on each of the initial registration(s) calls addGroups, requesting
+     *      that the discovery of the second set of groups, which should equal
+     *      the member groups of the second lookup service(s) started in construct
+     * <li> verifies that the listener for the first registration(s) receive
+     *      the appropriate remote discovery event for the second set of groups
+     * <li> creates a second set of registration(s) with the lookup discovery
+     *      service, requesting the discovery of the first set of groups
+     * <li> verifies that the listener for the second registration(s) receive
+     *      the appropriate remote discovery event for the first set of groups
+     * <li> on each of the second registration(s) calls addGroups, requesting
+     *      that the discovery of the second set of groups
+     * <li> verifies that the listener for the second registration(s) receive
+     *      the appropriate remote discovery event for the second set of groups
+     * </ul>
+     */
+    public void run() throws Exception {
+        logger.log(Level.FINE, "run()");
+        LookupLocator[] noLocs = getLocatorsToDiscover(getUseOnlyGroupDiscovery());
+        /* create the 1st set of registrations */
+        for(int i=0;i<nRegistrations;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(groups0,noLocs,i,leaseDuration);
+        }//end loop
+        /* verify discovery of the 1st groups for the 1st registration */
+        logger.log(Level.FINE, "wait for discovery -- initial "
+                          +"groups, initial registration(s)");
+        waitForDiscovery();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete");
+
+        Map regMap0 = new HashMap(getRegistrationMap());
+
+        /* add to groups to discover for the 1st set of registrations */
+        logger.log(Level.FINE, "add to groups on initial "
+                          +"registration(s)");
+        addGroupsAllRegs(groups1);
+        /* verify discovery of the 2nd groups for the 1st registration */
+        logger.log(Level.FINE, "wait for discovery -- "
+                          +"additional groups, initial registration(s)");
+        waitForDiscovery();
+        /* Reset all discovery event info in preparation for the next
+         * set of registraions
+         */
+        resetAllEventInfoAllRegs();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete ... request "+nAddRegistrations
+                          +" additional registration(s)");
+        /* create 2nd set of registrations */
+        int totalRegs = nRegistrations+nAddRegistrations;
+        for(int i=nRegistrations;i<totalRegs;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(groups0,noLocs,i,leaseDuration);
+        }//end loop
+        /* verify discovery of the 1st groups for the 2nd registration */
+        logger.log(Level.FINE, "wait for discovery -- initial "
+                          +"groups, additional registration(s)");
+        waitForDiscovery();
+        /* add to groups to discover for the 2nd set of registrations */
+        logger.log(Level.FINE, "wait period complete ... "
+                          +"add to groups on additional registration(s)");
+        Set eSet = getRegistrationMap().entrySet();
+        Iterator iter = eSet.iterator();
+        for(int i=0;iter.hasNext();i++) {
+            /* Reset & skip registrations from the initial set */
+            Map.Entry regListenerPair = (Map.Entry)iter.next();
+            if( regMap0.containsKey(regListenerPair.getKey()) ) {
+                /* Must reset discovery event info for these registrations
+                 * since their 'discoveryComplete' flag was set to true the
+                 * last time waitForDiscovery() was invoked.
+                 */
+                resetAllEventInfoOneReg(regListenerPair);
+                continue;
+            }//endif
+            addGroupsOneReg( groups1, regListenerPair );
+
+            if( groups1 == DiscoveryGroupManagement.ALL_GROUPS ) {
+                logger.log(Level.FINE, "   FAILURE -- tried to add ALL_GROUPS");
+            } else if( groups1.length <= 0 ) {
+                logger.log(Level.FINE, "    NO-OP -- tried to add NO_GROUPS");
+            } else {
+                GroupsUtil.displayGroupSet( groups1,
+                                           "   additional reg -- group",
+                                           Level.FINE);
+            }//endif
+        }//end loop
+        /* verify discovery of the 2nd groups for the 2nd registration */
+        logger.log(Level.FINE, "wait for discovery -- "
+                         +"additional groups, additional registration(s)");
+        waitForDiscovery();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete");
+    }//end run
+
+} //end class LateRegsNotifiedOnAddGroups
+

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnAddLocs.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnAddLocs.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnAddLocs.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnAddLocs.java Tue Mar  5 09:22:30 2013
@@ -1,183 +1,183 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.jini.test.spec.discoveryservice.event;
-
-import java.util.logging.Level;
-
-import com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
-import com.sun.jini.test.share.LocatorsUtil;
-
-import net.jini.discovery.DiscoveryGroupManagement;
-
-import net.jini.core.discovery.LookupLocator;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import com.sun.jini.qa.harness.QAConfig;
-
-/**
- * This class verifies that when the <code>addLocators</code> method is used
- * to add already-discovered locators to a "late-joiner" registration, the
- * lookup discovery service sends the appropriate remote discovery events
- * to that registration's listener.
- *
- * This test was written to test the lookup discovery service when it is
- * used in the following way:
- * <p><ul>
- *   <li> a lookup service is started having locator, say 'l0'
- *   <li> a second lookup service is started locator, say 'l1'
- *   <li> an initial registration is made with the lookup discovery service,
- *        requesting that locator 'l0' be discovered
- *   <li> the listener for the initial registration should receive the expected
- *        remote discovery event for locator 'l0'
- *   <li> addLocators is invoked on the initial registration to add locator
- *        'l1' to the set of locators to discover for that registration
- *   <li> the listener for the initial registration should receive the expected
- *        remote discovery event for locator 'l1'
- *   <li> a second registration is made with the lookup discovery service,
- *        requesting that the previously discovered locator 'l0' be discovered
- *   <li> the listener for the second registration should receive the expected
- *        remote discovery event for locator 'l0'
- *   <li> addLocators is invoked on the second registration to add the
- *        previously discovered locator 'l1' to the set of locators to
- *        discover for that second registration
- *   <li> the listener for the initial registration should receive the expected
- *        remote discovery event for locator 'l1'
- * </ul><p>
- *
- * If the lookup discovery service functions as specified, then upon invoking
- * <code>addLocators</code> for each registration, the listener of each
- * registration will receive an instance of  <code>RemoteDiscoveryEvent</code>
- * which accurately reflects the expected lookup services.
- * 
- * Specification test for LD3.2 and LD4.1.1 (Locator Mutator Methods)
- * Regression test for Bug ID 4437560
- */
-public class LateRegsNotifiedOnAddLocs extends LateRegsNotifiedOn2SetLocs {
-
-    /** Executes the current test by doing the following:
-     * <p><ul>
-     * <li> creates a first set of registration(s) with the lookup discovery
-     *      service, requesting the discovery of the first set of locators,
-     *      which should equal the locators of the first lookup service(s)
-     *      started in construct
-     * <li> verifies that the listener for the first registration(s) receives
-     *      the appropriate remote discovery event for the first set of
-     *      locators
-     * <li> on each of the initial registration(s) calls addLocators,
-     *      requesting that the discovery of the second set of locators, which
-     *      should equal the locators of the second lookup service(s) started
-     *      in construct
-     * <li> verifies that the listener for the first registration(s) receive
-     *      the appropriate remote discovery event for the second set of
-     *      locators
-     * <li> creates a second set of registration(s) with the lookup discovery
-     *      service, requesting the discovery of the first set of locators
-     * <li> verifies that the listener for the second registration(s) receive
-     *      the appropriate remote discovery event for the first set of
-     *      locators
-     * <li> on each of the second registration(s) calls addLocators, requesting
-     *      the discovery of the second set of locators
-     * <li> verifies that the listener for the second registration(s) receive
-     *      the appropriate remote discovery event for the second set of
-     *      locators
-     * </ul>
-     */
-    public void run() throws Exception {
-        logger.log(Level.FINE, "run()");
-        String[] noGroups = DiscoveryGroupManagement.NO_GROUPS;
-        /* create the 1st set of registrations */
-        for(int i=0;i<nRegistrations;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(noGroups,locs0,i,leaseDuration);
-        }//end loop
-        /* verify discovery of the 1st locs for the 1st registration */
-        logger.log(Level.FINE, "wait for discovery -- initial "
-                          +"locators, initial registration(s)");
-        waitForDiscovery();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete");
-
-        HashMap regMap0 = (HashMap)registrationMap.clone();
-
-        /* add to locators to discover for the 1st set of registrations */
-        logger.log(Level.FINE, "add to locators on initial "
-                          +"registration(s)");
-        addLocatorsAllRegs(locs1);
-        /* verify discovery of the 2nd locators for the 1st registration */
-        logger.log(Level.FINE, "wait for discovery -- "
-                          +"additional locators, initial registration(s)");
-        waitForDiscovery();
-        /* Reset all discovery event info in preparation for the next
-         * set of registraions
-         */
-        resetAllEventInfoAllRegs();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete ... request "+nAddRegistrations
-                          +" additional registration(s)");
-        /* create 2nd set of registrations */
-        int totalRegs = nRegistrations+nAddRegistrations;
-        for(int i=nRegistrations;i<totalRegs;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(noGroups,locs0,i,leaseDuration);
-        }//end loop
-        /* verify discovery of the 1st locators for the 2nd registration */
-        logger.log(Level.FINE, "wait for discovery -- initial "
-                          +"locators, additional registration(s)");
-        waitForDiscovery();
-        /* add to locators to discover for the 2nd set of registrations */
-        logger.log(Level.FINE, "wait period complete ... "
-                         +"add to locators on additional registration(s)");
-        Set eSet = registrationMap.entrySet();
-        Iterator iter = eSet.iterator();
-        for(int i=0;iter.hasNext();i++) {
-            /* Reset & skip registrations from the initial set */
-            Map.Entry regListenerPair = (Map.Entry)iter.next();
-            if( regMap0.containsKey(regListenerPair.getKey()) ) {
-                /* Must reset discovery event info for these registrations
-                 * since their 'discoveryComplete' flag was set to true the
-                 * last time waitForDiscovery() was invoked.
-                 */
-                resetAllEventInfoOneReg(regListenerPair);
-                continue;
-            }//endif
-            addLocatorsOneReg( locs1, regListenerPair );
-
-            if(locs1 == null) {
-                logger.log(Level.FINE, "    FAILURE -- tried to add NULL");
-            } else if( locs1.length <= 0 ) {
-                logger.log(Level.FINE, "   NO-OP -- tried to add NO_LOCATORS");
-            } else {
-                LocatorsUtil.displayLocatorSet( locs1,
-                                           "   additional reg -- locator",
-                                           Level.FINE);
-            }//endif
-        }//end loop
-        /* verify discovery of the 2nd locators for the 2nd registration */
-        logger.log(Level.FINE, "wait for discovery -- "
-                       +"additional locators, additional registration(s)");
-        waitForDiscovery();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete");
-    }//end run
-
-} //end class LateRegsNotifiedOnAddLocs
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.sun.jini.test.spec.discoveryservice.event;
+
+import java.util.logging.Level;
+
+import com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
+import com.sun.jini.test.share.LocatorsUtil;
+
+import net.jini.discovery.DiscoveryGroupManagement;
+
+import net.jini.core.discovery.LookupLocator;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import com.sun.jini.qa.harness.QAConfig;
+
+/**
+ * This class verifies that when the <code>addLocators</code> method is used
+ * to add already-discovered locators to a "late-joiner" registration, the
+ * lookup discovery service sends the appropriate remote discovery events
+ * to that registration's listener.
+ *
+ * This test was written to test the lookup discovery service when it is
+ * used in the following way:
+ * <p><ul>
+ *   <li> a lookup service is started having locator, say 'l0'
+ *   <li> a second lookup service is started locator, say 'l1'
+ *   <li> an initial registration is made with the lookup discovery service,
+ *        requesting that locator 'l0' be discovered
+ *   <li> the listener for the initial registration should receive the expected
+ *        remote discovery event for locator 'l0'
+ *   <li> addLocators is invoked on the initial registration to add locator
+ *        'l1' to the set of locators to discover for that registration
+ *   <li> the listener for the initial registration should receive the expected
+ *        remote discovery event for locator 'l1'
+ *   <li> a second registration is made with the lookup discovery service,
+ *        requesting that the previously discovered locator 'l0' be discovered
+ *   <li> the listener for the second registration should receive the expected
+ *        remote discovery event for locator 'l0'
+ *   <li> addLocators is invoked on the second registration to add the
+ *        previously discovered locator 'l1' to the set of locators to
+ *        discover for that second registration
+ *   <li> the listener for the initial registration should receive the expected
+ *        remote discovery event for locator 'l1'
+ * </ul><p>
+ *
+ * If the lookup discovery service functions as specified, then upon invoking
+ * <code>addLocators</code> for each registration, the listener of each
+ * registration will receive an instance of  <code>RemoteDiscoveryEvent</code>
+ * which accurately reflects the expected lookup services.
+ * 
+ * Specification test for LD3.2 and LD4.1.1 (Locator Mutator Methods)
+ * Regression test for Bug ID 4437560
+ */
+public class LateRegsNotifiedOnAddLocs extends LateRegsNotifiedOn2SetLocs {
+
+    /** Executes the current test by doing the following:
+     * <p><ul>
+     * <li> creates a first set of registration(s) with the lookup discovery
+     *      service, requesting the discovery of the first set of locators,
+     *      which should equal the locators of the first lookup service(s)
+     *      started in construct
+     * <li> verifies that the listener for the first registration(s) receives
+     *      the appropriate remote discovery event for the first set of
+     *      locators
+     * <li> on each of the initial registration(s) calls addLocators,
+     *      requesting that the discovery of the second set of locators, which
+     *      should equal the locators of the second lookup service(s) started
+     *      in construct
+     * <li> verifies that the listener for the first registration(s) receive
+     *      the appropriate remote discovery event for the second set of
+     *      locators
+     * <li> creates a second set of registration(s) with the lookup discovery
+     *      service, requesting the discovery of the first set of locators
+     * <li> verifies that the listener for the second registration(s) receive
+     *      the appropriate remote discovery event for the first set of
+     *      locators
+     * <li> on each of the second registration(s) calls addLocators, requesting
+     *      the discovery of the second set of locators
+     * <li> verifies that the listener for the second registration(s) receive
+     *      the appropriate remote discovery event for the second set of
+     *      locators
+     * </ul>
+     */
+    public void run() throws Exception {
+        logger.log(Level.FINE, "run()");
+        String[] noGroups = DiscoveryGroupManagement.NO_GROUPS;
+        /* create the 1st set of registrations */
+        for(int i=0;i<nRegistrations;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(noGroups,locs0,i,leaseDuration);
+        }//end loop
+        /* verify discovery of the 1st locs for the 1st registration */
+        logger.log(Level.FINE, "wait for discovery -- initial "
+                          +"locators, initial registration(s)");
+        waitForDiscovery();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete");
+
+        Map regMap0 = new HashMap(getRegistrationMap());
+
+        /* add to locators to discover for the 1st set of registrations */
+        logger.log(Level.FINE, "add to locators on initial "
+                          +"registration(s)");
+        addLocatorsAllRegs(locs1);
+        /* verify discovery of the 2nd locators for the 1st registration */
+        logger.log(Level.FINE, "wait for discovery -- "
+                          +"additional locators, initial registration(s)");
+        waitForDiscovery();
+        /* Reset all discovery event info in preparation for the next
+         * set of registraions
+         */
+        resetAllEventInfoAllRegs();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete ... request "+nAddRegistrations
+                          +" additional registration(s)");
+        /* create 2nd set of registrations */
+        int totalRegs = nRegistrations+nAddRegistrations;
+        for(int i=nRegistrations;i<totalRegs;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(noGroups,locs0,i,leaseDuration);
+        }//end loop
+        /* verify discovery of the 1st locators for the 2nd registration */
+        logger.log(Level.FINE, "wait for discovery -- initial "
+                          +"locators, additional registration(s)");
+        waitForDiscovery();
+        /* add to locators to discover for the 2nd set of registrations */
+        logger.log(Level.FINE, "wait period complete ... "
+                         +"add to locators on additional registration(s)");
+        Set eSet = getRegistrationMap().entrySet();
+        Iterator iter = eSet.iterator();
+        for(int i=0;iter.hasNext();i++) {
+            /* Reset & skip registrations from the initial set */
+            Map.Entry regListenerPair = (Map.Entry)iter.next();
+            if( regMap0.containsKey(regListenerPair.getKey()) ) {
+                /* Must reset discovery event info for these registrations
+                 * since their 'discoveryComplete' flag was set to true the
+                 * last time waitForDiscovery() was invoked.
+                 */
+                resetAllEventInfoOneReg(regListenerPair);
+                continue;
+            }//endif
+            addLocatorsOneReg( locs1, regListenerPair );
+
+            if(locs1 == null) {
+                logger.log(Level.FINE, "    FAILURE -- tried to add NULL");
+            } else if( locs1.length <= 0 ) {
+                logger.log(Level.FINE, "   NO-OP -- tried to add NO_LOCATORS");
+            } else {
+                LocatorsUtil.displayLocatorSet( locs1,
+                                           "   additional reg -- locator",
+                                           Level.FINE);
+            }//endif
+        }//end loop
+        /* verify discovery of the 2nd locators for the 2nd registration */
+        logger.log(Level.FINE, "wait for discovery -- "
+                       +"additional locators, additional registration(s)");
+        waitForDiscovery();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete");
+    }//end run
+
+} //end class LateRegsNotifiedOnAddLocs
+

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnSetGroups.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnSetGroups.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnSetGroups.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnSetGroups.java Tue Mar  5 09:22:30 2013
@@ -1,170 +1,170 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.jini.test.spec.discoveryservice.event;
-
-import java.util.logging.Level;
-
-import com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
-import com.sun.jini.test.share.GroupsUtil;
-
-import net.jini.discovery.DiscoveryGroupManagement;
-
-import net.jini.core.discovery.LookupLocator;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This class verifies that when the <code>setGroups</code> method, rather
- * than the <code>register</code> method, is used to configure a "late-joiner"
- * registration with its desired groups, the lookup discovery service sends
- * the appropriate remote discovery events to that registration's listener.
- *
- * This test was written to investigate a posting on the user's list. In
- * that posting, a user observed that when the lookup discovery service
- * was used in the following way, unexpected results occurred:
- * <p><ul>
- *   <li> a lookup service was started belonging to some group, say 'g0'
- *   <li> an initial service registered with the lookup discovery service,
- *        requesting NO_GROUPS and no locators be discovered
- *   <li> setGroups was then invoked to request that group 'g0' be discovered
- *   <li> the listener for that initial registration then received the
- *        expected remote discovery event
- *   <li> a second service was then registered with the lookup discovery
- *        service, again requesting that NO_GROUPS and no locators be
- *        discovered
- *   <li> setGroups was again invoked to request that group 'g0' be discovered
- *        for the second registration, but no remote discovery event was
- *        ever sent to the registration's listener
- * </ul><p>
- *
- * Upon investigation, it was found that the lookup discovery service was
- * not sending events for lookup services that were previously discovered for 
- * other registrations (the place where this should have occurred in the
- * contributed implementation of the lookup discovery service was in the
- * <code>SetGroupsTask</code>). This bug was filed as bug 4434000.
- *
- * To duplicate the user's scenario within the context of the current test
- * harness, it is not necessary to create two services; it is only necessary to
- * create two registrations, each initially registering for NO_GROUPS and no
- * locators, and then calling <code>setGroups</code> to request that the
- * lookup discovery service discover a given set of groups for each
- * registration.
- * 
- * If the lookup discovery service functions as specified, then upon invoking
- * <code>setGroups</code> for each registration, the listener of each
- * registration will receive an instance of  <code>RemoteDiscoveryEvent</code>
- * which accurately reflects the correct set of member groups.
- * 
- * Specification test for LD3.2 and LD4.1.1 (Group Mutator Methods)
- * Regression test for Bug ID 4434000
- */
-public class LateRegsNotifiedOnSetGroups extends AbstractBaseTest {
-
-    /** Executes the current test by doing the following:
-     * <p><ul>
-     * <li> create a first set of registration(s) with the lookup discovery
-     *      service, requesting that NO_GROUPS and no locators be discovered
-     * <li> calls setGroups, requesting the discovery of the member groups of
-     *      the lookup service(s) started in construct
-     * <li> verifies that the discovery process is working for the first
-     *      registration by waiting for the expected discovery events
-     * <li> creates a second set of registration(s) with the lookup discovery
-     *      service, again requesting that NO_GROUPS and no locators be
-     *      discovered
-     * <li> again calls setGroups, requesting the discovery of the same groups
-     *      with which the first registration is configured
-     * <li> verifies that the discovery process is working for the second
-     *      registration by waiting for the expected discovery events
-     * </ul>
-     */
-    public void run() throws Exception {
-        logger.log(Level.FINE, "run()");
-        String[] groupsToDiscover = getGroupsToDiscover(useOnlyGroupDiscovery);
-        LookupLocator[] noLocs = getLocatorsToDiscover(useOnlyGroupDiscovery);
-        /* create the 1st set of registrations */
-        for(int i=0;i<nRegistrations;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(DiscoveryGroupManagement.NO_GROUPS,noLocs,
-                           i,leaseDuration);
-        }//end loop
-        /* set the groups to discover for the 1st set of registrations */
-        logger.log(Level.FINE, "set groups on initial "
-                          +"registration(s)");
-        setGroupsAllRegs(groupsToDiscover);
-        logger.log(Level.FINE, "wait for discovery on "
-                          +" initial registration(s)");
-        waitForDiscovery();
-        /* Reset all discovery event info in preparation for the next
-         * set of registraions
-         */
-        resetAllEventInfoAllRegs();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete ... request "+nAddRegistrations
-                          +" additional registration(s)");
-
-        HashMap regMap0 = (HashMap)registrationMap.clone();
-
-        /* create 2nd set of registrations */
-        int totalRegs = nRegistrations+nAddRegistrations;
-        for(int i=nRegistrations;i<totalRegs;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(DiscoveryGroupManagement.NO_GROUPS,noLocs,
-                           i,leaseDuration);
-        }//end loop
-        /* set the groups to discover for the 2nd set of registrations */
-        logger.log(Level.FINE, "set groups on additional "
-                          +"registration(s)");
-        Set eSet = registrationMap.entrySet();
-        Iterator iter = eSet.iterator();
-        for(int i=0;iter.hasNext();i++) {
-            /* Skip registrations from the initial set of registrations */
-            Map.Entry regListenerPair = (Map.Entry)iter.next();
-            if( regMap0.containsKey(regListenerPair.getKey()) ) {
-                /* Must reset discovery event info for these registrations
-                 * since their 'discoveryComplete' flag was set to true the
-                 * last time waitForDiscovery() was invoked.
-                 */
-                resetAllEventInfoOneReg(regListenerPair);
-                continue;
-            }//endif
-            setGroupsOneReg( groupsToDiscover, regListenerPair );
-            if( groupsToDiscover == DiscoveryGroupManagement.ALL_GROUPS ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"groups set to ALL_GROUPS");
-            } else if( groupsToDiscover.length <= 0 ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"groups set to NO_GROUPS");
-            } else {
-                GroupsUtil.displayGroupSet( groupsToDiscover,
-                                           "   additional reg -- group",
-                                           Level.FINE);
-            }//endif
-        }//end loop
-        logger.log(Level.FINE, "wait for discovery on "
-                         +"additional registration(s)");
-        waitForDiscovery();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete");
-    }//end run
-
-} //end class LateRegsNotifiedOnSetGroups
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.sun.jini.test.spec.discoveryservice.event;
+
+import java.util.logging.Level;
+
+import com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
+import com.sun.jini.test.share.GroupsUtil;
+
+import net.jini.discovery.DiscoveryGroupManagement;
+
+import net.jini.core.discovery.LookupLocator;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class verifies that when the <code>setGroups</code> method, rather
+ * than the <code>register</code> method, is used to configure a "late-joiner"
+ * registration with its desired groups, the lookup discovery service sends
+ * the appropriate remote discovery events to that registration's listener.
+ *
+ * This test was written to investigate a posting on the user's list. In
+ * that posting, a user observed that when the lookup discovery service
+ * was used in the following way, unexpected results occurred:
+ * <p><ul>
+ *   <li> a lookup service was started belonging to some group, say 'g0'
+ *   <li> an initial service registered with the lookup discovery service,
+ *        requesting NO_GROUPS and no locators be discovered
+ *   <li> setGroups was then invoked to request that group 'g0' be discovered
+ *   <li> the listener for that initial registration then received the
+ *        expected remote discovery event
+ *   <li> a second service was then registered with the lookup discovery
+ *        service, again requesting that NO_GROUPS and no locators be
+ *        discovered
+ *   <li> setGroups was again invoked to request that group 'g0' be discovered
+ *        for the second registration, but no remote discovery event was
+ *        ever sent to the registration's listener
+ * </ul><p>
+ *
+ * Upon investigation, it was found that the lookup discovery service was
+ * not sending events for lookup services that were previously discovered for 
+ * other registrations (the place where this should have occurred in the
+ * contributed implementation of the lookup discovery service was in the
+ * <code>SetGroupsTask</code>). This bug was filed as bug 4434000.
+ *
+ * To duplicate the user's scenario within the context of the current test
+ * harness, it is not necessary to create two services; it is only necessary to
+ * create two registrations, each initially registering for NO_GROUPS and no
+ * locators, and then calling <code>setGroups</code> to request that the
+ * lookup discovery service discover a given set of groups for each
+ * registration.
+ * 
+ * If the lookup discovery service functions as specified, then upon invoking
+ * <code>setGroups</code> for each registration, the listener of each
+ * registration will receive an instance of  <code>RemoteDiscoveryEvent</code>
+ * which accurately reflects the correct set of member groups.
+ * 
+ * Specification test for LD3.2 and LD4.1.1 (Group Mutator Methods)
+ * Regression test for Bug ID 4434000
+ */
+public class LateRegsNotifiedOnSetGroups extends AbstractBaseTest {
+
+    /** Executes the current test by doing the following:
+     * <p><ul>
+     * <li> create a first set of registration(s) with the lookup discovery
+     *      service, requesting that NO_GROUPS and no locators be discovered
+     * <li> calls setGroups, requesting the discovery of the member groups of
+     *      the lookup service(s) started in construct
+     * <li> verifies that the discovery process is working for the first
+     *      registration by waiting for the expected discovery events
+     * <li> creates a second set of registration(s) with the lookup discovery
+     *      service, again requesting that NO_GROUPS and no locators be
+     *      discovered
+     * <li> again calls setGroups, requesting the discovery of the same groups
+     *      with which the first registration is configured
+     * <li> verifies that the discovery process is working for the second
+     *      registration by waiting for the expected discovery events
+     * </ul>
+     */
+    public void run() throws Exception {
+        logger.log(Level.FINE, "run()");
+        String[] groupsToDiscover = getGroupsToDiscover(getUseOnlyGroupDiscovery());
+        LookupLocator[] noLocs = getLocatorsToDiscover(getUseOnlyGroupDiscovery());
+        /* create the 1st set of registrations */
+        for(int i=0;i<nRegistrations;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(DiscoveryGroupManagement.NO_GROUPS,noLocs,
+                           i,leaseDuration);
+        }//end loop
+        /* set the groups to discover for the 1st set of registrations */
+        logger.log(Level.FINE, "set groups on initial "
+                          +"registration(s)");
+        setGroupsAllRegs(groupsToDiscover);
+        logger.log(Level.FINE, "wait for discovery on "
+                          +" initial registration(s)");
+        waitForDiscovery();
+        /* Reset all discovery event info in preparation for the next
+         * set of registraions
+         */
+        resetAllEventInfoAllRegs();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete ... request "+nAddRegistrations
+                          +" additional registration(s)");
+
+        Map regMap0 = new HashMap(getRegistrationMap());
+
+        /* create 2nd set of registrations */
+        int totalRegs = nRegistrations+nAddRegistrations;
+        for(int i=nRegistrations;i<totalRegs;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(DiscoveryGroupManagement.NO_GROUPS,noLocs,
+                           i,leaseDuration);
+        }//end loop
+        /* set the groups to discover for the 2nd set of registrations */
+        logger.log(Level.FINE, "set groups on additional "
+                          +"registration(s)");
+        Set eSet = getRegistrationMap().entrySet();
+        Iterator iter = eSet.iterator();
+        for(int i=0;iter.hasNext();i++) {
+            /* Skip registrations from the initial set of registrations */
+            Map.Entry regListenerPair = (Map.Entry)iter.next();
+            if( regMap0.containsKey(regListenerPair.getKey()) ) {
+                /* Must reset discovery event info for these registrations
+                 * since their 'discoveryComplete' flag was set to true the
+                 * last time waitForDiscovery() was invoked.
+                 */
+                resetAllEventInfoOneReg(regListenerPair);
+                continue;
+            }//endif
+            setGroupsOneReg( groupsToDiscover, regListenerPair );
+            if( groupsToDiscover == DiscoveryGroupManagement.ALL_GROUPS ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"groups set to ALL_GROUPS");
+            } else if( groupsToDiscover.length <= 0 ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"groups set to NO_GROUPS");
+            } else {
+                GroupsUtil.displayGroupSet( groupsToDiscover,
+                                           "   additional reg -- group",
+                                           Level.FINE);
+            }//endif
+        }//end loop
+        logger.log(Level.FINE, "wait for discovery on "
+                         +"additional registration(s)");
+        waitForDiscovery();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete");
+    }//end run
+
+} //end class LateRegsNotifiedOnSetGroups
+

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnSetLocs.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnSetLocs.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnSetLocs.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOnSetLocs.java Tue Mar  5 09:22:30 2013
@@ -1,153 +1,153 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.jini.test.spec.discoveryservice.event;
-
-import java.util.logging.Level;
-
-import com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
-import com.sun.jini.test.share.LocatorsUtil;
-
-import net.jini.discovery.DiscoveryGroupManagement;
-
-import net.jini.core.discovery.LookupLocator;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This class verifies that when the <code>setLocators</code> method, rather
- * than the <code>register</code> method, is used to configure a "late-joiner"
- * registration with its desired locators, the lookup discovery service sends
- * the appropriate remote discovery events to that registration's listener.
- *
- * This test was written to test the lookup discovery service when it is
- * used in the following way:
- * <p><ul>
- *   <li> a lookup service having locator 'l0' is started (group membership is
- *        irrelevant)
- *   <li> an initial registration is made with the lookup discovery,
- *        requesting NO_GROUPS and no locators be discovered
- *   <li> setLocators is invoked on that registration to request that locator
- *        'l0' be discovered
- *   <li> receipt of the expected remote discovery event by the listener for
- *        that initial registration is verified
- *   <li> a second registration is made with the lookup discovery service,
- *        again requesting that NO_GROUPS and no locators be discovered
- *   <li> another attempt is made to verify the receipt of the expected remote
- *        discovery event by the listener for the second registration
- * </ul><p>
- * 
- * If the lookup discovery service functions as specified, then upon invoking
- * <code>setLocators</code> for each registration, the listener of each
- * registration will receive an instance of  <code>RemoteDiscoveryEvent</code>
- * which accurately reflects the expected lookup services.
- * 
- * Specification test for LD3.2 and LD4.1.1 (Locator Mutator Methods)
- * Regression test for Bug ID 4434883
- */
-public class LateRegsNotifiedOnSetLocs extends AbstractBaseTest {
-
-    /** Executes the current test by doing the following:
-     * <p><ul>
-     * <li> create a first set of registration(s) with the lookup discovery
-     *      service, requesting that NO_GROUPS and no locators be discovered
-     * <li> calls setLocators, requesting the discovery of the locators of
-     *      the lookup service(s) started in construct
-     * <li> verifies that the discovery process is working for the first
-     *      registration by waiting for the expected discovery events
-     * <li> creates a second set of registration(s) with the lookup discovery
-     *      service, again requesting that NO_GROUPS and no locators be
-     *      discovered
-     * <li> again calls setLocators, requesting the discovery of the same
-     *      locators with which the first registration is configured
-     * <li> verifies that the discovery process is working for the second
-     *      registration by waiting for the expected discovery events
-     * </ul>
-     */
-    public void run() throws Exception {
-        logger.log(Level.FINE, "run()");
-        String[]        noGroups = DiscoveryGroupManagement.NO_GROUPS;
-        LookupLocator[] noLocs   = new LookupLocator[0];
-        LookupLocator[] locsToDiscover = getLocatorsToDiscover
-                                                         (useOnlyLocDiscovery);
-        /* create the 1st set of registrations */
-        for(int i=0;i<nRegistrations;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(noGroups,noLocs,i,leaseDuration);
-        }//end loop
-        /* set the locators to discover for the 1st set of registrations */
-        logger.log(Level.FINE, "set loators on initial "
-                          +"registration(s)");
-        setLocatorsAllRegs(locsToDiscover);
-        logger.log(Level.FINE, "wait for discovery on "
-                          +" initial registration(s)");
-        waitForDiscovery();
-        /* Reset all discovery event info in preparation for the next
-         * set of registraions
-         */
-        resetAllEventInfoAllRegs();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete ... request "+nAddRegistrations
-                          +" additional registration(s)");
-
-        HashMap regMap0 = (HashMap)registrationMap.clone();
-
-        /* create 2nd set of registrations */
-        int totalRegs = nRegistrations+nAddRegistrations;
-        for(int i=nRegistrations;i<totalRegs;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(noGroups,noLocs,i,leaseDuration);
-        }//end loop
-        /* set the locators to discover for the 2nd set of registrations */
-        logger.log(Level.FINE, "set locators on additional "
-                          +"registration(s)");
-        Set eSet = registrationMap.entrySet();
-        Iterator iter = eSet.iterator();
-        for(int i=0;iter.hasNext();i++) {
-            /* Skip registrations from the initial set of registrations */
-            Map.Entry regListenerPair = (Map.Entry)iter.next();
-            if( regMap0.containsKey(regListenerPair.getKey()) ) {
-                /* Must reset discovery event info for these registrations
-                 * since their 'discoveryComplete' flag was set to true the
-                 * last time waitForDiscovery() was invoked.
-                 */
-                resetAllEventInfoOneReg(regListenerPair);
-                continue;
-            }//endif
-            setLocatorsOneReg( locsToDiscover, regListenerPair );
-            if( locsToDiscover.length == 0 ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"locators set to NO_LOCATORS");
-            } else {
-                LocatorsUtil.displayLocatorSet( locsToDiscover,
-                                           "   additional reg -- locator",
-                                           Level.FINE);
-            }//endif
-        }//end loop
-        logger.log(Level.FINE, "wait for discovery on "
-                         +"additional registration(s)");
-        waitForDiscovery();
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete");
-    }//end run
-
-} //end class LateRegsNotifiedOnSetLocs
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.sun.jini.test.spec.discoveryservice.event;
+
+import java.util.logging.Level;
+
+import com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
+import com.sun.jini.test.share.LocatorsUtil;
+
+import net.jini.discovery.DiscoveryGroupManagement;
+
+import net.jini.core.discovery.LookupLocator;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class verifies that when the <code>setLocators</code> method, rather
+ * than the <code>register</code> method, is used to configure a "late-joiner"
+ * registration with its desired locators, the lookup discovery service sends
+ * the appropriate remote discovery events to that registration's listener.
+ *
+ * This test was written to test the lookup discovery service when it is
+ * used in the following way:
+ * <p><ul>
+ *   <li> a lookup service having locator 'l0' is started (group membership is
+ *        irrelevant)
+ *   <li> an initial registration is made with the lookup discovery,
+ *        requesting NO_GROUPS and no locators be discovered
+ *   <li> setLocators is invoked on that registration to request that locator
+ *        'l0' be discovered
+ *   <li> receipt of the expected remote discovery event by the listener for
+ *        that initial registration is verified
+ *   <li> a second registration is made with the lookup discovery service,
+ *        again requesting that NO_GROUPS and no locators be discovered
+ *   <li> another attempt is made to verify the receipt of the expected remote
+ *        discovery event by the listener for the second registration
+ * </ul><p>
+ * 
+ * If the lookup discovery service functions as specified, then upon invoking
+ * <code>setLocators</code> for each registration, the listener of each
+ * registration will receive an instance of  <code>RemoteDiscoveryEvent</code>
+ * which accurately reflects the expected lookup services.
+ * 
+ * Specification test for LD3.2 and LD4.1.1 (Locator Mutator Methods)
+ * Regression test for Bug ID 4434883
+ */
+public class LateRegsNotifiedOnSetLocs extends AbstractBaseTest {
+
+    /** Executes the current test by doing the following:
+     * <p><ul>
+     * <li> create a first set of registration(s) with the lookup discovery
+     *      service, requesting that NO_GROUPS and no locators be discovered
+     * <li> calls setLocators, requesting the discovery of the locators of
+     *      the lookup service(s) started in construct
+     * <li> verifies that the discovery process is working for the first
+     *      registration by waiting for the expected discovery events
+     * <li> creates a second set of registration(s) with the lookup discovery
+     *      service, again requesting that NO_GROUPS and no locators be
+     *      discovered
+     * <li> again calls setLocators, requesting the discovery of the same
+     *      locators with which the first registration is configured
+     * <li> verifies that the discovery process is working for the second
+     *      registration by waiting for the expected discovery events
+     * </ul>
+     */
+    public void run() throws Exception {
+        logger.log(Level.FINE, "run()");
+        String[]        noGroups = DiscoveryGroupManagement.NO_GROUPS;
+        LookupLocator[] noLocs   = new LookupLocator[0];
+        LookupLocator[] locsToDiscover = getLocatorsToDiscover
+                                                         (getUseOnlyLocDiscovery());
+        /* create the 1st set of registrations */
+        for(int i=0;i<nRegistrations;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(noGroups,noLocs,i,leaseDuration);
+        }//end loop
+        /* set the locators to discover for the 1st set of registrations */
+        logger.log(Level.FINE, "set loators on initial "
+                          +"registration(s)");
+        setLocatorsAllRegs(locsToDiscover);
+        logger.log(Level.FINE, "wait for discovery on "
+                          +" initial registration(s)");
+        waitForDiscovery();
+        /* Reset all discovery event info in preparation for the next
+         * set of registraions
+         */
+        resetAllEventInfoAllRegs();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete ... request "+nAddRegistrations
+                          +" additional registration(s)");
+
+        Map regMap0 = new HashMap(getRegistrationMap());
+
+        /* create 2nd set of registrations */
+        int totalRegs = nRegistrations+nAddRegistrations;
+        for(int i=nRegistrations;i<totalRegs;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(noGroups,noLocs,i,leaseDuration);
+        }//end loop
+        /* set the locators to discover for the 2nd set of registrations */
+        logger.log(Level.FINE, "set locators on additional "
+                          +"registration(s)");
+        Set eSet = getRegistrationMap().entrySet();
+        Iterator iter = eSet.iterator();
+        for(int i=0;iter.hasNext();i++) {
+            /* Skip registrations from the initial set of registrations */
+            Map.Entry regListenerPair = (Map.Entry)iter.next();
+            if( regMap0.containsKey(regListenerPair.getKey()) ) {
+                /* Must reset discovery event info for these registrations
+                 * since their 'discoveryComplete' flag was set to true the
+                 * last time waitForDiscovery() was invoked.
+                 */
+                resetAllEventInfoOneReg(regListenerPair);
+                continue;
+            }//endif
+            setLocatorsOneReg( locsToDiscover, regListenerPair );
+            if( locsToDiscover.length == 0 ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"locators set to NO_LOCATORS");
+            } else {
+                LocatorsUtil.displayLocatorSet( locsToDiscover,
+                                           "   additional reg -- locator",
+                                           Level.FINE);
+            }//endif
+        }//end loop
+        logger.log(Level.FINE, "wait for discovery on "
+                         +"additional registration(s)");
+        waitForDiscovery();
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete");
+    }//end run
+
+} //end class LateRegsNotifiedOnSetLocs
+