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 OJBPerfTest.java
Date Mon, 03 Nov 2003 09:53:36 GMT
arminw      2003/11/03 01:53:36

  Modified:    src/test/org/apache/ojb/performance PerfTest.java
                        PerfHandle.java
               src/test/org/apache/ojb/broker OJBPerfTest.java
  Log:
  - minor changes, better logging messages
  
  Revision  Changes    Path
  1.8       +7 -4      db-ojb/src/test/org/apache/ojb/performance/PerfTest.java
  
  Index: PerfTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/performance/PerfTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PerfTest.java	27 Jun 2003 20:47:30 -0000	1.7
  +++ PerfTest.java	3 Nov 2003 09:53:36 -0000	1.8
  @@ -102,6 +102,9 @@
       /**
        * Returns the count of all found {@link PerfArticle}
        * in database. Do not use the cache to get the count!
  +     * This method is not involved in the performance test
  +     * methods, thus it's not mandatory to use the api-methods
  +     * for implementation.
        */
       public abstract int articleCount();
   
  @@ -164,7 +167,7 @@
           }
           catch (InterruptedException ignore)
           {
  -            System.out.println("Thread join interrupted.");
  +            System.out.println(PREFIX_LOG + "Thread join interrupted.");
           }
           threads = null;
       }
  @@ -196,7 +199,7 @@
               }
               testTimes[0] = System.currentTimeMillis();
               runTestHandles(perfHandles);
  -            testTimes[0] = (long) (System.currentTimeMillis() - testTimes[0]);
  +            testTimes[0] = System.currentTimeMillis() - testTimes[0];
               // end of test threads
   
               objectCountAfter = articleCount();
  @@ -206,7 +209,7 @@
           catch (Exception e)
           {
               e.printStackTrace();
  -            perfMain.registerException(testName(), e);
  +            perfMain.registerException(PREFIX_LOG, e);
           }
       }
   
  
  
  
  1.10      +5 -8      db-ojb/src/test/org/apache/ojb/performance/PerfHandle.java
  
  Index: PerfHandle.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/performance/PerfHandle.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PerfHandle.java	27 Jun 2003 15:53:22 -0000	1.9
  +++ PerfHandle.java	3 Nov 2003 09:53:36 -0000	1.10
  @@ -66,8 +66,6 @@
   public abstract class PerfHandle implements Runnable
   {
       private String PREFIX_LOG = "[" + this.getClass().getName() + "] ";
  -    // private PerfArticle[] m_arr;
  -    private String threadName;
       private PerfTest test;
       private String objectName;
   
  @@ -149,7 +147,7 @@
        * The returned name was used as 'articleName' for all
        * created <code>PerfArticles</code> for this thread.
        * This allows an easy build of the query statement
  -     * to match the created {@link PerfArticles} for this
  +     * to match the created {@link PerfArticle} for this
        * instance/thread.
        */
       public String getTestObjectName()
  @@ -225,7 +223,7 @@
               }
               catch (Exception e)
               {
  -                test.registerException("Something wrong with query result", e);
  +                test.registerException(PREFIX_LOG + "(Something wrong with query result)
", e);
               }
               test.addTime(2, period);
   
  @@ -267,7 +265,7 @@
           catch (Exception e)
           {
               e.printStackTrace();
  -            test.registerException(test.testName(), e);
  +            test.registerException(PREFIX_LOG + "(Unexpected behaviour) ", e);
               test.interruptThreads();
           }
       }
  @@ -285,14 +283,13 @@
   
       private void checkQueryResult(Collection col, PerfArticle[] m_arr) throws Exception
       {
  -        Iterator iter = col.iterator();
           if(col.size() > 0)
           {
               Iterator it = col.iterator();
               Object obj = it.next();
               if(!(obj instanceof PerfArticle))
               {
  -                throw new Exception("Read objects: Wrong object type found. Expected instance
of"+
  +                throw new Exception("Wrong object type found. Expected instance of"+
                       PerfArticle.class.getName() + ", found " + obj.getClass().getName());
               }
           }
  
  
  
  1.11      +5 -4      db-ojb/src/test/org/apache/ojb/broker/OJBPerfTest.java
  
  Index: OJBPerfTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/OJBPerfTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- OJBPerfTest.java	13 Sep 2003 23:50:40 -0000	1.10
  +++ OJBPerfTest.java	3 Nov 2003 09:53:36 -0000	1.11
  @@ -10,6 +10,7 @@
   import org.apache.ojb.broker.query.QueryByCriteria;
   import org.apache.ojb.broker.util.ObjectModificationDefaultImpl;
   import org.apache.ojb.odmg.OJB;
  +import org.apache.ojb.odmg.TransactionExt;
   import org.apache.ojb.otm.OTMConnection;
   import org.apache.ojb.otm.OTMKit;
   import org.apache.ojb.otm.kit.SimpleKit;
  @@ -589,7 +590,7 @@
               for (int i = 0; i < arr.length; i++)
               {
                   m_tx.lock(arr[i], Transaction.WRITE);
  -                arr[i].setArticleName("" + System.currentTimeMillis());
  +                ((TransactionExt)m_tx).markDirty(arr[i]);
               }
               m_tx.commit();
           }
  @@ -601,7 +602,7 @@
                   Transaction tx = odmg.newTransaction();
                   tx.begin();
                   tx.lock(arr[i], Transaction.WRITE);
  -                arr[i].setArticleName("" + System.currentTimeMillis());
  +                ((TransactionExt)m_tx).markDirty(arr[i]);
                   tx.commit();
               }
           }
  @@ -635,7 +636,7 @@
               }
           }
       }
  -    
  +
       // =====================================================================================
       // Inner class, test base class using OTM-api
       // =====================================================================================
  
  
  

---------------------------------------------------------------------
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