db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/broker/sequence SMMultiThreadedTest.java
Date Mon, 05 Apr 2004 17:13:27 GMT
arminw      2004/04/05 10:13:27

  Modified:    src/test/org/apache/ojb/broker/metadata
                        MetadataMultithreadedTest.java
               src/test/org/apache/ojb/broker/sequence
                        SMMultiThreadedTest.java
  Log:
  - update tests
  
  Revision  Changes    Path
  1.7       +15 -7     db-ojb/src/test/org/apache/ojb/broker/metadata/MetadataMultithreadedTest.java
  
  Index: MetadataMultithreadedTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/MetadataMultithreadedTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MetadataMultithreadedTest.java	28 Mar 2004 10:48:41 -0000	1.6
  +++ MetadataMultithreadedTest.java	5 Apr 2004 17:13:27 -0000	1.7
  @@ -4,17 +4,17 @@
   import java.util.List;
   
   import org.apache.commons.lang.ClassUtils;
  -import org.apache.ojb.broker.JUnitExtensions;
   import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  -import org.apache.ojb.broker.Project;
   import org.apache.ojb.broker.Person;
  +import org.apache.ojb.broker.Project;
   import org.apache.ojb.broker.Role;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
   import org.apache.ojb.broker.sequence.Repository;
   import org.apache.ojb.broker.util.ClassHelper;
  +import org.apache.ojb.junit.JUnitExtensions;
   
   /**
    *
  @@ -41,6 +41,14 @@
           junit.textui.TestRunner.main(arr);
       }
   
  +    private long getTotalMemory()
  +    {
  +        long result = Long.MAX_VALUE;
  +        // TODO: find a solution for this problem, or uncomment if we cancel 1.2 support
  +        // result = Runtime.getRuntime().maxMemory(); // not available in JDK 1.2
  +        return result;
  +    }
  +
       protected void setUp() throws Exception
       {
           super.setUp();
  @@ -96,8 +104,8 @@
   
                   // start test
                   long memory = Runtime.getRuntime().freeMemory();
  -                long totalMemory = Long.MAX_VALUE; // Runtime.getRuntime().maxMemory();
// not available in JDK 1.2
  -                
  +                long totalMemory = getTotalMemory();
  +
                   int count = 0;
                   for (int k = 0; k < loops; k++)
                   {
  @@ -114,7 +122,7 @@
                       ++count;
                       System.out.println("Free/total Memory after loop " + count + ":   
      "
                               + convertToMB(Runtime.getRuntime().freeMemory())
  -                            + "/" + convertToMB(totalMemory) + "MB");
  +                            + "/" + convertToMB(getTotalMemory()) + "MB");
                   }
                   period = System.currentTimeMillis() - period;
                   System.out.println(ClassUtils.getShortClassName(MetadataMultithreadedTest.class)
+ " take: "
  @@ -130,7 +138,7 @@
                   memoryUseAfterTest = convertToMB(Runtime.getRuntime().freeMemory());
                   System.out.println("Free/total Memory after test and gc:   "
                           + memoryUseAfterTest
  -                        + "/" + convertToMB(totalMemory) + "MB");
  +                        + "/" + convertToMB(getTotalMemory()) + "MB");
                   System.out.println("Do cleanup now ...");
               }
               finally
  
  
  
  1.3       +4 -5      db-ojb/src/test/org/apache/ojb/broker/sequence/SMMultiThreadedTest.java
  
  Index: SMMultiThreadedTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/sequence/SMMultiThreadedTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SMMultiThreadedTest.java	5 Sep 2003 14:45:56 -0000	1.2
  +++ SMMultiThreadedTest.java	5 Apr 2004 17:13:27 -0000	1.3
  @@ -1,6 +1,5 @@
   package org.apache.ojb.broker.sequence;
   
  -import org.apache.ojb.broker.JUnitExtensions;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.query.Criteria;
  @@ -13,7 +12,7 @@
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
    */
  -public class SMMultiThreadedTest extends JUnitExtensions.MultiThreadedTestCase
  +public class SMMultiThreadedTest extends org.apache.ojb.junit.JUnitExtensions.MultiThreadedTestCase
   {
       String goodName;
       String badName;
  @@ -84,7 +83,7 @@
       }
   
   
  -    class GoodThenBadHandle extends JUnitExtensions.MultiThreadedTestCase.TestCaseRunnable
  +    class GoodThenBadHandle extends org.apache.ojb.junit.JUnitExtensions.MultiThreadedTestCase.TestCaseRunnable
       {
           int testObjects;
   
  @@ -148,7 +147,7 @@
           }
       }
   
  -    class BadThenGoodHandle extends JUnitExtensions.MultiThreadedTestCase.TestCaseRunnable
  +    class BadThenGoodHandle extends org.apache.ojb.junit.JUnitExtensions.MultiThreadedTestCase.TestCaseRunnable
       {
           int testObjects;
           PersistenceBroker broker;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message