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/schema ojbtest-schema.xml
Date Sun, 19 Oct 2003 16:38:29 GMT
arminw      2003/10/19 09:38:29

  Modified:    src/test/org/apache/ojb repository_junit.xml
               src/test/org/apache/ojb/broker ReferenceTest.java
               src/schema ojbtest-schema.xml
  Log:
  fix bug in test case, thanks Jakob
  
  Revision  Changes    Path
  1.97      +20 -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.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- repository_junit.xml	17 Oct 2003 14:12:55 -0000	1.96
  +++ repository_junit.xml	19 Oct 2003 16:38:28 -0000	1.97
  @@ -3725,6 +3725,7 @@
   <!-- ************************************************* -->
   
       <class-descriptor class="org.apache.ojb.broker.ReferenceTest$ReferenceIF">
  +        <extent-class class-ref="org.apache.ojb.broker.ReferenceTest$Reference" />
           <extent-class class-ref="org.apache.ojb.broker.ReferenceTest$ReferenceA" />
           <extent-class class-ref="org.apache.ojb.broker.ReferenceTest$ReferenceB" />
       </class-descriptor>
  @@ -3993,6 +3994,12 @@
            column="NAME"
            jdbc-type="VARCHAR"
           />
  +
  +        <field-descriptor
  +         name="ojbConcreteClass"
  +         column="OJB_CONCRETE_CLASS"
  +         jdbc-type="VARCHAR"
  +        />
       </class-descriptor>
   
       <class-descriptor
  @@ -4014,6 +4021,12 @@
           />
   
           <field-descriptor
  +         name="ojbConcreteClass"
  +         column="OJB_CONCRETE_CLASS"
  +         jdbc-type="VARCHAR"
  +        />
  +
  +        <field-descriptor
            name="refNameA"
            column="REF_NAME_A"
            jdbc-type="VARCHAR"
  @@ -4035,6 +4048,12 @@
           <field-descriptor
            name="name"
            column="NAME"
  +         jdbc-type="VARCHAR"
  +        />
  +
  +        <field-descriptor
  +         name="ojbConcreteClass"
  +         column="OJB_CONCRETE_CLASS"
            jdbc-type="VARCHAR"
           />
   
  
  
  
  1.7       +44 -9     db-ojb/src/test/org/apache/ojb/broker/ReferenceTest.java
  
  Index: ReferenceTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/ReferenceTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ReferenceTest.java	22 Aug 2003 21:37:48 -0000	1.6
  +++ ReferenceTest.java	19 Oct 2003 16:38:29 -0000	1.7
  @@ -50,9 +50,9 @@
           }
       }
   
  -    public void testReferenceStore()
  +    public void testStoreReferencesMappedToSameTable()
       {
  -        String referenceNamePrefix = "testReferenceStore"+System.currentTimeMillis();
  +        String referenceNamePrefix = "testStoreReferencesMappedToSameTable"+System.currentTimeMillis();
           Repository[] repository = prepareRepository(referenceNamePrefix);
   
           broker.beginTransaction();
  @@ -68,9 +68,9 @@
           assertEquals(repository[0].getRefB().getRefNameB(), REF_TEST_STRING);
       }
   
  -    public void testReferenceGetByIdentity()
  +    public void testGetReferencesByIdentityMappedToSameTable()
       {
  -        String referenceNamePrefix = "testReferenceGetByIdentity"+System.currentTimeMillis();
  +        String referenceNamePrefix = "testGetReferencesByIdentityMappedToSameTable"+System.currentTimeMillis();
           Repository[] repository = prepareRepository(referenceNamePrefix);
   
           broker.beginTransaction();
  @@ -105,9 +105,9 @@
           assertEquals(refB.getRefNameB(), REF_TEST_STRING);
       }
   
  -    public void testQueryReferences()
  +    public void testQueryReferencesMappedToSameTable()
       {
  -        String referenceNamePrefix = "testQueryReferences"+System.currentTimeMillis();
  +        String referenceNamePrefix = "testQueryReferencesMappedToSameTable"+System.currentTimeMillis();
           Repository[] repository = prepareRepository(referenceNamePrefix);
   
           broker.beginTransaction();
  @@ -116,6 +116,7 @@
           broker.store(repository[2]);
           broker.commitTransaction();
   
  +        broker.clearCache();
           Criteria criteria = new Criteria();
           criteria.addLike("name", referenceNamePrefix+"%");
           Query query = QueryFactory.newQuery(ReferenceIF.class, criteria);
  @@ -137,11 +138,32 @@
           assertEquals("Wrong number of RefernceA", 3, refA_count);
           assertEquals("Wrong number of RefernceB", 3, refB_count);
           assertEquals("Wrong number of Refernce", 3, ref_count);
  +
  +        result = broker.getCollectionByQuery(query);
  +        it = result.iterator();
  +        while(it.hasNext())
  +        {
  +            obj = it.next();
  +            if(obj instanceof ReferenceA)
  +            {
  +                assertNotNull(((ReferenceA) obj).getRefNameA());
  +                assertNotNull(((ReferenceA) obj).getName());
  +            }
  +            else if(obj instanceof ReferenceB)
  +            {
  +                assertNotNull(((ReferenceB) obj).getRefNameB());
  +                assertNotNull(((ReferenceB) obj).getName());
  +            }
  +            else if(obj instanceof Reference)
  +            {
  +                assertNotNull(((Reference) obj).getName());
  +            }
  +        }
       }
   
  -    public void testDeleteReferences()
  +    public void testDeleteReferencesMappedToSameTable()
       {
  -        String referenceNamePrefix = "testDeleteReferences"+System.currentTimeMillis();
  +        String referenceNamePrefix = "testDeleteReferencesMappedToSameTable"+System.currentTimeMillis();
           Repository[] repository = prepareRepository(referenceNamePrefix);
   
           broker.beginTransaction();
  @@ -718,16 +740,29 @@
   
       public static class Reference implements ReferenceIF
       {
  +        protected String ojbConcreteClass;
           private Integer refId;
           private String name;
   
           public Reference()
           {
  +            this(null);
           }
   
           public Reference(String name)
           {
               this.name = name;
  +            ojbConcreteClass = this.getClass().getName();
  +        }
  +
  +        public String getOjbConcreteClass()
  +        {
  +            return ojbConcreteClass;
  +        }
  +
  +        public void setOjbConcreteClass(String ojbConcreteClass)
  +        {
  +            this.ojbConcreteClass = ojbConcreteClass;
           }
   
           public Integer getRefId()
  
  
  
  1.55      +1 -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.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- ojbtest-schema.xml	17 Oct 2003 14:12:55 -0000	1.54
  +++ ojbtest-schema.xml	19 Oct 2003 16:38:29 -0000	1.55
  @@ -704,6 +704,7 @@
       <table name="REF_REFERENCE">
           <column name="REF_ID" required="true" primaryKey="true" type="INTEGER"/>
           <column name="NAME" type="VARCHAR" size="100"/>
  +        <column name="OJB_CONCRETE_CLASS" type="VARCHAR" size="100"/>
           <column name="REF_NAME_A" type="VARCHAR" size="100"/>
           <column name="REF_NAME_B" type="VARCHAR" size="100"/>
       </table>
  
  
  

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