Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 76841 invoked from network); 1 Oct 2005 13:50:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Oct 2005 13:50:56 -0000 Received: (qmail 71439 invoked by uid 500); 1 Oct 2005 13:50:56 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 71405 invoked by uid 500); 1 Oct 2005 13:50:55 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 71394 invoked by uid 500); 1 Oct 2005 13:50:55 -0000 Received: (qmail 71391 invoked by uid 99); 1 Oct 2005 13:50:55 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 01 Oct 2005 06:50:54 -0700 Received: (qmail 76746 invoked by uid 1510); 1 Oct 2005 13:50:34 -0000 Date: 1 Oct 2005 13:50:34 -0000 Message-ID: <20051001135034.76745.qmail@minotaur.apache.org> From: arminw@apache.org To: db-ojb-cvs@apache.org Subject: cvs commit: db-ojb/src/test/org/apache/ojb OJB-logging.properties OJB.properties repository.dtd repository_database.xml X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N arminw 2005/10/01 06:50:34 Modified: src/test/org/apache/ojb/broker/sequence SequenceManagerTest.java src/test/org/apache/ojb/broker BatchModeTest.java InheritanceMultipleTableTest.java KeyConstraintViolationTest.java M2NTest.java PBRollbackTest.java PersistenceBrokerTest.java ProxyExamples.java src/test/org/apache/ojb/compare OJBPerfTest.java PerformanceJdbcFailoverTest.java src/test/org/apache/ojb/junit OJBTestCase.java PBTestCase.java src/test/org/apache/ojb OJB-logging.properties OJB.properties repository.dtd repository_database.xml Log: initial version of the refactored/reworked batch- and statement-handing Revision Changes Path 1.33 +4 -4 db-ojb/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java Index: SequenceManagerTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- SequenceManagerTest.java 27 Aug 2005 12:39:54 -0000 1.32 +++ SequenceManagerTest.java 1 Oct 2005 13:50:33 -0000 1.33 @@ -227,7 +227,7 @@ { // let OJB re-initialize sequence-manager broker.close(); - ojb.releaseAllConnections(); + ojb.releaseAllConfigurations(); /* remove sequence name of autoincrement field but enable automatic sequence name generation @@ -596,7 +596,7 @@ try { jcd.setSequenceDescriptor(new SequenceDescriptor(jcd, SequenceManagerStoredProcedureImpl.class)); - ojb.releaseAllConnections(); + ojb.releaseAllConfigurations(); broker = ojb.lookupBroker(); SequenceManager sm = broker.serviceSequenceManager(); if (!(sm instanceof SequenceManagerStoredProcedureImpl)) @@ -621,7 +621,7 @@ if (old_sd != null) { - ojb.releaseAllConnections(); + ojb.releaseAllConfigurations(); jcd.setSequenceDescriptor(old_sd); } } 1.12 +21 -24 db-ojb/src/test/org/apache/ojb/broker/BatchModeTest.java Index: BatchModeTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/BatchModeTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- BatchModeTest.java 18 Dec 2004 14:01:16 -0000 1.11 +++ BatchModeTest.java 1 Oct 2005 13:50:33 -0000 1.12 @@ -11,7 +11,6 @@ import java.util.Collection; import java.util.Iterator; -import org.apache.ojb.broker.accesslayer.ConnectionManagerIF; import org.apache.ojb.broker.query.Criteria; import org.apache.ojb.broker.query.Query; import org.apache.ojb.broker.query.QueryFactory; @@ -43,14 +42,14 @@ public void setUp() throws Exception { super.setUp(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); // lookup connection to enable batch mode broker.serviceConnectionManager().getConnection(); } boolean batchModeDisabled() { - if(broker.serviceConnectionManager().isBatchMode()) + if(broker.serviceBatchManager().isBatchMode()) { return false; } @@ -150,7 +149,7 @@ broker.commitTransaction(); // enable batch mode before start tx - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); Identity oid = broker.serviceIdentity().buildIdentity(main1); broker.beginTransaction(); broker.delete(main1); @@ -167,21 +166,20 @@ assertEquals(1, newMain.getSubObjects().size()); } - public void testBatchStatementsOrder() + public void testBatchStatementsOrder() throws Exception { if(batchModeDisabled()) return; String name = "testBatchStatementsOrder_" + System.currentTimeMillis(); - ConnectionManagerIF conMan = broker.serviceConnectionManager(); // try to enable batch mode - conMan.setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.beginTransaction(); ProductGroup pg1 = new ProductGroup(); pg1.setName("ProductGroup#1_" + name); broker.store(pg1); - conMan.executeBatch(); + broker.serviceBatchManager().executeBatch(); Article a1 = new Article(); a1.setArticleName(name); @@ -210,11 +208,11 @@ pg3.add(a3); broker.store(a3); - conMan.executeBatch(); + broker.serviceBatchManager().executeBatch(); broker.delete(a1); - conMan.executeBatch(); + broker.serviceBatchManager().executeBatch(); broker.delete(pg1); broker.delete(a2); @@ -230,25 +228,24 @@ broker.delete(pg3); broker.store(pg3); broker.delete(pg3); - conMan.executeBatch(); + broker.serviceBatchManager().executeBatch(); broker.commitTransaction(); } /** * collection-descriptor without inverse reference-descriptor */ - public void testBatchStatementsOrder2() + public void testBatchStatementsOrder2() throws Exception { if(batchModeDisabled()) return; - ConnectionManagerIF conMan = broker.serviceConnectionManager(); broker.beginTransaction(); Zoo zoo1 = new Zoo(); zoo1.setName("BatchModeTest Zoo #1"); broker.store(zoo1); - conMan.executeBatch(); + broker.serviceBatchManager().executeBatch(); Mammal m1 = new Mammal(); m1.setName("BatchModeTest Mammal #1"); @@ -282,11 +279,11 @@ zoo3.getAnimals().add(m3); broker.store(m3); - conMan.executeBatch(); + broker.serviceBatchManager().executeBatch(); broker.delete(m1); - conMan.executeBatch(); + broker.serviceBatchManager().executeBatch(); broker.delete(zoo1); broker.delete(m2); @@ -294,7 +291,7 @@ broker.delete(m3); broker.delete(zoo3); - conMan.executeBatch(); + broker.serviceBatchManager().executeBatch(); broker.commitTransaction(); } @@ -304,7 +301,7 @@ String name = "testMassInsert_" + System.currentTimeMillis(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.beginTransaction(); for(int i = 200 - 1; i >= 0; i--) { @@ -341,7 +338,7 @@ String name = "testBatchModeDeclaration_" + System.currentTimeMillis(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.beginTransaction(); Person p = new Person(); p.setFirstname("a mass test"); @@ -354,7 +351,7 @@ setUp(); broker.beginTransaction(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); p = new Person(); p.setFirstname("a mass test"); p.setLastname(name); @@ -364,7 +361,7 @@ // new PB instance tearDown(); setUp(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.serviceConnectionManager().getConnection(); broker.beginTransaction(); broker.commitTransaction(); @@ -372,7 +369,7 @@ // new PB instance tearDown(); setUp(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.serviceConnectionManager().getConnection(); broker.beginTransaction(); broker.abortTransaction(); @@ -381,7 +378,7 @@ tearDown(); setUp(); broker.beginTransaction(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.serviceConnectionManager().getConnection(); broker.commitTransaction(); @@ -389,7 +386,7 @@ tearDown(); setUp(); broker.beginTransaction(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.serviceConnectionManager().getConnection(); broker.abortTransaction(); } 1.20 +2 -2 db-ojb/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java Index: InheritanceMultipleTableTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- InheritanceMultipleTableTest.java 29 Sep 2005 23:24:41 -0000 1.19 +++ InheritanceMultipleTableTest.java 1 Oct 2005 13:50:33 -0000 1.20 @@ -37,7 +37,7 @@ { super.setUp(); // allow to batch statements - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); } public void testQueryInheritancedObjects() 1.9 +1 -1 db-ojb/src/test/org/apache/ojb/broker/KeyConstraintViolationTest.java Index: KeyConstraintViolationTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/KeyConstraintViolationTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- KeyConstraintViolationTest.java 18 Dec 2004 14:01:16 -0000 1.8 +++ KeyConstraintViolationTest.java 1 Oct 2005 13:50:33 -0000 1.9 @@ -27,7 +27,7 @@ { // make sure not to batch mode, because key constraint exception will be wrapped by // a batch exception - broker.serviceConnectionManager().setBatchMode(false); + broker.serviceBatchManager().setBatchMode(false); broker.beginTransaction(); Article obj = new Article(); 1.19 +3 -3 db-ojb/src/test/org/apache/ojb/broker/M2NTest.java Index: M2NTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/M2NTest.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- M2NTest.java 27 Aug 2005 12:39:54 -0000 1.18 +++ M2NTest.java 1 Oct 2005 13:50:33 -0000 1.19 @@ -34,8 +34,8 @@ static final int LINK = ObjectReferenceDescriptor.CASCADE_LINK; static final int OBJECT = ObjectReferenceDescriptor.CASCADE_OBJECT; - int actorCount = 2000; - int movieCount = 1000; + int actorCount = 200; + int movieCount = 100; public static void main(String[] args) { 1.15 +2 -2 db-ojb/src/test/org/apache/ojb/broker/PBRollbackTest.java Index: PBRollbackTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PBRollbackTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- PBRollbackTest.java 27 Aug 2005 12:39:54 -0000 1.14 +++ PBRollbackTest.java 1 Oct 2005 13:50:34 -0000 1.15 @@ -62,7 +62,7 @@ int beforeCommit = broker.getCount(q); // Don't use batch statements - broker.serviceConnectionManager().setBatchMode(false); + broker.serviceBatchManager().setBatchMode(false); broker.beginTransaction(); broker.clearCache(); storeObjects(broker, getNewProjects(10)); @@ -98,7 +98,7 @@ int beforeCommit = broker.getCount(q); // Don't use batch statements - broker.serviceConnectionManager().setBatchMode(false); + broker.serviceBatchManager().setBatchMode(false); broker.beginTransaction(); storeObjects(broker, getNewProjects(10)); int whileTransaction = broker.getCount(q); 1.54 +2 -2 db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java Index: PersistenceBrokerTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- PersistenceBrokerTest.java 30 Sep 2005 21:48:40 -0000 1.53 +++ PersistenceBrokerTest.java 1 Oct 2005 13:50:34 -0000 1.54 @@ -145,7 +145,7 @@ comp.setName(name); // make sure not to use batch mode - broker.serviceConnectionManager().setBatchMode(false); + broker.serviceBatchManager().setBatchMode(false); broker.beginTransaction(); // store data broker.store(comp, OJB.INSERT); @@ -302,7 +302,7 @@ pb_1.close(); pb_2.close(); pb_3.close(); - ojb.releaseAllConnections(); + ojb.releaseAllConfigurations(); PersistenceBroker pbNew = ojb.lookupBroker(); if(pbNew instanceof DelegatingPersistenceBroker) { 1.23 +1 -1 db-ojb/src/test/org/apache/ojb/broker/ProxyExamples.java Index: ProxyExamples.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/ProxyExamples.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- ProxyExamples.java 2 Apr 2005 09:44:40 -0000 1.22 +++ ProxyExamples.java 1 Oct 2005 13:50:34 -0000 1.23 @@ -305,7 +305,7 @@ try { // Don't use batch statements - broker.serviceConnectionManager().setBatchMode(false); + broker.serviceBatchManager().setBatchMode(false); // Start transaction broker.beginTransaction(); 1.4 +29 -5 db-ojb/src/test/org/apache/ojb/compare/OJBPerfTest.java Index: OJBPerfTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/compare/OJBPerfTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- OJBPerfTest.java 31 Aug 2005 16:30:47 -0000 1.3 +++ OJBPerfTest.java 1 Oct 2005 13:50:34 -0000 1.4 @@ -246,7 +246,7 @@ private Connection getConnection() throws LookupException { // don't let OJB handle batching - broker.serviceConnectionManager().setBatchMode(false); + broker.serviceBatchManager().setBatchMode(false); return broker.serviceConnectionManager().getConnection(); } @@ -330,6 +330,10 @@ broker.store(arr[i]); broker.commitTransaction(); } + catch(Exception e) + { + if (broker != null) broker.abortTransaction(); + } finally { if (broker != null) broker.close(); @@ -347,7 +351,7 @@ try { broker = ojbInstance.lookupBroker(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.beginTransaction(); for (int i = 0; i < arr.length; i++) { @@ -355,6 +359,10 @@ } broker.commitTransaction(); } + catch(Exception e) + { + if (broker != null) broker.abortTransaction(); + } finally { if (broker != null) broker.close(); @@ -387,7 +395,7 @@ try { broker = ojbInstance.lookupBroker(); - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.beginTransaction(); for (int i = 0; i < arr.length; i++) { @@ -396,6 +404,10 @@ } broker.commitTransaction(); } + catch(Exception e) + { + if (broker != null) broker.abortTransaction(); + } finally { if (broker != null) broker.close(); @@ -414,6 +426,10 @@ broker.store(arr[i]); broker.commitTransaction(); } + catch(Exception e) + { + if (broker != null) broker.abortTransaction(); + } finally { if (broker != null) broker.close(); @@ -437,6 +453,10 @@ broker.delete(arr[i]); broker.commitTransaction(); } + catch(Exception e) + { + if (broker != null) broker.abortTransaction(); + } finally { if (broker != null) broker.close(); @@ -453,7 +473,7 @@ PersistenceBroker broker = ojbInstance.lookupBroker(); try { - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); broker.beginTransaction(); for (int i = 0; i < arr.length; i++) { @@ -461,6 +481,10 @@ } broker.commitTransaction(); } + catch(Exception e) + { + if (broker != null) broker.abortTransaction(); + } finally { if (broker != null) broker.close(); 1.4 +3 -3 db-ojb/src/test/org/apache/ojb/compare/PerformanceJdbcFailoverTest.java Index: PerformanceJdbcFailoverTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/compare/PerformanceJdbcFailoverTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- PerformanceJdbcFailoverTest.java 29 Sep 2005 20:36:41 -0000 1.3 +++ PerformanceJdbcFailoverTest.java 1 Oct 2005 13:50:34 -0000 1.4 @@ -516,7 +516,7 @@ } catch (Throwable ignored) { - } + } readArticlesByCursor(); } else @@ -595,7 +595,7 @@ } catch (Throwable ignored) { - } + } updateExistingArticles(); } else @@ -664,4 +664,4 @@ } } -} +} \ No newline at end of file 1.14 +2 -2 db-ojb/src/test/org/apache/ojb/junit/OJBTestCase.java Index: OJBTestCase.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/junit/OJBTestCase.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- OJBTestCase.java 27 Aug 2005 12:42:41 -0000 1.13 +++ OJBTestCase.java 1 Oct 2005 13:50:34 -0000 1.14 @@ -79,7 +79,7 @@ } } } - // ojb.releaseAllConnections(); + // ojb.releaseAllConfigurations(); super.tearDown(); // System.gc(); } 1.12 +2 -2 db-ojb/src/test/org/apache/ojb/junit/PBTestCase.java Index: PBTestCase.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/junit/PBTestCase.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- PBTestCase.java 27 Aug 2005 12:42:41 -0000 1.11 +++ PBTestCase.java 1 Oct 2005 13:50:34 -0000 1.12 @@ -56,7 +56,7 @@ // allows to run all tests in batch mode, if the 'batch-mode' // was enabled - broker.serviceConnectionManager().setBatchMode(true); + broker.serviceBatchManager().setBatchMode(true); } public void tearDown() throws Exception 1.7 +5 -1 db-ojb/src/test/org/apache/ojb/OJB-logging.properties Index: OJB-logging.properties =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/OJB-logging.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- OJB-logging.properties 6 Sep 2005 22:30:29 -0000 1.6 +++ OJB-logging.properties 1 Oct 2005 13:50:34 -0000 1.7 @@ -63,6 +63,10 @@ org.apache.ojb.broker.metadata.ConnectionDescriptorXmlHandler.LogLevel=WARN # Logger for JdbcAccess, useful for debugging JDBC related problems org.apache.ojb.broker.accesslayer.JdbcAccessImpl.LogLevel=WARN +# BatchManager implementation class +org.apache.ojb.broker.accesslayer.batch.BatchManagerImpl.LogLevel=WARN +# BatchStrategy implementation +org.apache.ojb.broker.accesslayer.batch.BatchStrategyDefaultImpl.LogLevel=WARN # Logger for RsIterator, useful for debugging problems with Object materialization org.apache.ojb.broker.accesslayer.RsIterator.LogLevel=WARN # Logger for SqlGenerator, useful for debugging generation of SQL 1.84 +8 -1 db-ojb/src/test/org/apache/ojb/OJB.properties Index: OJB.properties =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/OJB.properties,v retrieving revision 1.83 retrieving revision 1.84 diff -u -r1.83 -r1.84 --- OJB.properties 6 Sep 2005 22:30:29 -0000 1.83 +++ OJB.properties 1 Oct 2005 13:50:34 -0000 1.84 @@ -190,6 +190,13 @@ # # #---------------------------------------------------------------------------------------- +# BatchManager +#---------------------------------------------------------------------------------------- +# The BatchManagerClass entry defines the BatchManager implemementation to be used +BatchManagerClass=org.apache.ojb.broker.accesslayer.batch.BatchManagerImpl +# +# +#---------------------------------------------------------------------------------------- # RowReader #---------------------------------------------------------------------------------------- # Set the standard RowReader implementation. It is also possible to specify the 1.66 +9 -1 db-ojb/src/test/org/apache/ojb/repository.dtd Index: repository.dtd =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository.dtd,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- repository.dtd 5 Sep 2005 21:35:22 -0000 1.65 +++ repository.dtd 1 Oct 2005 13:50:34 -0000 1.66 @@ -206,11 +206,19 @@ The 'strategy' attribute specifies the full qualified class name of the used BatchStrategy implementation. + + The 'limit' attribute specifies the maximum allowed number of + batch entries. If the maximum is reached all batch statements + will be executed. + + The 'validator' attribute specifies the class used to validate + the batch statement execution return value array. --> - + --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org