You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2008/01/28 03:08:27 UTC

svn commit: r615702 - /db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/compare/OJBPerfTest.java

Author: arminw
Date: Sun Jan 27 18:08:13 2008
New Revision: 615702

URL: http://svn.apache.org/viewvc?rev=615702&view=rev
Log:
comment out the OTM test implementation

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/compare/OJBPerfTest.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/compare/OJBPerfTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/compare/OJBPerfTest.java?rev=615702&r1=615701&r2=615702&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/compare/OJBPerfTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/compare/OJBPerfTest.java Sun Jan 27 18:08:13 2008
@@ -6,10 +6,8 @@
 import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
-import org.apache.ojb.broker.Identity;
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.PersistenceBrokerFactory;
 import org.apache.ojb.broker.TestHelper;
@@ -20,10 +18,6 @@
 import org.apache.ojb.broker.util.ObjectModification;
 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;
-import org.apache.ojb.otm.lock.LockType;
 import org.apache.ojb.performance.PerfArticle;
 import org.apache.ojb.performance.PerfArticleImpl;
 import org.apache.ojb.performance.PerfTest;
@@ -31,8 +25,8 @@
 import org.odmg.Implementation;
 import org.odmg.ODMGException;
 import org.odmg.OQLQuery;
-import org.odmg.Transaction;
 import org.odmg.QueryException;
+import org.odmg.Transaction;
 
 /**
  * Multi-threaded performance test implementation classes for testing
@@ -643,164 +637,164 @@
     // =====================================================================================
     // Inner class, test handle using OTM-api
     // =====================================================================================
-    public static class OTMPerfTest extends PerfTest
-    {
-        private OTMKit _kit;
-
-        private OTMConnection _conn;
-
-        private org.apache.ojb.otm.core.Transaction _tx;
-
-        public void init()
-        {
-            _kit = SimpleKit.getInstance();
-            _conn = _kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
-        }
-
-        public void tearDown() throws Exception
-        {
-            if ((_tx != null) && _tx.isInProgress())
-            {
-                _tx.rollback();
-            }
-            _conn.close();
-        }
-
-        public String testName()
-        {
-            return "OTM";
-        }
-
-        public int articleCount()
-        {
-            Criteria c = new Criteria();
-            Query q = new QueryByCriteria(PerfArticleImpl.class, c);
-            int count = 0;
-            try
-            {
-                PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
-                count = broker.getCount(q);
-                broker.close();
-            }
-            catch (Exception e)
-            {
-                e.printStackTrace();
-            }
-            return count;
-        }
-
-        /**
-         * A resource cumbering insert-method implementation,
-         * this was used to test implementation.
-         */
-        public void insertNewArticlesStress(PerfArticle[] arr) throws Exception
-        {
-            for (int i = 0; i < arr.length; i++)
-            {
-                _tx = _kit.getTransaction(_conn);
-                _tx.begin();
-                _conn.makePersistent(arr[i]);
-                _tx.commit();
-            }
-        }
-
-        /**
-         * A performance optimized insert-method implementation,
-         * used to test performance.
-         */
-        public void insertNewArticles(PerfArticle[] arr) throws Exception
-        {
-            _tx = _kit.getTransaction(_conn);
-            _tx.begin();
-            for (int i = 0; i < arr.length; i++)
-            {
-                _conn.makePersistent(arr[i]);
-            }
-            _tx.commit();
-        }
-
-        public Collection readArticlesByCursor(String articleName) throws Exception
-        {
-            Criteria c = new Criteria();
-            c.addLike("articleName", articleName);
-            Query q = new QueryByCriteria(PerfArticleImpl.class, c);
-
-            _tx = _kit.getTransaction(_conn);
-            _tx.begin();
-            Collection col = _conn.getCollectionByQuery(q, LockType.NO_LOCK);
-            _tx.commit();
-            return col;
-        }
-
-        public PerfArticle getArticleByIdentity(Long articleId) throws Exception
-        {
-            Criteria c = new Criteria();
-            c.addEqualTo("articleId", articleId);
-            Query q = new QueryByCriteria(PerfArticleImpl.class, c);
-
-            _tx = _kit.getTransaction(_conn);
-            _tx.begin();
-            // the getByIdeneityMethod() needs Identity and this is currently not supported
-            Collection col = _conn.getCollectionByQuery(q, LockType.NO_LOCK);
-            _tx.commit();
-            Iterator it = col.iterator();
-            return it.hasNext() ? (PerfArticle) it.next() : null;
-        }
-
-        public void updateArticles(PerfArticle[] arr) throws Exception
-        {
-            _tx = _kit.getTransaction(_conn);
-            _tx.begin();
-            for (int i = 0; i < arr.length; i++)
-            {
-                Identity oid = _conn.getIdentity(arr[i]);
-                PerfArticle a = (PerfArticle) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
-                a.setArticleName("" + System.currentTimeMillis());
-            }
-            _tx.commit();
-        }
-
-        public void updateArticlesStress(PerfArticle[] arr) throws Exception
-        {
-            for (int i = 0; i < arr.length; i++)
-            {
-                _tx = _kit.getTransaction(_conn);
-                _tx.begin();
-                Identity oid = _conn.getIdentity(arr[i]);
-                PerfArticle a = (PerfArticle) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
-                a.setArticleName("" + System.currentTimeMillis());
-                _tx.commit();
-            }
-        }
-
-        /**
-         * A resource cumbering delete-method implementation,
-         * used to test implementation
-         */
-        public void deleteArticlesStress(PerfArticle[] arr) throws Exception
-        {
-            for (int i = 0; i < arr.length; i++)
-            {
-                _tx = _kit.getTransaction(_conn);
-                _tx.begin();
-                _conn.deletePersistent(arr[i]);
-                _tx.commit();
-            }
-        }
-
-        /**
-         * A performance optimized delete-method implementation,
-         * used to test performance
-         */
-        public void deleteArticles(PerfArticle[] arr) throws Exception
-        {
-            _tx = _kit.getTransaction(_conn);
-            _tx.begin();
-            for (int i = 0; i < arr.length; i++)
-            {
-                _conn.deletePersistent(arr[i]);
-            }
-            _tx.commit();
-        }
-    }
+//    public static class OTMPerfTest extends PerfTest
+//    {
+//        private OTMKit _kit;
+//
+//        private OTMConnection _conn;
+//
+//        private org.apache.ojb.otm.core.Transaction _tx;
+//
+//        public void init()
+//        {
+//            _kit = SimpleKit.getInstance();
+//            _conn = _kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
+//        }
+//
+//        public void tearDown() throws Exception
+//        {
+//            if ((_tx != null) && _tx.isInProgress())
+//            {
+//                _tx.rollback();
+//            }
+//            _conn.close();
+//        }
+//
+//        public String testName()
+//        {
+//            return "OTM";
+//        }
+//
+//        public int articleCount()
+//        {
+//            Criteria c = new Criteria();
+//            Query q = new QueryByCriteria(PerfArticleImpl.class, c);
+//            int count = 0;
+//            try
+//            {
+//                PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
+//                count = broker.getCount(q);
+//                broker.close();
+//            }
+//            catch (Exception e)
+//            {
+//                e.printStackTrace();
+//            }
+//            return count;
+//        }
+//
+//        /**
+//         * A resource cumbering insert-method implementation,
+//         * this was used to test implementation.
+//         */
+//        public void insertNewArticlesStress(PerfArticle[] arr) throws Exception
+//        {
+//            for (int i = 0; i < arr.length; i++)
+//            {
+//                _tx = _kit.getTransaction(_conn);
+//                _tx.begin();
+//                _conn.makePersistent(arr[i]);
+//                _tx.commit();
+//            }
+//        }
+//
+//        /**
+//         * A performance optimized insert-method implementation,
+//         * used to test performance.
+//         */
+//        public void insertNewArticles(PerfArticle[] arr) throws Exception
+//        {
+//            _tx = _kit.getTransaction(_conn);
+//            _tx.begin();
+//            for (int i = 0; i < arr.length; i++)
+//            {
+//                _conn.makePersistent(arr[i]);
+//            }
+//            _tx.commit();
+//        }
+//
+//        public Collection readArticlesByCursor(String articleName) throws Exception
+//        {
+//            Criteria c = new Criteria();
+//            c.addLike("articleName", articleName);
+//            Query q = new QueryByCriteria(PerfArticleImpl.class, c);
+//
+//            _tx = _kit.getTransaction(_conn);
+//            _tx.begin();
+//            Collection col = _conn.getCollectionByQuery(q, LockType.NO_LOCK);
+//            _tx.commit();
+//            return col;
+//        }
+//
+//        public PerfArticle getArticleByIdentity(Long articleId) throws Exception
+//        {
+//            Criteria c = new Criteria();
+//            c.addEqualTo("articleId", articleId);
+//            Query q = new QueryByCriteria(PerfArticleImpl.class, c);
+//
+//            _tx = _kit.getTransaction(_conn);
+//            _tx.begin();
+//            // the getByIdeneityMethod() needs Identity and this is currently not supported
+//            Collection col = _conn.getCollectionByQuery(q, LockType.NO_LOCK);
+//            _tx.commit();
+//            Iterator it = col.iterator();
+//            return it.hasNext() ? (PerfArticle) it.next() : null;
+//        }
+//
+//        public void updateArticles(PerfArticle[] arr) throws Exception
+//        {
+//            _tx = _kit.getTransaction(_conn);
+//            _tx.begin();
+//            for (int i = 0; i < arr.length; i++)
+//            {
+//                Identity oid = _conn.getIdentity(arr[i]);
+//                PerfArticle a = (PerfArticle) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
+//                a.setArticleName("" + System.currentTimeMillis());
+//            }
+//            _tx.commit();
+//        }
+//
+//        public void updateArticlesStress(PerfArticle[] arr) throws Exception
+//        {
+//            for (int i = 0; i < arr.length; i++)
+//            {
+//                _tx = _kit.getTransaction(_conn);
+//                _tx.begin();
+//                Identity oid = _conn.getIdentity(arr[i]);
+//                PerfArticle a = (PerfArticle) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
+//                a.setArticleName("" + System.currentTimeMillis());
+//                _tx.commit();
+//            }
+//        }
+//
+//        /**
+//         * A resource cumbering delete-method implementation,
+//         * used to test implementation
+//         */
+//        public void deleteArticlesStress(PerfArticle[] arr) throws Exception
+//        {
+//            for (int i = 0; i < arr.length; i++)
+//            {
+//                _tx = _kit.getTransaction(_conn);
+//                _tx.begin();
+//                _conn.deletePersistent(arr[i]);
+//                _tx.commit();
+//            }
+//        }
+//
+//        /**
+//         * A performance optimized delete-method implementation,
+//         * used to test performance
+//         */
+//        public void deleteArticles(PerfArticle[] arr) throws Exception
+//        {
+//            _tx = _kit.getTransaction(_conn);
+//            _tx.begin();
+//            for (int i = 0; i < arr.length; i++)
+//            {
+//                _conn.deletePersistent(arr[i]);
+//            }
+//            _tx.commit();
+//        }
+//    }
 }



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