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 ar...@apache.org on 2006/12/20 11:32:27 UTC

svn commit: r489019 - in /db/ojb/branches/OJB_1_0_RELEASE/src: schema/ test/org/apache/ojb/ test/org/apache/ojb/broker/ test/org/apache/ojb/broker/cache/ test/org/apache/ojb/broker/lob/ test/org/apache/ojb/broker/sequence/ test/org/apache/ojb/odmg/

Author: arminw
Date: Wed Dec 20 02:32:25 2006
New Revision: 489019

URL: http://svn.apache.org/viewvc?view=rev&rev=489019
Log:
update tests

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest2.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingMultithreadedTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/QueryTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/UnwrapHelperTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cache/ObjectCacheTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/lob/LOBTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_inheritance.xml

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml Wed Dec 20 02:32:25 2006
@@ -1878,7 +1878,24 @@
 		</foreign-key>
 	</table>
 
-    <table name="TPS_FOURTH">
+    <table name="TPS_FOURTH_A">
+		<column
+		   name="ID_A"
+		   type="INTEGER"
+		   primaryKey="true"/>
+		<column
+		   name="FOURTH_"
+		   type="VARCHAR"
+           size="250"/>
+        <column
+		   name="THIRD_FK"
+		   type="INTEGER"/>
+		<foreign-key foreignTable="TPS_THIRD">
+			<reference local="THIRD_FK" foreign="ID_"/>
+		</foreign-key>
+	</table>
+
+    <table name="TPS_FOURTH_B">
 		<column
 		   name="ID_"
 		   type="INTEGER"

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest2.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest2.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest2.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest2.java Wed Dec 20 02:32:25 2006
@@ -55,11 +55,12 @@
         changeAutoSetting(Project.class, "subProject_2s", true, true, false, false);
         changeAutoSetting(Project.class, "developers", true, true, false, false);
         changeAutoSetting(SubProject.class, "project", true, true, false, false);
+        changeAutoSetting(SubProject_2.class, "project", true, true, false, false);
 
         Project project = new Project(name, null, null);
 
         Timestamp t1 = new Timestamp(System.currentTimeMillis());
-        Timestamp t2 = new Timestamp(t1.getTime() + 1);
+        Timestamp t2 = new Timestamp(t1.getTime() + 1000);
         broker.beginTransaction();
         // first store the project to assign the PK
         broker.store(project);

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java Wed Dec 20 02:32:25 2006
@@ -24,7 +24,6 @@
  * reference descriptor. The test objects use a composite PK.
  * One autoincrement PK field - Integer. One non-autoincrement PK field with manually set PK- Long.
  *
- * @author <a href="mailto:arminw@apache.org">Armin Waibel</a>
  * @version $Id$
  */
 public class InheritanceMultipleTableTest extends PBTestCase
@@ -167,12 +166,6 @@
 
     public void testQueryInheritancedObjects()
     {
-        if(ojbSkipKnownIssueProblem("Classes mapped to multiple joined tables will always be instantiated " +
-                " with the class type of the query, instead of the real type"))
-        {
-            return;
-        }
-
         long timestamp = System.currentTimeMillis();
         String name = "testQueryInheritancedObjects_" + timestamp;
         // store company with Employee/Executive/Manager
@@ -326,10 +319,10 @@
 
     public void testJavaInheritance()
     {
-        ojbSkipKnownIssueProblem("Declared inheritance (without java inheritance)" +
-                "of classes is currently not supported and will be difficult to implement");
+        // Declared inheritance (without java inheritance)
+        // of classes is currently not supported and will be difficult to implement
 
-        String name = "testWithoutJavaInheritance_tmp" + System.currentTimeMillis();
+        String name = "testJavaInheritance_" + System.currentTimeMillis();
         Animal animal = new Animal(name, 55);
         Food f1 = new Food(name + "fruit1");
         Food f2 = new Food(name + "fruit2");
@@ -358,12 +351,6 @@
 
     public void testInheritancedObjectsInCollectionReferences()
     {
-        if(ojbSkipKnownIssueProblem("References of classes (1:1, 1:n) mapped to multiple joined tables only" +
-                " return base class type instances"))
-        {
-            return;
-        }
-
         long timestamp = System.currentTimeMillis();
         String name = "testInheritancedObjectsInCollectionReferences_" + timestamp;
         Company company = prepareTestDataWithCompany(name);
@@ -1626,15 +1613,78 @@
 
     public void testInheritanceViaAnonymousField_Serialized_3()
     {
+//        if(ojbSkipKnownIssueProblem("Table-per-subclass inheritance issue, when field was overridden in sub-class"))
+//        {
+//            return;
+//        }
+        long timestamp = System.currentTimeMillis();
+        String name = "testInheritanceViaAnonymousField_3_" + timestamp;
+        String t_name = "fourth_" + name;
+
+        FourthA fourth = new FourthA(t_name);
+        fourth.setFourth("fourth");
+        fourth.setThird("third");
+        fourth.setSecond("second");
+
+        broker.beginTransaction();
+        broker.store(fourth);
+        broker.commitTransaction();
+
+        Identity oid_3 = broker.serviceIdentity().buildIdentity(fourth);
+
+        broker.clearCache();
+
+        FourthA newFourth = (FourthA) broker.getObjectByIdentity(oid_3);
+
+        assertNotNull(newFourth);
+        assertEquals(t_name, newFourth.getName());
+        assertEquals("fourth", fourth.getFourth());
+        assertEquals("third", fourth.getThird());
+        assertEquals("second", fourth.getSecond());
+
+        newFourth.setName(newFourth.getName() + "_updated");
+        newFourth.setFourth("fourth_updated");
+        newFourth.setThird("third_updated");
+        newFourth.setSecond("second_updated");
+
+        newFourth = (FourthA) SerializationUtils.clone(newFourth);
+
+        broker.beginTransaction();
+        broker.store(newFourth);
+        broker.commitTransaction();
+
+        broker.clearCache();
+
+        newFourth = (FourthA) broker.getObjectByIdentity(oid_3);
+
+        assertNotNull(newFourth);
+        assertEquals(t_name + "_updated", newFourth.getName());
+        assertEquals("second_updated", newFourth.getSecond());
+        assertEquals("third_updated", newFourth.getThird());
+        assertEquals("fourth_updated", newFourth.getFourth());
+
+        newFourth = (FourthA) SerializationUtils.clone(newFourth);
+
+        broker.beginTransaction();
+        broker.delete(newFourth);
+        broker.commitTransaction();
+
+        newFourth = (FourthA) broker.getObjectByIdentity(oid_3);
+
+        assertNull(newFourth);
+    }
+
+    public void testInheritanceViaAnonymousField_Serialized_4()
+    {
         if(ojbSkipKnownIssueProblem("Table-per-subclass inheritance issue, when field was overridden in sub-class"))
         {
             return;
         }
         long timestamp = System.currentTimeMillis();
-        String name = "testInheritanceViaAnonymousField_3_" + timestamp;
+        String name = "testInheritanceViaAnonymousField_4_" + timestamp;
         String t_name = "fourth_" + name;
 
-        Fourth fourth = new Fourth(t_name);
+        FourthB fourth = new FourthB(t_name);
         fourth.setFourth("fourth");
         fourth.setThird("third");
         fourth.setSecond("second");
@@ -1647,7 +1697,7 @@
 
         broker.clearCache();
 
-        Fourth newFourth = (Fourth) broker.getObjectByIdentity(oid_3);
+        FourthB newFourth = (FourthB) broker.getObjectByIdentity(oid_3);
 
         assertNotNull(newFourth);
         assertEquals(t_name, newFourth.getName());
@@ -1660,7 +1710,7 @@
         newFourth.setThird("third_updated");
         newFourth.setSecond("second_updated");
 
-        newFourth = (Fourth) SerializationUtils.clone(newFourth);
+        newFourth = (FourthB) SerializationUtils.clone(newFourth);
 
         broker.beginTransaction();
         broker.store(newFourth);
@@ -1668,7 +1718,7 @@
 
         broker.clearCache();
 
-        newFourth = (Fourth) broker.getObjectByIdentity(oid_3);
+        newFourth = (FourthB) broker.getObjectByIdentity(oid_3);
 
         assertNotNull(newFourth);
         assertEquals(t_name + "_updated", newFourth.getName());
@@ -1676,13 +1726,13 @@
         assertEquals("third_updated", newFourth.getThird());
         assertEquals("fourth_updated", newFourth.getFourth());
 
-        newFourth = (Fourth) SerializationUtils.clone(newFourth);
+        newFourth = (FourthB) SerializationUtils.clone(newFourth);
 
         broker.beginTransaction();
         broker.delete(newFourth);
         broker.commitTransaction();
 
-        newFourth = (Fourth) broker.getObjectByIdentity(oid_3);
+        newFourth = (FourthB) broker.getObjectByIdentity(oid_3);
 
         assertNull(newFourth);
     }
@@ -2627,7 +2677,46 @@
         }
     }
 
-    public static class Fourth extends Third
+    public static class FourthA extends Third
+    {
+        //##################################
+        //!! override field to show issue !!
+        private int id;
+        public int getId()
+        {
+            return id;
+        }
+
+        public void setId(int id)
+        {
+            this.id = id;
+        }
+        //!!!!!
+        //####################################
+
+        private String fourth;
+
+        public FourthA()
+        {
+        }
+
+        public FourthA(String name)
+        {
+            super(name);
+        }
+
+        public String getFourth()
+        {
+            return fourth;
+        }
+
+        public void setFourth(String fourth)
+        {
+            this.fourth = fourth;
+        }
+    }
+
+    public static class FourthB extends Third
     {
         //##################################
         //!! override field to show issue !!
@@ -2646,11 +2735,11 @@
 
         private String fourth;
 
-        public Fourth()
+        public FourthB()
         {
         }
 
-        public Fourth(String name)
+        public FourthB(String name)
         {
             super(name);
         }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingMultithreadedTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingMultithreadedTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingMultithreadedTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingMultithreadedTest.java Wed Dec 20 02:32:25 2006
@@ -16,6 +16,12 @@
 {
     private static int threadCount;
     static final String msg = "Thread write order: ";
+    // number of concurrent threads to run
+    static int threads = 6;
+    // number of updates each thread performs against the object
+    static int objectUpdates = 20;
+    private static final int maxAttempts = 500;
+    private static final int nearMax = (int) (maxAttempts * 0.9);
 
     public static void main(String[] args)
     {
@@ -43,11 +49,6 @@
         LockedByVersion targetObject = createLockedByVersion();
         storeObject(targetObject);
 
-        // number of concurrent threads to run
-        int threads = 6;
-        // number of updates each thread performs against the object
-        int objectUpdates = 20;
-
         TestCaseRunnable tct [] = new TestCaseRunnable[threads];
         for (int i = 0; i < threads; i++)
         {
@@ -56,16 +57,15 @@
             the other threads lock deep copies of the shared object
             */
             if (i % 2 == 0)
-                tct[i] = new LockHandle(targetObject, objectUpdates);
+                tct[i] = new LockHandle(targetObject);
             else
-                tct[i] = new LockHandle(
-                        (LockedByVersion) SerializationUtils.clone(targetObject), objectUpdates);
+                tct[i] = new LockHandle((LockedByVersion) SerializationUtils.clone(targetObject));
         }
         System.out.println("*** START - Multithreaded lock test ***");
         System.out.println("Number of concurrent threads: " + threads);
         System.out.println("Number of object updates per thread: " + objectUpdates);
         System.out.println("Each thread try to update the same object. If an OptimisticLockException" +
-                " was thrown, the thread wait and try later again (200 attempts, then fail)");
+                " was thrown, the thread wait and try later again (" + maxAttempts + " attempts, then fail)");
         // run test classes
         runTestCaseRunnables(tct);
         System.out.println(targetObject.getValue());
@@ -110,12 +110,11 @@
     {
         LockedByVersion obj;
         int threadNumber;
-        int objectUpdates = 30;
+        private int counter = 0;
 
-        public LockHandle(LockedByVersion obj, int objectUpdates)
+        public LockHandle(LockedByVersion obj)
         {
             super();
-            this.objectUpdates = objectUpdates;
             this.obj = obj;
         }
 
@@ -125,13 +124,10 @@
             for (int i = 0; i < objectUpdates; i++)
             {
                 updateObject(obj, false);
+                Thread.sleep((int) (200 * Math.random()));
             }
         }
 
-        private int counter = 0;
-        private static final int maxAttempts = 200;
-        private static final int nearMax = (int) (maxAttempts * 0.9);
-
         private void updateObject(LockedByVersion obj, boolean LNGEthrown) throws Exception
         {
             PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
@@ -158,7 +154,7 @@
                                 + threadNumber + " waits " + counter
                                 + " times to update object. Maximal attempts before fail are " + maxAttempts
                                 + ". This can be a result of low hardware.");
-                    Thread.sleep(10);
+                    Thread.sleep((long) (Math.max(200, counter) * Math.random()));
                     PersistenceBroker pb = PersistenceBrokerFactory.defaultPersistenceBroker();
                     LockedByVersion temp;
                     try

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OptimisticLockingTest.java Wed Dec 20 02:32:25 2006
@@ -7,27 +7,28 @@
  */
 public class OptimisticLockingTest extends PBTestCase
 {
+    public static void main(String[] args)
+    {
+        String[] arr = {OptimisticLockingTest.class.getName()};
+        junit.textui.TestRunner.main(arr);
+    }
+
+    public OptimisticLockingTest(String name)
+    {
+        super(name);
+    }
 
-	public static void main(String[] args)
-	{
-		String[] arr = {OptimisticLockingTest.class.getName()};
-		junit.textui.TestRunner.main(arr);
-	}
-
-	public OptimisticLockingTest(String name)
-	{
-		super(name);
-	}
-
-	/** Test optimistic Lock by version.*/
-	public void testVersionLock() throws Exception
-	{
+    /**
+     * Test optimistic Lock by version.
+     */
+    public void testVersionLock() throws Exception
+    {
         LockedByVersion obj = new LockedByVersion();
         obj.setValue("original");
-        Identity oid = new Identity(obj, broker);
         broker.beginTransaction();
         broker.store(obj);
         broker.commitTransaction();
+        Identity oid = broker.serviceIdentity().buildIdentity(obj);
 
         broker.clearCache();
         LockedByVersion copy1 = (LockedByVersion) broker.getObjectByIdentity(oid);
@@ -50,7 +51,7 @@
             broker.store(copy2);
             broker.commitTransaction();
         }
-        catch (OptimisticLockException ex)
+        catch(OptimisticLockException ex)
         {
             assertTrue(true);
             //LoggerFactory.getDefaultLogger().debug(ex);
@@ -58,20 +59,20 @@
             return;
         }
         fail("Should throw an Optimistic Lock exception");
-	}
+    }
 
-	/**
-	 * demonstrates how OptimisticLockExceptions can be used
-	 * to handle resynchronization of conflicting instances.
-	 */
-	public void testLockHandling() throws Exception
-	{
+    /**
+     * demonstrates how OptimisticLockExceptions can be used
+     * to handle resynchronization of conflicting instances.
+     */
+    public void testLockHandling() throws Exception
+    {
         LockedByVersion obj = new LockedByVersion();
         obj.setValue("original");
-        Identity oid = new Identity(obj, broker);
         broker.beginTransaction();
         broker.store(obj);
         broker.commitTransaction();
+        Identity oid = broker.serviceIdentity().buildIdentity(obj);
 
         broker.clearCache();
         LockedByVersion copy1 = (LockedByVersion) broker.getObjectByIdentity(oid);
@@ -94,14 +95,14 @@
             broker.store(copy2);
             broker.commitTransaction();
         }
-        catch (OptimisticLockException ex)
+        catch(OptimisticLockException ex)
         {
             // obtain conflicting object from exception
             Object conflictingObject = ex.getSourceObject();
 
             // get a synchronized instance
             broker.removeFromCache(conflictingObject);
-            Object syncronizedObject = broker.getObjectByIdentity(new Identity(conflictingObject, broker));
+            Object syncronizedObject = broker.getObjectByIdentity(broker.serviceIdentity().buildIdentity(conflictingObject));
 
             // modify synchronized copy and call store again without trouble
             ((LockedByVersion) syncronizedObject).setValue("copy 3");
@@ -111,18 +112,20 @@
             return;
         }
         fail("Should throw an Optimistic Lock exception");
-	}
+    }
 
 
-/** Test optimistic Lock by timestamp.*/
-	public void testTimestampLock() throws Exception
-	{
-		LockedByTimestamp obj = new LockedByTimestamp();
+    /**
+     * Test optimistic Lock by timestamp.
+     */
+    public void testTimestampLock() throws Exception
+    {
+        LockedByTimestamp obj = new LockedByTimestamp();
         obj.setValue("original");
-        Identity oid = new Identity(obj, broker);
         broker.beginTransaction();
         broker.store(obj);
         broker.commitTransaction();
+        Identity oid = broker.serviceIdentity().buildIdentity(obj);
 
         broker.clearCache();
         LockedByTimestamp copy1 = (LockedByTimestamp) broker.getObjectByIdentity(oid);
@@ -130,12 +133,13 @@
         LockedByTimestamp copy2 = (LockedByTimestamp) broker.getObjectByIdentity(oid);
 
         /*
-        //mysql timestamp does not support milliseconds
+        mysql timestamp does not support milliseconds
         arminw:
-        For proper test we need millisecond precision, so if mysql does not support
-        this, better we let fail this test for mysql
+        For proper test we need millisecond precision but some databases only
+        support second precision. Thus we wait 1 sec to make this test compatible
+        with most DB
         */
-        Thread.sleep(50);
+        Thread.sleep(1001);
 
         copy1.setValue("copy 1");
         copy2.setValue("copy 2");
@@ -155,7 +159,7 @@
 
             fail("Should throw an Optimistic Lock exception");
         }
-        catch (OptimisticLockException ex)
+        catch(OptimisticLockException ex)
         {
             assertTrue(true);
             broker.abortTransaction();
@@ -171,16 +175,15 @@
             broker.delete(copy1);
             broker.commitTransaction();
         }
-        catch (OptimisticLockException e)
+        catch(OptimisticLockException e)
         {
-           // BRJ: exception thrown if object has been modified or deleted
-           //
-           // fail("If an object which use optimistic locking was deleted two times, OJB" +
-           //         " should not throw an optimistic locking exception: "+e.getMessage());
+            // BRJ: exception thrown if object has been modified or deleted
+            //
+            // fail("If an object which use optimistic locking was deleted two times, OJB" +
+            //         " should not throw an optimistic locking exception: "+e.getMessage());
             broker.abortTransaction();
-           return;
+            return;
         }
         fail("Should throw an Optimistic Lock exception");
     }
-
 }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/QueryTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/QueryTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/QueryTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/QueryTest.java Wed Dec 20 02:32:25 2006
@@ -2306,15 +2306,16 @@
 
     public void testOuterJoin()
     {
+        String appendix = "_" + System.currentTimeMillis();
         Article a = new Article();
-        a.articleName = "Good stuff";
+        a.articleName = "Good stuff" + appendix;
         a.productGroup = null;
         broker.beginTransaction();
         broker.store(a);
         broker.commitTransaction();
         
         Criteria crit = new Criteria();
-        crit.addLike("articleName", "G%");
+        crit.addLike("articleName", "G%"+appendix);
         crit.addIsNull("productGroup.description");
         
         QueryByCriteria qry1 = QueryFactory.newQuery(Article.class, crit);

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/UnwrapHelperTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/UnwrapHelperTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/UnwrapHelperTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/UnwrapHelperTest.java Wed Dec 20 02:32:25 2006
@@ -36,6 +36,8 @@
     private String connectionClassName = "org.hsqldb.jdbc.jdbcConnection";
     private String selectExample = "select 1 from OJB_HL_SEQ";
 
+    private static final Object[]testPattern = {"test", UnwrapHelper.TYPE_METHOD, null, null, UnwrapHelper.TYPE_METHOD, null, null};
+
     public static void main(String[] args)
     {
         String[] arr = {UnwrapHelperTest.class.getName()};
@@ -63,7 +65,7 @@
         int length = helper.getUnwrapPatterns().length;
         Object[] pattern = helper.getUnwrapPatterns()[0];
         helper.addUnwrapPattern(pattern);
-        helper.addUnwrapPattern(new Object[][]{null, null, null, null, null, null, null});
+        helper.addUnwrapPattern(testPattern);
         //System.out.println("## " + helper.toString());
         assertEquals(length + 2, helper.getUnwrapPatterns().length);
     }
@@ -125,7 +127,7 @@
 
         Object[] pattern = helper.getUnwrapPatterns()[0];
         helper.addUnwrapPattern(pattern);
-        helper.addUnwrapPattern(new Object[][]{null, null, null, null, null, null, null});
+        helper.addUnwrapPattern(testPattern);
         //System.out.println("Patterns: " + helper);
 
         t = System.currentTimeMillis();

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cache/ObjectCacheTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cache/ObjectCacheTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cache/ObjectCacheTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cache/ObjectCacheTest.java Wed Dec 20 02:32:25 2006
@@ -100,7 +100,7 @@
             bool = bool && cache.lookup(oid_3) != null;
             assertFalse("We should not found all cached objects", bool);
             // idle time is 2 sec
-            Thread.sleep(4000);
+            Thread.sleep(4100);
             assertNull(cache.lookup(oid_1));
             assertNull(cache.lookup(oid_2));
             assertNull(cache.lookup(oid_3));

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/lob/LOBTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/lob/LOBTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/lob/LOBTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/lob/LOBTest.java Wed Dec 20 02:32:25 2006
@@ -384,7 +384,7 @@
     {
         if(getPlatformClass().equals(PlatformHsqldbImpl.class.getName()))
         {
-            ojbSkipTestMessage("# Skip unsupported operation for platform: " + getPlatformClass() + " #");
+            ojbSkipTestMessage("Skip unsupported operation for platform: " + getPlatformClass() + ", Blob().setBytes(...)");
             return;
         }
         doUpdate(UpdateSetBytesSetString);
@@ -394,7 +394,7 @@
     {
         if(getPlatformClass().equals(PlatformHsqldbImpl.class.getName()))
         {
-            ojbSkipTestMessage("# Skip unsupported operation for platform: " + getPlatformClass() + " #");
+            ojbSkipTestMessage("Skip unsupported operation for platform: " + getPlatformClass() + ", setBlob(...)");
             return;
         }
         doUpdate(UpdateSetBlobSetClob);
@@ -404,7 +404,7 @@
     {
         if(getPlatformClass().equals(PlatformHsqldbImpl.class.getName()))
         {
-            ojbSkipTestMessage("# Skip unsupported operation for platform: " + getPlatformClass() + " #");
+            ojbSkipTestMessage("Skip unsupported operation for platform: " + getPlatformClass() + ", Blob().setBinaryStream(...)");
             return;
         }
         doUpdate(UpdateSetBinaryStreamSetCharacterStream);
@@ -416,11 +416,9 @@
 
     public void doUpdate(int updateType) throws Exception
     {
-        int size = 10;
-
-        byte[] barr = new byte[size];
+        byte[] barr = new byte[10];
         String carr = "yyyyyyyyyy";
-        for(int i = 0; i < size; i++)
+        for(int i = 0; i < 10; i++)
         {
             barr[i] = (byte) 'x';
         }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java Wed Dec 20 02:32:25 2006
@@ -269,7 +269,7 @@
         SequenceManager sm = SequenceManagerFactory.getSequenceManager(broker);
         if (!(sm instanceof SequenceManagerNextValImpl))
         {
-            System.out.println("This test only works for SeqMan implementations using "
+            ojbSkipTestMessage("This test only works for SeqMan implementations using "
                     + SequenceManagerNextValImpl.class + " Skip test case.");
             broker.close();
             return;

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java Wed Dec 20 02:32:25 2006
@@ -167,7 +167,7 @@
                                 + ". This can be a result of low hardware.");
                     try
                     {
-                        Thread.sleep(50 + (long) Math.random() * 100);
+                        Thread.sleep((long) (Math.random() * 200));
                     }
                     catch(InterruptedException e1)
                     {

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_inheritance.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_inheritance.xml?view=diff&rev=489019&r1=489018&r2=489019
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_inheritance.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_inheritance.xml Wed Dec 20 02:32:25 2006
@@ -503,9 +503,42 @@
         <foreignkey field-ref="secondFk"/>
     </reference-descriptor>
 </class-descriptor>
+
 <class-descriptor
-    class="org.apache.ojb.broker.InheritanceMultipleTableTest$Fourth"
-    table="TPS_FOURTH"
+    class="org.apache.ojb.broker.InheritanceMultipleTableTest$FourthA"
+    table="TPS_FOURTH_A"
+>
+    <field-descriptor
+        name="id"
+        column="ID_A"
+        jdbc-type="INTEGER"
+        primarykey="true"
+        autoincrement="true"
+    />
+
+    <field-descriptor
+        name="fourth"
+        column="FOURTH_"
+        jdbc-type="VARCHAR"
+    />
+
+    <field-descriptor
+        name="thirdFk"
+        column="THIRD_FK"
+        jdbc-type="INTEGER"
+        access="anonymous"
+    />
+
+    <reference-descriptor name="super"
+        class-ref="org.apache.ojb.broker.InheritanceMultipleTableTest$Third"
+    >
+        <foreignkey field-ref="thirdFk"/>
+    </reference-descriptor>
+</class-descriptor>
+
+<class-descriptor
+    class="org.apache.ojb.broker.InheritanceMultipleTableTest$FourthB"
+    table="TPS_FOURTH_B"
 >
     <field-descriptor
         name="id"



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org