[jboss-cvs] JBossAS SVN: r61004 - branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 28 11:34:27 EST 2007


Author: bstansberry at jboss.com
Date: 2007-02-28 11:34:27 -0500 (Wed, 28 Feb 2007)
New Revision: 61004

Modified:
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/RetryInterceptorUnitTestCase.java
Log:
Remove override of method that is final in JDK 1.4 but not in JDK5

Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/RetryInterceptorUnitTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/RetryInterceptorUnitTestCase.java	2007-02-28 16:27:05 UTC (rev 61003)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/RetryInterceptorUnitTestCase.java	2007-02-28 16:34:27 UTC (rev 61004)
@@ -23,13 +23,11 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
-import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.net.URL;
-import java.util.Enumeration;
+import java.net.URLClassLoader;
 import java.util.Properties;
 import java.util.Random;
-import java.util.Vector;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -61,6 +59,7 @@
 {   
    private static final String DISCOVERY_GROUP = System.getProperty("jbosstest.udpGroup");
    
+   private static File customJndiDir = null;
    private static File customJndiProperties = null;
    
    // NOTE: these variables must be static as apparently a separate instance
@@ -90,7 +89,8 @@
                // getResources("jndi.properties") request.
                // We use this to allow running the server with
                // HA-JNDI autodiscovery set to a custom address 
-               ClassLoader cl = new CustomJndiPropertiesClassLoader(tccl);
+               URL[] urls = new URL[]{ customJndiProperties.toURL() };
+               ClassLoader cl = new URLClassLoader(urls, tccl);
                Thread.currentThread().setContextClassLoader(cl);
             }
             
@@ -494,7 +494,11 @@
          // The server isn't listening on the std multicast address
          // for auto discovery, so we have to pretend there is a jndi.properties
          // telling the NamingContext what address to use
-         customJndiProperties = File.createTempFile("jnp-discoveryGroup", ".properties");
+         if (customJndiDir == null)
+            customJndiDir = new File(System.getProperty("java.io.tempdir"), "retry-int-test");
+         if (!customJndiDir.exists())
+            customJndiDir.mkdir();
+         customJndiProperties = new File(customJndiDir, "jndi.properties");
          FileOutputStream fos = new FileOutputStream(customJndiProperties);
          OutputStreamWriter writer = new OutputStreamWriter(fos);
          writer.write("jnp.discoveryGroup=" + DISCOVERY_GROUP);
@@ -633,6 +637,22 @@
          customJndiProperties = null;
       }
       
+      if (customJndiDir != null)
+      {
+         try
+         {
+            customJndiDir.delete();
+            if (customJndiDir.exists())
+               customJndiDir.deleteOnExit();
+         }
+         catch (Exception e)
+         {
+            log.error("problem cleaning customJndiDir", e);
+         }
+         
+         customJndiProperties = null;
+      }
+      
       if (System.getProperty("JBossCluster-DoFail") != null)
          System.setProperty("JBossCluster-DoFail", "false");
       
@@ -669,45 +689,5 @@
    protected void setDeployed1(boolean deployed)
    {
       deployed1 = deployed;
-   }   
-   
-   static class CustomJndiPropertiesClassLoader extends ClassLoader
-   {
-      private static final Logger log = Logger.getLogger(CustomJndiPropertiesClassLoader.class);
-      
-      CustomJndiPropertiesClassLoader(ClassLoader parent)
-      {
-         super(parent);
-         log.info("Constructed; using customJndiProperties " + customJndiProperties);
-      }
-
-      /**
-       * If customJndiProperties exists, include its URL in any request
-       * for "jndi.properties"
-       */
-      public Enumeration getResources(String name) throws IOException
-      {
-         Enumeration result = super.getResources(name);
-         
-         if (customJndiProperties != null
-               && "jndi.properties".equals(name))
-         {
-            log.info("Adding custom jndi.properties");
-            
-            Vector v = new Vector();
-            v.add(customJndiProperties.toURL());
-            if (result != null)
-            {
-               while (result.hasMoreElements())
-                  v.add(result.nextElement());
-            }
-            result = v.elements();
-         }
-         
-         return result;
-      }
-      
-      
    }
-
 }




More information about the jboss-cvs-commits mailing list