db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mka...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/junit PBTestCase.java
Date Wed, 23 Feb 2005 20:37:09 GMT
mkalen      2005/02/23 12:37:09

  Modified:    src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        OptimisticLockingTest.java
               src/test/org/apache/ojb/junit Tag: OJB_1_0_RELEASE
                        PBTestCase.java
  Log:
  Make assertion for Oracle and optimistic locking with TIMESTAMP a known failing issue, since
Torque is generating DATE in the DDL for ojb testdb (and thus the lock values read from db
are truncated to second precision).
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.10.2.3  +10 -0     db-ojb/src/test/org/apache/ojb/broker/OptimisticLockingTest.java
  
  Index: OptimisticLockingTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/OptimisticLockingTest.java,v
  retrieving revision 1.10.2.2
  retrieving revision 1.10.2.3
  diff -u -r1.10.2.2 -r1.10.2.3
  --- OptimisticLockingTest.java	19 Nov 2004 00:01:57 -0000	1.10.2.2
  +++ OptimisticLockingTest.java	23 Feb 2005 20:37:08 -0000	1.10.2.3
  @@ -7,6 +7,10 @@
    */
   public class OptimisticLockingTest extends PBTestCase
   {
  +    private static final String ORACLE_TORQUE_TIMETSAMP =
  +            "TODO: Resolv if we can get Torque to generate proper TIMESTAMP" +
  +            " columns instead of DATE (NB: TIMESTAMP is introduced in Orcale 9).";
  +
   	public static void main(String[] args)
   	{
   		String[] arr = {OptimisticLockingTest.class.getName()};
  @@ -151,6 +155,12 @@
               broker.beginTransaction();
               broker.store(copy2);
               broker.commitTransaction();
  +
  +            if (getPlatformClass().startsWith("org.apache.ojb.broker.platforms.PlatformOracle")
  +                && ojbSkipKnownIssueProblem(ORACLE_TORQUE_TIMETSAMP))
  +            {
  +                    return;
  +            }
               fail("Should throw an Optimistic Lock exception");
           }
           catch (OptimisticLockException ex)
  
  
  
  No                   revision
  No                   revision
  1.3.2.1   +19 -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.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PBTestCase.java	22 Jun 2004 18:16:22 -0000	1.3
  +++ PBTestCase.java	23 Feb 2005 20:37:08 -0000	1.3.2.1
  @@ -2,6 +2,7 @@
   
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.platforms.Platform;
   
   /**
    * A base class for PB-api based test cases.
  @@ -13,6 +14,7 @@
   public class PBTestCase extends OJBTestCase
   {
       public PersistenceBroker broker;
  +    private String platformClass;
   
       public PBTestCase()
       {
  @@ -25,8 +27,12 @@
   
       public void setUp() throws Exception
       {
  +        Platform platform;
  +
           super.setUp();
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  +        assertNotNull(broker = PersistenceBrokerFactory.defaultPersistenceBroker());
  +        assertNotNull(platform = broker.serviceConnectionManager().getSupportedPlatform());
  +        platformClass = platform.getClass().getName();
       }
   
       public void tearDown() throws Exception
  @@ -37,4 +43,15 @@
               broker.close();
           }
       }
  +
  +    /**
  +     * Returns the platform implementation class name of the currently
  +     * used broker.
  +     * @return platform implementation class name
  +     */
  +    public String getPlatformClass()
  +    {
  +        return platformClass;
  +    }
  +
   }
  
  
  

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