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 LockTestCommitedReads.java LockTestRepeatableReads.java LockTestSerializable.java LockTestUncommitedReads.java PersonWithArrayTest.java
Date Mon, 15 Nov 2004 18:02:51 GMT
arminw      2004/11/15 10:02:51

  Modified:    src/test/org/apache/ojb/odmg LockTestCommitedReads.java
                        LockTestRepeatableReads.java
                        LockTestSerializable.java
                        LockTestUncommitedReads.java
                        PersonWithArrayTest.java
  Log:
  merge with 1.0.x branch
  add locking test, remove trz catch block in test
  
  Revision  Changes    Path
  1.11      +22 -0     db-ojb/src/test/org/apache/ojb/odmg/LockTestCommitedReads.java
  
  Index: LockTestCommitedReads.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockTestCommitedReads.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LockTestCommitedReads.java	14 Nov 2004 09:42:54 -0000	1.10
  +++ LockTestCommitedReads.java	15 Nov 2004 18:02:51 -0000	1.11
  @@ -82,6 +82,28 @@
       }
   
   
  +    /**
  +     * Test 19
  +     */
  +    public void testWriteReleaseCheckRead()
  +    {
  +        assertTrue(lockManager.writeLock(tx2, obj));
  +        assertTrue(lockManager.checkRead(tx2, obj));
  +        assertTrue(lockManager.releaseLock(tx2, obj));
  +        assertFalse(lockManager.checkRead(tx2, obj));
  +    }
  +
  +    /**
  +     * Test 20
  +     */
  +    public void testReadWriteReleaseCheckRead()
  +    {
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
  +        assertTrue(lockManager.checkRead(tx2, obj));
  +        assertTrue(lockManager.releaseLock(tx2, obj));
  +        assertFalse(lockManager.checkRead(tx2, obj));
  +    }
   
       /**
        * Test 1
  
  
  
  1.11      +23 -0     db-ojb/src/test/org/apache/ojb/odmg/LockTestRepeatableReads.java
  
  Index: LockTestRepeatableReads.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockTestRepeatableReads.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LockTestRepeatableReads.java	14 Nov 2004 09:42:54 -0000	1.10
  +++ LockTestRepeatableReads.java	15 Nov 2004 18:02:51 -0000	1.11
  @@ -83,6 +83,29 @@
       }
   
       /**
  +     * Test 19
  +     */
  +    public void testWriteReleaseCheckRead()
  +    {
  +        assertTrue(lockManager.writeLock(tx2, obj));
  +        assertTrue(lockManager.checkRead(tx2, obj));
  +        assertTrue(lockManager.releaseLock(tx2, obj));
  +        assertFalse(lockManager.checkRead(tx2, obj));
  +    }
  +
  +    /**
  +     * Test 20
  +     */
  +    public void testReadWriteReleaseCheckRead()
  +    {
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
  +        assertTrue(lockManager.checkRead(tx2, obj));
  +        assertTrue(lockManager.releaseLock(tx2, obj));
  +        assertFalse(lockManager.checkRead(tx2, obj));
  +    }
  +
  +    /**
        * Test 1
        */
       public void testSingleReadLock()
  
  
  
  1.12      +23 -0     db-ojb/src/test/org/apache/ojb/odmg/LockTestSerializable.java
  
  Index: LockTestSerializable.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockTestSerializable.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- LockTestSerializable.java	14 Nov 2004 09:42:54 -0000	1.11
  +++ LockTestSerializable.java	15 Nov 2004 18:02:51 -0000	1.12
  @@ -83,6 +83,29 @@
       }
   
       /**
  +     * Test 19
  +     */
  +    public void testWriteReleaseCheckRead()
  +    {
  +        assertTrue(lockManager.writeLock(tx2, obj));
  +        assertTrue(lockManager.checkRead(tx2, obj));
  +        assertTrue(lockManager.releaseLock(tx2, obj));
  +        assertFalse(lockManager.checkRead(tx2, obj));
  +    }
  +
  +    /**
  +     * Test 20
  +     */
  +    public void testReadWriteReleaseCheckRead()
  +    {
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
  +        assertTrue(lockManager.checkRead(tx2, obj));
  +        assertTrue(lockManager.releaseLock(tx2, obj));
  +        assertFalse(lockManager.checkRead(tx2, obj));
  +    }
  +
  +    /**
        * Test 1
        */
       public void testSingleReadLock()
  
  
  
  1.12      +23 -0     db-ojb/src/test/org/apache/ojb/odmg/LockTestUncommitedReads.java
  
  Index: LockTestUncommitedReads.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockTestUncommitedReads.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- LockTestUncommitedReads.java	14 Nov 2004 09:42:54 -0000	1.11
  +++ LockTestUncommitedReads.java	15 Nov 2004 18:02:51 -0000	1.12
  @@ -83,6 +83,29 @@
       }
   
       /**
  +     * Test 19
  +     */
  +    public void testWriteReleaseCheckRead()
  +    {
  +        assertTrue(lockManager.writeLock(tx2, obj));
  +        assertTrue(lockManager.checkRead(tx2, obj));
  +        assertTrue(lockManager.releaseLock(tx2, obj));
  +        assertFalse(lockManager.checkRead(tx2, obj));
  +    }
  +
  +    /**
  +     * Test 20
  +     */
  +    public void testReadWriteReleaseCheckRead()
  +    {
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
  +        assertTrue(lockManager.checkRead(tx2, obj));
  +        assertTrue(lockManager.releaseLock(tx2, obj));
  +        assertFalse(lockManager.checkRead(tx2, obj));
  +    }
  +
  +    /**
        * Test 1
        */
       public void testSingleReadLock()
  
  
  
  1.7       +17 -4     db-ojb/src/test/org/apache/ojb/odmg/PersonWithArrayTest.java
  
  Index: PersonWithArrayTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/PersonWithArrayTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PersonWithArrayTest.java	22 Jun 2004 18:16:22 -0000	1.6
  +++ PersonWithArrayTest.java	15 Nov 2004 18:02:51 -0000	1.7
  @@ -7,6 +7,7 @@
   
   import java.util.Arrays;
   import java.util.Collection;
  +import java.util.ArrayList;
   
   import org.apache.ojb.junit.ODMGTestCase;
   import org.apache.ojb.odmg.shared.PersonImpl;
  @@ -207,10 +208,11 @@
           String firstnameFather = "Father" + postfix;
           String firstnameChild_1 = "Child_One" + postfix;
           String firstnameChild_2 = "Child_Two" + postfix;
  +        String lastname = "testStoreThreePersons_3" + postfix;
   
  -        Person father = createPerson(firstnameFather, "testStoreThreePersons_3", null,
null);
  -        Person child_1 = createPerson(firstnameChild_1, "testStoreThreePersons_3", null,
null);
  -        Person child_2 = createPerson(firstnameChild_2, "testStoreThreePersons_3", null,
null);
  +        Person father = createPerson(firstnameFather, lastname, null, null);
  +        Person child_1 = createPerson(firstnameChild_1, lastname, null, null);
  +        Person child_2 = createPerson(firstnameChild_2, lastname, null, null);
   
           Person[] children = new Person[]{child_1, child_2};
           father.setChildren(children);
  @@ -234,14 +236,25 @@
           father.setChildren(null);
           father.setFirstname(null);
   
  +        tx = odmg.newTransaction();
           tx.begin();
           // make sure all objects are retrieved freshly in subsequent transactions
           ((TransactionImpl) tx).getBroker().clearCache();
  +
           OQLQuery qry = odmg.newOQLQuery();
  +        qry.create("select a from " + PersonImpl.class.getName() + " where lastname=$1");
  +        qry.bind(lastname);
  +        Collection result = (Collection) qry.execute();
  +        assertEquals(3, new ArrayList(result).size());
  +
  +
  +        qry = odmg.newOQLQuery();
           qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
           qry.bind(firstnameFather);
  -        Collection result = (Collection) qry.execute();
  +        result = (Collection) qry.execute();
  +        tx.commit();
   
  +        tx.begin();
           assertEquals("Exactly one element in result set", 1, result.size());
           Person returnedFather = (Person) result.iterator().next();
           // should retrieve new instance, cause we clear the cache
  
  
  

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