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 LogServiceTest.java BatchModeTest.java AllTests.java
Date Sun, 26 Oct 2003 17:18:33 GMT
arminw      2003/10/26 09:18:33

  Modified:    src/test/org/apache/ojb/odmg AllTests.java
               src/test/org/apache/ojb/broker LogServiceTest.java
                        BatchModeTest.java AllTests.java
  Log:
  - use convenience method to add test classes
  - add simple batch test
  - modify log test
  
  Revision  Changes    Path
  1.15      +29 -35    db-ojb/src/test/org/apache/ojb/odmg/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/AllTests.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AllTests.java	8 Apr 2003 20:19:29 -0000	1.14
  +++ AllTests.java	26 Oct 2003 17:18:33 -0000	1.15
  @@ -9,18 +9,12 @@
    */
   public class AllTests extends junit.framework.TestSuite
   {
  -    /** static reference to .class.
  -     * Java does not provide any way to obtain the Class object from
  -     * static method without naming it.
  -     */
  -    private static Class CLASS = AllTests.class;
  -
       /**
        * runs the suite in a junit.textui.TestRunner.
        */
       public static void main(String[] args)
       {
  -        String[] arr = {CLASS.getName()};
  +        String[] arr = {AllTests.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  @@ -28,34 +22,34 @@
       public static Test suite()
       {
           TestSuite suite = new TestSuite();
  -        suite.addTest(new TestSuite(OdmgExamples.class));
  -        suite.addTest(new TestSuite(NamedRoots.class));
  -        suite.addTest(new TestSuite(DListTest.class));
  -        suite.addTest(new TestSuite(DMapTest.class));
  -        suite.addTest(new TestSuite(LockingTest.class));
  -        suite.addTest(new TestSuite(LockTestSerializable.class));
  -        suite.addTest(new TestSuite(LockTestRepeatableReads.class));
  -        suite.addTest(new TestSuite(LockTestCommitedReads.class));
  -        suite.addTest(new TestSuite(LockTestUncommitedReads.class));
  -        suite.addTest(new TestSuite(ProxyTest.class));
  -        suite.addTest(new TestSuite(RITest.class));
  -		suite.addTest(new TestSuite(ScrollableQueryResultsTest.class));
  -        suite.addTest(new TestSuite(ProjectionAttributeTest.class));
  -        suite.addTest(new TestSuite(ContractVersionEffectivenessOQLTest.class));
  -        suite.addTest(new TestSuite(OQLTest.class));
  -        suite.addTest(new TestSuite(AutoIncrementWithRelatedObjectTest.class));
  -        suite.addTest(new TestSuite(ODMGRollbackTest.class));
  -        suite.addTest(new TestSuite(MultiDBUsageTest.class));
  -        suite.addTest(new TestSuite(UserTestCases.class));
  -        suite.addTest(new TestSuite(BidirectionalAssociationTest.class));
  -        suite.addTest(new TestSuite(ManyToManyTest.class));
  -        suite.addTest(new TestSuite(OneToOneTest.class));
  -        suite.addTest(new TestSuite(OneToManyTest.class));
  -        suite.addTest(new TestSuite(OQLOrOnForeignKeyTest.class));
  -        suite.addTest(new TestSuite(FieldConversion_4.class));
  -        suite.addTest(new TestSuite(BatchModeTest.class));
  -        suite.addTest(new TestSuite(CollectionsTest.class));
  -		suite.addTest(new TestSuite(PersonWithArrayTest.class));
  +        suite.addTestSuite(OdmgExamples.class);
  +        suite.addTestSuite(NamedRoots.class);
  +        suite.addTestSuite(DListTest.class);
  +        suite.addTestSuite(DMapTest.class);
  +        suite.addTestSuite(LockingTest.class);
  +        suite.addTestSuite(LockTestSerializable.class);
  +        suite.addTestSuite(LockTestRepeatableReads.class);
  +        suite.addTestSuite(LockTestCommitedReads.class);
  +        suite.addTestSuite(LockTestUncommitedReads.class);
  +        suite.addTestSuite(ProxyTest.class);
  +        suite.addTestSuite(RITest.class);
  +		suite.addTestSuite(ScrollableQueryResultsTest.class);
  +        suite.addTestSuite(ProjectionAttributeTest.class);
  +        suite.addTestSuite(ContractVersionEffectivenessOQLTest.class);
  +        suite.addTestSuite(OQLTest.class);
  +        suite.addTestSuite(AutoIncrementWithRelatedObjectTest.class);
  +        suite.addTestSuite(ODMGRollbackTest.class);
  +        suite.addTestSuite(MultiDBUsageTest.class);
  +        suite.addTestSuite(UserTestCases.class);
  +        suite.addTestSuite(BidirectionalAssociationTest.class);
  +        suite.addTestSuite(ManyToManyTest.class);
  +        suite.addTestSuite(OneToOneTest.class);
  +        suite.addTestSuite(OneToManyTest.class);
  +        suite.addTestSuite(OQLOrOnForeignKeyTest.class);
  +        suite.addTestSuite(FieldConversion_4.class);
  +        suite.addTestSuite(BatchModeTest.class);
  +        suite.addTestSuite(CollectionsTest.class);
  +		suite.addTestSuite(PersonWithArrayTest.class);
           return suite;
       }
   }
  
  
  
  1.6       +25 -20    db-ojb/src/test/org/apache/ojb/broker/LogServiceTest.java
  
  Index: LogServiceTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/LogServiceTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LogServiceTest.java	26 Apr 2003 23:18:23 -0000	1.5
  +++ LogServiceTest.java	26 Oct 2003 17:18:33 -0000	1.6
  @@ -1,13 +1,14 @@
   package org.apache.ojb.broker;
   
   //JUNIT
  -import junit.framework.*;
   
  -//OJB
  +import junit.framework.Test;
  +import junit.framework.TestCase;
  +import junit.framework.TestSuite;
  +import org.apache.ojb.broker.accesslayer.RsIterator;
  +import org.apache.ojb.broker.core.PersistenceBrokerImpl;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.core.PersistenceBrokerImpl;
  -import org.apache.ojb.broker.accesslayer.RsIterator;
   
   
   /**
  @@ -16,12 +17,15 @@
    * @author Thomas Mahler
    */
   public class LogServiceTest
  -    extends TestCase
  +        extends TestCase
   {
  +    public static void main(String[] args)
  +    {
  +        String[] arr = {LogServiceTest.class.getName()};
  +        junit.textui.TestRunner.main(arr);
  +    }
   
  -//     PersistenceBroker broker;
  -
  -    public  LogServiceTest(String name)
  +    public LogServiceTest(String name)
   
       {
           super(name);
  @@ -36,9 +40,9 @@
       }
   
   
  -    public void testLogggers()
  +    public void testLogggers() throws Exception
       {
  -        String prefix = "testLogggers: ";
  +        String prefix = "Ignore this!! LOGGING TEST OUTPUT: ";
           Logger pbroker = LoggerFactory.getLogger(PersistenceBrokerImpl.class);
           Logger rsiterator = LoggerFactory.getLogger(RsIterator.class);
           Logger boot = LoggerFactory.getBootLogger();
  @@ -46,15 +50,16 @@
           pbroker = LoggerFactory.getLogger(PersistenceBrokerImpl.class);
           rsiterator = LoggerFactory.getLogger(RsIterator.class);
   
  -        pbroker.debug(prefix + "This should NOT be logged BROKER");
  -        pbroker.warn(prefix + "This should be logged BROKER");
  -
  -        rsiterator.debug(prefix + "This should NOT be logged RSIT");
  -        rsiterator.warn(prefix + "This should be logged RSIT");
  -
  -        boot.debug(prefix + "This should NOT be logged BOOT");
  -        boot.warn(prefix + "This should be logged BOOT");
  -
  +        pbroker.debug(prefix + "Should be with DEBUG level");
  +        pbroker.info(prefix + "Should be with INFO level");
  +        pbroker.warn(prefix + "Should be with WARN level");
  +
  +        rsiterator.debug(prefix + "Should be with DEBUG level");
  +        rsiterator.info(prefix + "Should be with INFO level");
  +        rsiterator.warn(prefix + "Should be with WARN level");
  +
  +        boot.debug(prefix + "Should be with DEBUG level");
  +        boot.info(prefix + "Should be with INFO level");
  +        boot.warn(prefix + "Should be with WARN level");
       }
  -
   }
  
  
  
  1.3       +27 -0     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BatchModeTest.java	10 Mar 2003 06:07:20 -0000	1.2
  +++ BatchModeTest.java	26 Oct 2003 17:18:33 -0000	1.3
  @@ -13,6 +13,11 @@
   
   import org.apache.ojb.broker.accesslayer.ConnectionManagerIF;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  +import org.apache.ojb.broker.query.QueryFactory;
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.Criteria;
  +
  +import java.util.Collection;
   
   /**
    * @author Oleg Nitz
  @@ -129,5 +134,27 @@
               broker.commitTransaction();
               conMan.setBatchMode(saveBatchMode);
           }
  +    }
  +
  +    public void testMassInsert()
  +    {
  +        String name = "testMassInsert_" + System.currentTimeMillis();
  +
  +        broker.serviceConnectionManager().setBatchMode(true);
  +        broker.beginTransaction();
  +        for (int i = 200 - 1; i >= 0; i--)
  +        {
  +            Person p = new Person();
  +            p.setFirstname("a mass test");
  +            p.setLastname(name);
  +            broker.store(p);
  +        }
  +        broker.commitTransaction();
  +
  +        Criteria crit = new Criteria();
  +        crit.addLike("lastname", name);
  +        Query q = QueryFactory.newQuery(Person.class, crit);
  +        Collection result = broker.getCollectionByQuery(q);
  +        assertEquals(200, result.size());
       }
   }
  
  
  
  1.36      +50 -56    db-ojb/src/test/org/apache/ojb/broker/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AllTests.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- AllTests.java	5 Sep 2003 14:45:55 -0000	1.35
  +++ AllTests.java	26 Oct 2003 17:18:33 -0000	1.36
  @@ -18,18 +18,12 @@
    */
   public class AllTests extends junit.framework.TestSuite
   {
  -    /** static reference to .class.
  -     * Java does not provide any way to obtain the Class object from
  -     * static method without naming it.
  -     */
  -    private static Class CLASS = AllTests.class;
  -
       /**
        * runs the suite in a junit.textui.TestRunner.
        */
       public static void main(String[] args)
       {
  -        String[] arr = {CLASS.getName()};
  +        String[] arr = {AllTests.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  @@ -37,55 +31,55 @@
       public static Test suite()
       {
           TestSuite suite = new TestSuite();
  -        suite.addTest(new TestSuite(QueryTest.class));
  -        suite.addTest(new TestSuite(PersistenceBrokerTest.class));
  -        suite.addTest(new TestSuite(BrokerExamples.class));
  -        suite.addTest(new TestSuite(ProxyExamples.class));
  -        suite.addTest(new TestSuite(PolymorphicExtents.class));
  -        suite.addTest(new TestSuite(TreeTest.class));
  -        suite.addTest(new TestSuite(TypedCollectionsTest.class));
  -        suite.addTest(new TestSuite(MtoNMapping.class));
  -        suite.addTest(new TestSuite(AutomaticForeignKeys.class));
  -        suite.addTest(new TestSuite(OptimisticLockingTest.class));
  -        suite.addTest(new TestSuite(GraphTest.class));
  -        suite.addTest(new TestSuite(PBListenerTest.class));
  -        suite.addTest(new TestSuite(ContractVersionEffectivenessTest.class));
  -        suite.addTest(new TestSuite(ComplexMultiMappedTableTest.class));
  -        suite.addTest(new TestSuite(ComplexMultiMappedTableWithCollectionByQueryTest.class));
  -        suite.addTest(new TestSuite(BidirectionalAssociationTest.class));
  -        suite.addTest(new TestSuite(AutoIncrementWithRelatedObjectTest.class));
  -        suite.addTest(new TestSuite(OneToManyTest.class));
  -        suite.addTest(new TestSuite(PBRollbackTest.class));
  -        suite.addTest(new TestSuite(TransactionDemarcationTest.class));
  -        suite.addTest(new TestSuite(MultipleDBTest.class));
  -        suite.addTest(new TestSuite(RepositoryPersistorTest.class));
  -        suite.addTest(new TestSuite(CustomAttributesTest.class));
  -        suite.addTest(new TestSuite(SequenceManagerTest.class));
  -        suite.addTest(new TestSuite(SMMultiThreadedTest.class));
  -        suite.addTest(new TestSuite(KeyConstraintViolationTest.class));
  -        suite.addTest(new TestSuite(RsIteratorTest.class));
  -        // suite.addTest(new TestSuite(BlobTest.class)); /* doesn't work for hsqldb */
  -        suite.addTest(new TestSuite(LogServiceTest.class));
  -        suite.addTest(new TestSuite(ManyToManyTest.class));
  -        suite.addTest(new TestSuite(OneToOneTest.class));
  -        suite.addTest(new TestSuite(MetaDataSerializationTest.class));
  -        suite.addTest(new TestSuite(MetadataTest.class));
  -        suite.addTest(new TestSuite(MetadataMultithreadedTest.class));
  -        suite.addTest(new TestSuite(FieldConversionTest.class));
  -        suite.addTest(new TestSuite(FieldConversionTest_2.class));
  -        suite.addTest(new TestSuite(FieldConversionTest_3.class));
  -        suite.addTest(new TestSuite(BatchModeTest.class));
  -        suite.addTest(new TestSuite(ObjectCacheTest.class));
  -        suite.addTest(new TestSuite(ReferenceTest.class));
  -        suite.addTest(new TestSuite(ExtentAwarePathExpressionsTest.class));
  -        suite.addTest(new TestSuite(MultipleTableExtentAwareQueryTest.class));
  -        suite.addTest(new TestSuite(RepositoryElementsTest.class));
  -        suite.addTest(new TestSuite(ConnectionFactoryTest.class));
  -        suite.addTest(new TestSuite(NativeIdentifierTest.class));
  -        suite.addTest(new TestSuite(AnonymousFieldsTest.class));
  -        suite.addTest(new TestSuite(AbstractExtentClassTest.class));
  -        suite.addTest(new TestSuite(MtoNTest.class));
  -        suite.addTest(new TestSuite(NestedFieldsTest.class));
  +        suite.addTestSuite(QueryTest.class);
  +        suite.addTestSuite(PersistenceBrokerTest.class);
  +        suite.addTestSuite(BrokerExamples.class);
  +        suite.addTestSuite(ProxyExamples.class);
  +        suite.addTestSuite(PolymorphicExtents.class);
  +        suite.addTestSuite(TreeTest.class);
  +        suite.addTestSuite(TypedCollectionsTest.class);
  +        suite.addTestSuite(MtoNMapping.class);
  +        suite.addTestSuite(AutomaticForeignKeys.class);
  +        suite.addTestSuite(OptimisticLockingTest.class);
  +        suite.addTestSuite(GraphTest.class);
  +        suite.addTestSuite(PBListenerTest.class);
  +        suite.addTestSuite(ContractVersionEffectivenessTest.class);
  +        suite.addTestSuite(ComplexMultiMappedTableTest.class);
  +        suite.addTestSuite(ComplexMultiMappedTableWithCollectionByQueryTest.class);
  +        suite.addTestSuite(BidirectionalAssociationTest.class);
  +        suite.addTestSuite(AutoIncrementWithRelatedObjectTest.class);
  +        suite.addTestSuite(OneToManyTest.class);
  +        suite.addTestSuite(PBRollbackTest.class);
  +        suite.addTestSuite(TransactionDemarcationTest.class);
  +        suite.addTestSuite(MultipleDBTest.class);
  +        suite.addTestSuite(RepositoryPersistorTest.class);
  +        suite.addTestSuite(CustomAttributesTest.class);
  +        suite.addTestSuite(SequenceManagerTest.class);
  +        suite.addTestSuite(SMMultiThreadedTest.class);
  +        suite.addTestSuite(KeyConstraintViolationTest.class);
  +        suite.addTestSuite(RsIteratorTest.class);
  +        // suite.addTestSuite(BlobTest.class); /* doesn't work for hsqldb */
  +        suite.addTestSuite(LogServiceTest.class);
  +        suite.addTestSuite(ManyToManyTest.class);
  +        suite.addTestSuite(OneToOneTest.class);
  +        suite.addTestSuite(MetaDataSerializationTest.class);
  +        suite.addTestSuite(MetadataTest.class);
  +        suite.addTestSuite(MetadataMultithreadedTest.class);
  +        suite.addTestSuite(FieldConversionTest.class);
  +        suite.addTestSuite(FieldConversionTest_2.class);
  +        suite.addTestSuite(FieldConversionTest_3.class);
  +        suite.addTestSuite(BatchModeTest.class);
  +        suite.addTestSuite(ObjectCacheTest.class);
  +        suite.addTestSuite(ReferenceTest.class);
  +        suite.addTestSuite(ExtentAwarePathExpressionsTest.class);
  +        suite.addTestSuite(MultipleTableExtentAwareQueryTest.class);
  +        suite.addTestSuite(RepositoryElementsTest.class);
  +        suite.addTestSuite(ConnectionFactoryTest.class);
  +        suite.addTestSuite(NativeIdentifierTest.class);
  +        suite.addTestSuite(AnonymousFieldsTest.class);
  +        suite.addTestSuite(AbstractExtentClassTest.class);
  +        suite.addTestSuite(MtoNTest.class);
  +        suite.addTestSuite(NestedFieldsTest.class);
           return suite;
       }
   
  
  
  

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