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 [3/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/AddLocatorsFullyQualified.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/AddLocatorsFullyQualified.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/AddLocatorsFullyQualified.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/AddLocatorsFullyQualified.java Tue Mar  5 09:22:30 2013
@@ -1,153 +1,152 @@
-/*
- * 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 com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-import com.sun.jini.qa.harness.TestException;
-import com.sun.jini.qa.harness.QAConfig;
-import com.sun.jini.qa.harness.Test;
-
-import com.sun.jini.test.share.GroupsUtil;
-import com.sun.jini.test.share.LocatorsUtil;
-
-import net.jini.discovery.LookupDiscoveryRegistration;
-
-import net.jini.discovery.DiscoveryGroupManagement;
-import net.jini.core.discovery.LookupLocator;
-import net.jini.discovery.ConstrainableLookupLocator;
-import net.jini.core.lookup.ServiceRegistrar;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This class verifies that the lookup discovery service operates in a manner
- * consistent with the specification. In particular, this class verifies
- * that when a registered client calls addLocators() with locators having
- * fully-qualified host names, the lookup discovery service will successfully
- * discover the associated lookup services.
- *
- * The environment in which this class expects to operate is as follows:
- * <p><ul>
- *   <li> one or more lookup services, each associated with a locator
- *   <li> one instance of the lookup discovery service
- *   <li> one or more registrations with the lookup discovery service, each
- *        initially configured to discover no lookup services
- *   <li> each registration with the lookup discovery service invokes the
- *        addLocators() method -- requesting that the set of locators-of-
- *        interest be augmented with a set in which each element is a locator
- *        having a fully-qualified host name
- *   <li> each registration with the lookup discovery service will receive
- *        remote discovery events through an instance of RemoteEventListener
- * </ul><p>
- * 
- * If the lookup discovery service functions as specified, then for each
- * discovered lookup service, a <code>RemoteDiscoveryEvent</code> instance
- * indicating a discovered event will be sent to the listener of each
- * registration that requested discovery of the lookup service.
- *
- * Related bug ids: 4979612
- * 
- */
-public class AddLocatorsFullyQualified extends AbstractBaseTest {
-
-    protected static Logger logger = 
-                            Logger.getLogger("com.sun.jini.qa.harness.test");
-    protected LookupLocator[] locsStarted;
-    protected LookupLocator[] locsToAdd;
-    protected LookupLocator[] expectedLocs;
-    protected HashMap regInfoMap = registrationMap;
-
-    /** Retrieves additional configuration values. */
-    public Test construct(QAConfig config) throws Exception {
-        super.construct(config);
-//      debugFlag = true;
-//      displayOn = true;
-        useDiscoveryList = useOnlyLocDiscovery;
-        locsStarted = getLocatorsToDiscover(useDiscoveryList);
-        locsToAdd   = new LookupLocator[locsStarted.length];
-        String domain = ( config.getStringConfigVal("com.sun.jini.jsk.domain",
-                                                    null) ).toLowerCase();
-        /* This test wishes to discover-by-locator, each of the lookup services
-         * that were configured to be started for this test. Thus, the set of
-         * locators to discover that is supplied to the lookup discovery
-         * service is created using the host and port of the locators of
-         * the lookups that are started. One difference is that the host
-         * names used to create the locators supplied to the lookup discovery
-         * service should each be fully-qualified names; that is, containing
-         * the domain of the host. 
-         *
-         * The loop below constructs that set of locators; extracting the
-         * host and port of the locator of each lookup service that was
-         * started, concatenating the host and domain when appropriate, and
-         * using the fully-qualified host and port to create the locator to
-         * discover.
-         */
-        for(int i=0; i<locsStarted.length; i++) {
-            String host = (locsStarted[i].getHost()).toLowerCase();
-            if( host.indexOf(domain) == -1 ) {//host does not contain domain
-                host = new String(host+"."+domain);//add domain
-            }//endif
-	    if (locsStarted[i] instanceof ConstrainableLookupLocator) {
-                locsToAdd[i] = new ConstrainableLookupLocator(
-		    host, locsStarted[i].getPort(), 
-		    ((ConstrainableLookupLocator)locsStarted[i]).getConstraints());
-	    } else {
-                locsToAdd[i] = new LookupLocator(host,locsStarted[i].getPort());
-	    }
-            logger.log(Level.FINE, "locsToAdd["+i+"] = "+locsToAdd[i]);
-        }//end loop
-        return this;
-    }//end construct
-
-    public void run() throws Exception {
-        logger.log(Level.FINE, "run()");
-        /* Register with the discovery service, initially requesting the 
-         * discovery of NO_GROUPS and NO_LOCATORS.
-         */
-        for(int i=0;i<nRegistrations;i++) {
-            logger.log(Level.FINE, 
-                      "lookup discovery service registration_"+i+" --");
-            doRegistration(DiscoveryGroupManagement.NO_GROUPS,
-                           new LookupLocator[0],
-                           i, leaseDuration);
-        }//end loop
-        logger.log(Level.FINE, "adding the new locators to discover");
-        /* Invoke the addLocators() method on each registration and set the
-         * locators that are expected to be discovered, based on the locators
-         * that are added.
-         */
-        addLocatorsAllRegs(locsToAdd);
-        logger.log(Level.FINE, "waiting for discovery events");
-        waitForDiscovery();
-    }//end run
-
-}//end class AddLocatorsFullyQualified
-
+/*
+ * 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 com.sun.jini.test.spec.discoveryservice.AbstractBaseTest;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+import com.sun.jini.qa.harness.TestException;
+import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.qa.harness.Test;
+
+import com.sun.jini.test.share.GroupsUtil;
+import com.sun.jini.test.share.LocatorsUtil;
+
+import net.jini.discovery.LookupDiscoveryRegistration;
+
+import net.jini.discovery.DiscoveryGroupManagement;
+import net.jini.core.discovery.LookupLocator;
+import net.jini.discovery.ConstrainableLookupLocator;
+import net.jini.core.lookup.ServiceRegistrar;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class verifies that the lookup discovery service operates in a manner
+ * consistent with the specification. In particular, this class verifies
+ * that when a registered client calls addLocators() with locators having
+ * fully-qualified host names, the lookup discovery service will successfully
+ * discover the associated lookup services.
+ *
+ * The environment in which this class expects to operate is as follows:
+ * <p><ul>
+ *   <li> one or more lookup services, each associated with a locator
+ *   <li> one instance of the lookup discovery service
+ *   <li> one or more registrations with the lookup discovery service, each
+ *        initially configured to discover no lookup services
+ *   <li> each registration with the lookup discovery service invokes the
+ *        addLocators() method -- requesting that the set of locators-of-
+ *        interest be augmented with a set in which each element is a locator
+ *        having a fully-qualified host name
+ *   <li> each registration with the lookup discovery service will receive
+ *        remote discovery events through an instance of RemoteEventListener
+ * </ul><p>
+ * 
+ * If the lookup discovery service functions as specified, then for each
+ * discovered lookup service, a <code>RemoteDiscoveryEvent</code> instance
+ * indicating a discovered event will be sent to the listener of each
+ * registration that requested discovery of the lookup service.
+ *
+ * Related bug ids: 4979612
+ * 
+ */
+public class AddLocatorsFullyQualified extends AbstractBaseTest {
+
+    protected static Logger logger = 
+                            Logger.getLogger("com.sun.jini.qa.harness.test");
+    protected LookupLocator[] locsStarted;
+    protected LookupLocator[] locsToAdd;
+    protected LookupLocator[] expectedLocs;
+
+    /** Retrieves additional configuration values. */
+    public Test construct(QAConfig config) throws Exception {
+        super.construct(config);
+//      debugFlag = true;
+//      displayOn = true;
+        useDiscoveryList = getUseOnlyLocDiscovery();
+        locsStarted = getLocatorsToDiscover(useDiscoveryList);
+        locsToAdd   = new LookupLocator[locsStarted.length];
+        String domain = ( config.getStringConfigVal("com.sun.jini.jsk.domain",
+                                                    null) ).toLowerCase();
+        /* This test wishes to discover-by-locator, each of the lookup services
+         * that were configured to be started for this test. Thus, the set of
+         * locators to discover that is supplied to the lookup discovery
+         * service is created using the host and port of the locators of
+         * the lookups that are started. One difference is that the host
+         * names used to create the locators supplied to the lookup discovery
+         * service should each be fully-qualified names; that is, containing
+         * the domain of the host. 
+         *
+         * The loop below constructs that set of locators; extracting the
+         * host and port of the locator of each lookup service that was
+         * started, concatenating the host and domain when appropriate, and
+         * using the fully-qualified host and port to create the locator to
+         * discover.
+         */
+        for(int i=0; i<locsStarted.length; i++) {
+            String host = (locsStarted[i].getHost()).toLowerCase();
+            if( host.indexOf(domain) == -1 ) {//host does not contain domain
+                host = new String(host+"."+domain);//add domain
+            }//endif
+	    if (locsStarted[i] instanceof ConstrainableLookupLocator) {
+                locsToAdd[i] = new ConstrainableLookupLocator(
+		    host, locsStarted[i].getPort(), 
+		    ((ConstrainableLookupLocator)locsStarted[i]).getConstraints());
+	    } else {
+                locsToAdd[i] = new LookupLocator(host,locsStarted[i].getPort());
+	    }
+            logger.log(Level.FINE, "locsToAdd["+i+"] = "+locsToAdd[i]);
+        }//end loop
+        return this;
+    }//end construct
+
+    public void run() throws Exception {
+        logger.log(Level.FINE, "run()");
+        /* Register with the discovery service, initially requesting the 
+         * discovery of NO_GROUPS and NO_LOCATORS.
+         */
+        for(int i=0;i<nRegistrations;i++) {
+            logger.log(Level.FINE, 
+                      "lookup discovery service registration_"+i+" --");
+            doRegistration(DiscoveryGroupManagement.NO_GROUPS,
+                           new LookupLocator[0],
+                           i, leaseDuration);
+        }//end loop
+        logger.log(Level.FINE, "adding the new locators to discover");
+        /* Invoke the addLocators() method on each registration and set the
+         * locators that are expected to be discovered, based on the locators
+         * that are added.
+         */
+        addLocatorsAllRegs(locsToAdd);
+        logger.log(Level.FINE, "waiting for discovery events");
+        waitForDiscovery();
+    }//end run
+
+}//end class AddLocatorsFullyQualified
+

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/DiscardUnreachable.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/DiscardUnreachable.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/DiscardUnreachable.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/DiscardUnreachable.java Tue Mar  5 09:22:30 2013
@@ -1,209 +1,207 @@
-/*
- * 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.qa.harness.TestException;
-import com.sun.jini.qa.harness.QAConfig;
-import com.sun.jini.qa.harness.Test;
-
-import com.sun.jini.test.share.DiscoveryProtocolSimulator;
-import com.sun.jini.test.share.DiscoveryServiceUtil;
-
-import net.jini.discovery.LookupDiscoveryRegistration;
-
-import net.jini.core.discovery.LookupLocator;
-import net.jini.core.lookup.ServiceRegistrar;
-
-import java.io.IOException;
-import java.rmi.RemoteException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This class verifies that the lookup discovery service operates in a manner
- * consistent with the specification. In particular, this class verifies
- * that the lookup discovery service can successfully employ both the
- * multicast and unicast discovery protocols on behalf of one or more clients
- * registered with that service to discover a number of pre-determined lookup
- * services and then, for each discovered lookup service, send to the 
- * appropriate registration listener, the appropriate remote event containing
- * the set of member groups with which the discovered lookup service was
- * configured.
- *
- * The environment in which this class expects to operate is as follows:
- * <p><ul>
- *   <li> one or more lookup services, each belonging to a finite set of
- *        member groups
- *   <li> one instance of the lookup discovery service
- *   <li> one or more registrations with the lookup discovery service
- *   <li> each registration with the lookup discovery service requests that
- *        some of the lookup services be discovered through only group
- *        discovery, some through only locator discovery, and some through
- *        both group and locator discovery
- *   <li> each registration with the lookup discovery service will receive
- *        remote discovery events through an instance of RemoteEventListener
- * </ul><p>
- * 
- * If the lookup discovery service utility functions as specified, then
- * for each discovered lookup service, a <code>RemoteDiscoveryEvent</code>
- * instance indicating a discarded event will be sent to the listener of
- * each registration for each un-reachable lookup service.
- */
-public class DiscardUnreachable extends AbstractBaseTest {
-
-    protected HashMap regInfoMap = registrationMap;
-
-    /** Performs actions necessary to prepare for execution of the 
-     *  current test (refer to the description of this method in the
-     *  parent class).
-     *
-     *  Retrieves additional configuration values. 
-     */
-    public Test construct(QAConfig config) throws Exception {
-        super.construct(config);
-        discardType = ACTIVE_DISCARDED;
-        regInfoMap = registrationMap;
-        return this;
-    }//end construct
-
-    /** Executes the current test by doing the following:
-     * <p>
-     *   <ul>
-     *     <li> registers with the lookup discovery service, requesting
-     *          the discovery of the the desired lookup services using the
-     *          desired discovery protocol
-     *     <li> verifies that the discovery process is working by waiting
-     *          for the expected discovery events
-     *     <li> stops the multicast announcements being sent from each
-     *          lookup service, and destroys the corresponding lookup service
-     *     <li> attempts to interact with each lookup service, invoking
-     *          the discard() method on each registration upon finding that
-     *          the lookup service is un-reachable
-     *     <li> verifies that the lookup discovery service utility under test
-     *          sends the expected number of events - containing the expected
-     *          set of member groups
-     *   </ul>
-     */
-    public void run() throws Exception {
-        logger.log(Level.FINE, "run()");
-        for(int i=0;i<nRegistrations;i++) {
-            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
-            doRegistration(getGroupsToDiscoverByIndex(i),
-                           getLocatorsToDiscoverByIndex(i),
-                           i, leaseDuration);
-        }//end loop
-        waitForDiscovery();
-        ServiceRegistrar[] proxies = getLookupProxies();
-        logger.log(Level.FINE, "# of proxies is " + proxies.length);
-        terminateAllLookups();
-        long t = 10000;
-        logger.log(Level.FINE, "waiting "+(t/1000)+" seconds "
-                          +"for shutdown completion ...");
-        DiscoveryServiceUtil.delayMS(10000);//wait for shutdown completion
-        pingAndDiscard(proxies,regInfoMap);
-        waitForDiscard(discardType);
-    }//end run
-
-    /** Retrieves the proxy to each lookup service started */
-    ServiceRegistrar[] getLookupProxies() {
-        ServiceRegistrar[] proxies = new ServiceRegistrar[genMap.size()];
-	Iterator iter = genMap.keySet().iterator();
-        for(int i=0;iter.hasNext();i++) {
-            proxies[i] =
-                    ((DiscoveryProtocolSimulator)iter.next()).getLookupProxy();
-        }//end loop
-        return proxies;
-    }//end getLookupProxies
-
-    /** Stops the generation of multicast announcements and destroys the
-     *  corresponding simulated lookup service
-     *  
-     *  @throws com.sun.jini.qa.harness.TestException
-     */
-    void terminateAllLookups() throws TestException, IOException {
-        logger.log(Level.FINE, "destroying each lookup service ...");
-        Iterator iter = genMap.keySet().iterator();
-        for(int i=0;iter.hasNext();i++) {
-            Object curObj = iter.next();
-            ServiceRegistrar regProxy = null;
-            if(curObj instanceof DiscoveryProtocolSimulator) {
-                DiscoveryProtocolSimulator curGen
-                                         = (DiscoveryProtocolSimulator)curObj;
-                regProxy = curGen.getLookupProxy();
-                curGen.stopAnnouncements();
-            } else {
-                regProxy = (ServiceRegistrar)curObj;
-            }//endif
-            /* destroy lookup service i */
-            getManager().destroyService(regProxy);
-        }//end loop
-        announcementsStopped = true;
-    }//end terminateAllLookups
-
-    /** For each lookup service proxy input, this method attempts to retrieve
-     *  the associated locator and, if that registrar is found to be 
-     *  unreachable, discards the lookup service through each of the give
-     *  regInfo's.
-     */
-    void pingAndDiscard(ServiceRegistrar[] proxies, Map regInfoMap) throws Exception {
-        int nDiscarded = 0;
-        for(int i=0;i<proxies.length;i++) {
-            try {
-                LookupLocator loc = QAConfig.getConstrainedLocator(proxies[i].getLocator());
-                logger.log(Level.FINE, "");
-                logger.log(Level.FINE, "warning -- lookup service "
-                                               +i+" still reachable");
-            } catch(RemoteException e) {
-                Set eSet = regInfoMap.entrySet();
-                Iterator iter = eSet.iterator();
-                for(int j=0;iter.hasNext();j++) {
-                    Map.Entry pair = (Map.Entry)iter.next();
-                    LookupDiscoveryRegistration ldsReg =
-                                    (LookupDiscoveryRegistration)pair.getKey();
-
-                    LDSEventListener regListener =
-                                             (LDSEventListener)pair.getValue();
-                    RegistrationInfo regInfo = regListener.getRegInfo();
-                    int rID = regInfo.handback;
-		    logger.log(Level.FINE, "  registration_"+rID
-			       +" -- discarding lookup service "+i);
-		    ldsReg.discard(proxies[i]);
-                    logger.log(Level.FINE, " registration_"+rID
-                               +" -- discarded lookup service "+i);
-                }//end loop(j)
-            } catch(Exception exc) { // just for logging purposes
-              logger.log(Level.FINE, " ******* exception during pingAndDiscard ********");
-              StackTraceElement[] stackTrace = exc.getStackTrace();
-              for(int k=0;k<stackTrace.length;k++) {
-                  logger.log(Level.FINE, stackTrace[k].toString());
-              }
-              logger.log(Level.FINE, " ******* end of exception during pingAndDiscard ********");
-              throw exc;
-            }
-        }//end loop(i)
-    }//end pingAndDiscard
-
-} //end class DiscardUnreachable
-
+/*
+ * 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.qa.harness.TestException;
+import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.qa.harness.Test;
+
+import com.sun.jini.test.share.DiscoveryProtocolSimulator;
+import com.sun.jini.test.share.DiscoveryServiceUtil;
+
+import net.jini.discovery.LookupDiscoveryRegistration;
+
+import net.jini.core.discovery.LookupLocator;
+import net.jini.core.lookup.ServiceRegistrar;
+
+import java.io.IOException;
+import java.rmi.RemoteException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class verifies that the lookup discovery service operates in a manner
+ * consistent with the specification. In particular, this class verifies
+ * that the lookup discovery service can successfully employ both the
+ * multicast and unicast discovery protocols on behalf of one or more clients
+ * registered with that service to discover a number of pre-determined lookup
+ * services and then, for each discovered lookup service, send to the 
+ * appropriate registration listener, the appropriate remote event containing
+ * the set of member groups with which the discovered lookup service was
+ * configured.
+ *
+ * The environment in which this class expects to operate is as follows:
+ * <p><ul>
+ *   <li> one or more lookup services, each belonging to a finite set of
+ *        member groups
+ *   <li> one instance of the lookup discovery service
+ *   <li> one or more registrations with the lookup discovery service
+ *   <li> each registration with the lookup discovery service requests that
+ *        some of the lookup services be discovered through only group
+ *        discovery, some through only locator discovery, and some through
+ *        both group and locator discovery
+ *   <li> each registration with the lookup discovery service will receive
+ *        remote discovery events through an instance of RemoteEventListener
+ * </ul><p>
+ * 
+ * If the lookup discovery service utility functions as specified, then
+ * for each discovered lookup service, a <code>RemoteDiscoveryEvent</code>
+ * instance indicating a discarded event will be sent to the listener of
+ * each registration for each un-reachable lookup service.
+ */
+public class DiscardUnreachable extends AbstractBaseTest {
+
+
+    /** Performs actions necessary to prepare for execution of the 
+     *  current test (refer to the description of this method in the
+     *  parent class).
+     *
+     *  Retrieves additional configuration values. 
+     */
+    public Test construct(QAConfig config) throws Exception {
+        super.construct(config);
+        discardType = ACTIVE_DISCARDED;
+        return this;
+    }//end construct
+
+    /** Executes the current test by doing the following:
+     * <p>
+     *   <ul>
+     *     <li> registers with the lookup discovery service, requesting
+     *          the discovery of the the desired lookup services using the
+     *          desired discovery protocol
+     *     <li> verifies that the discovery process is working by waiting
+     *          for the expected discovery events
+     *     <li> stops the multicast announcements being sent from each
+     *          lookup service, and destroys the corresponding lookup service
+     *     <li> attempts to interact with each lookup service, invoking
+     *          the discard() method on each registration upon finding that
+     *          the lookup service is un-reachable
+     *     <li> verifies that the lookup discovery service utility under test
+     *          sends the expected number of events - containing the expected
+     *          set of member groups
+     *   </ul>
+     */
+    public void run() throws Exception {
+        logger.log(Level.FINE, "run()");
+        for(int i=0;i<nRegistrations;i++) {
+            logger.log(Level.FINE, "lookup discovery service registration_"+i+" --");
+            doRegistration(getGroupsToDiscoverByIndex(i),
+                           getLocatorsToDiscoverByIndex(i),
+                           i, leaseDuration);
+        }//end loop
+        waitForDiscovery();
+        ServiceRegistrar[] proxies = getLookupProxies();
+        logger.log(Level.FINE, "# of proxies is " + proxies.length);
+        terminateAllLookups();
+        long t = 10000;
+        logger.log(Level.FINE, "waiting "+(t/1000)+" seconds "
+                          +"for shutdown completion ...");
+        DiscoveryServiceUtil.delayMS(10000);//wait for shutdown completion
+        pingAndDiscard(proxies,getRegistrationMap());
+        waitForDiscard(discardType);
+    }//end run
+
+    /** Retrieves the proxy to each lookup service started */
+    ServiceRegistrar[] getLookupProxies() {
+        ServiceRegistrar[] proxies = new ServiceRegistrar[getGenMap().size()];
+	Iterator iter = getGenMap().keySet().iterator();
+        for(int i=0;iter.hasNext();i++) {
+            proxies[i] =
+                    ((DiscoveryProtocolSimulator)iter.next()).getLookupProxy();
+        }//end loop
+        return proxies;
+    }//end getLookupProxies
+
+    /** Stops the generation of multicast announcements and destroys the
+     *  corresponding simulated lookup service
+     *  
+     *  @throws com.sun.jini.qa.harness.TestException
+     */
+    void terminateAllLookups() throws TestException, IOException {
+        logger.log(Level.FINE, "destroying each lookup service ...");
+        Iterator iter = getGenMap().keySet().iterator();
+        for(int i=0;iter.hasNext();i++) {
+            Object curObj = iter.next();
+            ServiceRegistrar regProxy = null;
+            if(curObj instanceof DiscoveryProtocolSimulator) {
+                DiscoveryProtocolSimulator curGen
+                                         = (DiscoveryProtocolSimulator)curObj;
+                regProxy = curGen.getLookupProxy();
+                curGen.stopAnnouncements();
+            } else {
+                regProxy = (ServiceRegistrar)curObj;
+            }//endif
+            /* destroy lookup service i */
+            getManager().destroyService(regProxy);
+        }//end loop
+        announcementsStopped = true;
+    }//end terminateAllLookups
+
+    /** For each lookup service proxy input, this method attempts to retrieve
+     *  the associated locator and, if that registrar is found to be 
+     *  unreachable, discards the lookup service through each of the give
+     *  regInfo's.
+     */
+    void pingAndDiscard(ServiceRegistrar[] proxies, Map regInfoMap) throws Exception {
+        int nDiscarded = 0;
+        for(int i=0;i<proxies.length;i++) {
+            try {
+                LookupLocator loc = QAConfig.getConstrainedLocator(proxies[i].getLocator());
+                logger.log(Level.FINE, "");
+                logger.log(Level.FINE, "warning -- lookup service "
+                                               +i+" still reachable");
+            } catch(RemoteException e) {
+                Set eSet = regInfoMap.entrySet();
+                Iterator iter = eSet.iterator();
+                for(int j=0;iter.hasNext();j++) {
+                    Map.Entry pair = (Map.Entry)iter.next();
+                    LookupDiscoveryRegistration ldsReg =
+                                    (LookupDiscoveryRegistration)pair.getKey();
+
+                    LDSEventListener regListener =
+                                             (LDSEventListener)pair.getValue();
+                    RegistrationInfo regInfo = regListener.getRegInfo();
+                    int rID = regInfo.getHandback();
+		    logger.log(Level.FINE, "  registration_"+rID
+			       +" -- discarding lookup service "+i);
+		    ldsReg.discard(proxies[i]);
+                    logger.log(Level.FINE, " registration_"+rID
+                               +" -- discarded lookup service "+i);
+                }//end loop(j)
+            } catch(Exception exc) { // just for logging purposes
+              logger.log(Level.FINE, " ******* exception during pingAndDiscard ********");
+              StackTraceElement[] stackTrace = exc.getStackTrace();
+              for(int k=0;k<stackTrace.length;k++) {
+                  logger.log(Level.FINE, stackTrace[k].toString());
+              }
+              logger.log(Level.FINE, " ******* end of exception during pingAndDiscard ********");
+              throw exc;
+            }
+        }//end loop(i)
+    }//end pingAndDiscard
+
+} //end class DiscardUnreachable
+

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/DiscoveredAll.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/DiscoveredAll.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/DiscoveredAll.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/DiscoveredAll.java Tue Mar  5 09:22:30 2013
@@ -85,7 +85,7 @@ public class DiscoveredAll extends Abstr
             if(i == (nRegistrations-1)) {
                 groupsToDiscover = DiscoveryGroupManagement.ALL_GROUPS;
                 locatorsToDiscover = getLocatorsToDiscover
-                                                  (useOnlyGroupDiscovery);
+                                                  (getUseOnlyGroupDiscovery());
 	    } else {
                 groupsToDiscover = getGroupsToDiscoverByIndex(i);
                 locatorsToDiscover = getLocatorsToDiscoverByIndex(i);

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedGroups.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedGroups.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedGroups.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedGroups.java Tue Mar  5 09:22:30 2013
@@ -77,8 +77,8 @@ public class LateRegsNotifiedGroups exte
     public Test construct(QAConfig config) throws Exception {
         super.construct(config);
         logger.log(Level.FINE, "setup()");
-        groupsToDiscover = getGroupsToDiscover(useOnlyGroupDiscovery);
-        locsToDiscover = getLocatorsToDiscover(useOnlyGroupDiscovery);
+        groupsToDiscover = getGroupsToDiscover(getUseOnlyGroupDiscovery());
+        locsToDiscover = getLocatorsToDiscover(getUseOnlyGroupDiscovery());
         return this;
     }//end construct
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedLocs.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedLocs.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedLocs.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedLocs.java Tue Mar  5 09:22:30 2013
@@ -67,8 +67,8 @@ public class LateRegsNotifiedLocs extend
     public Test construct(QAConfig config) throws Exception {
         super.construct(config);
         logger.log(Level.FINE, "setup()");
-        groupsToDiscover = getGroupsToDiscover(useOnlyLocDiscovery);
-        locsToDiscover = getLocatorsToDiscover(useOnlyLocDiscovery);
+        groupsToDiscover = getGroupsToDiscover(getUseOnlyLocDiscovery());
+        locsToDiscover = getLocatorsToDiscover(getUseOnlyLocDiscovery());
         return this;
     }//end construct
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOn2SetGroups.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOn2SetGroups.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOn2SetGroups.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOn2SetGroups.java Tue Mar  5 09:22:30 2013
@@ -1,240 +1,241 @@
-/*
- * 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;
-import com.sun.jini.qa.harness.Test;
-
-/**
- * This class verifies that when the <code>setGroups</code> method is called
- * more than once to configure/re-configure a "late-joiner" registration
- * for various groups of interest, the lookup discovery service sends to
- * that registration's listener, the appropriate remote discovery and discard
- * events.
- *
- * If the lookup discovery service functions as specified, then for
- * each invocation of <code>setGroups</code> on each registration,
- * the listener of each such registration will receive an instance of
- * <code>RemoteDiscoveryEvent</code> corresponding to each new discovery
- * or discard which occurs; and which accurately reflects the correct set of
- * member groups.
- *
- * Note that discard events will occur only if the lookup services started for
- * this test, as well as the groups of interest for each registration, are
- * configured in such a way that when <code>setGroups</code> is called, a
- * "no interest" discard would normally occur.
- */
-public class LateRegsNotifiedOn2SetGroups extends AbstractBaseTest {
-
-    protected String[] groups0;
-    protected String[] groups1;
-
-    /** Performs actions necessary to prepare for execution of the 
-     *  current test. Populates the sets of group names that are passed
-     *  in to the <code>setGroups</code> method. The intent is to guarantee
-     *  that those two sets of group names do not share any names so that
-     *  for properly configured lookup services, discard events, as well as
-     *  discovery events will be generated.
-     */
-    public Test construct(QAConfig config) throws Exception {
-        super.construct(config);
-        logger.log(Level.FINE, "setup()");
-        String[] allGroupsToDiscover = getGroupsToDiscover
-                                                      (useOnlyGroupDiscovery);
-        int len = allGroupsToDiscover.length;
-        int len0 = ( (len > 1) ? (len/2) : len);
-        int len1 = ( (len > 1) ? (len-len0) : len);
-        groups0 = new String[len0];
-        groups1 = new String[len1];
-        for(int i=0;i<len0;i++) {
-            groups0[i] = allGroupsToDiscover[i];
-        }//end loop
-        if(len1 == len) {
-            groups1[0] = allGroupsToDiscover[0];
-        } else {
-            for(int i=len0;i<len;i++) {
-                groups1[i-len0] = allGroupsToDiscover[i];
-            }//end loop
-        }//endif
-        return this;
-    }//end construct
-
-    /** 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 1st set of groups,
-     *      which should equal the member groups of the 1st lookup service
-     *      started in construct
-     * <li> verifies that the discovery/discard process is working for the
-     *      1st registration by waiting for the expected discovery and
-     *      discard events
-     * <li> calls setGroups, requesting the discovery of the 2nd set of groups,
-     *      which should equal the member groups of the 2nd lookup service
-     *      started in construct
-     * <li> verifies that the discovery/discard process is working for the
-     *      1st registration by waiting for the expected discovery and
-     *      discard 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 1st set
-     *      of groups
-     * <li> verifies that the discovery/discard process is working for the
-     *      2nd registration by waiting for the expected discovery and
-     *      discard events
-     * <li> again calls setGroups, requesting the discovery of the 2nd set
-     *      of groups
-     * <li> verifies that the discovery/discard process is working for the
-     *      2nd registration by waiting for the expected discovery and
-     *      discard events
-     * </ul>
-     */
-    public void run() throws Exception {
-        logger.log(Level.FINE, "run()");
-        LookupLocator[] noLocs = getLocatorsToDiscover(useOnlyGroupDiscovery);
-        /* create the first 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
-        /* for 1st reg, set 1st set of groups to discover */
-        logger.log(Level.FINE, "set 1st group set on "
-                          +"initial registration(s)");
-        setGroupsAllRegs(groups0);
-
-        logger.log(Level.FINE, "wait for discovery of the 1st "
-                          +"group set of initial registration(s)");
-        waitForDiscovery();
-        /* for 1st reg, set 2nd set of groups to discover */
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete ... set 2nd group set on "
-                          +"initial registration(s)");
-
-        setGroupsAllRegs(groups1);
-        logger.log(Level.FINE, "wait for expected discovery "
-                          +"and discard events generated by the 2nd group "
-                          +"set of initial registration(s)");
-        waitForDiscovery();
-        waitForDiscard(NO_INTEREST_DISCARDED);
-        logger.log(Level.FINE, "wait periods "
-                          +"complete ... request "+nAddRegistrations
-                          +" additional registration(s)");
-
-        HashMap regMap0 = (HashMap)registrationMap.clone();
-
-        /* create second 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
-
-
-        /* for 2nd reg, set 1st set of groups to discover */
-        logger.log(Level.FINE, "set 1st group set 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 & discard event info for these
-                 * registrations since their 'discoveryComplete' and
-                 * 'discardComplete' flags were set to true the last
-                 * time waitForDiscovery() and waitForDiscard() were
-                 * invoked.
-                 */
-                resetAllEventInfoOneReg(regListenerPair);
-                continue;
-            }//endif
-            setGroupsOneReg( groups0, regListenerPair );
-            if( groups0 == DiscoveryGroupManagement.ALL_GROUPS ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"groups set to ALL_GROUPS");
-            } else if( groups0.length <= 0 ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"groups set to NO_GROUPS");
-            } else {
-                GroupsUtil.displayGroupSet( groups0,
-                                           "   additional reg -- group",
-                                           Level.FINE);
-            }//endif
-        }//end loop
-        logger.log(Level.FINE, "wait for discovery of the 1st "
-                          +"group set of the additional registration(s)");
-        waitForDiscovery();
-
-
-        /* for 2nd reg, set 2nd set of groups to discover */
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete ... set 2nd group set on "
-                          +"additional registration(s)");
-        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( groups1, regListenerPair );
-            if( groups1 == DiscoveryGroupManagement.ALL_GROUPS ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"groups set to ALL_GROUPS");
-            } else if( groups1.length <= 0 ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"groups set to NO_GROUPS");
-            } else {
-                GroupsUtil.displayGroupSet( groups1,
-                                           "   additional reg -- group",
-                                           Level.FINE);
-            }//endif
-        }//end loop
-        logger.log(Level.FINE, "wait for expected discovery "
-                          +"and discard events generated by the 2nd group "
-                          +"set of the additional registration(s)");
-        waitForDiscovery();
-        waitForDiscard(NO_INTEREST_DISCARDED);
-        logger.log(Level.FINE, "wait periods complete");
-    }//end run
-
-} //end class LateRegsNotifiedOn2SetGroups
-
+/*
+ * 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;
+import com.sun.jini.qa.harness.Test;
+
+/**
+ * This class verifies that when the <code>setGroups</code> method is called
+ * more than once to configure/re-configure a "late-joiner" registration
+ * for various groups of interest, the lookup discovery service sends to
+ * that registration's listener, the appropriate remote discovery and discard
+ * events.
+ *
+ * If the lookup discovery service functions as specified, then for
+ * each invocation of <code>setGroups</code> on each registration,
+ * the listener of each such registration will receive an instance of
+ * <code>RemoteDiscoveryEvent</code> corresponding to each new discovery
+ * or discard which occurs; and which accurately reflects the correct set of
+ * member groups.
+ *
+ * Note that discard events will occur only if the lookup services started for
+ * this test, as well as the groups of interest for each registration, are
+ * configured in such a way that when <code>setGroups</code> is called, a
+ * "no interest" discard would normally occur.
+ */
+public class LateRegsNotifiedOn2SetGroups extends AbstractBaseTest {
+
+    protected volatile String[] groups0;
+    protected volatile String[] groups1;
+
+    /** Performs actions necessary to prepare for execution of the 
+     *  current test. Populates the sets of group names that are passed
+     *  in to the <code>setGroups</code> method. The intent is to guarantee
+     *  that those two sets of group names do not share any names so that
+     *  for properly configured lookup services, discard events, as well as
+     *  discovery events will be generated.
+     */
+    public Test construct(QAConfig config) throws Exception {
+        super.construct(config);
+        logger.log(Level.FINE, "setup()");
+        String[] allGroupsToDiscover = getGroupsToDiscover
+                                                      (getUseOnlyGroupDiscovery());
+        int len = allGroupsToDiscover.length;
+        int len0 = ( (len > 1) ? (len/2) : len);
+        int len1 = ( (len > 1) ? (len-len0) : len);
+        groups0 = new String[len0];
+        groups1 = new String[len1];
+        for(int i=0;i<len0;i++) {
+            groups0[i] = allGroupsToDiscover[i];
+        }//end loop
+        if(len1 == len) {
+            if (len == 0) return this;
+            groups1[0] = allGroupsToDiscover[0];
+        } else {
+            for(int i=len0;i<len;i++) {
+                groups1[i-len0] = allGroupsToDiscover[i];
+            }//end loop
+        }//endif
+        return this;
+    }//end construct
+
+    /** 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 1st set of groups,
+     *      which should equal the member groups of the 1st lookup service
+     *      started in construct
+     * <li> verifies that the discovery/discard process is working for the
+     *      1st registration by waiting for the expected discovery and
+     *      discard events
+     * <li> calls setGroups, requesting the discovery of the 2nd set of groups,
+     *      which should equal the member groups of the 2nd lookup service
+     *      started in construct
+     * <li> verifies that the discovery/discard process is working for the
+     *      1st registration by waiting for the expected discovery and
+     *      discard 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 1st set
+     *      of groups
+     * <li> verifies that the discovery/discard process is working for the
+     *      2nd registration by waiting for the expected discovery and
+     *      discard events
+     * <li> again calls setGroups, requesting the discovery of the 2nd set
+     *      of groups
+     * <li> verifies that the discovery/discard process is working for the
+     *      2nd registration by waiting for the expected discovery and
+     *      discard events
+     * </ul>
+     */
+    public void run() throws Exception {
+        logger.log(Level.FINE, "run()");
+        LookupLocator[] noLocs = getLocatorsToDiscover(getUseOnlyGroupDiscovery());
+        /* create the first 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
+        /* for 1st reg, set 1st set of groups to discover */
+        logger.log(Level.FINE, "set 1st group set on "
+                          +"initial registration(s)");
+        setGroupsAllRegs(groups0);
+
+        logger.log(Level.FINE, "wait for discovery of the 1st "
+                          +"group set of initial registration(s)");
+        waitForDiscovery();
+        /* for 1st reg, set 2nd set of groups to discover */
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete ... set 2nd group set on "
+                          +"initial registration(s)");
+
+        setGroupsAllRegs(groups1);
+        logger.log(Level.FINE, "wait for expected discovery "
+                          +"and discard events generated by the 2nd group "
+                          +"set of initial registration(s)");
+        waitForDiscovery();
+        waitForDiscard(NO_INTEREST_DISCARDED);
+        logger.log(Level.FINE, "wait periods "
+                          +"complete ... request "+nAddRegistrations
+                          +" additional registration(s)");
+        //Originally registration map was cloned.
+        Map regMap0 = new HashMap(getRegistrationMap());
+
+        /* create second 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
+
+
+        /* for 2nd reg, set 1st set of groups to discover */
+        logger.log(Level.FINE, "set 1st group set 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 & discard event info for these
+                 * registrations since their 'discoveryComplete' and
+                 * 'discardComplete' flags were set to true the last
+                 * time waitForDiscovery() and waitForDiscard() were
+                 * invoked.
+                 */
+                resetAllEventInfoOneReg(regListenerPair);
+                continue;
+            }//endif
+            setGroupsOneReg( groups0, regListenerPair );
+            if( groups0 == DiscoveryGroupManagement.ALL_GROUPS ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"groups set to ALL_GROUPS");
+            } else if( groups0.length <= 0 ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"groups set to NO_GROUPS");
+            } else {
+                GroupsUtil.displayGroupSet( groups0,
+                                           "   additional reg -- group",
+                                           Level.FINE);
+            }//endif
+        }//end loop
+        logger.log(Level.FINE, "wait for discovery of the 1st "
+                          +"group set of the additional registration(s)");
+        waitForDiscovery();
+
+
+        /* for 2nd reg, set 2nd set of groups to discover */
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete ... set 2nd group set on "
+                          +"additional registration(s)");
+        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( groups1, regListenerPair );
+            if( groups1 == DiscoveryGroupManagement.ALL_GROUPS ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"groups set to ALL_GROUPS");
+            } else if( groups1.length <= 0 ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"groups set to NO_GROUPS");
+            } else {
+                GroupsUtil.displayGroupSet( groups1,
+                                           "   additional reg -- group",
+                                           Level.FINE);
+            }//endif
+        }//end loop
+        logger.log(Level.FINE, "wait for expected discovery "
+                          +"and discard events generated by the 2nd group "
+                          +"set of the additional registration(s)");
+        waitForDiscovery();
+        waitForDiscard(NO_INTEREST_DISCARDED);
+        logger.log(Level.FINE, "wait periods complete");
+    }//end run
+
+} //end class LateRegsNotifiedOn2SetGroups
+

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOn2SetLocs.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOn2SetLocs.java?rev=1452708&r1=1452707&r2=1452708&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOn2SetLocs.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/event/LateRegsNotifiedOn2SetLocs.java Tue Mar  5 09:22:30 2013
@@ -1,227 +1,228 @@
-/*
- * 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;
-import com.sun.jini.qa.harness.Test;
-
-/**
- * This class verifies that when the <code>setLocators</code> method is called
- * more than once to configure/re-configure a "late-joiner" registration
- * for various locators of interest, the lookup discovery service sends to
- * that registration's listener, the appropriate remote discovery and discard
- * events.
- *
- * If the lookup discovery service functions as specified, then for
- * each invocation of <code>setLocators</code> on each registration,
- * the listener of each such registration will receive an instance of
- * <code>RemoteDiscoveryEvent</code> corresponding to each new discovery
- * or discard which occurs; and which accurately reflects the expected
- * lookup services.
- *
- * Note that discard events will occur only if the lookup services started for
- * this test, as well as the locators of interest for each registration, are
- * configured in such a way that when <code>setLocators</code> is called, a
- * "no interest" discard would normally occur.
- */
-public class LateRegsNotifiedOn2SetLocs extends AbstractBaseTest {
-
-    protected LookupLocator[] locs0;
-    protected LookupLocator[] locs1;
-
-    /** Performs actions necessary to prepare for execution of the 
-     *  current test. Populates the sets of locators that are passed in
-     *  to the <code>setLocators</code> method. The intent is to guarantee
-     *  that those two sets of locators do not share any elements so that
-     *  for properly configured lookup services, discard events, as well as
-     *  discovery events will be generated.
-     */
-    public Test construct(QAConfig config) throws Exception {
-        super.construct(config);
-        logger.log(Level.FINE, "setup()");
-        LookupLocator[] allLocsToDiscover = getLocatorsToDiscover
-                                                       (useOnlyLocDiscovery);
-        int len = allLocsToDiscover.length;
-        int len0 = ( (len > 1) ? (len/2) : len);
-        int len1 = ( (len > 1) ? (len-len0) : len);
-        locs0 = new LookupLocator[len0];
-        locs1 = new LookupLocator[len1];
-        for(int i=0;i<len0;i++) {
-            locs0[i] = allLocsToDiscover[i];
-        }//end loop
-        if(len1 == len) {
-            locs1[0] = allLocsToDiscover[0];
-        } else {
-            for(int i=len0;i<len;i++) {
-                locs1[i-len0] = allLocsToDiscover[i];
-            }//end loop
-        }//endif
-        return this;
-    }//end construct
-
-    /** 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/discard process is working for the
-     *      initial registration(s) by waiting for the expected discovery
-     *      and discard events
-     * <li> calls setLocators, requesting the discovery of the 2nd set of
-     *      locators which should equal the locators of the 2nd lookup service
-     *      started in construct
-     * <li> verifies that the discovery/discard process is working for the
-     *      initial registration(s) by waiting for the expected discovery and
-     *      discard 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> calls setLocators on the second set of registration(s), requesting
-     *      the discovery of the 1st set of locators
-     * <li> verifies that the discovery/discard process is working for the
-     *      second set of registration(s) by waiting for the expected
-     *      discovery and discard events
-     * <li> calls setLocators on the second set of registration(s), this time
-     *      requesting the discovery of the 2nd set of locators
-     * <li> verifies that the discovery/discard process is working for the
-     *      second set of registration(s) by waiting for the expected
-     *      discovery and discard events
-     * </ul>
-     */
-    public void run() throws Exception {
-        logger.log(Level.FINE, "run()");
-        String[]        noGroups = DiscoveryGroupManagement.NO_GROUPS;
-        LookupLocator[] noLocs   = new LookupLocator[0];
-        /* create the first 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
-        /* for 1st reg, set 1st set of locators to discover */
-        logger.log(Level.FINE, "set 1st locator set on "
-                          +"initial registration(s)");
-        setLocatorsAllRegs(locs0);
-        logger.log(Level.FINE, "wait for discovery of the 1st "
-                          +"locator set of initial registration(s)");
-        waitForDiscovery();
-        /* for 1st reg, set 2nd set of locators to discover */
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete ... set 2nd locator set on "
-                          +"initial registration(s)");
-        setLocatorsAllRegs(locs1);
-        logger.log(Level.FINE, "wait for expected discovery "
-                          +"and discard events generated by the 2nd "
-                          +"locator set of initial registration(s)");
-        waitForDiscovery();
-        waitForDiscard(NO_INTEREST_DISCARDED);
-        logger.log(Level.FINE, "wait periods "
-                          +"complete ... request "+nAddRegistrations
-                          +" additional registration(s)");
-
-        HashMap regMap0 = (HashMap)registrationMap.clone();
-
-        /* create second 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
-        /* for 2nd reg, set 1st set of locators to discover */
-        logger.log(Level.FINE, "set 1st locator set 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 & discard event info for these
-                 * registrations since their 'discoveryComplete' and
-                 * 'discardComplete' flags were set to true the last
-                 * time waitForDiscovery() and waitForDiscard() were
-                 * invoked.
-                 */
-                resetAllEventInfoOneReg(regListenerPair);
-                continue;
-            }//endif
-            setLocatorsOneReg( locs0, regListenerPair );
-
-            if( locs0.length == 0 ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"locators set to NO_LOCATORS");
-            } else {
-                LocatorsUtil.displayLocatorSet( locs0,
-                                            "   additional reg -- locator",
-                                            Level.FINE);
-            }//endif
-        }//end loop
-        logger.log(Level.FINE, "wait for discovery of the 1st "
-                         +"locator set of the additional registration(s)");
-        waitForDiscovery();
-        /* for 2nd reg, set 2nd set of locators to discover */
-        logger.log(Level.FINE, "discovery wait period "
-                          +"complete ... set 2nd locator set on "
-                          +"additional registration(s)");
-        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( locs1, regListenerPair );
-            if( locs1.length <= 0 ) {
-                logger.log(Level.FINE, "   additional reg -- "
-                                  +"locators set to NO_LOCATORS");
-            } else {
-                LocatorsUtil.displayLocatorSet( locs1,
-                                            "   additional reg -- locator",
-                                            Level.FINE);
-            }//endif
-        }//end loop
-        logger.log(Level.FINE, "wait for expected discovery "
-                          +"and discard events generated by the 2nd "
-                         +"locator set of the additional registration(s)");
-        waitForDiscovery();
-        waitForDiscard(NO_INTEREST_DISCARDED);
-        logger.log(Level.FINE, "wait periods complete");
-    }//end run
-
-} //end class LateRegsNotifiedOn2SetLocs
-
+/*
+ * 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;
+import com.sun.jini.qa.harness.Test;
+
+/**
+ * This class verifies that when the <code>setLocators</code> method is called
+ * more than once to configure/re-configure a "late-joiner" registration
+ * for various locators of interest, the lookup discovery service sends to
+ * that registration's listener, the appropriate remote discovery and discard
+ * events.
+ *
+ * If the lookup discovery service functions as specified, then for
+ * each invocation of <code>setLocators</code> on each registration,
+ * the listener of each such registration will receive an instance of
+ * <code>RemoteDiscoveryEvent</code> corresponding to each new discovery
+ * or discard which occurs; and which accurately reflects the expected
+ * lookup services.
+ *
+ * Note that discard events will occur only if the lookup services started for
+ * this test, as well as the locators of interest for each registration, are
+ * configured in such a way that when <code>setLocators</code> is called, a
+ * "no interest" discard would normally occur.
+ */
+public class LateRegsNotifiedOn2SetLocs extends AbstractBaseTest {
+
+    protected LookupLocator[] locs0;
+    protected LookupLocator[] locs1;
+
+    /** Performs actions necessary to prepare for execution of the 
+     *  current test. Populates the sets of locators that are passed in
+     *  to the <code>setLocators</code> method. The intent is to guarantee
+     *  that those two sets of locators do not share any elements so that
+     *  for properly configured lookup services, discard events, as well as
+     *  discovery events will be generated.
+     */
+    public Test construct(QAConfig config) throws Exception {
+        super.construct(config);
+        logger.log(Level.FINE, "setup()");
+        LookupLocator[] allLocsToDiscover = getLocatorsToDiscover
+                                                       (getUseOnlyLocDiscovery());
+        int len = allLocsToDiscover.length;
+        int len0 = ( (len > 1) ? (len/2) : len);
+        int len1 = ( (len > 1) ? (len-len0) : len);
+        locs0 = new LookupLocator[len0];
+        locs1 = new LookupLocator[len1];
+        for(int i=0;i<len0;i++) {
+            locs0[i] = allLocsToDiscover[i];
+        }//end loop
+        if(len1 == len) {
+            if (len == 0) return this;
+            locs1[0] = allLocsToDiscover[0];
+        } else {
+            for(int i=len0;i<len;i++) {
+                locs1[i-len0] = allLocsToDiscover[i];
+            }//end loop
+        }//endif
+        return this;
+    }//end construct
+
+    /** 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/discard process is working for the
+     *      initial registration(s) by waiting for the expected discovery
+     *      and discard events
+     * <li> calls setLocators, requesting the discovery of the 2nd set of
+     *      locators which should equal the locators of the 2nd lookup service
+     *      started in construct
+     * <li> verifies that the discovery/discard process is working for the
+     *      initial registration(s) by waiting for the expected discovery and
+     *      discard 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> calls setLocators on the second set of registration(s), requesting
+     *      the discovery of the 1st set of locators
+     * <li> verifies that the discovery/discard process is working for the
+     *      second set of registration(s) by waiting for the expected
+     *      discovery and discard events
+     * <li> calls setLocators on the second set of registration(s), this time
+     *      requesting the discovery of the 2nd set of locators
+     * <li> verifies that the discovery/discard process is working for the
+     *      second set of registration(s) by waiting for the expected
+     *      discovery and discard events
+     * </ul>
+     */
+    public void run() throws Exception {
+        logger.log(Level.FINE, "run()");
+        String[]        noGroups = DiscoveryGroupManagement.NO_GROUPS;
+        LookupLocator[] noLocs   = new LookupLocator[0];
+        /* create the first 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
+        /* for 1st reg, set 1st set of locators to discover */
+        logger.log(Level.FINE, "set 1st locator set on "
+                          +"initial registration(s)");
+        setLocatorsAllRegs(locs0);
+        logger.log(Level.FINE, "wait for discovery of the 1st "
+                          +"locator set of initial registration(s)");
+        waitForDiscovery();
+        /* for 1st reg, set 2nd set of locators to discover */
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete ... set 2nd locator set on "
+                          +"initial registration(s)");
+        setLocatorsAllRegs(locs1);
+        logger.log(Level.FINE, "wait for expected discovery "
+                          +"and discard events generated by the 2nd "
+                          +"locator set of initial registration(s)");
+        waitForDiscovery();
+        waitForDiscard(NO_INTEREST_DISCARDED);
+        logger.log(Level.FINE, "wait periods "
+                          +"complete ... request "+nAddRegistrations
+                          +" additional registration(s)");
+        // registration map was originally cloned.
+        Map regMap0 = new HashMap(getRegistrationMap());
+
+        /* create second 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
+        /* for 2nd reg, set 1st set of locators to discover */
+        logger.log(Level.FINE, "set 1st locator set 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 & discard event info for these
+                 * registrations since their 'discoveryComplete' and
+                 * 'discardComplete' flags were set to true the last
+                 * time waitForDiscovery() and waitForDiscard() were
+                 * invoked.
+                 */
+                resetAllEventInfoOneReg(regListenerPair);
+                continue;
+            }//endif
+            setLocatorsOneReg( locs0, regListenerPair );
+
+            if( locs0.length == 0 ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"locators set to NO_LOCATORS");
+            } else {
+                LocatorsUtil.displayLocatorSet( locs0,
+                                            "   additional reg -- locator",
+                                            Level.FINE);
+            }//endif
+        }//end loop
+        logger.log(Level.FINE, "wait for discovery of the 1st "
+                         +"locator set of the additional registration(s)");
+        waitForDiscovery();
+        /* for 2nd reg, set 2nd set of locators to discover */
+        logger.log(Level.FINE, "discovery wait period "
+                          +"complete ... set 2nd locator set on "
+                          +"additional registration(s)");
+        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( locs1, regListenerPair );
+            if( locs1.length <= 0 ) {
+                logger.log(Level.FINE, "   additional reg -- "
+                                  +"locators set to NO_LOCATORS");
+            } else {
+                LocatorsUtil.displayLocatorSet( locs1,
+                                            "   additional reg -- locator",
+                                            Level.FINE);
+            }//endif
+        }//end loop
+        logger.log(Level.FINE, "wait for expected discovery "
+                          +"and discard events generated by the 2nd "
+                         +"locator set of the additional registration(s)");
+        waitForDiscovery();
+        waitForDiscard(NO_INTEREST_DISCARDED);
+        logger.log(Level.FINE, "wait periods complete");
+    }//end run
+
+} //end class LateRegsNotifiedOn2SetLocs
+