db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb repository_junit.xml
Date Wed, 25 May 2005 20:02:33 GMT
brj         2005/05/25 13:02:33

  Modified:    src/test/org/apache/ojb/broker
                        InheritanceMultipleTableTest.java
               src/test/org/apache/ojb repository_junit.xml
  Log:
  fixed testcase for outer join hint
  
  Revision  Changes    Path
  1.14      +30 -18    db-ojb/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java
  
  Index: InheritanceMultipleTableTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- InheritanceMultipleTableTest.java	22 May 2005 16:06:38 -0000	1.13
  +++ InheritanceMultipleTableTest.java	25 May 2005 20:02:32 -0000	1.14
  @@ -65,9 +65,9 @@
           List newEmployees = newCompany.getEmployees();
           assertNotNull(newEmployees);
           assertEquals(company.getEmployees().size(), newEmployees.size());
  -        List newManagers = newCompany.getManagers();
  +        List newManagers = newCompany.getExecutives();
           assertNotNull(newManagers);
  -        assertEquals(company.getManagers().size(), newManagers.size());
  +        assertEquals(company.getExecutives().size(), newManagers.size());
   
           int countEmployee = 0;
           int countExecutive = 0;
  @@ -116,12 +116,11 @@
           employees.add(ex_2);
           employees.add(em);
   
  -        ArrayList managers = new ArrayList();
  -        managers.add(m_1);
  -        managers.add(m_2);
  -        managers.add(m_3);
  +        ArrayList executives = new ArrayList();
  +        executives.add(ex_1);
  +        executives.add(ex_2);
           
  -        Company company = new Company(id_2, name, employees, managers);
  +        Company company = new Company(id_2, name, employees, executives);
           broker.beginTransaction();
           broker.store(company);
           broker.commitTransaction();
  @@ -547,15 +546,26 @@
   
           Criteria crit = new Criteria();
           crit.addLike("name", name + "%");
  -        crit.addLike("managers.name", name + "%");
           QueryByCriteria query = QueryFactory.newQuery(Company.class, crit, true);
  +        Collection result = broker.getCollectionByQuery(query);
  +        assertEquals(2, result.size());								// retrieve both companies
  +        
  +        crit = new Criteria();
  +        crit.addLike("name", name + "%");
  +        
  +        Criteria nameCrit1 = new Criteria().addLike("executives.name", name + "%");
  +        Criteria nameCrit2 = new Criteria().addIsNull("executives.name");
  +        nameCrit1.addOrCriteria(nameCrit2);
  +        crit.addAndCriteria(nameCrit1);
  +        
  +        query = QueryFactory.newQuery(Company.class, crit, true);
           query.addOrderByAscending("id");
  -        query.setPathOuterJoin("managers");	
  +        query.setPathOuterJoin("executives");	
           
           SqlGenerator sqlg = broker.serviceSqlGenerator();
           String sql = sqlg.getPreparedSelectStatement(query, broker.getClassDescriptor(Company.class));
   
  -        Collection result = broker.getCollectionByQuery(query);
  +        result = broker.getCollectionByQuery(query);
           assertEquals(2, result.size());								// should retrieve both companies
        }
     
  @@ -922,18 +932,18 @@
           private Long id;
           private String name;
           private List  employees;
  -        private List  managers;
  +        private List  executives;
   
           public Company()
           {
           }
   
  -        public Company(Long id, String name, List employees,List managers)
  +        public Company(Long id, String name, List employees,List executives)
           {
               this.id = id;
               this.name = name;
               this.employees = employees;
  -            this.managers = managers;
  +            this.executives = executives;
           }
   
           public Long getId()
  @@ -966,12 +976,14 @@
               this.employees = employees;
           }
   
  -		public List getManagers() {
  -			return managers;
  +		public List getExecutives()
  +		{
  +			return executives;
   		}
   
  -		public void setManagers(List managers) {
  -			this.managers = managers;
  +		public void setExecutives(List executives)
  +		{
  +			this.executives = executives;
   		}
       }
   }
  
  
  
  1.133     +3 -3      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.132
  retrieving revision 1.133
  diff -u -r1.132 -r1.133
  --- repository_junit.xml	22 May 2005 16:17:20 -0000	1.132
  +++ repository_junit.xml	25 May 2005 20:02:33 -0000	1.133
  @@ -1981,8 +1981,8 @@
       </collection-descriptor>
   
      <collection-descriptor
  -        name="managers"
  -        element-class-ref="org.apache.ojb.broker.InheritanceMultipleTableTest$Manager"
  +        name="executives"
  +        element-class-ref="org.apache.ojb.broker.InheritanceMultipleTableTest$Executive"
           proxy="false"
           auto-retrieve="true"
           auto-update="object"
  
  
  

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