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 AnonymousFieldsTest.java
Date Sun, 25 Sep 2005 01:45:48 GMT
arminw      2005/09/24 18:45:48

  Modified:    src/test/org/apache/ojb/broker AnonymousFieldsTest.java
  Log:
  add new tests to show issue with super-reference classes
  
  Revision  Changes    Path
  1.20      +87 -4     db-ojb/src/test/org/apache/ojb/broker/AnonymousFieldsTest.java
  
  Index: AnonymousFieldsTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AnonymousFieldsTest.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- AnonymousFieldsTest.java	18 Sep 2005 13:07:34 -0000	1.19
  +++ AnonymousFieldsTest.java	25 Sep 2005 01:45:48 -0000	1.20
  @@ -671,7 +671,23 @@
       /**
        * Query Attribute of Super class E-F
        */
  -    public void testQuerySuperField()
  +    public void testQuerySuperField_WithCache()
  +    {
  +        doTestQuerySuperField(false);
  +    }
  +
  +    /**
  +     * Query Attribute of Super class E-F
  +     */
  +    public void testQuerySuperField_ClearedCache()
  +    {
  +        doTestQuerySuperField(true);
  +    }
  +
  +    /**
  +     * Query Attribute of Super class E-F
  +     */
  +    public void doTestQuerySuperField(boolean clearCache)
       {
           int data1 = (int) (Math.random() * Integer.MAX_VALUE);
           int data2 = (int) (Math.random() * Integer.MAX_VALUE);
  @@ -695,7 +711,8 @@
   
           broker.commitTransaction();
   
  -        broker.clearCache();
  +        if(clearCache) broker.clearCache();
  +
           Criteria c = new Criteria();
           c.addEqualTo("someSuperValue", new Integer(data2));
           Query q = QueryFactory.newQuery(ObjectRepository.F.class, c);
  @@ -709,7 +726,23 @@
       /**
        * Query Attribute of Super class E-F-G
        */
  -    public void testQuerySuperField2()
  +    public void testQuerySuperField_2_WithCache()
  +    {
  +        doTestQuerySuperField_2(false);
  +    }
  +
  +    /**
  +     * Query Attribute of Super class E-F-G
  +     */
  +    public void testQuerySuperField_2_ClearedCache()
  +    {
  +        doTestQuerySuperField_2(true);
  +    }
  +
  +    /**
  +     * Query Attribute of Super class E-F-G
  +     */
  +    public void doTestQuerySuperField_2(boolean clearCache)
       {
           int data1 = (int) (Math.random() * Integer.MAX_VALUE);
           int data2 = (int) (Math.random() * Integer.MAX_VALUE);
  @@ -734,7 +767,7 @@
           broker.store(g3);
           broker.commitTransaction();
   
  -        broker.clearCache();
  +        if(clearCache) broker.clearCache();
           Criteria c = new Criteria();
           c.addEqualTo("someSuperValue", new Integer(data2));
           Query q = QueryFactory.newQuery(ObjectRepository.G.class, c);
  @@ -754,6 +787,7 @@
           broker.beginTransaction();
           broker.store(entry);
           broker.commitTransaction();
  +
           Integer id = entry.getId();
           broker.clearCache();
           entry = (F1) findById(ObjectRepository.F1.class, id.intValue());
  @@ -762,6 +796,55 @@
           assertEquals(2, entry.getSomeValue());
       }
   
  +    public void testMultipleJoinedInheritanceAndExtentsWithCache()
  +    {
  +        ObjectRepository.F1 entry = new ObjectRepository.F1();
  +        entry.setSomeSuperValue(1);
  +        entry.setSomeValue(2);
  +        broker.beginTransaction();
  +        broker.store(entry);
  +        broker.commitTransaction();
  +
  +        Integer id = entry.getId();
  +        entry = (F1) findById(ObjectRepository.F1.class, id.intValue());
  +        assertEquals(id, entry.getId());
  +        assertEquals(1, entry.getSomeSuperValue());
  +        assertEquals(2, entry.getSomeValue());
  +    }
  +
  +    public void testMultipleJoinedInheritanceAndExtents_2()
  +    {
  +        ObjectRepository.F1 entry = new ObjectRepository.F1();
  +        entry.setSomeSuperValue(1);
  +        entry.setSomeValue(2);
  +        broker.beginTransaction();
  +        broker.store(entry);
  +        broker.commitTransaction();
  +
  +        Integer id = entry.getId();
  +        broker.clearCache();
  +        entry = (F1) findById(ObjectRepository.E.class, id.intValue());
  +        assertEquals(id, entry.getId());
  +        assertEquals(1, entry.getSomeSuperValue());
  +        assertEquals(2, entry.getSomeValue());
  +    }
  +
  +    public void testMultipleJoinedInheritanceAndExtents_2_WithCache()
  +    {
  +        ObjectRepository.F1 entry = new ObjectRepository.F1();
  +        entry.setSomeSuperValue(1);
  +        entry.setSomeValue(2);
  +        broker.beginTransaction();
  +        broker.store(entry);
  +        broker.commitTransaction();
  +
  +        Integer id = entry.getId();
  +        entry = (F1) findById(ObjectRepository.E.class, id.intValue());
  +        assertEquals(id, entry.getId());
  +        assertEquals(1, entry.getSomeSuperValue());
  +        assertEquals(2, entry.getSomeValue());
  +    }
  +
   
       // --------------------------------------------------------------------------------------
       // Utiltity methods.
  
  
  

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