db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/odmg ProxyTest.java
Date Thu, 24 Jun 2004 09:39:45 GMT
arminw      2004/06/24 02:39:45

  Modified:    src/test/org/apache/ojb/odmg ProxyTest.java
  Log:
  update test, use OJB specific TestCase class
  
  Revision  Changes    Path
  1.7       +6 -63     db-ojb/src/test/org/apache/ojb/odmg/ProxyTest.java
  
  Index: ProxyTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/ProxyTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProxyTest.java	22 Jun 2004 18:16:22 -0000	1.6
  +++ ProxyTest.java	24 Jun 2004 09:39:45 -0000	1.7
  @@ -1,76 +1,29 @@
   package org.apache.ojb.odmg;
   
   
  -import junit.framework.TestCase;
  -import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.odmg.shared.PersonImpl;
  +import org.apache.ojb.junit.ODMGTestCase;
   import org.apache.ojb.odmg.shared.Person;
  +import org.apache.ojb.odmg.shared.PersonImpl;
   import org.odmg.DList;
  -import org.odmg.Database;
  -import org.odmg.Implementation;
  -import org.odmg.ODMGException;
   import org.odmg.OQLQuery;
   import org.odmg.Transaction;
   
   /** Demo Application that shows basic concepts for Applications using the OJB ODMG
    * implementation as an transactional object server.
    */
  -public class ProxyTest extends TestCase
  +public class ProxyTest extends ODMGTestCase
   {
       public static void main(String[] args)
       {
  -        String[] arr = {CLASS.getName()};
  +        String[] arr = {ProxyTest.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  -    private static Class CLASS = ProxyTest.class;
  -    private String databaseName;
  -
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (24.12.2000 00:33:40)
  -     */
  -    public ProxyTest(String name)
  -    {
  -        super(name);
  -    }
  -
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (06.12.2000 21:58:53)
  -     */
  -    public void setUp()
  -    {
  -        databaseName = TestHelper.DEF_DATABASE_NAME;
  -    }
  -
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (06.12.2000 21:59:14)
  -     */
  -    public void tearDown()
  -    {
  -        databaseName = null;
  -    }
  -
       /**TestThreadsNLocks state transition of modification states*/
       public void testLoading()
       {
           try
           {
  -            // get facade instance
  -            Implementation odmg = OJB.getInstance();
  -            Database db = odmg.newDatabase();
  -            //open database
  -            try
  -            {
  -                db.open(databaseName, Database.OPEN_READ_WRITE);
  -            }
  -            catch (ODMGException ex)
  -            {
  -                fail("ODMGException: " + ex.getMessage());
  -            }
  -
               Person mum = new PersonImpl();
               mum.setFirstname("Macy");
               mum.setLastname("Gray");
  @@ -94,7 +47,8 @@
               tx.begin();
               ((HasBroker) tx).getBroker().clearCache();
               OQLQuery qry = odmg.newOQLQuery();
  -            qry.create("select a from " + PersonImpl.class.getName() + " where firstname=\"Kevin\"");
  +            qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
  +            qry.bind("Kevin");
   
               DList result = (DList) qry.execute();
               Person boy = (Person) result.get(0);
  @@ -103,22 +57,11 @@
               assertEquals(boy.getMother().getFirstname(), mum.getFirstname());
   
               tx.commit();
  -
  -            // close database
  -            try
  -            {
  -                db.close();
  -            }
  -            catch (ODMGException ex)
  -            {
  -                fail("ODMGException: " + ex.getMessage());
  -            }
           }
           catch (Throwable t)
           {
               t.printStackTrace();
               fail(t.getMessage());
           }
  -
       }
   }
  
  
  

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