You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by br...@apache.org on 2004/05/03 02:12:54 UTC
cvs commit: db-ojb/src/test/org/apache/ojb/jdo TestJDOQL.java
brianm 2004/05/02 17:12:54
Added: src/test/org/apache/ojb/jdo TestJDOQL.java
Log:
Start testing JDOQL implementation. Presently all fail as we have no JDOQL implementation.
Revision Changes Path
1.1 db-ojb/src/test/org/apache/ojb/jdo/TestJDOQL.java
Index: TestJDOQL.java
===================================================================
package org.apache.ojb.jdo;
import junit.framework.TestCase;
import org.apache.ojb.otm.Person;
import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import java.util.Collection;
public class TestJDOQL extends TestCase
{
private PersistenceManagerFactoryImpl factory = new PersistenceManagerFactoryImpl();
private PersistenceManager pm;
public void setUp()
{
this.pm = factory.getPersistenceManager();
}
public void tearDown()
{
if (!this.pm.isClosed()) this.pm.close();
}
public void _testOneVariableSubstitution()
{
Person p = new Person("George", "Harrison");
pm.currentTransaction().begin();
pm.makePersistent(p);
pm.currentTransaction().commit();
pm.evictAll();
pm.currentTransaction().begin();
Query q = pm.newQuery(Person.class);
q.declareVariables("java.lang.Integer pid");
q.declareImports("org.apache.ojb.otm.Person");
q.setFilter( "id == pid");
Collection results = (Collection) q.execute(new Integer(p.getId()));
assertNotNull(results);
assertEquals(1, results.size());
Person same = (Person) results.iterator().next();
assertEquals(p.getId(), same.getId());
pm.currentTransaction().commit();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org