river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter_firmst...@apache.org
Subject svn commit: r1634322 [20/41] - in /river/jtsk/skunk/qa_refactor/trunk: qa/src/com/sun/jini/qa/harness/ qa/src/com/sun/jini/test/impl/end2end/e2etest/ qa/src/com/sun/jini/test/impl/joinmanager/ qa/src/com/sun/jini/test/impl/mahalo/ qa/src/com/sun/jini/t...
Date Sun, 26 Oct 2014 13:17:31 GMT
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=1634322&r1=1634321&r2=1634322&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 Sun Oct 26 13:17:28 2014
@@ -1,380 +1,382 @@
-/*
- * 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 java.util.logging.Level;
-
-import com.sun.jini.qa.harness.QATestEnvironment;
-import com.sun.jini.qa.harness.QAConfig;
-
-import net.jini.discovery.DiscoveryGroupManagement;
-import net.jini.discovery.LookupDiscoveryService;
-import net.jini.discovery.LookupDiscoveryRegistration;
-
-import net.jini.core.discovery.LookupLocator;
-import net.jini.core.event.RemoteEvent;
-import net.jini.core.event.RemoteEventListener;
-
-import java.io.IOException;
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-import java.net.MalformedURLException;
-import java.rmi.MarshalledObject;
-import java.rmi.RemoteException;
-
-import net.jini.config.Configuration;
-import net.jini.config.ConfigurationException;
-import net.jini.export.Exporter;
-import net.jini.security.ProxyPreparer;
-import net.jini.security.TrustVerifier;
-import net.jini.security.proxytrust.ServerProxyTrust;
-
-import com.sun.jini.proxy.BasicProxyTrustVerifier;
-import java.rmi.server.ExportException;
-
-/**
- * This class contains a set of static methods that provide general-purpose
- * functions related to the use of the lookup discovery service. This
- * utility class is intended to be useful to all categories of tests that
- * wish to use instances of that service.
- *
- * @see net.jini.discovery.LookupDiscoveryService
- * @see net.jini.discovery.LookupDiscoveryRegistration
- */
-public class DiscoveryServiceUtil {
-    /** Convenience class for handling the events sent by the service
-     *  with which the client (the test) has registered
-     */
-    public static class BasicEventListener 
-	implements RemoteEventListener, ServerProxyTrust, Serializable 
-    {
-        private final Exporter exporter;
-	private Object proxy;
-
-        public BasicEventListener() throws RemoteException {
-            super();
-	    Configuration c = QAConfig.getConfig().getConfiguration();
-	    Exporter exporter = QAConfig.getDefaultExporter();
-	    if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
-		try {
-		    exporter = (Exporter) c.getEntry("test",
-						     "fiddlerListenerExporter", 
-						     Exporter.class);
-		} catch (ConfigurationException e) {
-		    throw new RemoteException("Configuration problem", e);
-		}
-	    }
-            this.exporter = exporter;
-        }
-        
-        public synchronized void export() throws ExportException{
-            proxy = exporter.export(this);
-        }
-
-	private synchronized Object writeReplace() throws ObjectStreamException {
-	    return proxy;
-	}
-
-        public void notify(RemoteEvent ev) {
-        }
-
-	public synchronized TrustVerifier getProxyVerifier() {
-	    return new BasicProxyTrustVerifier(proxy);
-	}
-    }//end class BasicEventListener
-
-    public  static final long defaultDuration = 1*30*1000;
-
-    private static final String[] defaultGroups
-                                         = DiscoveryGroupManagement.NO_GROUPS;
-    private static final LookupLocator[] defaultLocators
-                                         = new LookupLocator[0];
-    private static final Integer defaultHbVal    = new Integer(93);
-
-   /** Converts a given absolute expiration time to a time of duration
-     *  relative to the value of the <code>curTime</code> parameter.
-     *
-     *  Because inaccurracies in the value of the current system time are
-     *  expected, this method rounds the result to the smallest whole
-     *  number greater than or equal to the decimal representatin of the
-     *  computed duration.
-     * 
-     *  @param expiration the absolute expiration time in milliseconds of
-     *                    the lease whose duration is to be computed
-     *
-     *  @return the relative duration of the lease whose absolute expiration
-     *          is equal to the value in the <code>expiration</code>
-     *          parameter; rounded to the next whole number
-     */
-    public static long expirationToDuration(long expiration, long curTime) {
-        double dExpiration = (double)expiration;
-        double dCurTime    = (double)curTime;
-        double dDur        = (dExpiration-dCurTime)/1000;
-        double wDur        = Math.floor(dDur);
-        double remainder   = dDur - wDur;
-        double dDuration   = ( (remainder>0) ? (wDur+1) : wDur );
-        return (long)(1000*dDuration);
-    }//end expirationToDuration
-
-    /** Sleeps for the given number of milliseconds */
-    public static void delayMS(long nMS) {
-        try {
-            Thread.sleep(nMS);
-        } catch (InterruptedException e) { }
-    }//end delayMS
-
-    /** Converts a given absolute expiration time to a time of duration
-     *  relative to the current system time.
-     *
-     *  Because inaccurracies in the value of the current system time are
-     *  expected, this method rounds the result to the smallest whole
-     *  number greater than or equal to the decimal representatin of the
-     *  computed duration.
-     * 
-     *  @param expiration the absolute expiration time in milliseconds of
-     *                    the lease whose duration is to be computed
-     *
-     *  @return the relative duration of the lease whose absolute expiration
-     *          is equal to the value in the <code>expiration</code>
-     *          parameter; rounded to the next whole number
-     */
-    public static long expirationToDuration(long expiration) {
-        return expirationToDuration(expiration,System.currentTimeMillis());
-    }//end expirationToDuration
-
-    /** Given a proxy to a lookup discovery service, this method is one of
-     *  a number of overloaded versions that request a registration with
-     *  the service to which the <code>proxy</code> parameter corresponds.
-     *  This version of the method contains a fully defined argument
-     *  list; that is, all other versions of this method ultimately
-     *  invoke this method.
-     * 
-     *  @param proxy    the proxy object through which the request for
-     *                  registration with the service is made
-     *  @param listener the remote event listener with which to register
-     *                   with the service's event mechanism
-     *  @param groups   <code>String</code> containing the names of the
-     *                  groups containing the lookup services to discover
-     *  @param locators array of instances of <code>LookupLocator</code>,
-     *                  where each element of the array corresponds to a
-     *                  specific lookup service to discover
-     *  @param duration the number of milliseconds to request for the duration
-     *                  of the lease granted on the requested registration
-     *  @param handback the object that will be returned in any events
-     *                  sent by the registration to the listener 
-     *
-     *  @return a <code>net.jini.discovery.LookupDiscoveryRegistration</code>
-     *          instance through which the registered client can manipulate
-     *          the state of its registration with the service
-     */
-    public static LookupDiscoveryRegistration
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 String[] groups,
-                                                 LookupLocator[] locators,
-                                                 long duration,
-                                                 MarshalledObject handback)
-                                                        throws RemoteException
-    {
-	    return proxy.register(groups,locators,listener,handback,duration);
-    }//end getRegistration
-
-    /* 1. No handback parameter */
-    public static LookupDiscoveryRegistration
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 String[] groups,
-                                                 LookupLocator[] locators,
-                                                 long duration)
-                                                        throws RemoteException
-    {
-        try {
-            return getRegistration(proxy,listener,groups,locators,duration,
-                                   new MarshalledObject(defaultHbVal) );
-        } catch (IOException e) {
-            return getRegistration(proxy,listener,groups,locators,duration,
-                                   null);
-        }
-    }//end getRegistration
-
-    /* 2. No duration parameter */
-    public static LookupDiscoveryRegistration
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 String[] groups,
-                                                 LookupLocator[] locators,
-                                                 MarshalledObject handback)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,groups,locators,
-                               defaultDuration,handback);
-    }//end getRegistration
-
-    /* 3. No duration or handback parameter */
-    public static LookupDiscoveryRegistration
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 String[] groups,
-                                                 LookupLocator[] locators)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,groups,locators,defaultDuration);
-    }//end getRegistration
-
-    /* 4. No locators parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 String[] groups,
-                                                 long duration,
-                                                 MarshalledObject handback)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,groups,defaultLocators,
-                               duration,handback);
-    }//end getRegistration
-
-    /* 5. No locators or handback parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 String[] groups,
-                                                 long duration)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,groups,defaultLocators,duration);
-    }//end getRegistration
-
-    /* 6. No groups parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 LookupLocator[] locators,
-                                                 long duration,
-                                                 MarshalledObject handback)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,defaultGroups,locators,
-                               duration,handback);
-    }//end getRegistration
-
-    /* 7. No groups or handback parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 LookupLocator[] locators,
-                                                 long duration)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,defaultGroups,locators,duration);
-    }//end getRegistration
-
-    /* 8. No locators or duration parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 String[] groups,
-                                                 MarshalledObject handback)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,groups,defaultLocators,
-                               defaultDuration,handback);
-    }//end getRegistration
-
-    /* 9. No locators, duration, or handback parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 String[] groups)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener, groups,
-                               defaultLocators,defaultDuration);
-    }//end getRegistration
-
-    /* 10. No groups or duration parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 LookupLocator[] locators,
-                                                 MarshalledObject handback)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,defaultGroups,locators,
-                               defaultDuration,handback);
-    }//end getRegistration
-
-    /* 11. No groups, duration, or handback parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 LookupLocator[] locators)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,defaultGroups,locators,
-                               defaultDuration);
-    }//end getRegistration
-
-    /* 12. No groups or locators parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 long duration,
-                                                 MarshalledObject handback)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,defaultGroups,defaultLocators,
-                               duration,handback);
-    }//end getRegistration
-
-    /* 13. No groups, locators, or handback parameter */
-    public static LookupDiscoveryRegistration 
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 long duration)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,defaultGroups,defaultLocators,
-                               duration);
-    }//end getRegistration
-
-    /* 14. No groups, locators, or duration parameter */
-    public static LookupDiscoveryRegistration
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener,
-                                                 MarshalledObject handback)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,defaultGroups,defaultLocators,
-                               defaultDuration,handback);
-    }//end getRegistration
-
-    /* 15. No groups, locators, duration, or handback parameter */
-    public static LookupDiscoveryRegistration
-                                 getRegistration(LookupDiscoveryService proxy,
-                                                 RemoteEventListener listener)
-                                                        throws RemoteException
-    {
-        return getRegistration(proxy,listener,defaultGroups, defaultLocators,
-                               defaultDuration);
-    }//end getRegistration
-
-} //end class DiscoveryServiceUtil
-
-
+/*
+ * 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 java.util.logging.Level;
+
+import com.sun.jini.qa.harness.QATestEnvironment;
+import com.sun.jini.qa.harness.QAConfig;
+
+import net.jini.discovery.DiscoveryGroupManagement;
+import net.jini.discovery.LookupDiscoveryService;
+import net.jini.discovery.LookupDiscoveryRegistration;
+
+import net.jini.core.discovery.LookupLocator;
+import net.jini.core.event.RemoteEvent;
+import net.jini.core.event.RemoteEventListener;
+
+import java.io.IOException;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.rmi.MarshalledObject;
+import java.rmi.RemoteException;
+
+import net.jini.config.Configuration;
+import net.jini.config.ConfigurationException;
+import net.jini.export.Exporter;
+import net.jini.security.ProxyPreparer;
+import net.jini.security.TrustVerifier;
+import net.jini.security.proxytrust.ServerProxyTrust;
+
+import com.sun.jini.proxy.BasicProxyTrustVerifier;
+import java.rmi.server.ExportException;
+
+/**
+ * This class contains a set of static methods that provide general-purpose
+ * functions related to the use of the lookup discovery service. This
+ * utility class is intended to be useful to all categories of tests that
+ * wish to use instances of that service.
+ *
+ * @see net.jini.discovery.LookupDiscoveryService
+ * @see net.jini.discovery.LookupDiscoveryRegistration
+ */
+public class DiscoveryServiceUtil {
+    /** Convenience class for handling the events sent by the service
+     *  with which the client (the test) has registered
+     */
+    public static class BasicEventListener 
+	implements RemoteEventListener, ServerProxyTrust, Serializable 
+    {
+        private final Exporter exporter;
+	private Object proxy;
+
+        public BasicEventListener() throws RemoteException {
+            super();
+	    Configuration c = QAConfig.getConfig().getConfiguration();
+	    Exporter exporter = QAConfig.getDefaultExporter();
+	    if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
+		try {
+		    exporter = (Exporter) c.getEntry("test",
+						     "fiddlerListenerExporter", 
+						     Exporter.class);
+		} catch (ConfigurationException e) {
+		    throw new RemoteException("Configuration problem", e);
+		}
+	    }
+            this.exporter = exporter;
+        }
+        
+        public synchronized void export() throws ExportException{
+            proxy = exporter.export(this);
+        }
+
+	private synchronized Object writeReplace() throws ObjectStreamException {
+	    return proxy;
+	}
+
+        public void notify(RemoteEvent ev) {
+        }
+
+	public synchronized TrustVerifier getProxyVerifier() {
+	    return new BasicProxyTrustVerifier(proxy);
+	}
+    }//end class BasicEventListener
+
+    public  static final long defaultDuration = 1*30*1000;
+
+    private static final String[] defaultGroups
+                                         = DiscoveryGroupManagement.NO_GROUPS;
+    private static final LookupLocator[] defaultLocators
+                                         = new LookupLocator[0];
+    private static final Integer defaultHbVal    = new Integer(93);
+
+   /** Converts a given absolute expiration time to a time of duration
+     *  relative to the value of the <code>curTime</code> parameter.
+     *
+     *  Because inaccurracies in the value of the current system time are
+     *  expected, this method rounds the result to the smallest whole
+     *  number greater than or equal to the decimal representatin of the
+     *  computed duration.
+     * 
+     *  @param expiration the absolute expiration time in milliseconds of
+     *                    the lease whose duration is to be computed
+     *
+     *  @return the relative duration of the lease whose absolute expiration
+     *          is equal to the value in the <code>expiration</code>
+     *          parameter; rounded to the next whole number
+     */
+    public static long expirationToDuration(long expiration, long curTime) {
+        double dExpiration = (double)expiration;
+        double dCurTime    = (double)curTime;
+        double dDur        = (dExpiration-dCurTime)/1000;
+        double wDur        = Math.floor(dDur);
+        double remainder   = dDur - wDur;
+        double dDuration   = ( (remainder>0) ? (wDur+1) : wDur );
+        return (long)(1000*dDuration);
+    }//end expirationToDuration
+
+    /** Sleeps for the given number of milliseconds */
+    public static void delayMS(long nMS) {
+        try {
+            Thread.sleep(nMS);
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+        }
+    }//end delayMS
+
+    /** Converts a given absolute expiration time to a time of duration
+     *  relative to the current system time.
+     *
+     *  Because inaccurracies in the value of the current system time are
+     *  expected, this method rounds the result to the smallest whole
+     *  number greater than or equal to the decimal representatin of the
+     *  computed duration.
+     * 
+     *  @param expiration the absolute expiration time in milliseconds of
+     *                    the lease whose duration is to be computed
+     *
+     *  @return the relative duration of the lease whose absolute expiration
+     *          is equal to the value in the <code>expiration</code>
+     *          parameter; rounded to the next whole number
+     */
+    public static long expirationToDuration(long expiration) {
+        return expirationToDuration(expiration,System.currentTimeMillis());
+    }//end expirationToDuration
+
+    /** Given a proxy to a lookup discovery service, this method is one of
+     *  a number of overloaded versions that request a registration with
+     *  the service to which the <code>proxy</code> parameter corresponds.
+     *  This version of the method contains a fully defined argument
+     *  list; that is, all other versions of this method ultimately
+     *  invoke this method.
+     * 
+     *  @param proxy    the proxy object through which the request for
+     *                  registration with the service is made
+     *  @param listener the remote event listener with which to register
+     *                   with the service's event mechanism
+     *  @param groups   <code>String</code> containing the names of the
+     *                  groups containing the lookup services to discover
+     *  @param locators array of instances of <code>LookupLocator</code>,
+     *                  where each element of the array corresponds to a
+     *                  specific lookup service to discover
+     *  @param duration the number of milliseconds to request for the duration
+     *                  of the lease granted on the requested registration
+     *  @param handback the object that will be returned in any events
+     *                  sent by the registration to the listener 
+     *
+     *  @return a <code>net.jini.discovery.LookupDiscoveryRegistration</code>
+     *          instance through which the registered client can manipulate
+     *          the state of its registration with the service
+     */
+    public static LookupDiscoveryRegistration
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 String[] groups,
+                                                 LookupLocator[] locators,
+                                                 long duration,
+                                                 MarshalledObject handback)
+                                                        throws RemoteException
+    {
+	    return proxy.register(groups,locators,listener,handback,duration);
+    }//end getRegistration
+
+    /* 1. No handback parameter */
+    public static LookupDiscoveryRegistration
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 String[] groups,
+                                                 LookupLocator[] locators,
+                                                 long duration)
+                                                        throws RemoteException
+    {
+        try {
+            return getRegistration(proxy,listener,groups,locators,duration,
+                                   new MarshalledObject(defaultHbVal) );
+        } catch (IOException e) {
+            return getRegistration(proxy,listener,groups,locators,duration,
+                                   null);
+        }
+    }//end getRegistration
+
+    /* 2. No duration parameter */
+    public static LookupDiscoveryRegistration
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 String[] groups,
+                                                 LookupLocator[] locators,
+                                                 MarshalledObject handback)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,groups,locators,
+                               defaultDuration,handback);
+    }//end getRegistration
+
+    /* 3. No duration or handback parameter */
+    public static LookupDiscoveryRegistration
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 String[] groups,
+                                                 LookupLocator[] locators)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,groups,locators,defaultDuration);
+    }//end getRegistration
+
+    /* 4. No locators parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 String[] groups,
+                                                 long duration,
+                                                 MarshalledObject handback)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,groups,defaultLocators,
+                               duration,handback);
+    }//end getRegistration
+
+    /* 5. No locators or handback parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 String[] groups,
+                                                 long duration)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,groups,defaultLocators,duration);
+    }//end getRegistration
+
+    /* 6. No groups parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 LookupLocator[] locators,
+                                                 long duration,
+                                                 MarshalledObject handback)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,defaultGroups,locators,
+                               duration,handback);
+    }//end getRegistration
+
+    /* 7. No groups or handback parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 LookupLocator[] locators,
+                                                 long duration)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,defaultGroups,locators,duration);
+    }//end getRegistration
+
+    /* 8. No locators or duration parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 String[] groups,
+                                                 MarshalledObject handback)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,groups,defaultLocators,
+                               defaultDuration,handback);
+    }//end getRegistration
+
+    /* 9. No locators, duration, or handback parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 String[] groups)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener, groups,
+                               defaultLocators,defaultDuration);
+    }//end getRegistration
+
+    /* 10. No groups or duration parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 LookupLocator[] locators,
+                                                 MarshalledObject handback)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,defaultGroups,locators,
+                               defaultDuration,handback);
+    }//end getRegistration
+
+    /* 11. No groups, duration, or handback parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 LookupLocator[] locators)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,defaultGroups,locators,
+                               defaultDuration);
+    }//end getRegistration
+
+    /* 12. No groups or locators parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 long duration,
+                                                 MarshalledObject handback)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,defaultGroups,defaultLocators,
+                               duration,handback);
+    }//end getRegistration
+
+    /* 13. No groups, locators, or handback parameter */
+    public static LookupDiscoveryRegistration 
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 long duration)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,defaultGroups,defaultLocators,
+                               duration);
+    }//end getRegistration
+
+    /* 14. No groups, locators, or duration parameter */
+    public static LookupDiscoveryRegistration
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener,
+                                                 MarshalledObject handback)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,defaultGroups,defaultLocators,
+                               defaultDuration,handback);
+    }//end getRegistration
+
+    /* 15. No groups, locators, duration, or handback parameter */
+    public static LookupDiscoveryRegistration
+                                 getRegistration(LookupDiscoveryService proxy,
+                                                 RemoteEventListener listener)
+                                                        throws RemoteException
+    {
+        return getRegistration(proxy,listener,defaultGroups, defaultLocators,
+                               defaultDuration);
+    }//end getRegistration
+
+} //end class DiscoveryServiceUtil
+
+

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/KillVMUtil.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/KillVMUtil.java?rev=1634322&r1=1634321&r2=1634322&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/KillVMUtil.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/KillVMUtil.java Sun Oct 26 13:17:28 2014
@@ -1,179 +1,183 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.jini.test.share;
-
-//import com.sun.jini.start.ClassLoaderUtil;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-
-import java.rmi.activation.Activatable;
-import java.rmi.activation.ActivationDesc;
-import java.rmi.activation.ActivationException;
-import java.rmi.activation.ActivationGroupID;
-import java.rmi.activation.ActivationID;
-
-import java.rmi.MarshalledObject;
-import java.rmi.Remote;
-
-import java.rmi.RemoteException;
-
-/**
- * This class contains a set of static classes and methods that provide 
- * general-purpose functions related to shutting down an ActivationGroup (VM)
- * in which one or activatable processes are executing. This utility class
- * is intended to be useful to all categories of tests that wish to simulate
- * a system crash. For example, tests that verify the ability of an 
- * application to persist its state may find this utility particularly
- * useful.
- */
-public class KillVMUtil {
-    /** Utility method used to kill the VM (ActivationGroup) referenced
-     *  by the <code>gid</code> parameter. If an activatable service is
-     *  started in NON-restartable mode, calling this method with
-     *  the <code>ActivationGroupID</code> of that service's
-     *  <code>ActivationGroup</code> will cause a special object to be
-     *  registered with that VM; an object whose only function is to
-     *  perform a <code>System.exit</code> on the VM. After registering
-     *  this special object with the indicated <code>ActivationGroup</code>,
-     *  this method invokes the killVM() method on that object, resulting
-     *  in the stoppage of all processes running in the VM.
-     *
-     *  Note that if the original service was started in restart mode,
-     *  after stopping the VM, RMID will simply re-spawn the VM and 
-     *  re-start the service. 
-     */
-    public static void killActivationGroup(ActivationGroupID gid)
-                                   throws MalformedURLException,
-                                          ActivationException, RemoteException
-    {
-        String implClass = KillVMObjectImpl.class.getName();
-	String codeLocation = null; //BDJ - TEMP WORKAROUND FOR COMPILE
-//          String codeLocation = ClassLoaderUtil.URLsToString
-//                                (ClassLoaderUtil.getClasspathURLs
-//  	                             (System.getProperty("java.class.path")));
-        ActivationDesc desc = new ActivationDesc(gid,implClass,
-                                                 codeLocation,null,false);
-        KillVMObject serverStub = (KillVMObject)(Activatable.register(desc));
-        long delay = serverStub.killVM();        
-        try {Thread.sleep(delay);} catch (InterruptedException e) { }
-    }//end killActivationGroup
-
-    /** Remote interface that should be implemented by any object desiring
-     *  the capability to abruptly stop all processes in a given
-     *  ActivationGroup (VM).
-     */
-    public interface KillVMObject extends Remote {
-        /** Abruptly stops the VM in which this method's implementation
-         *  executes.
-         *  
-         * @return a <code>long</code> value representing an estimate of the
-         *         number of milliseconds that will elapse before the VM is
-         *         completely shutdown. The caller of this method should not
-         *         call any processes in this VM until after this time has
-         *         elapsed.
-         */
-        public long killVM() throws java.rmi.RemoteException;
-    }//end interface KillVMObject
-
-    /** Special activatable class whose instance, once registered with a
-     *  given ActivationGroup (VM), can be used to completely stop (or "kill")
-     *  all processes registered and running in that VM.
-     *
-     *  Note that because calls to this class' killVM() method are
-     *  asynchronous, certain requirements are imposed on the implementation.
-     *  If the VM is exited from the current thread, rather than from a
-     *  separate thread, entities which invoke this method will always
-     *  receive a <code>RemoteException</code> because exiting the VM in
-     *  the current thread will break the communication link between the
-     *  frontend and the backend of the service. Thus, the VM must be
-     *  exited from a separate thread.
-     *  
-     *  Another implementation requirement, related to the thread requirement,
-     *  involves preventing <code>RemoteException</code>s through the
-     *  introduction of timing delays. If the VM is exited before the remote
-     *  call has had a chance to complete, just as with the case of exiting
-     *  the VM from the current thread, the communication link between the
-     *  this class' frontend and backend will be broken, resulting in a
-     *  <code>RemoteException</code>. Thus, not only must the VM be exited
-     *  from a separate thread, but it also must be exited only after the
-     *  remote call to this method has completed. By instructing the thread
-     *  that exits the VM to delay a certain amount of time before actually
-     *  exiting the VM, this method attempts to "guarantee" that the VM will
-     *  not be exited until the remote call has completed. Note that the
-     *  amount of time to delay is simply a rough estimate of the amount
-     *  of time a typical remote call should take to complete. Thus, a
-     *  <code>RemoteException</code> may occur because the time delay is
-     *  too small.
-     *
-     *  Next, note that the use of the killVM() method also imposes a related
-     *  timing requirement on the client-side entity. That is, when an
-     *  entity invokes this method, it must also delay a certain amount
-     *  time before attempting to again interact with any process that
-     *  was registered with the killed VM in restart mode. This delay is
-     *  necessary to allow such services to be re-activated and to recover
-     *  any persisted state. The killVM() method returns a <code>long</code>
-     *  value that represents the amount of time the client-side entity
-     *  should delay before again attempting to interact with those
-     *  restartable processes. As with the server side time estimate,
-     *  this time value is a rough estimate, and may need to be adjusted
-     *  if the entity experiences <code>RemoteException</code>s on a
-     *  regular basis when the entity attempts to interact with any
-     *  restarted processes after invoking this method.
-     *
-     *  Finally, note that because this class is an inner class, it must 
-     *  be declared static. If it is not declared static, misleading
-     *  ActivationExceptions will occur that seem to indicate a missing
-     *  activation constructor (the exception will also say something about
-     *  and problems while intializing (<init>). These exceptions occur
-     *  because the non-static inner class will have an implicit reference
-     *  to the outter class which is not registered with the activation
-     *  system.
-     */
-    public static class KillVMObjectImpl implements KillVMObject {
-        public KillVMObjectImpl(ActivationID activationID,
-                                MarshalledObject data) throws IOException
-        {
-            Activatable.exportObject(this, activationID, 0);
-        }//end constructor
-        public long killVM() throws RemoteException {
-            long delay = 20; // wait N milliseconds before exiting VM
-            (new KillVMThread(delay)).start();
-            return (delay*1000); //just an estimate
-        }
-        private class KillVMThread extends Thread {
-            long delay;
-	    /** Thread that inherits its daemon status from main thread */
-	    public KillVMThread(long delay) {
-	        super("killVM");
-                this.delay = delay;
-            }
-	    public void run() {
-                try {
-                    Thread.sleep(delay);
-                } catch (InterruptedException e) { }
-                System.exit(0);
-	    }
-        }//end class KillVMThread
-    }//end class KillVMObjectImpl
-
-} //end class KillVMUtil
-
-
+/*
+ * 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.start.ClassLoaderUtil;
+
+import java.io.IOException;
+
+import java.net.MalformedURLException;
+
+import java.rmi.activation.Activatable;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationException;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.ActivationID;
+
+import java.rmi.MarshalledObject;
+import java.rmi.Remote;
+
+import java.rmi.RemoteException;
+
+/**
+ * This class contains a set of static classes and methods that provide 
+ * general-purpose functions related to shutting down an ActivationGroup (VM)
+ * in which one or activatable processes are executing. This utility class
+ * is intended to be useful to all categories of tests that wish to simulate
+ * a system crash. For example, tests that verify the ability of an 
+ * application to persist its state may find this utility particularly
+ * useful.
+ */
+public class KillVMUtil {
+    /** Utility method used to kill the VM (ActivationGroup) referenced
+     *  by the <code>gid</code> parameter. If an activatable service is
+     *  started in NON-restartable mode, calling this method with
+     *  the <code>ActivationGroupID</code> of that service's
+     *  <code>ActivationGroup</code> will cause a special object to be
+     *  registered with that VM; an object whose only function is to
+     *  perform a <code>System.exit</code> on the VM. After registering
+     *  this special object with the indicated <code>ActivationGroup</code>,
+     *  this method invokes the killVM() method on that object, resulting
+     *  in the stoppage of all processes running in the VM.
+     *
+     *  Note that if the original service was started in restart mode,
+     *  after stopping the VM, RMID will simply re-spawn the VM and 
+     *  re-start the service. 
+     */
+    public static void killActivationGroup(ActivationGroupID gid)
+                                   throws MalformedURLException,
+                                          ActivationException, RemoteException
+    {
+        String implClass = KillVMObjectImpl.class.getName();
+	String codeLocation = null; //BDJ - TEMP WORKAROUND FOR COMPILE
+//          String codeLocation = ClassLoaderUtil.URLsToString
+//                                (ClassLoaderUtil.getClasspathURLs
+//  	                             (System.getProperty("java.class.path")));
+        ActivationDesc desc = new ActivationDesc(gid,implClass,
+                                                 codeLocation,null,false);
+        KillVMObject serverStub = (KillVMObject)(Activatable.register(desc));
+        long delay = serverStub.killVM();        
+        try {Thread.sleep(delay);} catch (InterruptedException e) { 
+            Thread.currentThread().interrupt();
+        }
+    }//end killActivationGroup
+
+    /** Remote interface that should be implemented by any object desiring
+     *  the capability to abruptly stop all processes in a given
+     *  ActivationGroup (VM).
+     */
+    public interface KillVMObject extends Remote {
+        /** Abruptly stops the VM in which this method's implementation
+         *  executes.
+         *  
+         * @return a <code>long</code> value representing an estimate of the
+         *         number of milliseconds that will elapse before the VM is
+         *         completely shutdown. The caller of this method should not
+         *         call any processes in this VM until after this time has
+         *         elapsed.
+         */
+        public long killVM() throws java.rmi.RemoteException;
+    }//end interface KillVMObject
+
+    /** Special activatable class whose instance, once registered with a
+     *  given ActivationGroup (VM), can be used to completely stop (or "kill")
+     *  all processes registered and running in that VM.
+     *
+     *  Note that because calls to this class' killVM() method are
+     *  asynchronous, certain requirements are imposed on the implementation.
+     *  If the VM is exited from the current thread, rather than from a
+     *  separate thread, entities which invoke this method will always
+     *  receive a <code>RemoteException</code> because exiting the VM in
+     *  the current thread will break the communication link between the
+     *  frontend and the backend of the service. Thus, the VM must be
+     *  exited from a separate thread.
+     *  
+     *  Another implementation requirement, related to the thread requirement,
+     *  involves preventing <code>RemoteException</code>s through the
+     *  introduction of timing delays. If the VM is exited before the remote
+     *  call has had a chance to complete, just as with the case of exiting
+     *  the VM from the current thread, the communication link between the
+     *  this class' frontend and backend will be broken, resulting in a
+     *  <code>RemoteException</code>. Thus, not only must the VM be exited
+     *  from a separate thread, but it also must be exited only after the
+     *  remote call to this method has completed. By instructing the thread
+     *  that exits the VM to delay a certain amount of time before actually
+     *  exiting the VM, this method attempts to "guarantee" that the VM will
+     *  not be exited until the remote call has completed. Note that the
+     *  amount of time to delay is simply a rough estimate of the amount
+     *  of time a typical remote call should take to complete. Thus, a
+     *  <code>RemoteException</code> may occur because the time delay is
+     *  too small.
+     *
+     *  Next, note that the use of the killVM() method also imposes a related
+     *  timing requirement on the client-side entity. That is, when an
+     *  entity invokes this method, it must also delay a certain amount
+     *  time before attempting to again interact with any process that
+     *  was registered with the killed VM in restart mode. This delay is
+     *  necessary to allow such services to be re-activated and to recover
+     *  any persisted state. The killVM() method returns a <code>long</code>
+     *  value that represents the amount of time the client-side entity
+     *  should delay before again attempting to interact with those
+     *  restartable processes. As with the server side time estimate,
+     *  this time value is a rough estimate, and may need to be adjusted
+     *  if the entity experiences <code>RemoteException</code>s on a
+     *  regular basis when the entity attempts to interact with any
+     *  restarted processes after invoking this method.
+     *
+     *  Finally, note that because this class is an inner class, it must 
+     *  be declared static. If it is not declared static, misleading
+     *  ActivationExceptions will occur that seem to indicate a missing
+     *  activation constructor (the exception will also say something about
+     *  and problems while intializing (<init>). These exceptions occur
+     *  because the non-static inner class will have an implicit reference
+     *  to the outter class which is not registered with the activation
+     *  system.
+     */
+    public static class KillVMObjectImpl implements KillVMObject {
+        public KillVMObjectImpl(ActivationID activationID,
+                                MarshalledObject data) throws IOException
+        {
+            Activatable.exportObject(this, activationID, 0);
+        }//end constructor
+        public long killVM() throws RemoteException {
+            long delay = 20; // wait N milliseconds before exiting VM
+            (new KillVMThread(delay)).start();
+            return (delay*1000); //just an estimate
+        }
+        private class KillVMThread extends Thread {
+            long delay;
+	    /** Thread that inherits its daemon status from main thread */
+	    public KillVMThread(long delay) {
+	        super("killVM");
+                this.delay = delay;
+            }
+	    public void run() {
+                try {
+                    Thread.sleep(delay);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+                System.exit(0);
+	    }
+        }//end class KillVMThread
+    }//end class KillVMObjectImpl
+
+} //end class KillVMUtil
+
+

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=1634322&r1=1634321&r2=1634322&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 Sun Oct 26 13:17:28 2014
@@ -1,258 +1,260 @@
-/*
- * 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 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;
-
-
-/**
- * Base class for tests which acquire some resource under a lease and
- * then use until the lease expires. Also tests to see if the lease
- * has the appropriate duration.  Have variations that cancel and/or
- * renew the lease.
- */
-public abstract class LeaseUsesTestBase extends LeaseGrantTestBase {
-    /**
-     * Lease being used
-     */
-    protected volatile Lease lease = null;
-
-    // Time lease will expire
-    private volatile long expTime;
-
-    // Time lease of lease duration
-    private volatile long durTime;
-
-    // How long until the lease should be renewed
-    private volatile long renewTime;
-
-    // What to set renewTime to, if < 0 the half of duration
-    private volatile long renewWait;
-
-    // Time to let cancel to propgate
-    private volatile long cancelSlop;
-
-    // Set renew and exp times
-    private void setTimes() {
-	final long curTime = System.currentTimeMillis();
-
-	expTime = lease.getExpiration();
-	durTime = expTime - curTime;
-	
-	if (renewWait < 0)
-	    renewTime = expTime - durTime / 2;
-	else
-	    renewTime = renewWait + curTime;
-    }
-
-    protected volatile long renewals = 0;
-    protected volatile boolean cancel;
-    protected volatile long shutdownTime = -1;
-    protected volatile long restartSleep = 10000;
-
-    /** 
-     * Method should acquire some resource under a lease and return
-     * the Lease.  Note the returned value will be stored in
-     * the <code>lease</code> field
-     * @see LeaseUsesTestBase#lease
-     */
-    protected abstract Lease acquireResource() throws TestException;
-
-    /**
-     * Method should test to see if the resource acquired by
-     * acquireResource() is still available, returning
-     * <code>true</code> if is and <code>false</code> if it is not. 
-     * If some other exception occurs the method should call fail
-     */
-    protected abstract boolean isAvailable() throws TestException;
-
-    /**
-     * Parse our args
-     * <DL>
-     *
-     * <DT>-cancel<DD> Makes the test run the cancel variation of the
-     * test where the lease is canceled before it expires.
-     *
-     * <DT>-renew <var>int</var><DD> Renew the lease <var>int</var>
-     * times using the initial duration befor letting it expire or
-     * canceling it.  Defaults to 0 (no renewals.) 
-     *
-     * <DT>-cancel_slop <var>int</var><DD> Allow for a leased resource
-     * to disappear up to <var>int</var> milliseconds after cancel is
-     * called.  Provided for tests that don't directly test resource
-     * availability, most tests should not use this option. Defaults to
-     * 0.
-     * </DL> */
-    protected void parse() throws Exception {
-	super.parse();
-
-	renewals = getConfig().getIntConfigVal("com.sun.jini.test.share.renew", 0);
-	cancel = getConfig().getBooleanConfigVal("com.sun.jini.test.share.cancel", false);
-	renewWait = getConfig().getLongConfigVal("com.sun.jini.test.share.renew_wait", -1);
-	shutdownTime = getConfig().getLongConfigVal("com.sun.jini.test.share.shutdownTime", -1);
-	restartSleep = getConfig().getLongConfigVal("com.sun.jini.test.share.restartSleep", 10000);
-	cancelSlop = getConfig().getLongConfigVal("com.sun.jini.test.share.cancel_slop", 0);
-    }
-
-    public Test construct(QAConfig config) throws Exception {
-	super.construct(config);
-	parse();
-        return this;
-    }
-
-    public void run() throws Exception {
-	lease = acquireResource(); 
-	addLease(lease, true);
-	setTimes();
-
-	if (shutdownTime > 0) {
-	    final long curTime = System.currentTimeMillis();
-	    shutdownTime = curTime + shutdownTime;
-	}
-
-	logger.log(Level.INFO, "Resource acquired");
-	logRequest("resource", lease);
-
-	if (!isAcceptable(lease))
-	    throw new TestException("Lease had an improper duration");
-
-	if (cancel && renewals <= 0) {
-	    cancel();
-	} else {
-	    logger.log(Level.INFO, "Expire Test: Slop = {0}", slop);
-	    while (true) {
-		// We measure the time twice so propagation delays do
-		// not cause the test to fail.  The test only fails on
-		// availability if:
-		//
-		//    Before the check was made the lease had expired,
-		//    but the resource was still available, or;
-		//
-		//    after the check was made the lease had not
-		//    expired but the resource was unavailable.
-		//
-		// In both cases modulo slop.
-		//
-		// This eliminates the possibility of the test failing
-		// because the service rightfully believes the
-		// resource is available, but propagation delays cause
-		// isAvailable to return after expiration, or because
-		// isAvaialable is called before expiration, but
-		// because of propagation delays the service thinks
-		// the resource is unavailable.
-
-		final long preTime = System.currentTimeMillis();
-		final boolean stillThere = isAvailable();
-
-		// We also use postTime as an approximation of the 
-		// current time for the remainder of this iteration
-		final long postTime = System.currentTimeMillis();
-
-		// Check for late expiration against preTime
-		// postTime - slop elemnates overflow problems when
-		// expTime == FOREVER
-		if (stillThere && (preTime - slop > expTime))
-		    throw new TestException("Resource was available after lease expiration");
-
-		// Check for early expiration against postTime
-		if (!stillThere && (postTime < expTime - slop))
-		    throw new TestException("Resource was not available before lease expiration");
-
-		if (!stillThere) break;
-		// No use testing once it is gone
-
-		// Do we need to renew
-		if (renewals > 0 && postTime > renewTime) {
-		    try {
-			lease.renew(durationRequest);
-			resourceRequested();
-		    } catch (Exception e) {
-			throw new TestException("Could not renew lease:" + e.getMessage());
-		    }
-		    setTimes();
-		    logRequest("renew", lease);
-
-		    if (!isAcceptable(lease))
-			throw new TestException("Renewed lease had an improper duration");
-                    synchronized (this){
-                        renewals--;
-                    }
-		} else if (renewals == 0 && cancel) {
-		    cancel();
-		    // If we are here the cancel worked, need to break
-		    // so we don't see if it is there (which it won't be) 
-		    // and fail the test
-		    break;
-		} else if (shutdownTime > 0 && shutdownTime < postTime) {
-		    try {
-			shutdownTime = -1; // Oneshot
-			shutdown(0, restartSleep);
-		    } catch (InterruptedException e) {
-			// Should never happen, and if it does we don't care
-		    } catch (Throwable e) {
-			throw new TestException("Shutdown Failed:" + e.getMessage());
-		    }
-		}
-	    }
-	}
-    }
-
-    private void cancel() throws TestException {
-	// Make sure the resource is there
-	logger.log(Level.INFO, "Cancel Test: checking for availability");
-	if (!isAvailable())
-	    throw new TestException("Resource was never available");
-	
-	try {
-	    logger.log(Level.INFO, "Cancel Test: canceling lease");
-	    lease.cancel();
-	} catch (Exception e) {
-	    throw new TestException("Could not cancel lease", e);
-	}
-
-	// We could poll and loop here, but one big sleep is much
-	// easer to code
-	if (cancelSlop > 0) {
-	    try {
-		logger.log(Level.INFO, "Sleeping for {0}" +
-			  " milliseconds to " + "allow cancel to propagate... time:{1}", new Object[]{cancelSlop, System.currentTimeMillis()});
-		Thread.sleep(cancelSlop);
-		logger.log(Level.INFO, "awake ... time:{0}", System.currentTimeMillis());
-                
-	    } catch (InterruptedException e) {
-		// Should not happen
-		throw new TestException("Cancel slop sleep interupted!");
-	    }
-	}
-	
-	logger.log(Level.INFO, "Cancel Test: checking to make sure resource "+
-		    "is gone");
-	if (isAvailable())
-	    throw new TestException("Resource was available after cancel");
-    }
-}
-
-
+/*
+ * 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 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;
+
+
+/**
+ * Base class for tests which acquire some resource under a lease and
+ * then use until the lease expires. Also tests to see if the lease
+ * has the appropriate duration.  Have variations that cancel and/or
+ * renew the lease.
+ */
+public abstract class LeaseUsesTestBase extends LeaseGrantTestBase {
+    /**
+     * Lease being used
+     */
+    protected volatile Lease lease = null;
+
+    // Time lease will expire
+    private volatile long expTime;
+
+    // Time lease of lease duration
+    private volatile long durTime;
+
+    // How long until the lease should be renewed
+    private volatile long renewTime;
+
+    // What to set renewTime to, if < 0 the half of duration
+    private volatile long renewWait;
+
+    // Time to let cancel to propgate
+    private volatile long cancelSlop;
+
+    // Set renew and exp times
+    private void setTimes() {
+	final long curTime = System.currentTimeMillis();
+
+	expTime = lease.getExpiration();
+	durTime = expTime - curTime;
+	
+	if (renewWait < 0)
+	    renewTime = expTime - durTime / 2;
+	else
+	    renewTime = renewWait + curTime;
+    }
+
+    protected volatile long renewals = 0;
+    protected volatile boolean cancel;
+    protected volatile long shutdownTime = -1;
+    protected volatile long restartSleep = 10000;
+
+    /** 
+     * Method should acquire some resource under a lease and return
+     * the Lease.  Note the returned value will be stored in
+     * the <code>lease</code> field
+     * @see LeaseUsesTestBase#lease
+     */
+    protected abstract Lease acquireResource() throws TestException;
+
+    /**
+     * Method should test to see if the resource acquired by
+     * acquireResource() is still available, returning
+     * <code>true</code> if is and <code>false</code> if it is not. 
+     * If some other exception occurs the method should call fail
+     */
+    protected abstract boolean isAvailable() throws TestException;
+
+    /**
+     * Parse our args
+     * <DL>
+     *
+     * <DT>-cancel<DD> Makes the test run the cancel variation of the
+     * test where the lease is canceled before it expires.
+     *
+     * <DT>-renew <var>int</var><DD> Renew the lease <var>int</var>
+     * times using the initial duration befor letting it expire or
+     * canceling it.  Defaults to 0 (no renewals.) 
+     *
+     * <DT>-cancel_slop <var>int</var><DD> Allow for a leased resource
+     * to disappear up to <var>int</var> milliseconds after cancel is
+     * called.  Provided for tests that don't directly test resource
+     * availability, most tests should not use this option. Defaults to
+     * 0.
+     * </DL> */
+    protected void parse() throws Exception {
+	super.parse();
+
+	renewals = getConfig().getIntConfigVal("com.sun.jini.test.share.renew", 0);
+	cancel = getConfig().getBooleanConfigVal("com.sun.jini.test.share.cancel", false);
+	renewWait = getConfig().getLongConfigVal("com.sun.jini.test.share.renew_wait", -1);
+	shutdownTime = getConfig().getLongConfigVal("com.sun.jini.test.share.shutdownTime", -1);
+	restartSleep = getConfig().getLongConfigVal("com.sun.jini.test.share.restartSleep", 10000);
+	cancelSlop = getConfig().getLongConfigVal("com.sun.jini.test.share.cancel_slop", 0);
+    }
+
+    public Test construct(QAConfig config) throws Exception {
+	super.construct(config);
+	parse();
+        return this;
+    }
+
+    public void run() throws Exception {
+	lease = acquireResource(); 
+	addLease(lease, true);
+	setTimes();
+
+	if (shutdownTime > 0) {
+	    final long curTime = System.currentTimeMillis();
+	    shutdownTime = curTime + shutdownTime;
+	}
+
+	logger.log(Level.INFO, "Resource acquired");
+	logRequest("resource", lease);
+
+	if (!isAcceptable(lease))
+	    throw new TestException("Lease had an improper duration");
+
+	if (cancel && renewals <= 0) {
+	    cancel();
+	} else {
+	    logger.log(Level.INFO, "Expire Test: Slop = {0}", slop);
+	    while (true) {
+		// We measure the time twice so propagation delays do
+		// not cause the test to fail.  The test only fails on
+		// availability if:
+		//
+		//    Before the check was made the lease had expired,
+		//    but the resource was still available, or;
+		//
+		//    after the check was made the lease had not
+		//    expired but the resource was unavailable.
+		//
+		// In both cases modulo slop.
+		//
+		// This eliminates the possibility of the test failing
+		// because the service rightfully believes the
+		// resource is available, but propagation delays cause
+		// isAvailable to return after expiration, or because
+		// isAvaialable is called before expiration, but
+		// because of propagation delays the service thinks
+		// the resource is unavailable.
+
+		final long preTime = System.currentTimeMillis();
+		final boolean stillThere = isAvailable();
+
+		// We also use postTime as an approximation of the 
+		// current time for the remainder of this iteration
+		final long postTime = System.currentTimeMillis();
+
+		// Check for late expiration against preTime
+		// postTime - slop elemnates overflow problems when
+		// expTime == FOREVER
+		if (stillThere && (preTime - slop > expTime))
+		    throw new TestException("Resource was available after lease expiration");
+
+		// Check for early expiration against postTime
+		if (!stillThere && (postTime < expTime - slop))
+		    throw new TestException("Resource was not available before lease expiration");
+
+		if (!stillThere) break;
+		// No use testing once it is gone
+
+		// Do we need to renew
+		if (renewals > 0 && postTime > renewTime) {
+		    try {
+			lease.renew(durationRequest);
+			resourceRequested();
+		    } catch (Exception e) {
+			throw new TestException("Could not renew lease:" + e.getMessage());
+		    }
+		    setTimes();
+		    logRequest("renew", lease);
+
+		    if (!isAcceptable(lease))
+			throw new TestException("Renewed lease had an improper duration");
+                    synchronized (this){
+                        renewals--;
+                    }
+		} else if (renewals == 0 && cancel) {
+		    cancel();
+		    // If we are here the cancel worked, need to break
+		    // so we don't see if it is there (which it won't be) 
+		    // and fail the test
+		    break;
+		} else if (shutdownTime > 0 && shutdownTime < postTime) {
+		    try {
+			shutdownTime = -1; // Oneshot
+			shutdown(0, restartSleep);
+		    } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+			// Should never happen, and if it does we don't care
+		    } catch (Throwable e) {
+			throw new TestException("Shutdown Failed:" + e.getMessage());
+		    }
+		}
+	    }
+	}
+    }
+
+    private void cancel() throws TestException {
+	// Make sure the resource is there
+	logger.log(Level.INFO, "Cancel Test: checking for availability");
+	if (!isAvailable())
+	    throw new TestException("Resource was never available");
+	
+	try {
+	    logger.log(Level.INFO, "Cancel Test: canceling lease");
+	    lease.cancel();
+	} catch (Exception e) {
+	    throw new TestException("Could not cancel lease", e);
+	}
+
+	// We could poll and loop here, but one big sleep is much
+	// easer to code
+	if (cancelSlop > 0) {
+	    try {
+		logger.log(Level.INFO, "Sleeping for {0}" +
+			  " milliseconds to " + "allow cancel to propagate... time:{1}", new Object[]{cancelSlop, System.currentTimeMillis()});
+		Thread.sleep(cancelSlop);
+		logger.log(Level.INFO, "awake ... time:{0}", System.currentTimeMillis());
+                
+	    } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+		// Should not happen
+		throw new TestException("Cancel slop sleep interupted!");
+	    }
+	}
+	
+	logger.log(Level.INFO, "Cancel Test: checking to make sure resource "+
+		    "is gone");
+	if (isAvailable())
+	    throw new TestException("Resource was available after cancel");
+    }
+}
+
+

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupTestBase.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupTestBase.java?rev=1634322&r1=1634321&r2=1634322&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupTestBase.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/LookupTestBase.java Sun Oct 26 13:17:28 2014
@@ -1,174 +1,175 @@
-/*
- * 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.Test;
-import java.util.logging.Level;
-
-// Test harness specific classes
-import java.rmi.*;
-import com.sun.jini.qa.harness.TestException;
-
-import net.jini.admin.Administrable;
-import net.jini.admin.JoinAdmin;
-
-import net.jini.space.JavaSpace;
-import net.jini.lease.LeaseRenewalService;
-import net.jini.core.transaction.server.TransactionManager;
-
-
-/**
- * Base class for tests that thest JoinAdmin related functionality
- */
-public abstract class LookupTestBase extends TestBase implements Test {
-    protected Object    service;
-    protected Object    admin;
-
-    protected boolean activatable;
-    protected boolean tryShutdown;
-    protected boolean noCleanup;
-
-    /** Return true if for every elemet in <code>a1</code> there is an
-        element that is <code>equal()</code> in <code>a2</code> and vis-versa
-    */
-    protected boolean arraysEqual(Object[] a1, Object[] a2) {
-	if (a1.length != a2.length)
-	    return false;
-
-	for (int i=0; i<a1.length; i++) {
-	    int j;
-	    for (j=0; j<a2.length; j++)
-		if (a1[i].equals(a2[j]))
-		    break;
-	    if (j == a2.length)
-		// element in a1 that was not in a2
-		return false;
-	}
-
-	// Because they are of equal length if all elements in a1 are
-	// in a2, all elements of a2 must be in a1
-	return true;
-    }
-
-    /**
-     * Dump all of the elements in <code>objects</code> to the log.
-     */
-    protected void dumpArray(Object[] objects, String separator) {
-	if (objects == null) {
-	    logger.log(Level.INFO, "<array==null>");
-	    return;
-	}
-
-	if (objects.length == 0) {
-	    logger.log(Level.INFO, "<array.length==0>");
-	    return;
-	}
-
-	for (int i=0; i<objects.length; i++) {
-	    logger.log(Level.INFO, "\"" + objects[i] + "\"");
-	    if (i != (objects.length - 1))
-		logger.log(Level.INFO, separator);
-	}
-
-	logger.log(Level.INFO, "");
-    }
-
-    /**
-     * Dump all of the join admin state in the passed object
-     */
-    protected void dumpJoinState(JoinAdmin joinAdmin)
-	throws RemoteException
-    {
-	logger.log(Level.INFO, "getLookupAttributes():\n\t");
-	dumpArray(joinAdmin.getLookupAttributes(), "\n\t");
-
-	logger.log(Level.INFO, "getLookupGroups():");
-	dumpArray(joinAdmin.getLookupGroups(), ",");
-
-	logger.log(Level.INFO, "getLookupLocators():");
-	dumpArray(joinAdmin.getLookupLocators(), ",");
-    }
-
-    /**
-     * sleep for <code>dur</code> milliseconds ignoring all
-     * InterruptedExceptions
-     */
-    protected void sleep(long dur) {
-	try {
-	    Thread.sleep(dur);
-	} catch (InterruptedException e) {
-	}
-    }
-
-    /**
-     * Attempt to shut down <code>service</code>
-     */
-    protected void shutdown() throws Exception {
-	shutdown(0);
-    }
-
-    /**
-     * Parse command line args
-     * <DL>
-     * <DT>-notActivatable <DD> Should be used if the service
-     * undertest is not activatable
-     *
-     * <DT>-tryShutdown<DD> If used the test will attempt to shutdown
-     * the service and restart it (if it is activatable) and check to
-     * ensure the service's JoinAdmin state is persistent.
-     *
-     * <DT>-noCleanup<DD> The lookup tests change the various join
-     * admin atributs and then set them back to their orignal values
-     * after thay are done.  If <code>-noCleanup</code> is used the
-     * test will not perform this restoration.
-     * </DL>
-     */
-    protected void parse() throws Exception {
-	super.parse();
-
-	activatable = !getConfig().getBooleanConfigVal("com.sun.jini.test.share.notActivatable", false);
-	tryShutdown = getConfig().getBooleanConfigVal("com.sun.jini.test.share.tryShutdown", false);
-	noCleanup   = getConfig().getBooleanConfigVal("com.sun.jini.test.share.noCleanup", false);
-    }
-
-    protected void init() throws TestException {
-	specifyServices(new Class[]{Administrable.class});
-	service = services[0];
-	String preparerName = null;
-	if (service instanceof JavaSpace) {
-	    preparerName = "test.outriggerAdminPreparer";
-	} else if (service instanceof LeaseRenewalService) {
-	    preparerName = "test.normAdminPreparer";
-        } else if (service instanceof TransactionManager) {
-	    preparerName = "test.mahaloAdminPreparer";
-	} else {
-	    throw new TestException("Unexpected service: " + service);
-	}
-	try {
-	    admin = ((Administrable)service).getAdmin();
-	    admin = getConfig().prepare(preparerName, admin);
-	} catch (Throwable t) {
-	    setupFailure("Could not get admin from " + service, t);
-	}
-    }
-
-}
-
-
-
+/*
+ * 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.Test;
+import java.util.logging.Level;
+
+// Test harness specific classes
+import java.rmi.*;
+import com.sun.jini.qa.harness.TestException;
+
+import net.jini.admin.Administrable;
+import net.jini.admin.JoinAdmin;
+
+import net.jini.space.JavaSpace;
+import net.jini.lease.LeaseRenewalService;
+import net.jini.core.transaction.server.TransactionManager;
+
+
+/**
+ * Base class for tests that thest JoinAdmin related functionality
+ */
+public abstract class LookupTestBase extends TestBase implements Test {
+    protected Object    service;
+    protected Object    admin;
+
+    protected boolean activatable;
+    protected boolean tryShutdown;
+    protected boolean noCleanup;
+
+    /** Return true if for every elemet in <code>a1</code> there is an
+        element that is <code>equal()</code> in <code>a2</code> and vis-versa
+    */
+    protected boolean arraysEqual(Object[] a1, Object[] a2) {
+	if (a1.length != a2.length)
+	    return false;
+
+	for (int i=0; i<a1.length; i++) {
+	    int j;
+	    for (j=0; j<a2.length; j++)
+		if (a1[i].equals(a2[j]))
+		    break;
+	    if (j == a2.length)
+		// element in a1 that was not in a2
+		return false;
+	}
+
+	// Because they are of equal length if all elements in a1 are
+	// in a2, all elements of a2 must be in a1
+	return true;
+    }
+
+    /**
+     * Dump all of the elements in <code>objects</code> to the log.
+     */
+    protected void dumpArray(Object[] objects, String separator) {
+	if (objects == null) {
+	    logger.log(Level.INFO, "<array==null>");
+	    return;
+	}
+
+	if (objects.length == 0) {
+	    logger.log(Level.INFO, "<array.length==0>");
+	    return;
+	}
+
+	for (int i=0; i<objects.length; i++) {
+	    logger.log(Level.INFO, "\"" + objects[i] + "\"");
+	    if (i != (objects.length - 1))
+		logger.log(Level.INFO, separator);
+	}
+
+	logger.log(Level.INFO, "");
+    }
+
+    /**
+     * Dump all of the join admin state in the passed object
+     */
+    protected void dumpJoinState(JoinAdmin joinAdmin)
+	throws RemoteException
+    {
+	logger.log(Level.INFO, "getLookupAttributes():\n\t");
+	dumpArray(joinAdmin.getLookupAttributes(), "\n\t");
+
+	logger.log(Level.INFO, "getLookupGroups():");
+	dumpArray(joinAdmin.getLookupGroups(), ",");
+
+	logger.log(Level.INFO, "getLookupLocators():");
+	dumpArray(joinAdmin.getLookupLocators(), ",");
+    }
+
+    /**
+     * sleep for <code>dur</code> milliseconds ignoring all
+     * InterruptedExceptions
+     */
+    protected void sleep(long dur) {
+	try {
+	    Thread.sleep(dur);
+	} catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+	}
+    }
+
+    /**
+     * Attempt to shut down <code>service</code>
+     */
+    protected void shutdown() throws Exception {
+	shutdown(0);
+    }
+
+    /**
+     * Parse command line args
+     * <DL>
+     * <DT>-notActivatable <DD> Should be used if the service
+     * undertest is not activatable
+     *
+     * <DT>-tryShutdown<DD> If used the test will attempt to shutdown
+     * the service and restart it (if it is activatable) and check to
+     * ensure the service's JoinAdmin state is persistent.
+     *
+     * <DT>-noCleanup<DD> The lookup tests change the various join
+     * admin atributs and then set them back to their orignal values
+     * after thay are done.  If <code>-noCleanup</code> is used the
+     * test will not perform this restoration.
+     * </DL>
+     */
+    protected void parse() throws Exception {
+	super.parse();
+
+	activatable = !getConfig().getBooleanConfigVal("com.sun.jini.test.share.notActivatable", false);
+	tryShutdown = getConfig().getBooleanConfigVal("com.sun.jini.test.share.tryShutdown", false);
+	noCleanup   = getConfig().getBooleanConfigVal("com.sun.jini.test.share.noCleanup", false);
+    }
+
+    protected void init() throws TestException {
+	specifyServices(new Class[]{Administrable.class});
+	service = services[0];
+	String preparerName = null;
+	if (service instanceof JavaSpace) {
+	    preparerName = "test.outriggerAdminPreparer";
+	} else if (service instanceof LeaseRenewalService) {
+	    preparerName = "test.normAdminPreparer";
+        } else if (service instanceof TransactionManager) {
+	    preparerName = "test.mahaloAdminPreparer";
+	} else {
+	    throw new TestException("Unexpected service: " + service);
+	}
+	try {
+	    admin = ((Administrable)service).getAdmin();
+	    admin = getConfig().prepare(preparerName, admin);
+	} catch (Throwable t) {
+	    setupFailure("Could not get admin from " + service, t);
+	}
+    }
+
+}
+
+
+



Mime
View raw message