org.apache.ojb.odmg
Class UserTestCases

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.ojb.odmg.UserTestCases
All Implemented Interfaces:
junit.framework.Test

public class UserTestCases
extends junit.framework.TestCase

Collection of test cases sent by OJB users

Version:
$Id: UserTestCases.java,v 1.12 2004/01/22 12:11:43 arminw Exp $
Author:
Armin Waibel

Constructor Summary
UserTestCases()
           
 
Method Summary
static void main(java.lang.String[] args)
           
 void setUp()
           
protected  void tearDown()
           
 void testDuplicateInsertion()
          Send by Antonio Note: The name attribute was declared as unique in the DB.
 void testImplicitLocking()
          User test case posted by Charles: Up to now, we've been just using the broker layer.
 void testRetrieveNonExistent()
           
 void testRetrieveOutsideTxn()
           
 void testSimpleQueryDelete()
           
 void testStoreRetrieveSameTxn()
          store an object and then retrieve it by id.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserTestCases

public UserTestCases()
Method Detail

testDuplicateInsertion

public void testDuplicateInsertion()
                            throws java.lang.Exception
Send by Antonio Note: The name attribute was declared as unique in the DB.

Throws:
java.lang.Exception

testSimpleQueryDelete

public void testSimpleQueryDelete()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testImplicitLocking

public void testImplicitLocking()
                         throws java.lang.Exception
User test case posted by Charles: Up to now, we've been just using the broker layer. I now have a usecase where we will need to use the ODMG layer. We do not want to use implicit locking; I want my developers to explicit lock each object to an ODMG transaction (implicit locking generates loads of queries for all the proxy collections). It seems that something 'funny' happens if implicit locking is turned off - objects are not marked as being "dirty" when changed - even when they are explicitly lock to the transaction. As I am a complete novice in the ways of the ODMG, I don't really know where to look to sort this issue out so I have added a new test method to org.apache.ojb.odmg.UserTestCases (it should be attached to this email). Essentially, it creates an object and persists it; retrieves and updates it; then flushes the cache, and retrieves it again to ensure the update worked. If ImplicitLocking is TRUE, the test passes. If ImplicitLocking is FALSE, the test fails. I think this is incorrect, and would dearly like this to be resolved. thma's comment: IMO this works as designed. objects must be locked to an ODMG tx before any modifications are taking place. I simply moved the lock two lines up and the test passed.

Throws:
java.lang.Exception

testStoreRetrieveSameTxn

public void testStoreRetrieveSameTxn()
store an object and then retrieve it by id.


testRetrieveNonExistent

public void testRetrieveNonExistent()

testRetrieveOutsideTxn

public void testRetrieveOutsideTxn()

main

public static void main(java.lang.String[] args)

setUp

public void setUp()

tearDown

protected void tearDown()
                 throws java.lang.Exception
Throws:
java.lang.Exception


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14