arminw      2005/08/22 08:34:11

  Modified:    src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        ExtentAwarePathExpressionsTest.java
  Log:
  fix test
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.7.2.2   +54 -85    
db-ojb/src/test/org/apache/ojb/broker/ExtentAwarePathExpressionsTest.java
  
  Index: ExtentAwarePathExpressionsTest.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/test/org/apache/ojb/broker/ExtentAwarePathExpressionsTest.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- ExtentAwarePathExpressionsTest.java       21 Jun 2005 10:53:45 -0000      
1.7.2.1
  +++ ExtentAwarePathExpressionsTest.java       22 Aug 2005 15:34:11 -0000      
1.7.2.2
  @@ -1,16 +1,11 @@
   package org.apache.ojb.broker;
   
  -import java.net.URL;
   import java.util.Iterator;
   import java.util.List;
   
  -import junit.framework.Test;
  -import junit.framework.TestCase;
  -import junit.framework.TestSuite;
  -
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.QueryByCriteria;
  -import org.apache.ojb.broker.util.ClassHelper;
  +import org.apache.ojb.junit.PBTestCase;
   
   /**
    * Tests for extent aware path expressions
  @@ -19,85 +14,59 @@
    * 
    * $Id$
    */
  -public class ExtentAwarePathExpressionsTest extends TestCase
  +public class ExtentAwarePathExpressionsTest extends PBTestCase
   {
  -
  -    /** */
  -     private PersistenceBroker broker;
  -     
  -    /**
  -      * 
  -      */
  -     public ExtentAwarePathExpressionsTest()
  -     {
  -             super();
  -     }
  -
       /**
        * You can run the test like a java app 
        */
  -     public static void main(String[] args)
  -     {
  +    public static void main(String[] args)
  +    {
           //OBS: when running this test from eclipse, one must copy the 
database file to the directory where 
           //u checked out ojb from cvs
  -        URL url = ClassHelper.getResource("DB.script");
  -        System.out.println("Hsql database @ :" + url);
  -             String[] arr = {ExtentAwarePathExpressionsTest.class.getName()};
  -             junit.textui.TestRunner.main(arr);
  -     }
  -
  -     /**
  -      * @param testeName
  -      */
  -     public ExtentAwarePathExpressionsTest(String testName)
  -     {
  -             super(testName);
  -     }
  -
  -    public static Test suite()
  -    {
  -        TestSuite suite = new TestSuite();
  -        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testAddPathClass"));
  -        suite.addTest(new 
ExtentAwarePathExpressionsTest("testAddPathClasses"));
  -        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testNotNullPathElement"));
  -        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testSetPathClass"));
  -        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testWithoutHintClass1"));
  -        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testWithoutHintClass2"));
  -        return suite;
  -        
  -    }
  -
  -     public void setUp() throws PBFactoryException
  -     {
  -             broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  -     }
  -
  -     public void tearDown()
  -     {
  -             broker.close();
  -     }
  -
  -     public void testWithoutHintClass1() throws Exception
  -     {
  -             Criteria criteria = new Criteria();
  -             criteria.addEqualTo("qualifiers.name", "Cars");
  -             QueryByCriteria query = new QueryByCriteria(News.class, 
criteria);
  -
  -             broker.clearCache();
  -             List content = (List) broker.getCollectionByQuery(query);
  -             assertEquals(1, content.size());
  -     }
  -
  -     public void testWithoutHintClass2() throws Exception
  -     {
  -             Criteria criteria = new Criteria();
  -             criteria.addLike("qualifiers.name", "%ers%");
  -             QueryByCriteria query = new 
QueryByCriteria(BaseContentImpl.class, criteria, true);
  -
  -             broker.clearCache();
  -             List content = (List) broker.getCollectionByQuery(query);
  -             assertEquals(2, content.size());
  -     }
  +//        URL url = ClassHelper.getResource("DB.script");
  +//        System.out.println("Hsql database @ :" + url);
  +        String[] arr = {ExtentAwarePathExpressionsTest.class.getName()};
  +        junit.textui.TestRunner.main(arr);
  +    }
  +
  +    public ExtentAwarePathExpressionsTest(String testName)
  +    {
  +        super(testName);
  +    }
  +
  +//    public static Test suite()
  +//    {
  +//        TestSuite suite = new TestSuite();
  +//        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testAddPathClass"));
  +//        suite.addTest(new 
ExtentAwarePathExpressionsTest("testAddPathClasses"));
  +//        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testNotNullPathElement"));
  +//        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testSetPathClass"));
  +//        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testWithoutHintClass1"));
  +//        //suite.addTest(new 
ExtentAwarePathExpressionsTest("testWithoutHintClass2"));
  +//        return suite;
  +//    }
  +
  +    public void testWithoutHintClass1() throws Exception
  +    {
  +        Criteria criteria = new Criteria();
  +        criteria.addEqualTo("qualifiers.name", "Cars");
  +        QueryByCriteria query = new QueryByCriteria(News.class, criteria);
  +
  +        broker.clearCache();
  +        List content = (List) broker.getCollectionByQuery(query);
  +        assertEquals(1, content.size());
  +    }
  +
  +    public void testWithoutHintClass2() throws Exception
  +    {
  +        Criteria criteria = new Criteria();
  +        criteria.addLike("qualifiers.name", "%ers%");
  +        QueryByCriteria query = new QueryByCriteria(BaseContentImpl.class, 
criteria, true);
  +
  +        broker.clearCache();
  +        List content = (List) broker.getCollectionByQuery(query);
  +        assertEquals(2, content.size());
  +    }
   
       public void testNotNullPathElement()
       {
  @@ -107,7 +76,7 @@
           List content = (List) broker.getCollectionByQuery(query);
           assertEquals(4,content.size());
       }
  -    
  +
       public void testSetPathClass()
       {
           Criteria criteria = new Criteria();
  @@ -123,7 +92,7 @@
           }
   
       }
  -    
  +
       public void testSetPathClassInCriteria()
       {
           Criteria criteria = new Criteria();
  @@ -180,14 +149,14 @@
       public void testAddPathClasses()
       {
           Criteria criteria = new Criteria();
  -        
  +
           criteria.addLike("headline","Bra%");
           criteria.addNotNull("qualifiers.name");
           QueryByCriteria query = new QueryByCriteria(BaseContentImpl.class, 
criteria, true);
           query.addPathClass("qualifiers",Qualifier.class);
           query.addPathClass("qualifiers",Topic.class);
           query.addPathClass("qualifiers",Category.class);
  -        
  +
           List content = (List) broker.getCollectionByQuery(query);
           assertEquals(1,content.size());
           assertEquals(3,((News)content.get(0)).getId());
  @@ -196,7 +165,7 @@
       public void testAddPathClassesInCriteria()
       {
           Criteria criteria = new Criteria();
  -        
  +
           criteria.addLike("headline", "Bra%");
           criteria.addNotNull("qualifiers.name");
           criteria.addPathClass("qualifiers", Qualifier.class);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to