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/java/org/apache/ojb/broker/metadata ObjectReferenceDescriptor.java
Date Tue, 10 Jun 2003 06:19:24 GMT
thma        2003/06/09 23:19:24

  Modified:    src/schema ojbtest-schema.xml
               src/test/org/apache/ojb/broker F.java E.java
               src/java/org/apache/ojb/broker/metadata/fieldaccess
                        AnonymousPersistentField.java
               src/test/org/apache/ojb/quick-db OJB.properties OJB.script
               src/test/org/apache/ojb repository_junit.xml
               src/java/org/apache/ojb/broker/metadata
                        ObjectReferenceDescriptor.java
  Added:       src/test/org/apache/ojb/broker AnonymousFieldsTest.java
  Log:
  prepare testcases for anonymous fields and vertical inheritance
  
  Revision  Changes    Path
  1.36      +11 -0     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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- ojbtest-schema.xml	30 May 2003 10:25:08 -0000	1.35
  +++ ojbtest-schema.xml	10 Jun 2003 06:19:23 -0000	1.36
  @@ -700,4 +700,15 @@
           <column name="RO_LONG" type="DECIMAL"/>
       </table>
   
  +    <table name="TABLE_E">
  +        <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="SOMESUPERVALUE" type="INTEGER" />
  +    </table>
  +
  +    <table name="TABLE_F">
  +        <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="E_ID" required="true" type="INTEGER"/>
  +        <column name="SOMEVALUE" type="INTEGER" />
  +    </table>
  +
   </database>
  
  
  
  1.2       +11 -2     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- F.java	9 Nov 2002 00:53:39 -0000	1.1
  +++ F.java	10 Jun 2003 06:19:23 -0000	1.2
  @@ -11,10 +11,19 @@
   
   public class F extends E implements Serializable
   {
  -
  -
  +    int id;
  +    
       int someValue;
   
  +    public int getId()
  +    {
  +        return id;
  +    }
  +
  +    public void setId(int id)
  +    {
  +        this.id = id;
  +    }
   
     
       public int getSomeValue()
  
  
  
  1.2       +1 -1      db-ojb/src/test/org/apache/ojb/broker/E.java
  
  Index: E.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/E.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- E.java	9 Nov 2002 00:53:39 -0000	1.1
  +++ E.java	10 Jun 2003 06:19:23 -0000	1.2
  @@ -14,7 +14,7 @@
   
       int id;
   
  -    int someSuperValue;
  +    protected int someSuperValue;
   
   
       public int getId()
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/AnonymousFieldsTest.java
  
  Index: AnonymousFieldsTest.java
  ===================================================================
  package org.apache.ojb.broker;
  
  import junit.framework.TestCase;
  
  /**
   * This TestClass tests the anonymous fields feature.
   */
  public class AnonymousFieldsTest extends TestCase
  {
      public static void main(String[] args)
      {
          String[] arr = {AnonymousFieldsTest.class.getName()};
          junit.textui.TestRunner.main(arr);
      }
  
      private PersistenceBroker broker;
  
      /**
       * Insert the method's description here.
       * Creation date: (24.12.2000 00:33:40)
       */
      public AnonymousFieldsTest(String name)
      {
          super(name);
      }
  
      /**
       * Insert the method's description here.
       * Creation date: (06.12.2000 21:58:53)
       */
      public void setUp() throws Exception
      {
          broker = PersistenceBrokerFactory.defaultPersistenceBroker();
      }
  
      /**
       * Insert the method's description here.
       * Creation date: (06.12.2000 21:59:14)
       */
      public void tearDown()
      {
          try
          {
              broker.clearCache();
              broker.close();
          }
          catch (PersistenceBrokerException e)
          {
          }
      }
  
  
      /** Test optimistic Lock by timestamp.*/
      public void testInheritanceLoad() throws Exception
      {
  
  
      }
  
  
  }
  
  
  
  1.2       +1 -1      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/AnonymousPersistentField.java
  
  Index: AnonymousPersistentField.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/AnonymousPersistentField.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AnonymousPersistentField.java	26 Mar 2003 10:37:55 -0000	1.1
  +++ AnonymousPersistentField.java	10 Jun 2003 06:19:24 -0000	1.2
  @@ -11,7 +11,7 @@
    */
   
   public class AnonymousPersistentField implements PersistentField {
  -	protected Map fkCache = new WeakHashMap();
  +	protected transient Map fkCache = new WeakHashMap();
   	protected String fieldname;
   
   	public AnonymousPersistentField(String fieldname) {
  
  
  
  1.20      +1 -1      db-ojb/src/test/org/apache/ojb/quick-db/OJB.properties
  
  Index: OJB.properties
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/quick-db/OJB.properties,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- OJB.properties	2 Jun 2003 15:17:35 -0000	1.19
  +++ OJB.properties	10 Jun 2003 06:19:24 -0000	1.20
  @@ -1,5 +1,5 @@
   #HSQL database
  -#Mon Jun 02 15:13:18 CEST 2003
  +#Mon Jun 09 14:36:51 CEST 2003
   sql.strict_fk=true
   readonly=false
   sql.strong_fk=true
  
  
  
  1.21      +2 -0      db-ojb/src/test/org/apache/ojb/quick-db/OJB.script
  
  Index: OJB.script
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/quick-db/OJB.script,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- OJB.script	2 Jun 2003 15:17:35 -0000	1.20
  +++ OJB.script	10 Jun 2003 06:19:24 -0000	1.21
  @@ -77,6 +77,8 @@
   CREATE TABLE COLLECTION_COLLECTIBLE_A(COL_ID INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(150),GAT_ID
INTEGER)
   CREATE TABLE COLLECTION_COLLECTIBLE_BC(COL_ID INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(150),GAT_ID
INTEGER,EXTENT_NAME VARCHAR(150))
   CREATE TABLE READONLY_TEST(OBJ_ID DECIMAL NOT NULL PRIMARY KEY,NAME VARCHAR(150),RO_STRING
VARCHAR(150),RO_LONG DECIMAL)
  +CREATE TABLE TABLE_E(ID INTEGER NOT NULL PRIMARY KEY,SOMESUPERVALUE INTEGER)
  +CREATE TABLE TABLE_F(ID INTEGER NOT NULL PRIMARY KEY,E_ID INTEGER,SOMEVALUE INTEGER)
   CREATE TABLE OJB_HL_SEQ(TABLENAME VARCHAR(175) NOT NULL,FIELDNAME VARCHAR(70) NOT NULL,MAX_KEY
INTEGER,GRAB_SIZE INTEGER,VERSION INTEGER,CONSTRAINT SYS_PK_OJB_HL_SEQ PRIMARY KEY(TABLENAME,FIELDNAME))
   CREATE TABLE OJB_LOCKENTRY(OID_ VARCHAR(250) NOT NULL,TX_ID VARCHAR(50) NOT NULL,TIMESTAMP_
TIMESTAMP,ISOLATIONLEVEL INTEGER,LOCKTYPE INTEGER,CONSTRAINT SYS_PK_OJB_LOCKENTRY PRIMARY
KEY(OID_,TX_ID))
   CREATE TABLE OJB_NRM(NAME VARCHAR(250) NOT NULL PRIMARY KEY,OID_ LONGVARBINARY)
  
  
  
  1.69      +58 -0     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.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- repository_junit.xml	3 Jun 2003 00:12:48 -0000	1.68
  +++ repository_junit.xml	10 Jun 2003 06:19:24 -0000	1.69
  @@ -4126,6 +4126,64 @@
   	     />
   
       </class-descriptor>
  +    
  +    
  +<!-- mappings for anonymous field testclasses-->
  + <class-descriptor
  +        class="org.apache.ojb.broker.E"
  +        table="TABLE_E">
  +
  +        <field-descriptor
  +            name="id"
  +            column="ID"
  +            jdbc-type="INTEGER"
  +            primarykey="true"
  +            autoincrement="true"
  +        />
  +
  +        <field-descriptor
  +            name="someSuperValue"
  +            column="SOMESUPERVALUE"
  +            jdbc-type="INTEGER"
  +        />
  +
  + </class-descriptor>    
  +
  + <class-descriptor
  +        class="org.apache.ojb.broker.F"
  +        table="TABLE_F">
  +
  +        <field-descriptor
  +            name="id"
  +            column="ID"
  +            jdbc-type="INTEGER"
  +            primarykey="true"
  +            autoincrement="true"
  +        />
  +
  +    	<field-descriptor
  +        	name="eID"
  +        	column="E_ID"
  +        	jdbc-type="INTEGER"
  +        	access="anonymous" 
  +        />
  +
  +        <field-descriptor
  +            name="someValue"
  +            column="SOMEVALUE"
  +            jdbc-type="INTEGER"
  +        />
  + 
  +        
  +  		<reference-descriptor name="this" 
  +  			class-ref="org.apache.ojb.broker.E" 
  +     		auto-retrieve="true" 
  +     		auto-update="true" 
  +     		auto-delete="true">
  +    		<foreignkey field-ref="eID" />
  +  		</reference-descriptor>
  +
  +    </class-descriptor>    
   
   
   <!-- Mapping of classes used in junit tests and tutorials ends here -->
  
  
  
  1.26      +6 -1      db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
  
  Index: ObjectReferenceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ObjectReferenceDescriptor.java	13 May 2003 07:56:24 -0000	1.25
  +++ ObjectReferenceDescriptor.java	10 Jun 2003 06:19:24 -0000	1.26
  @@ -368,7 +368,12 @@
   
           // attributes
           // name
  -        result += "        " + tags.getAttribute(FIELD_NAME, this.getAttributeName()) +
eol;
  +        String name = this.getAttributeName();
  +        if (name == null)
  +        {
  +        	name = "this";
  +        }
  +        result += "        " + tags.getAttribute(FIELD_NAME, name) + eol;
   
           // class-ref
           result += "        " + tags.getAttribute(REFERENCED_CLASS, this.getItemClassName())
+ eol;
  
  
  

Mime
View raw message