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/01/13 12:56:42 UTC

svn commit: r1432594 - in /river/jtsk/skunk/qa_refactor/trunk/qa: harness/policy/ src/com/sun/jini/qa/harness/ src/com/sun/jini/test/impl/discoverymanager/ src/com/sun/jini/test/impl/lookupdiscovery/ src/com/sun/jini/test/impl/start/ src/com/sun/jini/t...

Author: peter_firmstone
Date: Sun Jan 13 11:56:41 2013
New Revision: 1432594

URL: http://svn.apache.org/viewvc?rev=1432594&view=rev
Log:
Refactoring of QA suite to fix shared state visibility issues.

Modified:
    river/jtsk/skunk/qa_refactor/trunk/qa/harness/policy/defaulttest.policy
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/qa/harness/QAConfig.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/discoverymanager/RemoveGroupsLocsDiscard.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/start/AbstractBaseTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/resources/jinitest.policy
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupServices.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/AbstractBaseTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/Discovered.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/joinmanager/AbstractBaseTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/locatordiscovery/AbstractBaseTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/AbstractBaseTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/DiscoveredStagger.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/servicediscovery/AbstractBaseTest.java

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/harness/policy/defaulttest.policy
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/harness/policy/defaulttest.policy?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/harness/policy/defaulttest.policy (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/harness/policy/defaulttest.policy Sun Jan 13 11:56:41 2013
@@ -39,6 +39,12 @@ grant codebase "file:${com.sun.jini.jsk.
     permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
 };
 
+grant codebase "file:${com.sun.jini.jsk.home}${/}lib${/}reference-collections-1.0.1.jar" {
+    permission java.lang.RuntimePermission "modifyThreadGroup";
+    permission java.lang.RuntimePermission "setContextClassLoader";
+    permission java.lang.RuntimePermission "modifyThread";
+};
+
 grant codebase "file:${com.sun.jini.qa.harness.harnessJar}" {
     permission java.security.AllPermission "", "";
 };

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/qa/harness/QAConfig.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/qa/harness/QAConfig.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/qa/harness/QAConfig.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/qa/harness/QAConfig.java Sun Jan 13 11:56:41 2013
@@ -2206,6 +2206,7 @@ public class QAConfig implements Seriali
 	    InetAddress hostAddr = InetAddress.getByName(hostName);
 	    hostName = hostAddr.getCanonicalHostName();
 	} catch (UnknownHostException ignore) {
+            logger.severe("InetAddress threw unknown host exception: " + hostName);
 	}
 	return hostName;
     }

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/discoverymanager/RemoveGroupsLocsDiscard.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/discoverymanager/RemoveGroupsLocsDiscard.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/discoverymanager/RemoveGroupsLocsDiscard.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/discoverymanager/RemoveGroupsLocsDiscard.java Sun Jan 13 11:56:41 2013
@@ -29,6 +29,7 @@ import net.jini.discovery.DiscoveryGroup
 import net.jini.core.discovery.LookupLocator;
 
 import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.qa.harness.Test;
 import java.util.List;
 
 /**
@@ -63,7 +64,7 @@ import java.util.List;
  * Refer to the description for bug ID 4510435.
  *
  */
-public class RemoveGroupsLocsDiscard extends AbstractBaseTest {
+public class RemoveGroupsLocsDiscard extends AbstractBaseTest implements Test {
 
     /** Constructs an instance of this class. Initializes this classname */
     public RemoveGroupsLocsDiscard() {

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java Sun Jan 13 11:56:41 2013
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.logging.Level;
 import com.sun.jini.qa.harness.QAConfig;
 import com.sun.jini.qa.harness.Test;
+import com.sun.jini.qa.harness.Test;
 import com.sun.jini.qa.harness.TestException;
 import java.io.IOException;
 import net.jini.config.Configuration;
@@ -58,7 +59,7 @@ import net.jini.loader.pref.PreferredCla
  * and must encounter <code>java.lang.SecurityException</code>.
  *
  */
-public class RestoreContextForTasks extends BaseQATest {
+public class RestoreContextForTasks extends BaseQATest implements Test {
     private static final String CLASSNAME =
 	"com.sun.jini.test.impl.lookupdiscovery.util.TestTaskProducerImpl";
     private static final String QAHOMEPROP = "com.sun.jini.test.home";

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/start/AbstractBaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/start/AbstractBaseTest.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/start/AbstractBaseTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/start/AbstractBaseTest.java Sun Jan 13 11:56:41 2013
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Properties;
 import com.sun.jini.qa.harness.QAConfig;
 import com.sun.jini.qa.harness.Test;
+import com.sun.jini.qa.harness.Test;
 
 /**
  * This class is an abstract class that acts as the base class which
@@ -41,7 +42,7 @@ import com.sun.jini.qa.harness.Test;
  * be executed in order to verify the assertions addressed by that test.
  * 
  */
-abstract public class AbstractBaseTest extends BaseQATest {
+abstract public class AbstractBaseTest extends BaseQATest implements Test {
 
     /** Performs actions necessary to prepare for execution of the 
      *  current test

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/resources/jinitest.policy
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/resources/jinitest.policy?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/resources/jinitest.policy (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/resources/jinitest.policy Sun Jan 13 11:56:41 2013
@@ -71,6 +71,12 @@ grant codebase "file:${com.sun.jini.jsk.
     permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
 };
 
+grant codebase "file:${com.sun.jini.jsk.home}${/}lib${/}reference-collections-1.0.1.jar" {
+    permission java.lang.RuntimePermission "modifyThreadGroup";
+    permission java.lang.RuntimePermission "setContextClassLoader";
+    permission java.lang.RuntimePermission "modifyThread";
+};
+
 // grants for various test services, placed here for simplicity, but
 // should probably be separated into separate, targeted policy files
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java Sun Jan 13 11:56:41 2013
@@ -70,7 +70,7 @@ import java.util.logging.Level;
  * @see com.sun.jini.qa.harness.QAConfig
  * @see com.sun.jini.qa.harness.QATestEnvironment
  */
-abstract public class BaseQATest extends QATestEnvironment implements Test {
+abstract public class BaseQATest extends QATestEnvironment {
 
     public static final int AUTOMATIC_LOCAL_TEST = Integer.MAX_VALUE;
     public static final int MANUAL_TEST_REMOTE_COMPONENT = 1;
@@ -1186,7 +1186,7 @@ abstract public class BaseQATest extends
     public Test construct(QAConfig config) throws Exception {
 	super.construct(config);
 	this.config = config;
-	logger.log(Level.FINE, " setup()");
+	logger.log(Level.FINE, " construct()");
 	debugsync = getConfig().getBooleanConfigVal("qautil.debug.sync",false);
         testType = config.getIntConfigVal("com.sun.jini.testType",
                                        BaseQATest.AUTOMATIC_LOCAL_TEST);
@@ -1201,7 +1201,13 @@ abstract public class BaseQATest extends
 	    startInitLookups();
 	}//endif
 	startInitLDS();
-        return this;
+        return new Test(){
+
+            public void run() throws Exception {
+                //Nothing to do.
+            }
+            
+        };
     }//end construct
 
     /** Cleans up any remaining state not already cleaned up by the test

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupServices.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupServices.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupServices.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupServices.java Sun Jan 13 11:56:41 2013
@@ -26,6 +26,7 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.rmi.RemoteException;
 import java.util.ArrayList;
+import java.util.ConcurrentModificationException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -44,7 +45,12 @@ import net.jini.discovery.DiscoveryManag
 import net.jini.lookup.DiscoveryAdmin;
 
 /**
- *
+ * This class was refactored out of BaseQATest, there are some minor issues
+ * remaining:
+ * 
+ * TODO: Ensure lookup service instances can only be started once.
+ * TODO: If the index is incorrect report the new index back to the caller.
+ * 
  * @author peter
  */
 public class LookupServices {
@@ -459,6 +465,23 @@ public class LookupServices {
         }//endif(nAddLookupServices > 0)
     }//end startAddLookups
 
+    /**
+     * Start next lookup.
+     * @return index of lookup started.
+     * @throws Exception  
+     */
+    public int startNextLookup(String info) throws Exception {
+        synchronized (lock){
+            int indx = curLookupListSize(info);
+            LocatorGroupsPair pair = allLookupsToStart.get(indx);
+            int port = (pair.getLocator()).getPort();
+            if(portInUse(port)) port = 0;//use randomly chosen port
+            startLookup(indx, port, pair.getLocator().getHost());
+            if (port == 0) refreshLookupLocatorListsAt(indx);
+            return indx;
+        }
+    }
+    
     /** 
      * Start a lookup service with configuration referenced by the
      * given parameter values.
@@ -569,7 +592,7 @@ public class LookupServices {
      * @return true if port in use. 
      */
     public boolean portInUse(int port) {
-        assert Thread.holdsLock(lock);
+        if (! Thread.holdsLock(lock)) throw new ConcurrentModificationException("calling thread doesn't hold lock");
         for(int i=0;i<lookupsStarted.size();i++) {
             LocatorGroupsPair pair = lookupsStarted.get(i);
             int curPort = (pair.getLocator()).getPort();
@@ -578,6 +601,21 @@ public class LookupServices {
         return false;
     }//end portInUse
     
+    private void refreshLookupLocatorListsAt(int index){
+        if (! Thread.holdsLock(lock)) throw new ConcurrentModificationException("calling thread doesn't hold lock");
+        LocatorGroupsPair locGroupsPair = lookupsStarted.get(index);
+        /* index range of init lookups */
+        int initLookupsBegin = nRemoteLookupServices + nAddRemoteLookupServices;
+        int initLookupsEnd = initLookupsBegin + nLookupServices;
+        /* index range of add lookups */
+        int addLookupsBegin = nRemoteLookupServices + nAddRemoteLookupServices + nLookupServices;
+        int addLookupsEnd = addLookupsBegin + nAddLookupServices;
+        /* update lookup lists */
+        if (index >= initLookupsBegin && index < initLookupsEnd) initLookupsToStart.set(index,locGroupsPair);
+        if (index >= addLookupsBegin && index < addLookupsEnd) addLookupsToStart.set(index, locGroupsPair);
+        allLookupsToStart.set(index,locGroupsPair);
+    }
+    
     private LocatorGroupsPair getLocatorGroupsPair(int indx, String[] groups) throws TestException {
         LookupLocator l = getTestLocator(indx);
         return new BaseQATest.LocatorGroupsPair(l, groups);
@@ -1282,5 +1320,100 @@ public class LookupServices {
     public void setnAddServices(int nAddServices) {
         this.nAddServices = nAddServices;
     }
+    
+    /**
+     * Returns a thread in which a number of lookup services are started after
+     * various time delays. This thread is intended to be used by tests that need to
+     * simulate "late joiner" lookup services. After all of the requested
+     * lookup services have been started, this thread will exit.
+     * 
+     * The thread doesn't start until Thread.start() is called.
+     * @return Thread that staggers starting of lookup services.
+     */
+    public Thread staggeredStartThread(int index){
+        return new StaggeredStartThread(index);
+    }
+    
+    /** Thread in which a number of lookup services are started after various
+     *  time delays. This thread is intended to be used by tests that need to
+     *  simulate "late joiner" lookup services. After all of the requested
+     *  lookup services have been started, this thread will exit.
+     */
+    private class StaggeredStartThread extends Thread {
+        private final long[] waitTimes
+                           = {    5*1000, 10*1000, 20*1000, 30*1000, 60*1000, 
+                               2*60*1000,
+                                 60*1000, 30*1000, 20*1000, 10*1000, 5*1000 };
+        private final int startIndx;
+
+        /** Use this constructor if a number of lookup services (equal to the
+         *  value of the given startIndx) have already been started; and this
+         *  thread will start the remaining lookup services. The locGroupsList
+         *  parameter is an ArrayList that should contain LocatorGroupsPair
+         *  instances that reference the locator and corresponding member
+         *  groups of each lookup service to start.
+         */
+         private StaggeredStartThread(int startIndx) {
+            super("StaggeredStartThread");
+            setDaemon(true);
+            this.startIndx = startIndx;
+        }//end constructor
+         
+        private int size(){
+            synchronized (lock){
+                return allLookupsToStart.size();
+            }
+        }
+
+        public void run() {
+            int n = waitTimes.length;
+            for(int i=startIndx;((!isInterrupted())&&(i<size()));
+                                                                          i++)
+            {
+                long waitMS = ( i < n ? waitTimes[i] : waitTimes[n-1] );
+                logger.log(Level.FINE,
+                              " waiting "+(waitMS/1000)+" seconds before "
+                              +"attempting to start the next lookup service");
+                try { 
+                    Thread.sleep(waitMS);
+                } catch(InterruptedException e) { 
+                    /* Need to re-interrupt this thread because catching
+                     * an InterruptedException clears the interrupted status
+                     * of this thread. 
+                     * 
+                     * If the sleep() call was not interrupted but was timed
+                     * out, this means that this thread should continue
+                     * processing; and the fact that the interrupted status
+                     * has been cleared is consistent with that fact. On the
+                     * other hand, if the sleep() was actually interrupted,
+                     * this means that some entity external to this thread
+                     * is signalling that this thread should exit. But the
+                     * code below that determines whether to exit or continue
+                     * processing bases its decision on the state of the
+                     * interrupted status. And since the interrupted status
+                     * was cleared when the InterruptedException was caught,
+                     * the interrupted status of this thread needs to be reset
+                     * to an interrupted state so that an exit will occur.
+                     */
+                    Thread.currentThread().interrupt();
+                }
+                
+                synchronized (lock){
+                    LocatorGroupsPair pair = allLookupsToStart.get(i);
+                    LookupLocator l = pair.getLocator();
+                    int port = l.getPort();
+                    if(portInUse(port)) port = 0;
+                    if( isInterrupted() )  break;//exit this thread
+                    try {
+                        startLookup(i, port, l.getHost());
+                    } catch(Exception e) {
+                        e.printStackTrace();
+                    }
+                    if(port == 0) refreshLookupLocatorListsAt(i);
+                }
+            }//end loop
+        }//end run
+    }//end class StaggeredStartThread
+
 
 }

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/AbstractBaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/AbstractBaseTest.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/AbstractBaseTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/AbstractBaseTest.java Sun Jan 13 11:56:41 2013
@@ -26,6 +26,7 @@ import com.sun.jini.test.share.BaseQATes
 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.qa.harness.Test;
 
 import net.jini.discovery.DiscoveryManagement;
 import net.jini.discovery.DiscoveryGroupManagement;
@@ -87,9 +88,9 @@ abstract public class AbstractBaseTest e
     protected static final int ALL_BY_LOC        = 3;
     protected static final int BY_LOC_AND_BOTH   = 4;
 
-    protected LookupDiscoveryManager discoveryMgr = null;
-    protected ArrayList ldmList = new ArrayList(1);
-    protected LookupListener mainListener = null;
+    protected volatile LookupDiscoveryManager discoveryMgr = null;
+    private final ArrayList<LookupDiscoveryManager> ldmList = new ArrayList<LookupDiscoveryManager>(1); //The same thread that calls construct calls tearDown, lack of sync ok.
+    protected volatile LookupListener mainListener = null;// this field is synchronized on, this is a candidate for returning a separate test object.
 
     /** Performs actions necessary to prepare for execution of the 
      *  current test as follows:
@@ -119,12 +120,14 @@ abstract public class AbstractBaseTest e
 				       config.getConfiguration());
 	ldmList.add(discoveryMgr);
 	mainListener = new LookupListener();
-        return this;
-    }
+        return new Test() {
 
-    /** Executes the current test
-     */
-    abstract public void run() throws Exception;
+            public void run() throws Exception {
+                // nothing to do.
+            }
+            
+        };
+    }
 
     /** Cleans up all state. Terminates the lookup discovery utilities that
      *  may have been created, shutdowns any lookup service(s) that may

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/Discovered.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/Discovered.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/Discovered.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoverymanager/Discovered.java Sun Jan 13 11:56:41 2013
@@ -24,6 +24,7 @@ import net.jini.discovery.DiscoveryGroup
 import net.jini.core.discovery.LookupLocator;
 import com.sun.jini.qa.harness.QAConfig;
 import com.sun.jini.qa.harness.Test;
+import com.sun.jini.qa.harness.Test;
 import java.util.List;
 
 /**
@@ -53,7 +54,7 @@ import java.util.List;
  * listener will receive the expected number of discovered events, with the
  * expected contents.
  */
-public class Discovered extends AbstractBaseTest {
+public class Discovered extends AbstractBaseTest implements Test {
 
     protected String[] groupsToDiscover = DiscoveryGroupManagement.NO_GROUPS;
     protected LookupLocator[] locatorsToDiscover = new LookupLocator[0];

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/joinmanager/AbstractBaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/joinmanager/AbstractBaseTest.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/joinmanager/AbstractBaseTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/joinmanager/AbstractBaseTest.java Sun Jan 13 11:56:41 2013
@@ -29,6 +29,7 @@ import com.sun.jini.test.share.LocatorsU
 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.qa.harness.Test;
 
 import net.jini.discovery.DiscoveryManagement;
 import net.jini.discovery.DiscoveryGroupManagement;
@@ -85,7 +86,7 @@ import net.jini.config.ConfigurationExce
  * <code>run</code> method which defines the actual functions that must
  * be executed in order to verify the assertions addressed by that test.
  */
-abstract public class AbstractBaseTest extends BaseQATest {
+abstract public class AbstractBaseTest extends BaseQATest implements Test {
 
     /** Class whose different instances will be registered with various
      *  lookup services; each of which is expected to be discovered by the

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/locatordiscovery/AbstractBaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/locatordiscovery/AbstractBaseTest.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/locatordiscovery/AbstractBaseTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/locatordiscovery/AbstractBaseTest.java Sun Jan 13 11:56:41 2013
@@ -24,6 +24,7 @@ import com.sun.jini.test.share.BaseQATes
 
 import com.sun.jini.qa.harness.QAConfig;
 import com.sun.jini.qa.harness.Test;
+import com.sun.jini.qa.harness.Test;
 import com.sun.jini.qa.harness.TestException;
 
 import net.jini.discovery.DiscoveryManagement;
@@ -65,7 +66,7 @@ import java.util.List;
  * in progress must be configured for explicit, pre-assigned, port numbers.
  *
  */
-abstract public class AbstractBaseTest extends BaseQATest {
+abstract public class AbstractBaseTest extends BaseQATest implements Test {
 
     protected volatile LookupLocatorDiscovery locatorDiscovery = null;
     protected final List<LookupLocatorDiscovery> locatorDiscoveryList = new CopyOnWriteArrayList<LookupLocatorDiscovery>();

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/AbstractBaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/AbstractBaseTest.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/AbstractBaseTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/AbstractBaseTest.java Sun Jan 13 11:56:41 2013
@@ -57,7 +57,7 @@ import java.util.concurrent.CopyOnWriteA
  * <code>run</code> method which defines the actual functions that must
  * be executed in order to verify the assertions addressed by that test.
  */
-abstract public class AbstractBaseTest extends BaseQATest {
+abstract public class AbstractBaseTest extends BaseQATest implements Test {
 
     protected volatile LookupDiscovery lookupDiscovery = null;
     protected final List<LookupDiscovery> lookupDiscoveryList = new CopyOnWriteArrayList<LookupDiscovery>();

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/DiscoveredStagger.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/DiscoveredStagger.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/DiscoveredStagger.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupdiscovery/DiscoveredStagger.java Sun Jan 13 11:56:41 2013
@@ -23,6 +23,7 @@ import com.sun.jini.qa.harness.Test;
 import java.util.logging.Level;
 
 import com.sun.jini.qa.harness.TestException;
+import com.sun.jini.test.share.LookupServices;
 
 /**
  * This class verifies that the <code>LookupDiscovery</code> utility
@@ -82,22 +83,18 @@ public class DiscoveredStagger extends A
          */
         boolean oldUseFastTimeout = useFastTimeout;
         useFastTimeout = false;
-        StaggeredStartThread lookupsThread =
-                                new StaggeredStartThread(1, getAllLookupsToStart());
+        LookupServices lookups = getLookupServices();
+        Thread lookupsThread = null;
         try {
             /* Start 1st lookup service (so it's up before discovery starts) */
-            LocatorGroupsPair pair
-                                 = (LocatorGroupsPair)getAllLookupsToStart().get(0);
-            int port = (pair.getLocator()).getPort();
-            if(portInUse(port)) port = 0;//use randomly chosen port
-            startLookup(0, port, pair.getLocator().getHost());
+            int index = lookups.startNextLookup(null);
+            lookupsThread = lookups.staggeredStartThread(index + 1);
             /* Re-configure LookupDiscovery to discover given  groups */
             logger.log(Level.FINE,
                           "change LookupDiscovery to discover -- ");
             String[] groupsToDiscover = toGroupsArray(getAllLookupsToStart());
             for(int i=0;i<groupsToDiscover.length;i++) {
-                logger.log(Level.FINE,
-                                  "   "+groupsToDiscover[i]);
+                logger.log(Level.FINE, "   {0}", groupsToDiscover[i]);
             }//end loop
             lookupDiscovery.setGroups(groupsToDiscover);
             /* Add the given listener to the LookupDiscovery utility */
@@ -116,7 +113,7 @@ public class DiscoveredStagger extends A
              * to tell the thread to stop so that it doesn't continue running
              * into the next test.
              */
-            lookupsThread.interrupt();
+            if (lookupsThread != null ) lookupsThread.interrupt();
             useFastTimeout = oldUseFastTimeout;
         }
     }//end run

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/servicediscovery/AbstractBaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/servicediscovery/AbstractBaseTest.java?rev=1432594&r1=1432593&r2=1432594&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/servicediscovery/AbstractBaseTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/servicediscovery/AbstractBaseTest.java Sun Jan 13 11:56:41 2013
@@ -26,6 +26,7 @@ import com.sun.jini.test.share.BaseQATes
 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.qa.harness.Test;
 
 import com.sun.jini.test.share.DiscoveryServiceUtil;
 import com.sun.jini.test.share.GroupsUtil;
@@ -96,7 +97,7 @@ import net.jini.config.ConfigurationExce
  * @see com.sun.jini.qa.harness.TestException
  * @see com.sun.jini.qa.harness.QAConfig
  */
-abstract public class AbstractBaseTest extends BaseQATest {
+abstract public class AbstractBaseTest extends BaseQATest implements Test {
 
     /** Note that for convenience, a number of inner classes are defined below.
      *  Each such inner class that is defined as <code>Serializable</code>