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/broker ExtentAwarePathExpressionsTest.java
Date Fri, 11 Apr 2003 19:05:50 GMT
brj         2003/04/11 12:05:50

  Modified:    src/test/org/apache/ojb/broker
                        ExtentAwarePathExpressionsTest.java
  Log:
  additional testcase querying for abstract class
  
  Revision  Changes    Path
  1.3       +65 -49    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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExtentAwarePathExpressionsTest.java	9 Apr 2003 20:35:39 -0000	1.2
  +++ ExtentAwarePathExpressionsTest.java	11 Apr 2003 19:05:49 -0000	1.3
  @@ -2,70 +2,86 @@
   
   import java.util.List;
   
  +import junit.framework.TestCase;
   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 static Class CLASS = ExtentAwarePathExpressionsTest.class;
  +	private static Class CLASS = ExtentAwarePathExpressionsTest.class;
   
  -    private PersistenceBroker broker;
  -    /**
  -     * 
  -     */
  -    public ExtentAwarePathExpressionsTest()
  -    {
  -        super();
  -    }
  +	private PersistenceBroker broker;
  +	/**
  +	 * 
  +	 */
  +	public ExtentAwarePathExpressionsTest()
  +	{
  +		super();
  +	}
  +
  +	/**
  +	 * Insert the method's description here.
  +	 * Creation date: (23.12.2000 18:30:38)
  +	 * @param args java.lang.String[]
  +	 */
  +	public static void main(String[] args)
  +	{
  +		String[] arr = { CLASS.getName()};
  +		junit.textui.TestRunner.main(arr);
  +	}
  +
  +	/**
  +	 * @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();
  +	}
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (23.12.2000 18:30:38)
  -     * @param args java.lang.String[]
  +     * Querying News.qualifierNmaes 
        */
  -    public static void main(String[] args)
  -    {
  -        String[] arr = {CLASS.getName()};
  -        junit.textui.TestRunner.main(arr);
  -    }
  +	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());
  +	}
   
       /**
  -     * @param testeName
  +     * Querying News/Paper.qualifierNmaes 
        */
  -    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() );        
  -    }
  -
  +	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());
  +	}
   
   }
  
  
  

Mime
View raw message