db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb repository_junit.xml
Date Tue, 10 Jun 2003 20:44:46 GMT
thma        2003/06/10 13:44:46

  Modified:    src/test/org/apache/ojb/broker F.java
                        AnonymousFieldsTest.java AllTests.java
               src/test/org/apache/ojb repository_junit.xml
  Log:
  add testcases for anonymous fields and vertical inheritance
  
  Revision  Changes    Path
  1.3       +7 -0      db-ojb/src/test/org/apache/ojb/broker/F.java
  
  Index: F.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/F.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- F.java	10 Jun 2003 06:19:23 -0000	1.2
  +++ F.java	10 Jun 2003 20:44:45 -0000	1.3
  @@ -9,6 +9,13 @@
   
   import java.io.Serializable;
   
  +/**
  + * important note:
  + * This class uses an anonymous field to hold the foreign key referencing to the parent
table.
  + * thus there is no attribute holding the FK in the class.
  + * There is also no additional coding required to populate the inherited attributes
  + * on loading or persiting an instance of this class.
  + */
   public class F extends E implements Serializable
   {
       int id;
  
  
  
  1.2       +42 -3     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AnonymousFieldsTest.java	10 Jun 2003 06:19:23 -0000	1.1
  +++ AnonymousFieldsTest.java	10 Jun 2003 20:44:45 -0000	1.2
  @@ -50,11 +50,50 @@
       }
   
   
  -    /** Test optimistic Lock by timestamp.*/
  -    public void testInheritanceLoad() throws Exception
  +    /** 
  +     * write an entry using vertical inheritance and try to read it again.
  +     */
  +    public void testVerticalInheritanceStoreAndLoad() throws Exception
       {
  +    	// produce some test data
  +		F entry = new F();
  +		entry.setSomeSuperValue(31415926);
  +		entry.setSomeValue(123456);
  +		Identity oid = new Identity(entry, broker);
  +		broker.store(entry);
  +		
  +		// clear cache and retrieve a copy from the DB
  +		broker.clearCache();		
  +		F copy = (F) broker.getObjectByIdentity(oid);
  +		
  +		// check equality
  +		assertEquals(entry.getSomeValue(), copy.getSomeValue());
  +		assertEquals(entry.getSomeSuperValue(), copy.getSomeSuperValue());
  +    }
   
  -
  +    /** 
  +     * write an entry using vertical inheritance and try to read it again.
  +     */
  +    public void testVerticalInheritanceUpdate() throws Exception
  +    {
  +    	// produce some test data
  +		F entry = new F();
  +		entry.setSomeSuperValue(2718281);
  +		entry.setSomeValue(9999);
  +		Identity oid = new Identity(entry, broker);
  +		broker.store(entry);
  +		
  +		entry.setSomeSuperValue(2718282);
  +		entry.setSomeValue(10000);
  +		broker.store(entry);
  +		
  +		// clear cache and retrieve a copy from the DB
  +		broker.clearCache();		
  +		F copy = (F) broker.getObjectByIdentity(oid);
  +		
  +		// check equality
  +		assertEquals(entry.getSomeValue(), copy.getSomeValue());
  +		assertEquals(entry.getSomeSuperValue(), copy.getSomeSuperValue());
       }
   
   
  
  
  
  1.30      +1 -0      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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- AllTests.java	23 May 2003 16:44:34 -0000	1.29
  +++ AllTests.java	10 Jun 2003 20:44:45 -0000	1.30
  @@ -79,6 +79,7 @@
           suite.addTest(new TestSuite(RepositoryElementsTest.class));
           suite.addTest(new TestSuite(ConnectionFactoryTest.class));
           suite.addTest(new TestSuite(NativeIdentifierTest.class));
  +        suite.addTest(new TestSuite(AnonymousFieldsTest.class));
           return suite;
       }
   
  
  
  
  1.70      +1 -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.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- repository_junit.xml	10 Jun 2003 06:19:24 -0000	1.69
  +++ repository_junit.xml	10 Jun 2003 20:44:46 -0000	1.70
  @@ -4175,7 +4175,7 @@
           />
    
           
  -  		<reference-descriptor name="this" 
  +  		<reference-descriptor name="super" 
     			class-ref="org.apache.ojb.broker.E" 
        		auto-retrieve="true" 
        		auto-update="true" 
  
  
  

Mime
View raw message