db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From baser...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/broker BaseContentImpl.java BaseQualifierImpl.java Category.java Content.java ExtentAwarePathExpressionsTest.java News.java Paper.java Qualifier.java Topic.java AllTests.java
Date Wed, 09 Apr 2003 13:33:32 GMT
baserose    2003/04/09 06:33:32

  Modified:    src/schema ojbtest-data.dtd ojbtest-data.xml
                        ojbtest-schema.xml
               src/test/org/apache/ojb repository_junit.xml
               src/test/org/apache/ojb/broker AllTests.java
  Added:       src/test/org/apache/ojb/broker BaseContentImpl.java
                        BaseQualifierImpl.java Category.java Content.java
                        ExtentAwarePathExpressionsTest.java News.java
                        Paper.java Qualifier.java Topic.java
  Log:
  Adding tests to extent aware path expressions
  This tests are failing right now !
  
  Revision  Changes    Path
  1.8       +39 -3     db-ojb/src/schema/ojbtest-data.dtd
  
  Index: ojbtest-data.dtd
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-data.dtd,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ojbtest-data.dtd	19 Feb 2003 10:37:55 -0000	1.7
  +++ ojbtest-data.dtd	9 Apr 2003 13:33:31 -0000	1.8
  @@ -29,8 +29,13 @@
       SMMaxAAA*,
       SMMaxAB*,
       SMMaxB*,
  -    SMMaxBB*
  -    )>
  +    SMMaxBB*,
  +    News*,
  +    Paper*,
  +    Category*,
  +    Topic*,
  +    ContentQualifier*
  +)>
   <!ATTLIST dataset
       name CDATA #REQUIRED
   >
  @@ -272,4 +277,35 @@
   <!ATTLIST SMMaxBB
     id CDATA #REQUIRED
     name CDATA #IMPLIED
  ->
  \ No newline at end of file
  +>
  +
  +<!ELEMENT News EMPTY>
  +<!ATTLIST News
  +  Id CDATA #REQUIRED
  +  Headline CDATA #IMPLIED
  +>
  +
  +<!ELEMENT Paper EMPTY>
  +<!ATTLIST Paper
  +  Id CDATA #REQUIRED
  +  Date CDATA #IMPLIED
  +  Author CDATA #IMPLIED
  +>
  +
  +<!ELEMENT Category EMPTY>
  +<!ATTLIST Category
  +  Id CDATA #REQUIRED
  +  Name CDATA #IMPLIED
  +>
  +
  +<!ELEMENT Topic EMPTY>
  +<!ATTLIST Topic
  +  Id CDATA #REQUIRED
  +  Name CDATA #IMPLIED
  +>
  +
  +<!ELEMENT ContentQualifier EMPTY>
  +<!ATTLIST ContentQualifier
  +    ContentId CDATA #REQUIRED
  +    QualifierId CDATA #REQUIRED
  +>
  
  
  
  1.8       +25 -7     db-ojb/src/schema/ojbtest-data.xml
  
  Index: ojbtest-data.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-data.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ojbtest-data.xml	19 Feb 2003 10:37:55 -0000	1.7
  +++ ojbtest-data.xml	9 Apr 2003 13:33:31 -0000	1.8
  @@ -110,12 +110,12 @@
       <Person Id="9" Firstname="guido" Lastname="guido"/>
       <Person Id="10" Firstname="hank" Lastname="hank"/>
   
  -    <Project Id="1" Title="OJB" Description="OJB"/>
  -    <Project Id="2" Title="SODA" Description="SODA"/>
  -    <Project Id="3" Title="HSQLDB" Description="HSQLDB"/>
  -    <Project Id="4" Title="XERCES" Description="XERCES"/>
  -    <Project Id="5" Title="Linux" Description="Linux"/>
  -    <Project Id="6" Title="mySQL" Description="mySQL"/>
  +    <Project Id="1" Title="OJB" Description="OJB" />
  +    <Project Id="2" Title="SODA" Description="SODA" />
  +    <Project Id="3" Title="HSQLDB" Description="HSQLDB" />
  +    <Project Id="4" Title="XERCES" Description="XERCES" />
  +    <Project Id="5" Title="Linux" Description="Linux" />
  +    <Project Id="6" Title="mySQL" Description="mySQL" />
   
       <PersonProject PersonId="1" ProjectId="1" Rolename="founder"/>
       <PersonProject PersonId="1" ProjectId="2" Rolename="friend"/>
  @@ -154,4 +154,22 @@
       <SMMaxB id="116" name="B"/>
       <SMMaxBB id="130" name="BB"/>
       <SMMaxBB id="131" name="BB"/>
  -</dataset>
  \ No newline at end of file
  +
  +    <News Id="1" Headline="Healf Care News (NONE)"/>
  +    <News Id="2" Headline="Ferrai for sale (CARS - BUYERS)"/>
  +    <News Id="3" Headline="Brazil World Cup Champion ! (SPORTS)"/>
  +
  +    <Paper Id="10" Date="today" Author="NONE"/>
  +    <Paper Id="11" Date="yesterday" Author="SALES MAN"/>
  +
  +    <Category Id="1" Name="Cars" />
  +    <Category Id="2" Name="Sports" />
  +
  +    <Topic Id="10" Name="Buyers" />
  +    <Topic Id="11" Name="Sellers" />
  +    
  +    <ContentQualifier ContentId="2" QualifierId="1"/>
  +    <ContentQualifier ContentId="2" QualifierId="10"/>
  +    <ContentQualifier ContentId="3" QualifierId="2"/>
  +    <ContentQualifier ContentId="11" QualifierId="11"/>    
  +</dataset>
  
  
  
  1.30      +38 -1     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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ojbtest-schema.xml	12 Mar 2003 18:38:35 -0000	1.29
  +++ ojbtest-schema.xml	9 Apr 2003 13:33:31 -0000	1.30
  @@ -9,6 +9,7 @@
     <!-- B O O K  T A B L E                                  -->
     <!-- =================================================== -->
   
  +
     <!--
     <table name="">
       <column name="" required="true" primaryKey="true" type="INTEGER"/>
  @@ -395,9 +396,45 @@
     </table>
   
   
  +  <!-- ======================================================== -->  
  +  <!--                                                          -->
  +  <!--           Extent Aware Path Expressions Tables           -->
  +  <!--                                                          -->
  +  <!-- ======================================================== -->
  +
  +  <!-- Content -->
  +  <table name="NEWS">
  +    <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
  +    <column name="HEADLINE" type="VARCHAR" size="50"/>
  +  </table>
  +  
  +  <!-- Content -->
  +  <table name="PAPER">
  +    <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
  +    <column name="DATE" type="VARCHAR" size="50"/>
  +    <column name="AUTHOR" type="VARCHAR" size="50"/>
  +  </table>
  +  
  +  <!-- Qualifier -->
  +  <table name="TOPIC">
  +    <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
  +    <column name="NAME" type="VARCHAR" size="50"/>
  +  </table>
   
  +  <!-- Qualifier -->
  +  <table name="CATEGORY">
  +    <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
  +    <column name="NAME" type="VARCHAR" size="50"/>
  +  </table>
   
  +  <!-- Cant have foreign keys -->
  +  <table name="CONTENT_QUALIFIER">
  +    <column name="CONTENT_ID" required="true" primaryKey="true" type="INTEGER"/>
  +    <column name="QUALIFIER_ID" required="true" primaryKey="true" type="INTEGER"/>
  +  </table>
   
  +  
  +  
       <!-- =================================================== -->
       <!-- Sequence mangager test tables                       -->
       <!-- =================================================== -->
  @@ -645,4 +682,4 @@
           <column name="GAT_ID" type="INTEGER"/>
           <column name="EXTENT_NAME" type="VARCHAR" size="150"/>
       </table>
  -</database>
  \ No newline at end of file
  +</database>
  
  
  
  1.57      +58 -2     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.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- repository_junit.xml	8 Apr 2003 16:25:15 -0000	1.56
  +++ repository_junit.xml	9 Apr 2003 13:33:31 -0000	1.57
  @@ -3509,6 +3509,63 @@
           />
       </class-descriptor>
   
  +
  +	<!-- ########################################################## 	-->
  +	<!--                        																								-->
  +	<!--                         extent Aware Path Expressions 											-->
  +	<!-- 																														-->
  +	<!-- ########################################################## 	-->
  +	<class-descriptor class="org.apache.ojb.broker.Content">
  +		<extent-class class-ref="org.apache.ojb.broker.BaseContentImpl"/>
  +	</class-descriptor>
  +
  +	<class-descriptor class="org.apache.ojb.broker.BaseContentImpl">
  +		<extent-class class-ref="org.apache.ojb.broker.News"/>
  +		<extent-class class-ref="org.apache.ojb.broker.Paper"/>
  +		<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
  +    	<collection-descriptor 	name="qualifiers"
  +                           					element-class-ref="org.apache.ojb.broker.Qualifier"
  +                           					auto-retrieve="true"
  +                           					auto-update="false"
  +                           					auto-delete="false"
  +                           					indirection-table="CONTENT_QUALIFIER">
  +				<fk-pointing-to-this-class column="CONTENT_ID"/>
  +         		<fk-pointing-to-element-class column="QUALIFIER_ID"/>
  +    		</collection-descriptor>
  +	</class-descriptor>
  +
  +	<class-descriptor class="org.apache.ojb.broker.News" table="NEWS">
  +			<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
  +			<field-descriptor id="2" name="headline" column="HEADLINE" jdbc-type="VARCHAR"/>
  +	</class-descriptor>
  +
  +	<class-descriptor class="org.apache.ojb.broker.Paper" table="PAPER">
  +			<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
  +			<field-descriptor id="2" name="date" column="DATE" jdbc-type="VARCHAR"/>
  +			<field-descriptor id="3" name="author" column="author" jdbc-type="VARCHAR"/>	
	
  +	</class-descriptor>
  +
  +	<class-descriptor class="org.apache.ojb.broker.Qualifier">
  +		<extent-class class-ref="org.apache.ojb.broker.BaseQualifierImpl"/>
  +	</class-descriptor>
  +
  +	<class-descriptor class="org.apache.ojb.broker.BaseQualifierImpl">
  +		<extent-class class-ref="org.apache.ojb.broker.Topic"/>
  +		<extent-class class-ref="org.apache.ojb.broker.Category"/>
  +		<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
  +	</class-descriptor>
  +
  +	<class-descriptor class="org.apache.ojb.broker.Topic" table="TOPIC">
  +		<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
  +		<field-descriptor id="2" name="name" column="NAME" jdbc-type="VARCHAR"/>
  +	</class-descriptor>
  +
  +	<class-descriptor class="org.apache.ojb.broker.Category" table="CATEGORY">
  +		<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
  +		<field-descriptor id="2" name="name" column="NAME" jdbc-type="VARCHAR"/>
  +	</class-descriptor>
  +
  +
   <!-- ************************************************* -->
   <!--      ODMG collection tests                        -->
   <!-- ************************************************* -->
  @@ -3698,5 +3755,4 @@
           </reference-descriptor>
       </class-descriptor>
   
  -
  -<!-- Mapping of classes used in junit tests and tutorials ends here -->
  \ No newline at end of file
  +<!-- Mapping of classes used in junit tests and tutorials ends here -->
  
  
  
  1.23      +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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AllTests.java	8 Apr 2003 20:19:27 -0000	1.22
  +++ AllTests.java	9 Apr 2003 13:33:31 -0000	1.23
  @@ -71,6 +71,7 @@
           suite.addTest(new TestSuite(BatchModeTest.class));
           suite.addTest(new TestSuite(ObjectCacheTest.class));
           suite.addTest(new TestSuite(ReferenceTest.class));
  +        suite.addTest(new TestSuite(ExtentAwarePathExpressionsTest.class));
           return suite;
       }
   
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/BaseContentImpl.java
  
  Index: BaseContentImpl.java
  ===================================================================
  package org.apache.ojb.broker;
  
  import java.util.List;
  
  /**
   * 
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public abstract class BaseContentImpl 
      implements Content
  {
      /**
       * 
       */
      private int id;
      
      private List qualifiers;
      
      /**
       * @see org.apache.ojb.broker.Content#getId()
       */
      public int getId()
      {
          return id;
      }
  
      /**
       * @see org.apache.ojb.broker.Content#setId(int)
       */
      public void setId(int id)
      {
          this.id = id;
      }
  
  }
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/BaseQualifierImpl.java
  
  Index: BaseQualifierImpl.java
  ===================================================================
  package org.apache.ojb.broker;
  
  /**
   * This class is used to test extent aware path expressions  
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public abstract class BaseQualifierImpl 
      implements Qualifier
  {
      private int id;
      
      private String name;
      
      /**
       * @see org.apache.ojb.broker.Qualifier#getId()
       */
      public int getId()
      {
          return id;
      }
  
      /**
       * @see org.apache.ojb.broker.Qualifier#setId(int)
       */
      public void setId(int id)
      {
          this.id = id;
      }
  
      /**
       * @see org.apache.ojb.broker.Qualifier#getName()
       */
      public String getName()
      {
          return name;
      }
  
      /**
       * @see org.apache.ojb.broker.Qualifier#setName(java.lang.String)
       */
      public void setName(String name)
      {
          this.name = name;
      }
  
  }
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/Category.java
  
  Index: Category.java
  ===================================================================
  package org.apache.ojb.broker;
  
  /**
   * 
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public class Category 
      extends BaseQualifierImpl
  {
  
  }
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/Content.java
  
  Index: Content.java
  ===================================================================
  package org.apache.ojb.broker;
  
  /**
   * This interface is used to test extent aware path expressions 
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public interface Content
  {
      int getId();
      
      void setId(int id);
  }
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/ExtentAwarePathExpressionsTest.java
  
  Index: ExtentAwarePathExpressionsTest.java
  ===================================================================
  package org.apache.ojb.broker;
  
  import java.util.List;
  
  import org.apache.ojb.broker.query.Criteria;
  import org.apache.ojb.broker.query.QueryByCriteria;
  
  import junit.framework.TestCase;
  
  /**
   * 
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public class ExtentAwarePathExpressionsTest extends TestCase
  {
      private PersistenceBroker broker;
      /**
       * 
       */
      public ExtentAwarePathExpressionsTest()
      {
          super();
      }
  
      /**
       * @param testeName
       */
      public ExtentAwarePathExpressionsTest(String testName)
      {
          super(testName);
      }
  
      public void setUp() throws PBFactoryException
      {
          broker = PersistenceBrokerFactory.defaultPersistenceBroker();
      }
  
      /**
       * Insert the method's description here.
       * Creation date: (06.12.2000 21:59:14)
       */
      public void tearDown()
      {
              broker.close();
      }
      
      public void testWithoutHintClass()
          throws Exception
      {
          Criteria criteria = new Criteria();
          criteria.addEqualTo("qualifiers.name","Cars");
          QueryByCriteria query = new QueryByCriteria(News.class,criteria);
          List content = (List) broker.getCollectionByQuery(query);
          assertEquals(1,content.size() );        
      }
  
  
  }
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/News.java
  
  Index: News.java
  ===================================================================
  package org.apache.ojb.broker;
  
  /**
   * This interface is used to test extent aware path expressions 
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public class News 
      extends BaseContentImpl
  {
      
      /**
       * 
       */
      private String headline;    
  
  
      /**
       * @return
       */
      public String getHeadline()
      {
          return headline;
      }
  
      /**
       * @param string
       */
      public void setHeadline(String headline)
      {
          this.headline = headline;
      }
  
  }
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/Paper.java
  
  Index: Paper.java
  ===================================================================
  package org.apache.ojb.broker;
  
  /**
   * This interface is used to test extent aware path expressions 
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public class Paper 
      extends BaseContentImpl
  {
      /**
       * 
       */
      private String date;
      
      /**
       * 
       */
      private String author;
      
      
      /**
       * @return
       */
      public String getAuthor()
      {
          return author;
      }
  
      /**
       * @return
       */
      public String getDate()
      {
          return date;
      }
  
      /**
       * @param string
       */
      public void setAuthor(String author)
      {
          this.author = author;
      }
  
      /**
       * @param string
       */
      public void setDate(String date)
      {
          this.date = date;
      }
  
  }
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/Qualifier.java
  
  Index: Qualifier.java
  ===================================================================
  package org.apache.ojb.broker;
  
  /**
   * This interface is used to test extent aware path expressions 
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public interface Qualifier
  {
      int getId();
      
      void setId(int id);
      
      String getName();
      
      void setName(String name);
  }
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/Topic.java
  
  Index: Topic.java
  ===================================================================
  package org.apache.ojb.broker;
  
  /**
   * 
   * @author <a href="leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
   */
  public class Topic 
      extends BaseQualifierImpl
  {
  
  }
  
  
  

Mime
View raw message