db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mka...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/broker QueryTest.java
Date Wed, 23 Feb 2005 18:04:39 GMT
mkalen      2005/02/23 10:04:39

  Modified:    src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        QueryTest.java
  Log:
  Resolve ClassCastException when running testReportPathExpressionForExtents1 with Oracle
(also make a self-reporting TODO in test if failing for other platforms). Use ojbSkipKnownIssueProblem
for skipping known failures, to avoid warnings about unused local variables.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.61.2.11 +38 -5     db-ojb/src/test/org/apache/ojb/broker/QueryTest.java
  
  Index: QueryTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/QueryTest.java,v
  retrieving revision 1.61.2.10
  retrieving revision 1.61.2.11
  diff -u -r1.61.2.10 -r1.61.2.11
  --- QueryTest.java	7 Feb 2005 20:50:02 -0000	1.61.2.10
  +++ QueryTest.java	23 Feb 2005 18:04:39 -0000	1.61.2.11
  @@ -9,6 +9,7 @@
   import java.util.List;
   import java.util.Set;
   import java.util.Vector;
  +import java.math.BigDecimal;
   
   import org.apache.commons.lang.time.StopWatch;
   import org.apache.ojb.broker.accesslayer.sql.SqlGenerator;
  @@ -1057,9 +1058,15 @@
           }
           assertTrue(results.size() > 0);
   
  +        // TODO: resolve
  +        if (ojbSkipKnownIssueProblem("broker.getCount() vs .getReportQueryIteratorByQuery().size()"))
  +        {
  +            return;
  +        }
  +
           // compare with count
           int count = broker.getCount(q);
  -        // assertEquals(results.size(), count);   // FAILS !
  +        assertEquals(results.size(), count);   // FAILS !
       }
   
       /**
  @@ -1100,9 +1107,15 @@
           }
           assertTrue(results.size() > 0);
   
  +        // TODO: resolve
  +        if (ojbSkipKnownIssueProblem("broker.getCount() vs .getReportQueryIteratorByQuery().size()"))
  +        {
  +            return;
  +        }
  +        
           // compare with count
           int count = broker.getCount(q);
  -        // assertEquals(results.size(), count);   // FAILS !
  +        assertEquals(results.size(), count);   // FAILS !
       }
   
       /**
  @@ -1579,8 +1592,18 @@
           Iterator iter = broker.getReportQueryIteratorByQuery(q);
           while(iter.hasNext())
           {
  -            Object obj = iter.next();
  -            list.add(obj);
  +            Object row;
  +            Object[] columns;
  +
  +            assertNotNull("Invalid ReportQueryIterator, hasNext() is true but next() is
null",
  +                    row = iter.next());
  +            assertTrue("ReportQuery result row is not Object[]",
  +                    row instanceof Object[]);
  +            columns = (Object[]) row;
  +            list.add(columns);
  +
  +            assertTrue("ReportQuery result row does not contain all expected columns",
  +                    columns.length == 3);
   
               /*
               arminw:
  @@ -1593,8 +1616,18 @@
   //                System.out.println("### " + ((Object[]) obj)[0]
   //                        + "  " + ((Object[]) obj)[1]
   //                        + "  " + ((Object[]) obj)[2]);
  +                Object articleId = columns[2];
  +                int i = -1;
  +                if (articleId instanceof Integer) {
  +                    i = ((Integer) articleId).intValue();
  +                } else if (articleId instanceof BigDecimal) {
  +                    i = ((BigDecimal) articleId).intValue();
  +                } else {
  +                    assertTrue("TODO: Your platforms resulting class for INTEGER (" +
  +                                articleId.getClass().getName() +
  +                                ") is not yet supported in testcase.", false);
  +                }
   
  -                int i = ((Integer) ((Object[]) obj)[2]).intValue();
                   assertTrue("i=" + i, i < 6 & i > 0);
               }
           }
  
  
  

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