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 InheritanceMultipleTableTest.java
Date Sun, 14 Aug 2005 15:50:00 GMT
arminw      2005/08/14 08:50:00

  Modified:    src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        InheritanceMultipleTableTest.java
  Log:
  add test to check backward compatibility of new "super"-reference handling
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.7.2.11  +47 -1     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.7.2.10
  retrieving revision 1.7.2.11
  diff -u -r1.7.2.10 -r1.7.2.11
  --- InheritanceMultipleTableTest.java	8 Aug 2005 13:18:48 -0000	1.7.2.10
  +++ InheritanceMultipleTableTest.java	14 Aug 2005 15:50:00 -0000	1.7.2.11
  @@ -1008,6 +1008,52 @@
           assertNull(newM1);
       }
   
  +    /**
  +     * Check backward compatibility with 'old' super-reference handling using explicite
  +     * anonymous field for FK to super class/table.
  +     */
  +    public void testInheritanceViaAnonymousField()
  +    {
  +        ObjectRepository.G obj_1 = new ObjectRepository.G();
  +        obj_1.setSomeValue(1);
  +        obj_1.setSomeSuperValue(2);
  +        obj_1.setSomeSubValue(3);
  +
  +        broker.beginTransaction();
  +        broker.store(obj_1);
  +        broker.commitTransaction();
  +
  +        Identity oid = broker.serviceIdentity().buildIdentity(obj_1);
  +        broker.clearCache();
  +
  +        ObjectRepository.G obj_2 = (ObjectRepository.G) broker.getObjectByIdentity(oid);
  +        assertEquals(obj_1.getId(), obj_2.getId());
  +        assertEquals(obj_1.getSomeSubValue(), obj_2.getSomeSubValue());
  +        assertEquals(obj_1.getSomeSuperValue(), obj_2.getSomeSuperValue());
  +        assertEquals(obj_1.getSomeValue(), obj_2.getSomeValue());
  +
  +        broker.beginTransaction();
  +        obj_1.setSomeValue(11);
  +        obj_1.setSomeSuperValue(22);
  +        obj_1.setSomeSubValue(33);
  +        broker.store(obj_1);
  +        broker.commitTransaction();
  +
  +        broker.clearCache();
  +
  +        ObjectRepository.G obj_3 = (ObjectRepository.G) broker.getObjectByIdentity(oid);
  +        assertEquals(obj_1.getId(), obj_3.getId());
  +        assertEquals(obj_1.getSomeSubValue(), obj_3.getSomeSubValue());
  +        assertEquals(obj_1.getSomeSuperValue(), obj_3.getSomeSuperValue());
  +        assertEquals(obj_1.getSomeValue(), obj_3.getSomeValue());
  +
  +        assertEquals(obj_2.getId(), obj_3.getId());
  +        assertFalse(obj_2.getSomeSubValue() == obj_3.getSomeSubValue());
  +        assertFalse(obj_2.getSomeSuperValue() == obj_3.getSomeSuperValue());
  +        assertFalse(obj_2.getSomeValue() == obj_3.getSomeValue());
  +    }
  +
  +
       //************************************************************
       // inner classes used for test
       //************************************************************
  
  
  

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