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 2012/11/12 10:44:36 UTC
svn commit: r1408232 - in /river/jtsk/trunk/qa/src/com/sun/jini/test:
impl/locatordiscovery/BadLocatorDiscoveryListener.td resources/qa1.logging
share/BaseQATest.java share/DiscoveryProtocolSimulator.java
Author: peter_firmstone
Date: Mon Nov 12 09:44:35 2012
New Revision: 1408232
URL: http://svn.apache.org/viewvc?rev=1408232&view=rev
Log:
Debugging tests on arm platform to gather more information.
Modified:
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/locatordiscovery/BadLocatorDiscoveryListener.td
river/jtsk/trunk/qa/src/com/sun/jini/test/resources/qa1.logging
river/jtsk/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java
river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java
Modified: river/jtsk/trunk/qa/src/com/sun/jini/test/impl/locatordiscovery/BadLocatorDiscoveryListener.td
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/qa/src/com/sun/jini/test/impl/locatordiscovery/BadLocatorDiscoveryListener.td?rev=1408232&r1=1408231&r2=1408232&view=diff
==============================================================================
--- river/jtsk/trunk/qa/src/com/sun/jini/test/impl/locatordiscovery/BadLocatorDiscoveryListener.td (original)
+++ river/jtsk/trunk/qa/src/com/sun/jini/test/impl/locatordiscovery/BadLocatorDiscoveryListener.td Mon Nov 12 09:44:35 2012
@@ -2,3 +2,4 @@ testClass=BadLocatorDiscoveryListener
testCategories=locatordiscovery,locatordiscovery_impl,impllocatordiscovery
include0=locatordiscovery.properties
include1=com/sun/jini/test/share/reggie3_2.properties
+qautil.debug.sync=true
Modified: river/jtsk/trunk/qa/src/com/sun/jini/test/resources/qa1.logging
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/qa/src/com/sun/jini/test/resources/qa1.logging?rev=1408232&r1=1408231&r2=1408232&view=diff
==============================================================================
--- river/jtsk/trunk/qa/src/com/sun/jini/test/resources/qa1.logging (original)
+++ river/jtsk/trunk/qa/src/com/sun/jini/test/resources/qa1.logging Mon Nov 12 09:44:35 2012
@@ -256,7 +256,7 @@ com.sun.jini.outrigger.transactions.leve
com.sun.jini.example.browser.level = INFO
# For the test harness, tests, and infrastructure.
-com.sun.jini.qa.harness.test.level = INFO
-com.sun.jini.qa.harness.service.level = INFO
-com.sun.jini.qa.harness.config.level = INFO
+com.sun.jini.qa.harness.test.level = FINEST
+com.sun.jini.qa.harness.service.level = FINEST
+com.sun.jini.qa.harness.config.level = FINEST
com.sun.jini.test.spec.jeri.mux.level = INFO
Modified: river/jtsk/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java?rev=1408232&r1=1408231&r2=1408232&view=diff
==============================================================================
--- river/jtsk/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java (original)
+++ river/jtsk/trunk/qa/src/com/sun/jini/test/share/BaseQATest.java Mon Nov 12 09:44:35 2012
@@ -29,6 +29,8 @@ import com.sun.jini.test.share.LocatorsU
import com.sun.jini.qa.harness.QAConfig;
import com.sun.jini.qa.harness.TestException;
+import java.rmi.activation.ActivationException;
+import java.util.logging.Logger;
import net.jini.admin.Administrable;
import net.jini.admin.JoinAdmin;
@@ -88,15 +90,15 @@ abstract public class BaseQATest extends
protected static final int MANUAL_TEST_REMOTE_COMPONENT = 1;
protected static final int MANUAL_TEST_LOCAL_COMPONENT = 2;
- protected boolean useFastTimeout = false;//for faster completion
- protected int fastTimeout = 10;//default value
- protected boolean displayOn = true;//verbose in waitForDiscovery/Discard
- protected boolean debugsync = false;//turns on synchronization debugging
+ protected volatile boolean useFastTimeout = false;//for faster completion
+ protected volatile int fastTimeout = 10;//default value
+ protected volatile boolean displayOn = true;//verbose in waitForDiscovery/Discard
+ protected volatile boolean debugsync = false;//turns on synchronization debugging
/** Ordered pair containing a LookupLocator and the corresponding groups */
public class LocatorGroupsPair {
- public LookupLocator locator;
- public String[] groups;
+ public final LookupLocator locator;
+ public final String[] groups;
public LocatorGroupsPair(LookupLocator locator, String[] groups) {
this.locator = locator;
this.groups = groups;
@@ -112,8 +114,8 @@ abstract public class BaseQATest extends
/** Data structure representing a set of LookupLocators & groups to join */
public class ToJoinPair {
- public LookupLocator[] locators;
- public String[] groups;
+ public final LookupLocator[] locators;
+ public final String[] groups;
public ToJoinPair(LookupLocator[] locators, String[] groups) {
this.locators = locators;
this.groups = groups;
@@ -138,11 +140,11 @@ abstract public class BaseQATest extends
*/
protected class LookupListener implements DiscoveryListener {
public LookupListener(){ }
- public HashMap discoveredMap = new HashMap(11);
- public HashMap discardedMap = new HashMap(11);
+ public final HashMap discoveredMap = new HashMap(11);
+ public final HashMap discardedMap = new HashMap(11);
- public HashMap expectedDiscoveredMap = new HashMap(11);
- public HashMap expectedDiscardedMap = new HashMap(11);
+ public final HashMap expectedDiscoveredMap = new HashMap(11);
+ public final HashMap expectedDiscardedMap = new HashMap(11);
/** Returns the locators of the lookups from discoveredMap, which
* contains both the lookups that are expected to be discovered,
@@ -682,8 +684,8 @@ abstract public class BaseQATest extends
{
public GroupChangeListener(){ }
- public HashMap changedMap = new HashMap(11);
- public HashMap expectedChangedMap = new HashMap(11);
+ public final HashMap changedMap = new HashMap(11);
+ public final HashMap expectedChangedMap = new HashMap(11);
public void clearAllEventInfo() {
synchronized(this) {
@@ -872,7 +874,7 @@ abstract public class BaseQATest extends
2*60*1000,
60*1000, 30*1000, 20*1000, 10*1000, 5*1000 };
private int startIndx = 0;
- private ArrayList locGroupsList;
+ private final ArrayList locGroupsList;
/** Use this constructor if it is desired that all lookup services
* be started in this thread. The locGroupsList parameter is an
* ArrayList that should contain LocatorGroupsPair instances that
@@ -945,76 +947,76 @@ abstract public class BaseQATest extends
}//end class StaggeredStartThread
/* Protected instance variables */
- protected int testType = AUTOMATIC_LOCAL_TEST;
+ protected volatile int testType = AUTOMATIC_LOCAL_TEST;
- protected String implClassname;
+ protected volatile String implClassname;
- protected int maxSecsEventWait = 10 * 60;
- protected int announceInterval = 2 * 60 * 1000;
- protected int originalAnnounceInterval = 0;
- protected int minNAnnouncements = 2;
- protected int nIntervalsToWait = 3;
+ protected volatile int maxSecsEventWait = 10 * 60;
+ protected volatile int announceInterval = 2 * 60 * 1000;
+ protected volatile int originalAnnounceInterval = 0;
+ protected volatile int minNAnnouncements = 2;
+ protected volatile int nIntervalsToWait = 3;
- protected boolean delayLookupStart = false;
+ protected volatile boolean delayLookupStart = false;
- protected int nLookupServices = 0;
- protected int nAddLookupServices = 0;
- protected int nRemoteLookupServices = 0;
- protected int nAddRemoteLookupServices = 0;
+ protected volatile int nLookupServices = 0;
+ protected volatile int nAddLookupServices = 0;
+ protected volatile int nRemoteLookupServices = 0;
+ protected volatile int nAddRemoteLookupServices = 0;
- protected int nServices = 0;//local/serializable test services
- protected int nAddServices = 0;//additional local/serializable services
+ protected volatile int nServices = 0;//local/serializable test services
+ protected volatile int nAddServices = 0;//additional local/serializable services
/* Specified jini services */
- protected String ldsImplClassname = "no ImplClassname";
- protected int nLookupDiscoveryServices = 0;
- protected int nAddLookupDiscoveryServices = 0;
- protected int nRemoteLookupDiscoveryServices = 0;
- protected int nAddRemoteLookupDiscoveryServices = 0;
-
- protected String lrsImplClassname = "no ImplClassname";
- protected int nLeaseRenewalServices = 0;
- protected int nAddLeaseRenewalServices = 0;
- protected int nRemoteLeaseRenewalServices = 0;
- protected int nAddRemoteLeaseRenewalServices = 0;
-
- protected String emsImplClassname = "no ImplClassname";
- protected int nEventMailboxServices = 0;
- protected int nAddEventMailboxServices = 0;
- protected int nRemoteEventMailboxServices = 0;
- protected int nAddRemoteEventMailboxServices = 0;
+ protected volatile String ldsImplClassname = "no ImplClassname";
+ protected volatile int nLookupDiscoveryServices = 0;
+ protected volatile int nAddLookupDiscoveryServices = 0;
+ protected volatile int nRemoteLookupDiscoveryServices = 0;
+ protected volatile int nAddRemoteLookupDiscoveryServices = 0;
+
+ protected volatile String lrsImplClassname = "no ImplClassname";
+ protected volatile int nLeaseRenewalServices = 0;
+ protected volatile int nAddLeaseRenewalServices = 0;
+ protected volatile int nRemoteLeaseRenewalServices = 0;
+ protected volatile int nAddRemoteLeaseRenewalServices = 0;
+
+ protected volatile String emsImplClassname = "no ImplClassname";
+ protected volatile int nEventMailboxServices = 0;
+ protected volatile int nAddEventMailboxServices = 0;
+ protected volatile int nRemoteEventMailboxServices = 0;
+ protected volatile int nAddRemoteEventMailboxServices = 0;
/* Attributes per service */
- protected int nAttributes = 0;
- protected int nAddAttributes = 0;
+ protected volatile int nAttributes = 0;
+ protected volatile int nAddAttributes = 0;
- protected int nSecsLookupDiscovery = 30;
- protected int nSecsServiceDiscovery = 30;
- protected int nSecsJoin = 30;
+ protected volatile int nSecsLookupDiscovery = 30;
+ protected volatile int nSecsServiceDiscovery = 30;
+ protected volatile int nSecsJoin = 30;
- protected String remoteHost = "UNKNOWN_HOST";
+ protected volatile String remoteHost = "UNKNOWN_HOST";
/* Data structures - lookup services */
- protected ArrayList initLookupsToStart = new ArrayList(11);
- protected ArrayList addLookupsToStart = new ArrayList(11);
- protected ArrayList allLookupsToStart = new ArrayList(11);
- protected ArrayList lookupsStarted = new ArrayList(11);
-
- protected ArrayList lookupList = new ArrayList(1);
- protected HashMap genMap = new HashMap(11);
- protected int nStarted = 0;
+ protected final ArrayList initLookupsToStart = new ArrayList(11);
+ protected final ArrayList addLookupsToStart = new ArrayList(11);
+ protected final ArrayList allLookupsToStart = new ArrayList(11);
+ protected final ArrayList lookupsStarted = new ArrayList(11);
+
+ protected final ArrayList lookupList = new ArrayList(1);
+ protected final HashMap genMap = new HashMap(11);
+ protected volatile int nStarted = 0;
/* Data structures - lookup discovery services */
- protected ArrayList initLDSToStart = new ArrayList(11);
- protected ArrayList addLDSToStart = new ArrayList(11);
- protected ArrayList allLDSToStart = new ArrayList(11);
- protected ArrayList ldsList = new ArrayList(1);
+ protected final ArrayList initLDSToStart = new ArrayList(11);
+ protected final ArrayList addLDSToStart = new ArrayList(11);
+ protected final ArrayList allLDSToStart = new ArrayList(11);
+ protected final ArrayList ldsList = new ArrayList(1);
- protected Class[] serviceClasses = null;
- protected ArrayList expectedServiceList = new ArrayList(1);
+ protected volatile Class[] serviceClasses = null;
+ protected final ArrayList expectedServiceList = new ArrayList(1);
- protected QAConfig config = null;
+ protected volatile QAConfig config = null;
- private boolean announcementsStopped = false;
+ private volatile boolean announcementsStopped = false;
/* Need to keep a local mapping of registrars to their corresponding
* locators and groups so that when a registrar is discarded (indicating
@@ -1024,7 +1026,7 @@ abstract public class BaseQATest extends
* is started, the registrar and its locator/groups pair are added to this
* map.
*/
- protected HashMap regsToLocGroupsMap = new HashMap(11);
+ protected final HashMap regsToLocGroupsMap = new HashMap(11);
/* Private instance variables */
@@ -1032,7 +1034,7 @@ abstract public class BaseQATest extends
* lookup service so those groups can be mapped to the correct member
* groups configuration item.
*/
- private ArrayList memberGroupsList = new ArrayList(11);
+ private final ArrayList memberGroupsList = new ArrayList(11);
/** Performs actions necessary to prepare for execution of the
* current test as follows:
@@ -1626,9 +1628,23 @@ abstract public class BaseQATest extends
if(debugsync) logger.log(Level.FINE,
" BaseQATest.startLookup - "
+"sync on lookupList --> granted");
- /* Use either a random or an explicit locator port */
- generator = new DiscoveryProtocolSimulator
- (config,memberGroups,manager, port);
+ try {
+ /* Use either a random or an explicit locator port */
+ generator = new DiscoveryProtocolSimulator
+ (config,memberGroups,manager, port);
+ } catch (ActivationException ex) {
+ ex.fillInStackTrace();
+ logger.log(Level.FINE, null, ex);
+ throw ex;
+ } catch (IOException ex) {
+ ex.fillInStackTrace();
+ logger.log(Level.FINE, null, ex);
+ throw ex;
+ } catch (TestException ex) {
+ ex.fillInStackTrace();
+ logger.log(Level.FINE, null, ex);
+ throw ex;
+ }
genMap.put( generator, memberGroups );
lookupProxy = generator.getLookupProxy();
lookupList.add( lookupProxy );
Modified: river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java?rev=1408232&r1=1408231&r2=1408232&view=diff
==============================================================================
--- river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java (original)
+++ river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java Mon Nov 12 09:44:35 2012
@@ -150,7 +150,7 @@ public class DiscoveryProtocolSimulator
/** Default maximum size of multicast packets to send and receive */
private static final int DEFAULT_MAX_PACKET_SIZE = 512;
/** Default time to live value to use for sending multicast packets */
- private static int DEFAULT_MULTICAST_TTL;
+ private static volatile int DEFAULT_MULTICAST_TTL;
/** Default timeout to set on sockets used for unicast discovery */
private static final int DEFAULT_SOCKET_TIMEOUT = 1*60*1000;
@@ -168,57 +168,62 @@ public class DiscoveryProtocolSimulator
*/
private InetAddress[] nicAddresses;
- /** Port for unicast discovery */
+ /** Port for unicast discovery
+ * lockLookupLocator for synch
+ */
private int unicastPort = 0;
/** The locator to send */
- private LookupLocator lookupLocator = null;
+ private volatile LookupLocator lookupLocator = null;
/** The member groups to send */
private String[] memberGroups = {};
/** Thread to receive/process multicast requests from client or service */
- MulticastThread multicastRequestThread;
- /** Thread to receive/process unicast requests from client or service */
- UnicastThread unicastRequestThread;
+ final MulticastThread multicastRequestThread;
+ /** Thread to receive/process unicast requests from client or service
+ * write by lockLookupLocator synch
+ * read by volatile
+ */
+ volatile UnicastThread unicastRequestThread;
/** Thread to send multicast announcements to from client or service */
- AnnounceThread multicastAnnouncementThread;
+ final AnnounceThread multicastAnnouncementThread;
/** Task manager for sending events and discovery responses */
private final TaskManager taskMgr = new TaskManager(10, 1000 * 15, 1.0f);
/** Proxy for the "fake" lookup service that is sent */
- private LookupSimulatorProxyInterface lookupProxy;
+ private volatile LookupSimulatorProxyInterface lookupProxy;
/** The service ID to assign to the lookup service that is sent */
- private ServiceID lookupServiceID = null;
+ private volatile ServiceID lookupServiceID = null;
/** Socket timeout for unicast discovery request processing */
- private int unicastTimeout =
+ private volatile int unicastTimeout =
Integer.getInteger("com.sun.jini.reggie.unicastTimeout",
1000 * 60).intValue();
/* For synchronization, instead of ReadersWriter locks used by reggie */
- private Object lockNAnnouncements = new Object();
- private Object lockLookupProxy = new Object();
- private Object lockLookupLocator = new Object();
- private Object lockMemberGroups = new Object();
+ private final Object lockNAnnouncements = new Object();
+ private final Object lockLookupProxy = new Object();
+ private final Object lockLookupLocator = new Object();
+ private final Object lockMemberGroups = new Object();
/* new fields taken from the davis reggie */
/** Network interfaces to use for multicast discovery */
- private NetworkInterface[] multicastInterfaces;
+ private volatile NetworkInterface[] multicastInterfaces;
/** Flag indicating whether network interfaces were explicitly specified */
- private boolean multicastInterfacesSpecified;
- private Discovery protocol2;
+ private volatile boolean multicastInterfacesSpecified;
+ private volatile Discovery protocol2;
/** Constraints specified for incoming multicast requests */
- private DiscoveryConstraints multicastRequestConstraints;
+ private volatile DiscoveryConstraints multicastRequestConstraints;
/** Constraints specified for outgoing multicast announcements */
- private DiscoveryConstraints multicastAnnouncementConstraints;
+ private volatile DiscoveryConstraints multicastAnnouncementConstraints;
/** Constraints specified for handling unicast discovery */
- private DiscoveryConstraints unicastDiscoveryConstraints;
+ private volatile DiscoveryConstraints unicastDiscoveryConstraints;
/** Client subject checker to apply to incoming multicast requests */
- private ClientSubjectChecker multicastRequestSubjectChecker;
+ private volatile ClientSubjectChecker multicastRequestSubjectChecker;
/** Client subject checker to apply to unicast discovery attempts */
- private ClientSubjectChecker unicastDiscoverySubjectChecker;
+ private volatile ClientSubjectChecker unicastDiscoverySubjectChecker;
/** Interval to wait in between sending multicast announcements */
- private long multicastAnnouncementInterval = 1000 * 60 * 2;
+ private volatile long multicastAnnouncementInterval = 1000 * 60 * 2;
public DiscoveryProtocolSimulator(QAConfig config,
@@ -290,6 +295,9 @@ public class DiscoveryProtocolSimulator
}
}
}
+ multicastRequestThread = new MulticastThread();
+ multicastAnnouncementThread = new AnnounceThread();
+ unicastRequestThread = new UnicastThread(unicastPort);
}//end constructor
public void stopAnnouncements() {
@@ -420,7 +428,9 @@ public class DiscoveryProtocolSimulator
unicastRequestThread.interrupt();
try {
unicastRequestThread.join();
- } catch (InterruptedException e) { }
+ } catch (InterruptedException e) {
+
+ }
/* start the UnicastThread listening on the new port */
unicastRequestThread = newUnicastRequestThread;
unicastRequestThread.start();
@@ -1088,7 +1098,6 @@ public class DiscoveryProtocolSimulator
host = InetAddress.getLocalHost().getHostName();
}
thisInetAddress = InetAddress.getByName(host);
- unicastRequestThread = new UnicastThread(unicastPort);
lookupLocator = QAConfig.getConstrainedLocator(host, unicastRequestThread.port);
/* start an activatable lookup service simulation */
if (lookupServiceID == null) {
@@ -1174,8 +1183,7 @@ public class DiscoveryProtocolSimulator
}
/* start the discovery-related threads */
- multicastRequestThread = new MulticastThread();
- multicastAnnouncementThread = new AnnounceThread();
+
/* start the threads */
unicastRequestThread.start();
multicastRequestThread.start();