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 Fri, 27 Jun 2003 20:47:30 GMT
arminw      2003/06/27 13:47:30

  Modified:    src/test/org/apache/ojb/performance PerfTest.java
                        PerfMain.java
               src/test/org/apache/ojb/broker OJBPerfTest.java
  Log:
  minor changes, beautifications
  
  Revision  Changes    Path
  1.7       +3 -3      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PerfTest.java	24 Jun 2003 16:30:41 -0000	1.6
  +++ PerfTest.java	27 Jun 2003 20:47:30 -0000	1.7
  @@ -108,7 +108,7 @@
   
       private void checkApi() throws Exception
       {
  -        String name = testName()+"_Pre_Test_Object";
  +        String name = testName() + "_Pre_Test_Object";
           PerfHandle handle = newPerfHandle(this);
           PerfArticle article = handle.getPreparedPerfArticle(name);
           PerfArticle[] arr = new PerfArticle[]{article};
  @@ -205,8 +205,8 @@
           }
           catch (Exception e)
           {
  -            perfMain.registerException(testName(), e);
               e.printStackTrace();
  +            perfMain.registerException(testName(), e);
           }
       }
   
  
  
  
  1.6       +3 -3      db-ojb/src/test/org/apache/ojb/performance/PerfMain.java
  
  Index: PerfMain.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/performance/PerfMain.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PerfMain.java	24 Jun 2003 16:30:41 -0000	1.5
  +++ PerfMain.java	27 Jun 2003 20:47:30 -0000	1.6
  @@ -93,7 +93,7 @@
    * <br/>
    * For example:
    * <br/>
  - * <code>java -classpath CLASSPATH my.MyPerfTest,myMyPerfTest2 3 10 2000 fale</code>
  + * <code>java -classpath CLASSPATH my.MyPerfTest,myMyPerfTest2 3 10 2000 false</code>
    * </p>
    *
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
  @@ -546,7 +546,7 @@
   
           public long getTotalTime()
           {
  -            return ((insertPeriod + fetchPeriod + updatePeriod + deletePeriod)/ getTestLoops())
/ getNumberOfThreads();
  +            return ((insertPeriod + fetchPeriod + updatePeriod + deletePeriod) / getTestLoops())
/ getNumberOfThreads();
           }
   
           public long getInsertPeriod()
  
  
  
  1.8       +18 -20    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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- OJBPerfTest.java	25 Jun 2003 17:50:04 -0000	1.7
  +++ OJBPerfTest.java	27 Jun 2003 20:47:30 -0000	1.8
  @@ -24,9 +24,9 @@
   import java.sql.PreparedStatement;
   import java.sql.ResultSet;
   import java.sql.Statement;
  +import java.util.ArrayList;
   import java.util.Collection;
   import java.util.List;
  -import java.util.ArrayList;
   
   /**
    * Performance test implementation classes for testing
  @@ -132,7 +132,7 @@
               buf.append(" (ARTICLE_ID, ARTICLE_NAME, MINIMUM_STOCK, PRICE, UNIT, STOCK,
SUPPLIER_ID)");
               buf.append(" VALUES (?,?,?,?,?,?,?)");
               Connection con = getConnection();
  -			con.setAutoCommit(false);
  +            con.setAutoCommit(false);
               PreparedStatement stmt = con.prepareStatement(buf.toString());
               for (int i = 0; i < arr.length; i++)
               {
  @@ -142,14 +142,14 @@
                   stmt.setLong(1, article.getArticleId().longValue());
                   stmt.setString(2, article.getArticleName());
                   stmt.setInt(3, article.getMinimumStock());
  -                stmt.setDouble(4,article.getPrice());
  +                stmt.setDouble(4, article.getPrice());
                   stmt.setString(5, article.getUnit());
                   stmt.setInt(6, article.getStock());
                   stmt.setInt(7, article.getSupplierId());
                   stmt.executeUpdate();
               }
  -			con.commit();
  -			con.setAutoCommit(true);
  +            con.commit();
  +            con.setAutoCommit(true);
               stmt.close();
               releaseConnection();
           }
  @@ -161,12 +161,12 @@
   
           public Collection readArticlesByCursor(String articleName) throws Exception
           {
  -            String sql = "SELECT * FROM " + TABLE_NAME + " WHERE ARTICLE_NAME LIKE '"+articleName+"'";
  +            String sql = "SELECT * FROM " + TABLE_NAME + " WHERE ARTICLE_NAME LIKE '" +
articleName + "'";
               Connection con = getConnection();
               Statement stmt = con.createStatement();
               ResultSet rs = stmt.executeQuery(sql);
               ArrayList list = new ArrayList();
  -            while(rs.next())
  +            while (rs.next())
               {
                   PerfArticle article = new PerfArticleImpl();
                   article.setArticleId(new Long(rs.getLong("ARTICLE_ID")));
  @@ -192,22 +192,22 @@
               buf.append(" SET ARTICLE_NAME = ?, MINIMUM_STOCK = ?, PRICE = ?, UNIT = ?,
STOCK = ?, SUPPLIER_ID = ?");
               buf.append(" WHERE ARTICLE_ID = ?");
               Connection con = getConnection();
  -			con.setAutoCommit(false);
  +            con.setAutoCommit(false);
               PreparedStatement stmt = con.prepareStatement(buf.toString());
               for (int i = 0; i < arr.length; i++)
               {
                   PerfArticle article = arr[i];
                   stmt.setString(1, article.getArticleName());
                   stmt.setInt(2, article.getMinimumStock());
  -				stmt.setDouble(3, article.getPrice());
  +                stmt.setDouble(3, article.getPrice());
                   stmt.setString(4, article.getUnit());
                   stmt.setInt(5, article.getStock());
                   stmt.setInt(6, article.getSupplierId());
                   stmt.setLong(7, article.getArticleId().longValue());
                   stmt.executeUpdate();
               }
  -			con.commit();
  -			con.setAutoCommit(true);
  +            con.commit();
  +            con.setAutoCommit(true);
               stmt.close();
               releaseConnection();
           }
  @@ -219,9 +219,9 @@
   
           public void deleteArticles(PerfArticle[] arr) throws Exception
           {
  -            String sql = "DELETE FROM "+TABLE_NAME + " WHERE ARTICLE_ID = ?";
  +            String sql = "DELETE FROM " + TABLE_NAME + " WHERE ARTICLE_ID = ?";
               Connection con = getConnection();
  -			con.setAutoCommit(false);
  +            con.setAutoCommit(false);
               PreparedStatement stmt = con.prepareStatement(sql);
               for (int i = 0; i < arr.length; i++)
               {
  @@ -229,8 +229,8 @@
                   stmt.setLong(1, article.getArticleId().longValue());
                   stmt.execute();
               }
  -			con.commit();
  -			con.setAutoCommit(true);
  +            con.commit();
  +            con.setAutoCommit(true);
               stmt.close();
               releaseConnection();
           }
  @@ -336,8 +336,7 @@
            */
           public void insertNewArticles(PerfArticle[] arr) throws Exception
           {
  -            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl();
  -            needsInsert.setNeedsInsert(true);
  +            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl(true,
false);
               PersistenceBroker broker = null;
               try
               {
  @@ -378,8 +377,7 @@
   
           public void updateArticles(PerfArticle[] arr) throws Exception
           {
  -            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl();
  -            needsInsert.setNeedsUpdate(true);
  +            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl(false,
true);
               PersistenceBroker broker = null;
               try
               {
  
  
  

Mime
View raw message