jsalvata    2004/01/20 08:41:27

  Modified:    src/jorphan/org/apache/jorphan/test AllTests.java
  Log:
  Avoid caching problems running TestCase.suite().
  
  Revision  Changes    Path
  1.18      +17 -10    jakarta-jmeter/src/jorphan/org/apache/jorphan/test/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/jorphan/org/apache/jorphan/test/AllTests.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AllTests.java     20 Jan 2004 02:01:14 -0000      1.17
  +++ AllTests.java     20 Jan 2004 16:41:27 -0000      1.18
  @@ -331,22 +331,29 @@
                         */
   
                        Class clazz = Class.forName(name);
  +                     TestSuite t= null;
                                        try
                                        {
                                                Method m = clazz.getMethod("suite", 
new Class[0]);
  -                                             TestSuite t = (TestSuite) 
m.invoke(clazz,null);
  -                                             suite.addTest(t);
  -                                     }
  -                                     catch (Exception e)
  -                                     {
  -                                             TestSuite ts = new TestSuite(clazz);
  -                                             suite.addTest(ts);
  -                     }
  +                                             t = (TestSuite) m.invoke(clazz,null);
  +                     }
  +                     catch (NoSuchMethodException e) {} // this is not an error, 
the others are
  +                     //catch (SecurityException e) {}
  +                                     //catch (IllegalAccessException e) {}
  +                                     //catch (IllegalArgumentException e) {}
  +                                     //catch (InvocationTargetException e) {}
  +                     
  +                     if (t == null)
  +                     {
  +                                             t= new TestSuite(clazz);
  +                     }
  +
  +                                     suite.addTest(t);
                   }
                   catch (Exception ex)
                   {
                        System.out.println("Error adding test for class "+name+" 
"+ex.toString());
  -                    log.error("error adding test :" + ex);
  +                    log.error("error adding test :", ex);
                   }
               }
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to