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 mk...@apache.org on 2005/03/02 16:57:26 UTC

cvs commit: db-ojb/src/test/org/apache/ojb repository_junit.xml

mkalen      2005/03/02 07:57:26

  Modified:    src/schema Tag: OJB_1_0_RELEASE ojbtest-schema.xml
               src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        AllTests.java
               src/test/org/apache/ojb/junit Tag: OJB_1_0_RELEASE
                        PBTestCase.java
               src/test/org/apache/ojb Tag: OJB_1_0_RELEASE
                        repository_junit.xml
  Added:       src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        CharacterTest.java
  Log:
  New PB-API testcase broker.CharacterTest to prove ClassCastExceptions in Oracle JDBC-driver when using default platform impl rs.setObject() and java.lang.Character. Passes with hsqldb, fails with Oracle9i.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.80.2.11 +9 -1      db-ojb/src/schema/ojbtest-schema.xml
  
  Index: ojbtest-schema.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-schema.xml,v
  retrieving revision 1.80.2.10
  retrieving revision 1.80.2.11
  diff -u -r1.80.2.10 -r1.80.2.11
  --- ojbtest-schema.xml	25 Feb 2005 21:00:19 -0000	1.80.2.10
  +++ ojbtest-schema.xml	2 Mar 2005 15:57:26 -0000	1.80.2.11
  @@ -207,6 +207,14 @@
       <column name="CLOB_VALUE_" type="CLOB"/>
     </table>
   
  +  <table name="CHARACTER_TEST">
  +    <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
  +    <column name="CHAR_1" type="CHAR" size="1" />
  +    <column name="CHAR_10" type="CHAR" size="10" />
  +    <column name="VARCHAR_1" type="VARCHAR" size="1" />
  +    <column name="VARCHAR_10" type="VARCHAR" size="10" />
  +  </table>
  +
     <table name="MDTEST_MASTER">
       <column name="MASTERID" required="true" primaryKey="true" type="INTEGER"/>
       <column name="MASTER_TEXT" type="VARCHAR" size="255"/>
  
  
  
  No                   revision
  No                   revision
  1.49.2.6  +2 -1      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.49.2.5
  retrieving revision 1.49.2.6
  diff -u -r1.49.2.5 -r1.49.2.6
  --- AllTests.java	19 Feb 2005 21:49:55 -0000	1.49.2.5
  +++ AllTests.java	2 Mar 2005 15:57:26 -0000	1.49.2.6
  @@ -17,7 +17,6 @@
   import org.apache.ojb.broker.metadata.MetadataTest;
   import org.apache.ojb.broker.metadata.PersistentFieldTest;
   import org.apache.ojb.broker.metadata.ReadonlyTest;
  -import org.apache.ojb.broker.metadata.ReferenceMapTest;
   import org.apache.ojb.broker.metadata.RepositoryElementsTest;
   import org.apache.ojb.broker.metadata.RepositoryPersistorTest;
   import org.apache.ojb.broker.sequence.AutoIncrementTest;
  @@ -29,6 +28,7 @@
    * the facade to all TestCases in this package.
    *
    * @author Thomas Mahler
  + * @version $Id$
    */
   public class AllTests extends junit.framework.TestSuite
   {
  @@ -73,6 +73,7 @@
           suite.addTestSuite(KeyConstraintViolationTest.class);
           suite.addTestSuite(RsIteratorTest.class);
           suite.addTestSuite(BlobTest.class);
  +        suite.addTestSuite(CharacterTest.class);
           suite.addTestSuite(LogServiceTest.class);
           suite.addTestSuite(MetaDataSerializationTest.class);
           suite.addTestSuite(MetadataTest.class);
  
  
  
  No                   revision
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AllTests.java,v
  retrieving revision 1.49.2.5
  retrieving revision 1.49.2.6
  diff -u -r1.49.2.5 -r1.49.2.6
  --- AllTests.java	19 Feb 2005 21:49:55 -0000	1.49.2.5
  +++ AllTests.java	2 Mar 2005 15:57:26 -0000	1.49.2.6
  @@ -17,7 +17,6 @@
   import org.apache.ojb.broker.metadata.MetadataTest;
   import org.apache.ojb.broker.metadata.PersistentFieldTest;
   import org.apache.ojb.broker.metadata.ReadonlyTest;
  -import org.apache.ojb.broker.metadata.ReferenceMapTest;
   import org.apache.ojb.broker.metadata.RepositoryElementsTest;
   import org.apache.ojb.broker.metadata.RepositoryPersistorTest;
   import org.apache.ojb.broker.sequence.AutoIncrementTest;
  @@ -29,6 +28,7 @@
    * the facade to all TestCases in this package.
    *
    * @author Thomas Mahler
  + * @version $Id$
    */
   public class AllTests extends junit.framework.TestSuite
   {
  @@ -73,6 +73,7 @@
           suite.addTestSuite(KeyConstraintViolationTest.class);
           suite.addTestSuite(RsIteratorTest.class);
           suite.addTestSuite(BlobTest.class);
  +        suite.addTestSuite(CharacterTest.class);
           suite.addTestSuite(LogServiceTest.class);
           suite.addTestSuite(MetaDataSerializationTest.class);
           suite.addTestSuite(MetadataTest.class);
  
  
  
  No                   revision
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AllTests.java,v
  retrieving revision 1.49.2.5
  retrieving revision 1.49.2.6
  diff -u -r1.49.2.5 -r1.49.2.6
  --- AllTests.java	19 Feb 2005 21:49:55 -0000	1.49.2.5
  +++ AllTests.java	2 Mar 2005 15:57:26 -0000	1.49.2.6
  @@ -17,7 +17,6 @@
   import org.apache.ojb.broker.metadata.MetadataTest;
   import org.apache.ojb.broker.metadata.PersistentFieldTest;
   import org.apache.ojb.broker.metadata.ReadonlyTest;
  -import org.apache.ojb.broker.metadata.ReferenceMapTest;
   import org.apache.ojb.broker.metadata.RepositoryElementsTest;
   import org.apache.ojb.broker.metadata.RepositoryPersistorTest;
   import org.apache.ojb.broker.sequence.AutoIncrementTest;
  @@ -29,6 +28,7 @@
    * the facade to all TestCases in this package.
    *
    * @author Thomas Mahler
  + * @version $Id$
    */
   public class AllTests extends junit.framework.TestSuite
   {
  @@ -73,6 +73,7 @@
           suite.addTestSuite(KeyConstraintViolationTest.class);
           suite.addTestSuite(RsIteratorTest.class);
           suite.addTestSuite(BlobTest.class);
  +        suite.addTestSuite(CharacterTest.class);
           suite.addTestSuite(LogServiceTest.class);
           suite.addTestSuite(MetaDataSerializationTest.class);
           suite.addTestSuite(MetadataTest.class);
  
  
  
  1.1.2.1   +231 -0    db-ojb/src/test/org/apache/ojb/broker/Attic/CharacterTest.java
  
  
  
  
  No                   revision
  No                   revision
  1.3.2.2   +58 -1     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.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- PBTestCase.java	23 Feb 2005 20:37:08 -0000	1.3.2.1
  +++ PBTestCase.java	2 Mar 2005 15:57:26 -0000	1.3.2.2
  @@ -1,7 +1,23 @@
   package org.apache.ojb.junit;
   
  +/* Copyright 2002-2004 The Apache Software Foundation
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.platforms.Platform;
   
   /**
  @@ -54,4 +70,45 @@
           return platformClass;
       }
   
  +    /**
  +     * Persists an object with PB-API in a method-local transaction.
  +     * @param obj the object to persist
  +     * @throws org.apache.ojb.broker.TransactionInProgressException
  +     *  if external transaction in progress
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     *  on persistence error
  +     */
  +    public void pbPersist(Object obj)
  +    {
  +        try
  +        {
  +            broker.beginTransaction();
  +            broker.store(obj);
  +            broker.commitTransaction();
  +        }
  +        catch (PersistenceBrokerException pbe)
  +        {
  +            throw pbe;
  +        }
  +        catch (ClassCastException cce)
  +        {
  +            System.err.println("Error in JDBC-driver while storing: " + obj);
  +            throw cce;
  +        }
  +        finally
  +        {
  +            if (broker.isInTransaction())
  +            {
  +                try
  +                {
  +                    broker.abortTransaction();
  +                }
  +                catch (Throwable ignore)
  +                {
  +                    //ignore
  +                }
  +            }
  +        }
  +    }
  +
   }
  
  
  
  No                   revision
  No                   revision
  1.112.2.10 +16 -1     db-ojb/src/test/org/apache/ojb/repository_junit.xml
  
  Index: repository_junit.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit.xml,v
  retrieving revision 1.112.2.9
  retrieving revision 1.112.2.10
  diff -u -r1.112.2.9 -r1.112.2.10
  --- repository_junit.xml	2 Feb 2005 19:52:03 -0000	1.112.2.9
  +++ repository_junit.xml	2 Mar 2005 15:57:26 -0000	1.112.2.10
  @@ -1304,6 +1304,21 @@
         />
      </class-descriptor>
   
  +<!-- Definitions for broker.CharacterTest$ObjectWithCharField -->
  +  <class-descriptor
  +    class="org.apache.ojb.broker.CharacterTest$ObjectWithCharField"
  +    table="CHARACTER_TEST">
  +    <field-descriptor name="id" column="ID"
  +      jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
  +    <field-descriptor name="characterCharField" column="CHAR_1"
  +      jdbc-type="CHAR" length="1"/>
  +    <field-descriptor name="characterVarcharField" column="VARCHAR_1"
  +      jdbc-type="VARCHAR" length="1"/>
  +    <field-descriptor name="stringCharField" column="CHAR_10"
  +      jdbc-type="CHAR" length="10"/>
  +    <field-descriptor name="stringVarcharField" column="VARCHAR_10"
  +      jdbc-type="VARCHAR" length="10"/>
  +  </class-descriptor>
   
   <!-- Definitions for org.apache.ojb.broker.PBAwareEntity -->
      <class-descriptor
  
  
  

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


Re: cvs commit: db-ojb/src/test/org/apache/ojb repository_junit.xml

Posted by Martin Kalén <mk...@apache.org>.
mkalen@apache.org wrote:
> mkalen      2005/03/02 07:57:26
[...]
>   Added:       src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
>                         CharacterTest.java
[...]
>   1.1.2.1   +231 -0    db-ojb/src/test/org/apache/ojb/broker/Attic/CharacterTest.java

Hm... looks like there was a "dead" checkin in trunk because I am 
working on OJB_1_0_RELEASE-branch and added this testcase there.

Hopefully one can revive this file in trunk when merging there.

Was it a bad move to add in branch?
What's our "best practice" here -- any CVS-experts out there?

Regards,
  Martin

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