[Jboss-cvs] JBossAS SVN: r56504 - in projects/test/trunk/test/src/main/org/jboss: ant/taskdefs/server test test/security test/util test/util/server test/visitor

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 1 08:25:55 EDT 2006


Author: adrian at jboss.org
Date: 2006-09-01 08:25:40 -0400 (Fri, 01 Sep 2006)
New Revision: 56504

Modified:
   projects/test/trunk/test/src/main/org/jboss/ant/taskdefs/server/ConfigManagerTask.java
   projects/test/trunk/test/src/main/org/jboss/test/AbstractTestCase.java
   projects/test/trunk/test/src/main/org/jboss/test/AbstractTestDelegate.java
   projects/test/trunk/test/src/main/org/jboss/test/JBossMemoryTestCase.java
   projects/test/trunk/test/src/main/org/jboss/test/JBossTestCase.java
   projects/test/trunk/test/src/main/org/jboss/test/JBossTestServices.java
   projects/test/trunk/test/src/main/org/jboss/test/JBossTestSetup.java
   projects/test/trunk/test/src/main/org/jboss/test/security/TestsPolicyPlugin.java
   projects/test/trunk/test/src/main/org/jboss/test/util/ByteArrayCallback.java
   projects/test/trunk/test/src/main/org/jboss/test/util/SecurityProviderUtil.java
   projects/test/trunk/test/src/main/org/jboss/test/util/server/Server.java
   projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerController.java
   projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerManager.java
   projects/test/trunk/test/src/main/org/jboss/test/visitor/PropertiesVisitorImpl.java
Log:
Sourcecode tidyup

Modified: projects/test/trunk/test/src/main/org/jboss/ant/taskdefs/server/ConfigManagerTask.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/ant/taskdefs/server/ConfigManagerTask.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/ant/taskdefs/server/ConfigManagerTask.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -62,6 +62,8 @@
 
    /**
     * Add a server.
+    * 
+    * @param server the server
     */
    public void addServer(Server server)
    {
@@ -98,6 +100,8 @@
    /**
     * The UDP group to pass to org.jboss.Main using
     * the -u option.
+    * 
+    * @param udpGroup the udp group
     */
    public void setUdpGroup(String udpGroup)
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/AbstractTestCase.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/AbstractTestCase.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/AbstractTestCase.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -72,14 +72,14 @@
    
    public static URL findResource(final Class clazz, final String name)
    {
-      PrivilegedAction action = new PrivilegedAction()
+      PrivilegedAction<URL> action = new PrivilegedAction<URL>()
       {
-         public Object run()
+         public URL run()
          {
             return clazz.getResource(name);
          }
       };
-      return (URL) AccessController.doPrivileged(action);
+      return AccessController.doPrivileged(action);
    }
 
    protected void setUp() throws Exception

Modified: projects/test/trunk/test/src/main/org/jboss/test/AbstractTestDelegate.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/AbstractTestDelegate.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/AbstractTestDelegate.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -56,6 +56,8 @@
     * delegates.
     * 
     * @param clazz the test class
+    * @return the delegate
+    * @throws Exception for any error
     */
    protected static AbstractTestDelegate getDelegate(Class clazz) throws Exception
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/JBossMemoryTestCase.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/JBossMemoryTestCase.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/JBossMemoryTestCase.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -63,7 +63,7 @@
           pathIgnore = classLocation.toString();
        } 
        
-       ArrayList urls = new ArrayList();
+       ArrayList<URL> urls = new ArrayList<URL>();
        while (tokenString.hasMoreElements())
        {
           String value = tokenString.nextToken();
@@ -75,7 +75,7 @@
           }
        }
        
-       URL[] urlArray= (URL[])urls.toArray(new URL[urls.size()]);
+       URL[] urlArray= urls.toArray(new URL[urls.size()]);
        
        ClassLoader masterClassLoader = URLClassLoader.newInstance(urlArray,null);
        
@@ -108,7 +108,8 @@
     * If you started your class with -agentlib:jbossAgent in case of leakage (if className still loaded) a file (reportFile) will be created, and a heapSnapshot(./snapshot,mem)
     * 
     * @param weakReferenceOnLoader A weakReference to the created ClassLoader. If there is no references to this classLoader this reference will be cleared
-    * @param className The class name supposed to be unloade. 
+    * @param className The class name supposed to be unloade.
+    * @param reportHTMLFile the report file 
     * @throws Exception
     */
    protected void checkUnload(WeakReference weakReferenceOnLoader, String className, String reportHTMLFile) throws Exception
@@ -154,7 +155,7 @@
    }
    private Field[] getDeclaredFields(Class clazz)
    {
-      ArrayList list = new ArrayList();
+      ArrayList<Field> list = new ArrayList<Field>();
       for (Class classIteration = clazz;classIteration!=null;classIteration=classIteration.getSuperclass())
       {
           Field[] fields = classIteration.getDeclaredFields();
@@ -166,10 +167,14 @@
           
       }
       
-      return (Field[]) list.toArray(new Field[list.size()]);
+      return list.toArray(new Field[list.size()]);
    }
 
-   /** This method could be used for debug purposes */
+   /** 
+    * This method could be used for debug purposes
+    * 
+    * @param className the class name
+    */
    protected void clearEverySingleFieldOnInstances(String className)
    {
       System.out.println("Clearing " + className);

Modified: projects/test/trunk/test/src/main/org/jboss/test/JBossTestCase.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/JBossTestCase.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/JBossTestCase.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -56,7 +56,6 @@
 
    /**
     *  Saved exception from deployment.
-    *  Will be thrown from {@link #testServerFound}, if not <code>null</code>.
     */
    protected static Exception deploymentException = null;
 
@@ -125,6 +124,7 @@
     * Gets the InitialContext attribute of the JBossTestCase object
     *
     * @return   The InitialContext value
+    * @throws Exception for any error
     */
    protected InitialContext getInitialContext() throws Exception
    {
@@ -135,6 +135,7 @@
     * Gets the Server attribute of the JBossTestCase object
     *
     * @return   The Server value
+    * @throws Exception for any error
     */
    protected MBeanServerConnection getServer() throws Exception
    {
@@ -178,10 +179,14 @@
       return delegate.getDeployURL(filename);
    }
 
-   /** Get a URL string to a resource in the testsuite/output/resources dir.
+   /**
+    * Get a URL string to a resource in the testsuite/output/resources dir.
     * This relies on the output/resources directory being in the
     * testcase classpath.
     *
+    * @param resource the resource name
+    * @return the string version of the resource url
+    * @throws MalformedURLException for an invalid url
     */
    protected String getResourceURL(final String resource) throws MalformedURLException
    {
@@ -248,9 +253,10 @@
     *
     * @param test a Test
     * @param jarNames is a comma seperated list of deployments
+    * @return the wrapping test that does the setup
+    * @throws Exception for any error
     */
-   public static Test getDeploySetup(final Test test, final String jarNames)
-      throws Exception
+   public static Test getDeploySetup(final Test test, final String jarNames) throws Exception
    {
       JBossTestSetup wrapper = new JBossTestSetup(test)
       {
@@ -341,6 +347,8 @@
    /**
     * Get the JBoss server host from system property "jbosstest.server.host"
     * This defaults to "localhost"
+    * 
+    * @return the host name
     */
    public String getServerHost()
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/JBossTestServices.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/JBossTestServices.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/JBossTestServices.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -86,6 +86,8 @@
 
    /**
     * The JUnit setup method
+    * 
+    * @throws Exception for any error
     */
    public void setUp() throws Exception
    {
@@ -101,6 +103,8 @@
 
    /**
     * The teardown method for JUnit
+    * 
+    * @throws Exception for any error
     */
    public void tearDown() throws Exception
    {
@@ -113,6 +117,7 @@
     * Gets the InitialContext attribute of the JBossTestCase object
     *
     * @return   The InitialContext value
+    * @throws Exception for any error
     */
    public InitialContext getInitialContext() throws Exception
    {
@@ -123,6 +128,7 @@
     * Gets the Server attribute of the JBossTestCase object
     *
     * @return   The Server value
+    * @throws Exception for any error
     */
    public MBeanServerConnection getServer() throws Exception
    {
@@ -419,6 +425,8 @@
 
    /** 
     * Initializes the {@link InitialContext} if not set.
+    * 
+    * @throws Exception for any error
     */
    public void init() throws Exception
    {
@@ -432,6 +440,8 @@
    
    /** 
     * Re-initializes the {@link InitialContext}.
+    * 
+    * @throws Exception for any error
     */   
    public void reinit() throws Exception
    {
@@ -443,6 +453,8 @@
    /**
     * Returns the JBoss server host from system property "jbosstest.server.host"
     * This defaults to "localhost"
+    * 
+    * @return the host name
     */
    public String getServerHost()
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/JBossTestSetup.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/JBossTestSetup.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/JBossTestSetup.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -58,6 +58,9 @@
 
    /**
     * Constructor for the JBossTestCase object
+    * 
+    * @param test the test
+    * @throws Exception for any error
     */
    public JBossTestSetup(Test test) throws Exception
    {
@@ -75,6 +78,7 @@
     * Gets the InitialContext attribute of the JBossTestCase object
     *
     * @return   The InitialContext value
+    * @throws Exception for any error
     */
    protected InitialContext getInitialContext() throws Exception
    {
@@ -85,6 +89,7 @@
     * Gets the Server attribute of the JBossTestCase object
     *
     * @return   The Server value
+    * @throws Exception for any error
     */
    protected MBeanServerConnection getServer() throws Exception
    {
@@ -227,6 +232,8 @@
    /**
     * Get the JBoss server host from system property "jbosstest.host.name"
     * This defaults to "localhost"
+    * 
+    * @return the host name
     */
    public String getServerHost()
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/security/TestsPolicyPlugin.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/security/TestsPolicyPlugin.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/security/TestsPolicyPlugin.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -45,7 +45,7 @@
  */
 public class TestsPolicyPlugin extends PolicyPlugin
 {
-   private HashSet classPermissions = new HashSet();
+   private HashSet<Permission> classPermissions = new HashSet<Permission>();
 
    private static final URL codeSourceLocation;
    
@@ -80,12 +80,12 @@
       // Augment the policy with testcase clazz data
       PropertiesVisitorImpl visitor = new PropertiesVisitorImpl();
       TypeHierarchyTraversal.visit(clazz, visitor);
-      HashMap typeProperties = visitor.getTypeProperties();
-      Iterator iter = typeProperties.values().iterator();
+      HashMap<Class, Properties> typeProperties = visitor.getTypeProperties();
+      Iterator<Properties> iter = typeProperties.values().iterator();
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
       while( iter.hasNext() )
       {
-         Properties props = (Properties) iter.next();
+         Properties props = iter.next();
          Enumeration names = props.propertyNames();
          while( names.hasMoreElements() )
          {

Modified: projects/test/trunk/test/src/main/org/jboss/test/util/ByteArrayCallback.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/util/ByteArrayCallback.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/util/ByteArrayCallback.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -34,8 +34,11 @@
     private transient String prompt;
     private transient byte[] data;
 
-    /** Initialize the SecurityAssociationCallback
-    */
+    /** 
+     * Initialize the SecurityAssociationCallback
+     * 
+     * @param prompt the prompt
+     */
     public ByteArrayCallback(String prompt)
     {
         this.prompt = prompt;

Modified: projects/test/trunk/test/src/main/org/jboss/test/util/SecurityProviderUtil.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/util/SecurityProviderUtil.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/util/SecurityProviderUtil.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -45,7 +45,8 @@
    
    /**
     * Get a JSSE Security Provider
-    * @return
+    * 
+    * @return the provider
     */
    public static Provider getJSSEProvider() 
    {
@@ -66,7 +67,8 @@
    
    /**
     * Get the https protocl handler
-    * @return
+    * 
+    * @return the protocol handler name
     */
    public static String getProtocolHandlerName()
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/util/server/Server.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/util/server/Server.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/util/server/Server.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -44,16 +44,16 @@
    private String config;
 
    /** the arguments to pass to jboss **/
-   private List arguments = new ArrayList();
+   private List<Argument> arguments = new ArrayList<Argument>();
 
    /** the server's process, if running **/
    private Process process;
 
    /** the arguments for the jvm **/
-   private List jvmArguments = new ArrayList();
+   private List<Argument> jvmArguments = new ArrayList<Argument>();
 
    /** system properties for the jvm **/
-   private List sysProperties = new ArrayList();
+   private List<Property> sysProperties = new ArrayList<Property>();
 
    /** the port used to determine if jboss started **/
    private Integer httpPort = new Integer(8080);
@@ -118,7 +118,7 @@
    /**
     * Get the arguments as a string for the command line.
     *
-    * @return
+    * @return the arguments as a string
     */
    public String getArgs()
    {
@@ -145,7 +145,7 @@
    /**
     * Get the JVM args for the command line.
     *
-    * @return
+    * @return the arguments as a string
     */
    public String getJvmArgs()
    {
@@ -172,7 +172,7 @@
    /**
     * Get the system properties for the command line.
     *
-    * @return
+    * @return the properties as a string
     */
    public String getSysProperties()
    {
@@ -197,7 +197,7 @@
    /**
     * Is the server actually running?
     *
-    * @return
+    * @return whether the server is running
     */
    public boolean isRunning()
    {
@@ -222,7 +222,8 @@
 
    /**
     * Has the server been intentionally stopped?
-    * @return
+    * 
+    * @return whether the server is stopped
     */
    public boolean isStopped()
    {
@@ -231,7 +232,8 @@
 
    /**
     * Get the process.
-    * @return
+    * 
+    * @return the process
     */
    public Process getProcess()
    {
@@ -240,8 +242,9 @@
 
    /**
     * Where is the HTTP service listening?
-    * @return
-    * @throws MalformedURLException
+    * 
+    * @return whether the service is listening 
+    * @throws MalformedURLException for a malformed url
     */
    public URL getHttpUrl() throws MalformedURLException
    {
@@ -250,7 +253,8 @@
 
    /**
     * The URl for the RMI listener.
-    * @return
+    * 
+    * @return the rmi url
     */
    public String getRmiUrl()
    {
@@ -326,7 +330,8 @@
 
    /**
     * Get the rmiPort
-    * @return
+    * 
+    * @return the rmi port
     */
    public Integer getRmiPort()
    {
@@ -334,7 +339,8 @@
    }
    /**
     * Where should the server's std err log go?
-    * @return
+    * 
+    * @return the error log file
     */
    public File getErrorLog()
    {
@@ -343,7 +349,8 @@
 
    /**
     * Where should the servers's std out go?
-    * @return
+    * 
+    * @return the output log file
     */
    public File getOutputLog()
    {
@@ -353,7 +360,7 @@
    /**
     * The server's log directory
     *
-    * @return
+    * @return the log directory
     */
    private File getLogDir()
    {
@@ -363,7 +370,7 @@
    /**
     * The server's directory (ie, all, default)
     *
-    * @return
+    * @return the configuration directory
     */
    private File getConfDir()
    {
@@ -372,7 +379,8 @@
 
    /**
     * Set the output log's writer
-    * @param outlog
+    * 
+    * @param outlog the log writer
     */
    public void setOutWriter(PrintWriter outlog)
    {
@@ -382,7 +390,7 @@
    /**
     * The writer for the output log.
     *
-    * @return
+    * @return the output writer
     */
    public PrintWriter getOutWriter()
    {
@@ -392,7 +400,7 @@
    /**
     * The error log's writer.
     *
-    * @return
+    * @return the log writer
     */
    public PrintWriter getErrorWriter()
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerController.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerController.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerController.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -138,10 +138,11 @@
 
    /**
     * Create the command line to execute
-    * @param server
-    * @param manager
-    * @return
-    * @throws IOException
+    * 
+    * @param server the server
+    * @param manager the manager
+    * @return the command line
+    * @throws IOException for any error
     */
    private static String getStartCommandLine(Server server, ServerManager manager) throws IOException
    {
@@ -194,9 +195,9 @@
     * Check if the server is fully intialized by trying to
     * open a connection to tomcat.
     *
-    * @param server
-    * @return
-    * @throws IOException
+    * @param server the server
+    * @return whether it is started
+    * @throws IOException for any error
     */
    private static boolean isServerStarted(Server server) throws IOException
    {
@@ -320,10 +321,11 @@
 
    /**
     * Get the server shutdown command line.
-    * @param server
-    * @param manager
-    * @return
-    * @throws IOException
+    * 
+    * @param server the server
+    * @param manager the manager
+    * @return the shutdown command
+    * @throws IOException for any error
     */
    private static String getStopCommandLine(Server server, ServerManager manager) throws IOException
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerManager.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerManager.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/util/server/ServerManager.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -54,7 +54,7 @@
    private String udpGroup;
    
    /** list of all configured servers **/
-   private List servers = new ArrayList();
+   private List<Server> servers = new ArrayList<Server>();
 
    /**
     * Create a new ServerManager.  Make sure all servers are killed on shutdown.
@@ -105,8 +105,8 @@
     * Get the server by name.  Can't use a hashmap because of 
     * Ant.
     * 
-    * @param name
-    * @return
+    * @param name the name of the server
+    * @return the server
     */
    public Server getServer(String name)
    {
@@ -184,7 +184,8 @@
 
    /** 
     * The classpath to run the server
-    * @return
+    * 
+    * @return the classpath as a string
     */
    protected String getStartClasspath()
    {
@@ -209,7 +210,8 @@
 
    /** 
     * Get the jboss home.
-    * @return
+    * 
+    * @return the home directory as a string
     */
    public String getJBossHome()
    {
@@ -218,7 +220,8 @@
 
    /** 
     * How long to wait (in seconds) for a server to shutdown
-    * @return
+    * 
+    * @return the shutdown timeout
     */
    public int getShutdownTimeout()
    {
@@ -227,7 +230,8 @@
 
    /** 
     * How long to wait (in seconds) for a server to startup
-    * @return
+    * 
+    * @return the startup timeout
     */
    public int getStartupTimeout()
    {

Modified: projects/test/trunk/test/src/main/org/jboss/test/visitor/PropertiesVisitorImpl.java
===================================================================
--- projects/test/trunk/test/src/main/org/jboss/test/visitor/PropertiesVisitorImpl.java	2006-09-01 12:04:29 UTC (rev 56503)
+++ projects/test/trunk/test/src/main/org/jboss/test/visitor/PropertiesVisitorImpl.java	2006-09-01 12:25:40 UTC (rev 56504)
@@ -42,30 +42,32 @@
 {
    private static Logger log = Logger.getLogger(PropertiesVisitorImpl.class);
    /** HashMap<Class, Properties> */
-   private HashMap typeProperties = new HashMap();
+   private HashMap<Class, Properties> typeProperties = new HashMap<Class, Properties>();
    /** HashMap<String, Properties> */
-   private HashMap methodProperties = new HashMap();
+   private HashMap<String, Properties> methodProperties = new HashMap<String, Properties>();
    /** HashMap<String, Properties> */
-   private HashMap fieldProperties = new HashMap();
+   private HashMap<String, Properties> fieldProperties = new HashMap<String, Properties>();
 
    /**
     * @return HashMap<Class, Properties>
     */
-   public HashMap getTypeProperties()
+   public HashMap<Class, Properties> getTypeProperties()
    {
       return typeProperties;
    }
+
    /**
     * @return HashMap<String, Properties>
     */
-   public HashMap getMethodProperties()
+   public HashMap<String, Properties> getMethodProperties()
    {
       return methodProperties;
    }
+   
    /**
     * @return HashMap<String, Properties>
     */
-   public HashMap getFieldProperties()
+   public HashMap<String, Properties> getFieldProperties()
    {
       return fieldProperties;
    }
@@ -124,18 +126,19 @@
 
    /**
     * 
+    * @param <T> the key type
     * @param type - the class used to load the name resource via
     *    Class.getResource(name)
     * @param key - the key into map
     * @param name - the resource name to search for
     * @param map - Map<key, Properties> to populate
     */
-   protected void loadProperties(Class type, Object key, String name, HashMap map)
+   protected <T> void loadProperties(Class type, T key, String name, HashMap<T, Properties> map)
    {
       URL res = type.getResource(name);
       if( res != null )
       {
-         Properties props = (Properties) map.get(key);
+         Properties props = map.get(key);
          if( props == null )
          {
             props = new Properties();




More information about the jboss-cvs-commits mailing list