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/02 06:21:08 UTC

svn commit: r1427655 [19/35] - in /river/jtsk/skunk/qa_refactor/trunk/qa: ./ doc/ src/com/sun/jini/qa/harness/ src/com/sun/jini/test/impl/discoverymanager/ src/com/sun/jini/test/impl/discoveryproviders/ src/com/sun/jini/test/impl/end2end/e2etest/ src/c...

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DestroyTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DestroyTest.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DestroyTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DestroyTest.java Wed Jan  2 05:20:52 2013
@@ -29,6 +29,7 @@ import com.sun.jini.admin.DestroyAdmin;
 import net.jini.admin.Administrable;
 
 import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.qa.harness.Test;
 
 
 public class DestroyTest extends LookupTestBase {
@@ -41,9 +42,10 @@ public class DestroyTest extends LookupT
     /** How much we'll wait after destroy() method call (in seconds) */
     private int destroyDelay;
 
-    public void setup(QAConfig config) throws Exception {
-	super.setup(config);
+    public Test construct(QAConfig config) throws Exception {
+	super.construct(config);
 	this.parse();
+        return this;
     }
 
     /**

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryAdminUtil.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryAdminUtil.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryAdminUtil.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryAdminUtil.java Wed Jan  2 05:20:52 2013
@@ -21,7 +21,7 @@ package com.sun.jini.test.share;
 import java.util.logging.Level;
 
 import com.sun.jini.qa.harness.TestException;
-import com.sun.jini.qa.harness.QATest;
+import com.sun.jini.qa.harness.QATestEnvironment;
 import com.sun.jini.qa.harness.QAConfig;
 
 import net.jini.admin.Administrable;

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java Wed Jan  2 05:20:52 2013
@@ -20,7 +20,7 @@ package com.sun.jini.test.share;
 
 import java.util.logging.Level;
 
-import com.sun.jini.qa.harness.QATest;
+import com.sun.jini.qa.harness.QATestEnvironment;
 import com.sun.jini.qa.harness.QAConfig;
 
 import net.jini.discovery.DiscoveryGroupManagement;

Added: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/EventMailBoxServices.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/EventMailBoxServices.java?rev=1427655&view=auto
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/EventMailBoxServices.java (added)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/EventMailBoxServices.java Wed Jan  2 05:20:52 2013
@@ -0,0 +1,121 @@
+/*
+ * 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.share;
+
+import com.sun.jini.qa.harness.QAConfig;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author peter
+ */
+public class EventMailBoxServices {
+    /** the logger */
+    private static final Logger logger = Logger.getLogger("com.sun.jini.qa.harness");
+    private final int nEventMailboxServices;
+    private final int nAddEventMailboxServices;
+    private final int nRemoteEventMailboxServices;
+    private final int nAddRemoteEventMailboxServices;
+    
+    public EventMailBoxServices(QAConfig config){
+        int testType = config.getIntConfigVal("com.sun.jini.testType",
+                                   BaseQATest.AUTOMATIC_LOCAL_TEST);
+        /* begin event mailbox service info */
+        int nEventMailboxServ = config.getIntConfigVal
+                           ("net.jini.event.nEventMailboxServices",
+                             0);
+        int nRemoteEventMailboxServ = config.getIntConfigVal
+                         ("net.jini.event.nRemoteEventMailboxServices",
+                           0);
+        int nAddEventMailboxServ = config.getIntConfigVal
+                           ("net.jini.event.nAddEventMailboxServices",
+                             0);
+
+        int nAddRemoteEventMailboxServ = config.getIntConfigVal
+                      ("net.jini.event.nAddRemoteEventMailboxServices",
+                       0);
+        if(testType == BaseQATest.MANUAL_TEST_REMOTE_COMPONENT) {
+            nEventMailboxServ = nRemoteEventMailboxServ;
+            nAddEventMailboxServ = nAddRemoteEventMailboxServ;
+            nRemoteEventMailboxServ = 0;
+            nAddRemoteEventMailboxServ = 0;
+        }//endif
+        
+        this.nEventMailboxServices = nEventMailboxServ;
+        this.nAddEventMailboxServices = nAddEventMailboxServ;
+        this.nRemoteEventMailboxServices = nRemoteEventMailboxServ;
+        this.nAddRemoteEventMailboxServices = nAddRemoteEventMailboxServ;
+        
+        int tmpN =   nEventMailboxServ+ nAddEventMailboxServ
+               + nRemoteEventMailboxServ + nAddRemoteEventMailboxServ;
+        if(tmpN > 0) {
+            logger.log(Level.FINE,
+                          " ----- Event Mailbox Service Info ----- ");
+            logger.log(Level.FINE, " # of event mailbox services to start     -- {0}", nEventMailboxServ);
+            logger.log(Level.FINE, " # of additional event mailbox srvcs      -- {0}", nAddEventMailboxServ);
+        }//endif(tmpN > 0)
+
+        /* Handle remote/local components of manual tests */
+        String remoteHost = config.getStringConfigVal("net.jini.lookup.remotehost",
+                                            "UNKNOWN_HOST");
+        switch(testType) {
+            case BaseQATest.MANUAL_TEST_REMOTE_COMPONENT:
+                logger.log(Level.FINE,
+                                  " ***** REMOTE COMPONENT OF A MANUAL TEST "+"(remote host = {0}) ***** ", remoteHost);
+                break;
+            case BaseQATest.MANUAL_TEST_LOCAL_COMPONENT:
+                logger.log(Level.FINE,
+                                  " ***** LOCAL COMPONENT OF A MANUAL TEST "+"(remote host = {0}) ***** ", remoteHost);
+                logger.log(Level.FINE,
+                       " ----- Remote Event Mailbox Service Info ----- ");
+                logger.log(Level.FINE, " # of remote event mailbox services    -- {0}", nRemoteEventMailboxServ);
+                logger.log(Level.FINE, " additional remote event mailbox srvcs -- {0}", nAddRemoteEventMailboxServ);
+                break;
+        }//end switch(testType)
+
+    }
+
+    /**
+     * @return the nEventMailboxServices
+     */
+    public int getnEventMailboxServices() {
+        return nEventMailboxServices;
+    }
+
+    /**
+     * @return the nAddEventMailboxServices
+     */
+    public int getnAddEventMailboxServices() {
+        return nAddEventMailboxServices;
+    }
+
+    /**
+     * @return the nRemoteEventMailboxServices
+     */
+    public int getnRemoteEventMailboxServices() {
+        return nRemoteEventMailboxServices;
+    }
+
+    /**
+     * @return the nAddRemoteEventMailboxServices
+     */
+    public int getnAddRemoteEventMailboxServices() {
+        return nAddRemoteEventMailboxServices;
+    }
+}

Propchange: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/EventMailBoxServices.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/FiddlerAdminUtil.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/FiddlerAdminUtil.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/FiddlerAdminUtil.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/FiddlerAdminUtil.java Wed Jan  2 05:20:52 2013
@@ -19,7 +19,7 @@
 package com.sun.jini.test.share;
 
 import com.sun.jini.qa.harness.TestException;
-import com.sun.jini.qa.harness.QATest;
+import com.sun.jini.qa.harness.QATestEnvironment;
 import com.sun.jini.qa.harness.QAConfig;
 
 import com.sun.jini.fiddler.FiddlerAdmin;

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/JoinAdminUtil.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/JoinAdminUtil.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/JoinAdminUtil.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/JoinAdminUtil.java Wed Jan  2 05:20:52 2013
@@ -19,7 +19,7 @@
 package com.sun.jini.test.share;
 
 import com.sun.jini.qa.harness.TestException;
-import com.sun.jini.qa.harness.QATest;
+import com.sun.jini.qa.harness.QATestEnvironment;
 import com.sun.jini.qa.harness.QAConfig;
 
 import net.jini.admin.Administrable;

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseBackEndImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseBackEndImpl.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseBackEndImpl.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseBackEndImpl.java Wed Jan  2 05:20:52 2013
@@ -29,7 +29,7 @@ import net.jini.core.lease.UnknownLeaseE
 import java.lang.reflect.Constructor;
 import java.io.Serializable;
 
-import com.sun.jini.qa.harness.QATest;
+import com.sun.jini.qa.harness.QATestEnvironment;
 import com.sun.jini.qa.harness.QAConfig;
 
 import net.jini.export.Exporter;

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseGrantTestBase.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseGrantTestBase.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseGrantTestBase.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseGrantTestBase.java Wed Jan  2 05:20:52 2013
@@ -17,6 +17,7 @@
  */
 package com.sun.jini.test.share;
 
+import com.sun.jini.qa.harness.Test;
 import java.util.logging.Level;
 
 // Test harness specific classes
@@ -30,7 +31,7 @@ import net.jini.admin.Administrable;
  * Base class for tests which grab a lease and make sure the returned lease
  * meets give constraints.
  */
-public abstract class LeaseGrantTestBase extends TestBase {
+public abstract class LeaseGrantTestBase extends TestBase implements Test {
     // If true then the tests expects leases to granted
     // exactly.  If false the grant can be for less than the request
     private boolean exact = false; 

Added: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseRenewalServices.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseRenewalServices.java?rev=1427655&view=auto
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseRenewalServices.java (added)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseRenewalServices.java Wed Jan  2 05:20:52 2013
@@ -0,0 +1,110 @@
+/*
+ * 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.share;
+
+import com.sun.jini.qa.harness.QAConfig;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author peter
+ */
+public class LeaseRenewalServices {
+    /** the logger */
+    private static final Logger logger = Logger.getLogger("com.sun.jini.qa.harness");
+    private final int nLeaseRenewalServices;
+    private final int nAddLeaseRenewalServices;
+    private final int nRemoteLeaseRenewalServices;
+    private final int nAddRemoteLeaseRenewalServices;
+    
+    public LeaseRenewalServices(QAConfig config){
+        int testType = config.getIntConfigVal("com.sun.jini.testType",
+                                   BaseQATest.AUTOMATIC_LOCAL_TEST);
+        /* begin lease renewal service info */
+        int nLeaseRenewalServ = config.getIntConfigVal
+                           ("net.jini.lease.nLeaseRenewalServices", 0);
+        int nRemoteLeaseRenewalServ = config.getIntConfigVal
+                         ("net.jini.lease.nRemoteLeaseRenewalServices", 0);
+        int nAddLeaseRenewalServ = config.getIntConfigVal
+                           ("net.jini.lease.nAddLeaseRenewalServices", 0);
+        int nAddRemoteLeaseRenewalServ = config.getIntConfigVal
+                      ("net.jini.lease.nAddRemoteLeaseRenewalServices", 0);
+        if(testType == BaseQATest.MANUAL_TEST_REMOTE_COMPONENT) {
+            nLeaseRenewalServ = nRemoteLeaseRenewalServ;
+            nAddLeaseRenewalServ = nAddRemoteLeaseRenewalServ;
+            nRemoteLeaseRenewalServ = 0;
+            nAddRemoteLeaseRenewalServ = 0;
+        }//endif
+        this.nLeaseRenewalServices = nLeaseRenewalServ;
+        this.nRemoteLeaseRenewalServices = nRemoteLeaseRenewalServ;
+        this.nAddLeaseRenewalServices = nAddLeaseRenewalServ;
+        this.nAddRemoteLeaseRenewalServices = nAddRemoteLeaseRenewalServ;
+        
+        int tmpN =   nLeaseRenewalServ+ nAddLeaseRenewalServ
+               + nRemoteLeaseRenewalServ + nAddRemoteLeaseRenewalServ;
+        if(tmpN > 0) {
+            logger.log(Level.FINE, " ----- Lease Renewal Service Info ----- ");
+            logger.log(Level.FINE, " # of lease renewal services to start     -- {0}", nLeaseRenewalServ);
+            logger.log(Level.FINE, " # of additional lease renewal srvcs      -- {0}", nAddLeaseRenewalServ);
+        }//endif(tmpN > 0)
+        /* Handle remote/local components of manual tests */
+        String remoteHost = config.getStringConfigVal("net.jini.lookup.remotehost",
+                                            "UNKNOWN_HOST");
+        switch(testType) {
+            case BaseQATest.MANUAL_TEST_REMOTE_COMPONENT:
+                logger.log(Level.FINE, " ***** REMOTE COMPONENT OF A MANUAL TEST "+"(remote host = {0}) ***** ", remoteHost);
+                break;
+            case BaseQATest.MANUAL_TEST_LOCAL_COMPONENT:
+                logger.log(Level.FINE, " ***** LOCAL COMPONENT OF A MANUAL TEST "+"(remote host = {0}) ***** ", remoteHost);
+                logger.log(Level.FINE, " ----- Remote Lease Renewal Service Info ----- ");
+                logger.log(Level.FINE, " # of remote lease renewal services    -- {0}", nRemoteLeaseRenewalServices);
+                logger.log(Level.FINE, " additional remote lease renewal srvcs -- {0}", nAddRemoteLeaseRenewalServices);
+                break;
+        }//end switch(testType)
+    }
+
+    /**
+     * @return the nLeaseRenewalServices
+     */
+    public int getnLeaseRenewalServices() {
+        return nLeaseRenewalServices;
+    }
+
+    /**
+     * @return the nAddLeaseRenewalServices
+     */
+    public int getnAddLeaseRenewalServices() {
+        return nAddLeaseRenewalServices;
+    }
+
+    /**
+     * @return the nRemoteLeaseRenewalServices
+     */
+    public int getnRemoteLeaseRenewalServices() {
+        return nRemoteLeaseRenewalServices;
+    }
+
+    /**
+     * @return the nAddRemoteLeaseRenewalServices
+     */
+    public int getnAddRemoteLeaseRenewalServices() {
+        return nAddRemoteLeaseRenewalServices;
+    }
+    
+}

Propchange: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseRenewalServices.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseUsesTestBase.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseUsesTestBase.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseUsesTestBase.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LeaseUsesTestBase.java Wed Jan  2 05:20:52 2013
@@ -22,6 +22,7 @@ import java.util.logging.Level;
 // Test harness specific classes
 import com.sun.jini.qa.harness.TestException;
 import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.qa.harness.Test;
 
 import java.rmi.*;
 import net.jini.core.lease.Lease;
@@ -116,9 +117,10 @@ public abstract class LeaseUsesTestBase 
 	cancelSlop = getConfig().getLongConfigVal("com.sun.jini.test.share.cancel_slop", 0);
     }
 
-    public void setup(QAConfig config) throws Exception {
-	super.setup(config);
+    public Test construct(QAConfig config) throws Exception {
+	super.construct(config);
 	parse();
+        return this;
     }
 
     public void run() throws Exception {

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupAttributeAdminTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupAttributeAdminTest.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupAttributeAdminTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupAttributeAdminTest.java Wed Jan  2 05:20:52 2013
@@ -29,6 +29,7 @@ import java.util.Set;
 import net.jini.admin.JoinAdmin;
 import net.jini.core.entry.Entry;
 import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.qa.harness.Test;
 import net.jini.lookup.entry.ServiceControlled;
 
 public class LookupAttributeAdminTest extends LookupTestBase {
@@ -36,9 +37,10 @@ public class LookupAttributeAdminTest ex
     static final private Entry[] entryarray = new Entry[0];
     private Entry[] originalState;
 
-    public void setup(QAConfig config) throws Exception {
-	super.setup(config);
+    public Test construct(QAConfig config) throws Exception {
+	super.construct(config);
 	this.parse();
+        return this;
     }
 
     protected static void fill(Set aSet, Object[] aArray) {

Added: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupDiscoveryServices.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupDiscoveryServices.java?rev=1427655&view=auto
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupDiscoveryServices.java (added)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupDiscoveryServices.java Wed Jan  2 05:20:52 2013
@@ -0,0 +1,332 @@
+/*
+ * 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.share;
+
+import com.sun.jini.qa.harness.AdminManager;
+import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.test.share.BaseQATest.ToJoinPair;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import net.jini.admin.Administrable;
+import net.jini.admin.JoinAdmin;
+import net.jini.core.discovery.LookupLocator;
+import net.jini.discovery.DiscoveryGroupManagement;
+import net.jini.discovery.LookupDiscoveryService;
+
+/**
+ *
+ * @author peter
+ */
+public class LookupDiscoveryServices {
+    /** the logger */
+    private static final Logger logger = Logger.getLogger("com.sun.jini.qa.harness");
+    private final int testType;
+    private final int nLookupDiscoveryServices;
+    private final int nAddLookupDiscoveryServices;
+    private final int nRemoteLookupDiscoveryServices;
+    private final int nAddRemoteLookupDiscoveryServices;
+    private final String remoteHost;
+    /* Data structures - lookup discovery services */
+    private final List<ToJoinPair> initLDSToStart;// No mutation after construction
+    private final List<ToJoinPair> addLDSToStart;// No mutation after construction
+    private final List<ToJoinPair> allLDSToStart;// No mutation after construction
+    private final List<LookupDiscoveryService> ldsList;// Synchronized list
+    private final List expectedServiceList;// Externally supplied list - concurrent.
+    private final QAConfig config;
+    private final AdminManager admin;
+    
+    public LookupDiscoveryServices(QAConfig config, AdminManager admin, List expectedServiceList){
+        this.config = config;
+        this.admin = admin;
+        initLDSToStart = new ArrayList<ToJoinPair>(11);
+        addLDSToStart  = new ArrayList<ToJoinPair>(11);
+        allLDSToStart  = new ArrayList<ToJoinPair>(11);
+        ldsList = Collections.synchronizedList(new ArrayList<LookupDiscoveryService>(3));
+        this.expectedServiceList = expectedServiceList;
+        testType = config.getIntConfigVal("com.sun.jini.testType",
+                                   BaseQATest.AUTOMATIC_LOCAL_TEST);
+        /* begin lookup discovery service info */
+        int nLookupDiscoveryServ = config.getIntConfigVal
+                           ("net.jini.discovery.nLookupDiscoveryServices",
+                             0);
+        int nRemoteLookupDiscoveryServ = config.getIntConfigVal
+                         ("net.jini.discovery.nRemoteLookupDiscoveryServices",
+                           0);
+        int nAddLookupDiscoveryServ = config.getIntConfigVal
+                           ("net.jini.discovery.nAddLookupDiscoveryServices",
+                             0);
+
+        int nAddRemoteLookupDiscoveryServ = config.getIntConfigVal
+                      ("net.jini.discovery.nAddRemoteLookupDiscoveryServices",
+                       0);
+        if(testType == BaseQATest.MANUAL_TEST_REMOTE_COMPONENT) {
+            nLookupDiscoveryServ = nRemoteLookupDiscoveryServ;
+            nAddLookupDiscoveryServ = nAddRemoteLookupDiscoveryServ;
+            nRemoteLookupDiscoveryServ = 0;
+            nAddRemoteLookupDiscoveryServ = 0;
+        }//endif
+        this.nLookupDiscoveryServices = nLookupDiscoveryServ;
+        this.nRemoteLookupDiscoveryServices = nRemoteLookupDiscoveryServ;
+        this.nAddLookupDiscoveryServices = nAddLookupDiscoveryServ;
+        this.nAddRemoteLookupDiscoveryServices = nAddRemoteLookupDiscoveryServ;
+        int tmpN =   nLookupDiscoveryServ
+                   + nAddLookupDiscoveryServ
+                   + nRemoteLookupDiscoveryServ
+                   + nAddRemoteLookupDiscoveryServ;
+        if(tmpN > 0) {
+            logger.log(Level.FINE,
+                          " ----- Lookup Discovery Service Info ----- ");
+            logger.log(Level.FINE, " # of lookup discovery services to start  -- {0}", 
+                    nLookupDiscoveryServ);
+            logger.log(Level.FINE, " # of additional lookup discovery srvcs   -- {0}", 
+                    nAddLookupDiscoveryServ);
+        }//endif(tmpN > 0)
+    /* Handle remote/local components of manual tests */
+        remoteHost = config.getStringConfigVal("net.jini.lookup.remotehost",
+                                            "UNKNOWN_HOST");
+        switch(testType) {
+            case BaseQATest.MANUAL_TEST_REMOTE_COMPONENT:
+                logger.log(Level.FINE, " ***** REMOTE COMPONENT OF A MANUAL TEST "
+                        +"(remote host = {0}) ***** ", remoteHost);
+                break;
+            case BaseQATest.MANUAL_TEST_LOCAL_COMPONENT:
+                logger.log(Level.FINE, " ***** LOCAL COMPONENT OF A MANUAL TEST "
+                        +"(remote host = {0}) ***** ", remoteHost);
+                logger.log(Level.FINE,
+                       " ----- Remote Lookup Discovery Service Info ----- ");
+                logger.log(Level.FINE, " # of remote lookup discovery services    -- {0}", 
+                        nRemoteLookupDiscoveryServ);
+                logger.log(Level.FINE, " additional remote lookup discovery srvcs -- {0}", 
+                        nAddRemoteLookupDiscoveryServ);
+                break;
+        }//end switch(testType)
+        
+        /** Retrieves and stores the information needed to configure any lookup
+         *  discovery services that will be started for the current test run.
+         */
+
+        /* Retrieve groups/locators each lookup discovery service should join*/
+        int n0 = 0;
+        int n1 = n0 + nRemoteLookupDiscoveryServ;
+        for(int i=0;i<n1;i++) {//initial remote lookup discovery services
+            /* Locators and groups to join */
+            String tojoinArg = config.getServiceStringProperty
+                                ("net.jini.discovery.LookupDiscoveryService",
+                                 "tojoin", i);
+
+            initLDSToStart.add(getToJoinPair(tojoinArg));
+        }//end loop
+        /*Remote lookup discovery servicess started after initial remote LDSs*/
+        n0 = n1;
+        n1 = n0 + nAddRemoteLookupDiscoveryServ;
+        for(int i=n0;i<n1;i++) {//additional remote lookup discovery services
+            /* Locators and groups to join */
+            String tojoinArg = config.getServiceStringProperty
+                                ("net.jini.discovery.LookupDiscoveryService",
+                                 "tojoin", i);
+            /* Use NON-unique groups to join */
+            addLDSToStart.add(getToJoinPair(tojoinArg));
+        }//end loop
+        /* Handle all lookup discovery services to be started locally */
+        n0 = n1;
+        n1 = n0 + nLookupDiscoveryServ;
+        for(int i=n0;i<n1;i++) {//initial local lookup discovery services
+            /* Locators and groups to join */
+            String tojoinArg = config.getServiceStringProperty
+                                ("net.jini.discovery.LookupDiscoveryService",
+                                 "tojoin", i);
+            if(testType == BaseQATest.AUTOMATIC_LOCAL_TEST) {//use unique group names
+                tojoinArg = config.makeGroupsUnique(tojoinArg);
+            }//endif
+            initLDSToStart.add(getToJoinPair(tojoinArg));
+        }//end loop
+        /* The LDSs to start after the initial LDSs */
+        n0 = n1;
+        n1 = n0 + nAddRemoteLookupDiscoveryServ;
+        for(int i=n0;i<n1;i++) {//additional local lookup discovery services
+            /* Locators and groups to join */
+            String tojoinArg = config.getServiceStringProperty
+                                ("net.jini.discovery.LookupDiscoveryService",
+                                 "tojoin", i);
+            if(testType == BaseQATest.AUTOMATIC_LOCAL_TEST) {//use unique group names
+                tojoinArg = config.makeGroupsUnique(tojoinArg);
+            }//endif
+            addLDSToStart.add(getToJoinPair(tojoinArg));
+        }//end loop
+        /* Populate the ArrayList allLDSToStart */
+        for(int i=0;i<initLDSToStart.size();i++) {
+            allLDSToStart.add(initLDSToStart.get(i));
+        }//end loop
+        for(int i=0;i<addLDSToStart.size();i++) {
+            allLDSToStart.add(addLDSToStart.get(i));
+        }//end loop
+
+    }
+    
+    /** Convenience method that examines the given <code>String</code>
+     *  containing a comma-separated list of groups and locators to join,
+     *  and returns a <code>String</code> array containing the items that
+     *  correspond to the groups to join.
+     */
+    private String[] getGroupsFromToJoinArg(String tojoinArg) {
+        String[] tojoin = config.parseString(tojoinArg,",");
+        if(tojoin == null) return DiscoveryGroupManagement.ALL_GROUPS;
+        if(tojoin.length == 0) return DiscoveryGroupManagement.NO_GROUPS;
+        ArrayList<String> tojoinList = new ArrayList<String>(tojoin.length);
+        for(int i=0;i<tojoin.length;i++) {
+            if( !config.isLocator(tojoin[i]) ) tojoinList.add(tojoin[i]);
+        }//end loop
+        return tojoinList.toArray(new String[tojoinList.size()]);
+    }//end getGroupsFromToJoinArg
+
+    
+    /** Convenience method that examines the given <code>String</code>
+     *  containing a comma-separated list of groups and locators to join,
+     *  and returns a <code>LookupLocator</code> array containing the items
+     *  that correspond to the locators to join.
+     */
+    //this method obtain constrainable locators because the locators are
+    // administratively set after the service is started. It's not clear whether
+    // this can be discarded in favor of the new initialLookupLocators configuration
+    // entry
+    private LookupLocator[] getLocatorsFromToJoinArg(String tojoinArg) {
+        String[] tojoin = config.parseString(tojoinArg,",");
+        if(tojoin == null) return new LookupLocator[0];
+        if(tojoin.length == 0) return new LookupLocator[0];
+        ArrayList<LookupLocator> tojoinList = new ArrayList<LookupLocator>(tojoin.length);
+        for(int i=0;i<tojoin.length;i++) {
+            try {
+                tojoinList.add(QAConfig.getConstrainedLocator(tojoin[i]));
+            } catch(MalformedURLException e) {
+                continue;//not a valid locator (must be group), try next one
+            }
+        }//end loop
+        return tojoinList.toArray(new LookupLocator[tojoinList.size()]);
+    }//end getLocatorsFromToJoinArg
+
+    private ToJoinPair getToJoinPair(String tojoinArg){
+        /* Do NOT use unique groups names since clocks on the local
+         * and remote sides are not synchronized, and host names are
+         * different
+         */
+        LookupLocator[] locsToJoin = getLocatorsFromToJoinArg(tojoinArg);
+        String[] groupsToJoin = getGroupsFromToJoinArg(tojoinArg);
+        return new ToJoinPair(locsToJoin, groupsToJoin);
+    }
+    
+    
+    /** Convenience method that can be used to start, at a single point 
+     *  during the current test run, all of the lookup discovery services
+     *  needed by that test run. Useful when all of the lookup discovery
+     *  services are to be started during construct processing.
+     * @throws Exception 
+     */
+    protected void startAllLDS() throws Exception {
+        startInitLDS();
+        startAddLDS();
+    }//end startAllLDS
+
+    /** Convenience method that can be used to start, at a single point 
+     *  during the current test run, all of the lookup discovery services
+     *  INITIALLY needed by that test run. Useful when an initial set of
+     *  lookup discovery services are to be started during construct processing,
+     *  and (possibly) an additional set of lookup discovery services are to
+     *  be started at some later time, after the test has already begun
+     *  execution.
+     * @throws Exception 
+     */
+    protected void startInitLDS() throws Exception {
+        if(nLookupDiscoveryServices > 0) {
+            /* Skip over remote LDSs to the indices of the local LDSs */
+            int n0 = nRemoteLookupDiscoveryServices 
+                              + nAddRemoteLookupDiscoveryServices;
+            int n1 = n0 + nLookupDiscoveryServices;
+            for(int i=n0;i<n1;i++) {
+                startLDS(i, initLDSToStart.get(i));
+            }//end loop
+        }//endif(nLookupDiscoveryServices > 0)
+    }//end startInitLDS
+
+    /** Convenience method that can be used to start, at a single point 
+     *  during the current test run, any additional lookup discovery services 
+     *  needed by that test run. Useful when an initial set of lookup discovery
+     *  services are to be started during construct processing, and an additional
+     *  set of lookup discovery services are to be started at some later time,
+     *  after the test has already begun execution.
+     * @throws Exception 
+     */
+    protected void startAddLDS() throws Exception {
+        if(nAddLookupDiscoveryServices > 0) {
+            /* Skip over remote LDSs and LDSs already started to the
+             * indices of the additional local LDSs
+             */
+            int n0 = nRemoteLookupDiscoveryServices
+                                  + nAddRemoteLookupDiscoveryServices
+                                           + ldsList.size();
+            int n1 = n0 + nAddLookupDiscoveryServices;
+            for(int i=n0;i<n1;i++) {
+                int j = i-n0;
+                startLDS(i, addLDSToStart.get(j));
+            }//end loop
+        }//endif(nAddLookupDiscoveryServices > 0)
+    }//end startAddLDS
+
+    /** Convenience method that can be used to start, at any point during
+     *  the current test run, a single lookup discovery service with
+     *  configuration referenced by the given parameter values. Useful when
+     *  individual lookup discovery services are to be started at different
+     *  points in time during the test run, or when a set of lookup discovery
+     *  services are to be started from within a loop.
+     * @param indx
+     * @param tojoinPair 
+     * @throws Exception  
+     */
+    private void startLDS(int indx, ToJoinPair tojoinPair) throws Exception {
+        logger.log(Level.FINE, " starting lookup discovery service {0}", indx);
+	/* the returned proxy is already prepared using the preparer named
+	 * by the service preparername property
+	 */
+        LookupDiscoveryService ldsProxy =
+             (LookupDiscoveryService)(admin.startService
+                                ("net.jini.discovery.LookupDiscoveryService"));
+        /* Force non-unique groups for manual tests */
+        if(    (testType == BaseQATest.MANUAL_TEST_REMOTE_COMPONENT)
+            || (testType == BaseQATest.MANUAL_TEST_LOCAL_COMPONENT) ) 
+        {
+            if(ldsProxy instanceof Administrable) {
+                Object adminis = ((Administrable)ldsProxy).getAdmin();
+		adminis = config.prepare("test.fiddlerAdminPreparer", adminis);
+                if(adminis instanceof JoinAdmin) {
+                    ((JoinAdmin)adminis).setLookupGroups(tojoinPair.getGroups());
+                }//endif
+            }//endif
+        }//endif
+        ldsList.add( ldsProxy );
+        expectedServiceList.add( ldsProxy );
+        LocatorsUtil.displayLocatorSet(tojoinPair.getLocators(),
+                                    "  locators to join",Level.FINE);
+        GroupsUtil.displayGroupSet(tojoinPair.getGroups(),
+                                    "  groups to join",Level.FINE);
+    }//end startLDS
+
+}

Propchange: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupDiscoveryServices.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupGroupAdminTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupGroupAdminTest.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupGroupAdminTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupGroupAdminTest.java Wed Jan  2 05:20:52 2013
@@ -28,15 +28,17 @@ import java.rmi.*;
 import net.jini.admin.JoinAdmin;
 import java.util.Set;
 import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.qa.harness.Test;
 
 public class LookupGroupAdminTest extends LookupTestBase {
     private JoinAdmin joinAdmin;
     static final private String[] strarray = new String[0];
     private String[] originalState;
 
-    public void setup(QAConfig config) throws Exception {
-	super.setup(config);
+    public Test construct(QAConfig config) throws Exception {
+	super.construct(config);
 	this.parse();
+        return this;
     }
 
     protected void checkGroups(Set groups, String op) throws RemoteException, TestException {

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupLocatorAdminTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupLocatorAdminTest.java?rev=1427655&r1=1427654&r2=1427655&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupLocatorAdminTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupLocatorAdminTest.java Wed Jan  2 05:20:52 2013
@@ -22,6 +22,7 @@ import java.util.logging.Level;
 
 // Test harness specific classes
 import com.sun.jini.qa.harness.QAConfig;
+import com.sun.jini.qa.harness.Test;
 import com.sun.jini.qa.harness.TestException;
 
 // All other imports
@@ -35,9 +36,10 @@ public class LookupLocatorAdminTest exte
     static final private LookupLocator[] LLarray = new LookupLocator[0];
     private LookupLocator[] originalState;
 
-    public void setup(QAConfig config) throws Exception {
-	super.setup(config);
+    public Test construct(QAConfig config) throws Exception {
+	super.construct(config);
 	this.parse();
+        return this;
     }
 
     protected void checkLocators(Set locators, String op)