db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r452266 - in /db/ojb/trunk/src/test/org/apache/ojb: broker/PathTest.java broker/QueryTest.java odmg/LockingMultithreadedTest.java
Date Mon, 02 Oct 2006 23:46:17 GMT
Author: arminw
Date: Mon Oct  2 16:46:16 2006
New Revision: 452266

URL: http://svn.apache.org/viewvc?view=rev&rev=452266
Log:
fix, cleanup tests

Modified:
    db/ojb/trunk/src/test/org/apache/ojb/broker/PathTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java
    db/ojb/trunk/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/PathTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/PathTest.java?view=diff&rev=452266&r1=452265&r2=452266
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/PathTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/PathTest.java Mon Oct  2 16:46:16 2006
@@ -228,362 +228,290 @@
 	 */
 	public void testPathClassOnSegment1() throws Exception
 	{
-        try
-		{
-			// c1 criteria 
-			Criteria crit1 = new Criteria();
-			crit1.addEqualTo("cSet.c1Attrib", new Integer("10001"));
-			crit1.addPathClass("cSet", C1.class);
-			
-			Query query = QueryFactory.newQuery(B.class, crit1);
-
-			Collection allBs = broker.getCollectionByQuery(query);
-
-			java.util.Iterator itr = allBs.iterator();
-
-			assertEquals(1 * NUM_A, allBs.size());
-			output.append(eol +"testPathClassOnSegment1() iteration size:" + allBs.size());
-			while (itr.hasNext())
-			{
-				B b = (B) itr.next();
-				output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
-			}
-		}
-		catch (Throwable t)
-		{
-			t.printStackTrace(System.out);
-			fail("testPathClassOnSegment1: " + t.getMessage());
-		}
-	}
-	
+        // c1 criteria
+        Criteria crit1 = new Criteria();
+        crit1.addEqualTo("cSet.c1Attrib", new Integer("10001"));
+        crit1.addPathClass("cSet", C1.class);
+
+        Query query = QueryFactory.newQuery(B.class, crit1);
+
+        Collection allBs = broker.getCollectionByQuery(query);
+
+        java.util.Iterator itr = allBs.iterator();
+
+        assertEquals(1 * NUM_A, allBs.size());
+        output.append(eol +"testPathClassOnSegment1() iteration size:" + allBs.size());
+        while (itr.hasNext())
+        {
+            B b = (B) itr.next();
+            output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
+        }
+    }
+
 	/*
 	 *  Find all As having a particular C1 (c1)
 	 *  Works
 	 */
 	public void testPathClassOnSegment2() throws Exception
 	{
-        try
-		{
-			// c1 criteria 
-			Criteria crit1 = new Criteria();
-			crit1.addEqualTo("bSet.cSet.c1Attrib", new Integer("10001"));
-			crit1.addPathClass("bSet.cSet", C1.class);
-			
-			Query query = QueryFactory.newQuery(A.class, crit1);
-
-			Collection allAs = broker.getCollectionByQuery(query);
-
-			java.util.Iterator itr = allAs.iterator();
-
-			assertEquals(allAs.size(), 1 * NUM_A);
-			output.append(eol +"testPathClassOnSegment2() iteration size:" + allAs.size());
-			while (itr.hasNext())
-			{
-				A a = (A) itr.next();
-				output.append(eol +"Found A:  " + a.getId() + " " + a.getaAttrib());
-			}
-		}
-		catch (Throwable t)
-		{
-			t.printStackTrace(System.out);
-			fail("testPathClassOnSegment2: " + t.getMessage());
-		}
-	}
-	
+        // c1 criteria
+        Criteria crit1 = new Criteria();
+        crit1.addEqualTo("bSet.cSet.c1Attrib", new Integer("10001"));
+        crit1.addPathClass("bSet.cSet", C1.class);
+
+        Query query = QueryFactory.newQuery(A.class, crit1);
+
+        Collection allAs = broker.getCollectionByQuery(query);
+
+        java.util.Iterator itr = allAs.iterator();
+
+        assertEquals(allAs.size(), 1 * NUM_A);
+        output.append(eol +"testPathClassOnSegment2() iteration size:" + allAs.size());
+        while (itr.hasNext())
+        {
+            A a = (A) itr.next();
+            output.append(eol +"Found A:  " + a.getId() + " " + a.getaAttrib());
+        }
+    }
+
 	/*
 	 *  Find all Bs having a C with a particular D (d1)
 	 *  Works
 	 */
 	public void testSingleAlias() throws Exception
 	{
-        try
-		{
-			// d1 criteria 
-			Criteria crit1 = new Criteria();
-			crit1.setAlias("cToD1", "cSet");  // unnecessary, but its use should not
-											// cause incorrect results
-			crit1.addEqualTo("cSet.d.dAttrib", new Integer("10010"));
-
-			Query query = QueryFactory.newQuery(B.class, crit1);
-
-			Collection allBs = broker.getCollectionByQuery(query);
-
-			java.util.Iterator itr = allBs.iterator();
-
-			assertEquals(2 * NUM_A, allBs.size());
-			output.append(eol +"testSingleAlias() iteration size:" + allBs.size());
-			while (itr.hasNext())
-			{
-				B b = (B) itr.next();
-				output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
-			}
-		}
-		catch (Throwable t)
-		{
-			t.printStackTrace(System.out);
-			fail("testSingleAlias: " + t.getMessage());
-		}
-	}
-	
+        // d1 criteria
+        Criteria crit1 = new Criteria();
+        crit1.setAlias("cToD1", "cSet");  // unnecessary, but its use should not
+                                        // cause incorrect results
+        crit1.addEqualTo("cSet.d.dAttrib", new Integer("10010"));
+
+        Query query = QueryFactory.newQuery(B.class, crit1);
+
+        Collection allBs = broker.getCollectionByQuery(query);
+
+        java.util.Iterator itr = allBs.iterator();
+
+        assertEquals(2 * NUM_A, allBs.size());
+        output.append(eol +"testSingleAlias() iteration size:" + allBs.size());
+        while (itr.hasNext())
+        {
+            B b = (B) itr.next();
+            output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
+        }
+    }
+
 	/*
 	 *  Find all Bs having any C with a particular D (d1) and any C with a particular D (d2)
 	 *  Works
 	 */
 	public void testTwoAliasesTwoSegments() throws Exception
 	{
-        try
-		{
-			// d1 criteria 
-			Criteria crit1 = new Criteria();
-			crit1.setAlias("cToD1", "cSet.d");
-			crit1.addEqualTo("cSet.d.dAttrib", new Integer("10010"));
-
-			// d2 criteria
-			Criteria crit2 = new Criteria();
-			crit2.setAlias("cToD2", "cSet.d");
-			crit2.addEqualTo("cSet.d.dAttrib", new Integer("10110"));
-
-			crit1.addAndCriteria(crit2);
-
-			Query query = QueryFactory.newQuery(B.class, crit1);
-
-			Collection allBs = broker.getCollectionByQuery(query);
-
-			Iterator itr = allBs.iterator();
-
-			assertEquals(4 * NUM_A, allBs.size());
-			output.append(eol +"testTwoAliasesTwoSegments() iteration size:" + allBs.size());
-			while (itr.hasNext())
-			{
-				B b = (B) itr.next();
-				output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
-			}
-		}
-		catch (Throwable t)
-		{
-			t.printStackTrace(System.out);
-			fail("testTwoAliasesTwoSegments: " + t.getMessage());
-		}
-	}
-	
+			// d1 criteria
+        Criteria crit1 = new Criteria();
+        crit1.setAlias("cToD1", "cSet.d");
+        crit1.addEqualTo("cSet.d.dAttrib", new Integer("10010"));
+
+        // d2 criteria
+        Criteria crit2 = new Criteria();
+        crit2.setAlias("cToD2", "cSet.d");
+        crit2.addEqualTo("cSet.d.dAttrib", new Integer("10110"));
+
+        crit1.addAndCriteria(crit2);
+
+        Query query = QueryFactory.newQuery(B.class, crit1);
+
+        Collection allBs = broker.getCollectionByQuery(query);
+
+        Iterator itr = allBs.iterator();
+
+        assertEquals(4 * NUM_A, allBs.size());
+        output.append(eol +"testTwoAliasesTwoSegments() iteration size:" + allBs.size());
+        while (itr.hasNext())
+        {
+            B b = (B) itr.next();
+            output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
+        }
+    }
+
 	/*
 	 *  Find all As having any B with any C with a particular D (d1) and any C with a particular
D (d2)
 	 *  Works
 	 */
 	public void testTwoAliasesThreeSegments() throws Exception
 	{
-        try
-		{
-			// d1 criteria 
-			Criteria crit1 = new Criteria();
-			crit1.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10010"));
-			crit1.setAlias("bToCToD1", "cSet.d");
-
-			// d2 criteria
-			Criteria crit2 = new Criteria();
-			crit2.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10110"));
-			crit2.setAlias("bToCToD2", "cSet.d");
-
-			crit1.addAndCriteria(crit2);
-
-			Query query = QueryFactory.newQuery(A.class, crit1, true);
-
-			Collection allAs = broker.getCollectionByQuery(query);
-
-			java.util.Iterator itr = allAs.iterator();
-
-			assertEquals(1 * NUM_A, allAs.size());
-			output.append(eol +"testTwoAliasesThreeSegments() iteration size:" + allAs.size());
-			while (itr.hasNext())
-			{
-				A a = (A) itr.next();
-				output.append(eol +"Found A:  " + a.getId() + " " + a.getaAttrib());
-			}
-		}
-		catch (Throwable t)
-		{
-			t.printStackTrace(System.out);
-			fail("testTwoAliasesThreeSegments: " + t.getMessage());
-		}
-	}	
-	
+        // d1 criteria
+        Criteria crit1 = new Criteria();
+        crit1.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10010"));
+        crit1.setAlias("bToCToD1", "cSet.d");
+
+        // d2 criteria
+        Criteria crit2 = new Criteria();
+        crit2.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10110"));
+        crit2.setAlias("bToCToD2", "cSet.d");
+
+        crit1.addAndCriteria(crit2);
+
+        Query query = QueryFactory.newQuery(A.class, crit1, true);
+
+        Collection allAs = broker.getCollectionByQuery(query);
+
+        java.util.Iterator itr = allAs.iterator();
+
+        assertEquals(1 * NUM_A, allAs.size());
+        output.append(eol +"testTwoAliasesThreeSegments() iteration size:" + allAs.size());
+        while (itr.hasNext())
+        {
+            A a = (A) itr.next();
+            output.append(eol +"Found A:  " + a.getId() + " " + a.getaAttrib());
+        }
+    }
+
 	/*
 	 *  Find all Bs having a particular C (c) and a particular C1 (c1)
 	 */
     public void testPathClassPerCriteria() throws Exception
     {
-        try
-        {
-            // C criteria
-            Criteria crit1 = new Criteria();
-            crit1.addEqualTo("cSet.cAttrib", new Integer("10200"));
-            crit1.addPathClass("cSet", C.class);
-			crit1.setAlias("alias1");
-
-            // C1 criteria (subclass of C)
-            Criteria crit2 = new Criteria();
-            crit2.addEqualTo("cSet.c1Attrib", new Integer("10001"));
-            crit2.addPathClass("cSet", C1.class);
-			crit2.setAlias("alias2");
-
-            crit1.addAndCriteria(crit2);
-
-            Query query = QueryFactory.newQuery(B.class, crit1);
-
-            Collection allBs = broker.getCollectionByQuery(query);
-
-            java.util.Iterator itr = allBs.iterator();
-
-            assertEquals(1 * NUM_A, allBs.size());
-            output.append(eol +"testPathClassPerCriteria() iteration size:" + allBs.size());
-            while (itr.hasNext())
-            {
-                B b = (B) itr.next();
-                output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
-            }
-        }
-        catch (Throwable t)
+        // C criteria
+        Criteria crit1 = new Criteria();
+        crit1.addEqualTo("cSet.cAttrib", new Integer("10200"));
+        crit1.addPathClass("cSet", C.class);
+        crit1.setAlias("alias1");
+
+        // C1 criteria (subclass of C)
+        Criteria crit2 = new Criteria();
+        crit2.addEqualTo("cSet.c1Attrib", new Integer("10001"));
+        crit2.addPathClass("cSet", C1.class);
+        crit2.setAlias("alias2");
+
+        crit1.addAndCriteria(crit2);
+
+        Query query = QueryFactory.newQuery(B.class, crit1);
+
+        Collection allBs = broker.getCollectionByQuery(query);
+
+        java.util.Iterator itr = allBs.iterator();
+
+        assertEquals(1 * NUM_A, allBs.size());
+        output.append(eol +"testPathClassPerCriteria() iteration size:" + allBs.size());
+        while (itr.hasNext())
         {
-            t.printStackTrace(System.out);
-            fail("testPathClassPerCriteria: " + t.getMessage());
+            B b = (B) itr.next();
+            output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
         }
     }
-    
+
 	/*
 	 *  Find all Bs having a particular C1 (c1_a) and a particular C3 (c1_b)
 	 *  Works
 	 */
 	public void testPathClassPerQuery() throws Exception
 	{
-        try
-		{
-			// c1_a criteria 
-			Criteria crit1 = new Criteria();
-			crit1.addEqualTo("cSet.c1Attrib", new Integer("12001"));
-			//crit1.addPathClass("cSet", C1.class); // can use 1 query setting instead
-			crit1.setAlias("alias1");
-
-			// c2_b criteria
-			Criteria crit2 = new Criteria();
-			crit2.addEqualTo("cSet.c1Attrib", new Integer("12101"));
-			//crit2.addPathClass("cSet", C1.class); // can use 1 query setting instead
-			crit2.setAlias("alias2");
-
-			crit1.addAndCriteria(crit2);
-
-			QueryByCriteria query = QueryFactory.newQuery(B.class, crit1);
-			query.addPathClass("cSet", C1.class);
-
-			Collection allBs = broker.getCollectionByQuery(query);
-
-			java.util.Iterator itr = allBs.iterator();
-
-			assertEquals(1 * NUM_A, allBs.size());
-			output.append(eol +"testPathClassPerQuery() iteration size:" + allBs.size());
-			while (itr.hasNext())
-			{
-				B b = (B) itr.next();
-				output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
-			}
-		}
-		catch (Throwable t)
-		{
-			t.printStackTrace(System.out);
-			fail("testPathClassPerQuery: " + t.getMessage());
-		}
-	}
-	
+        // c1_a criteria
+        Criteria crit1 = new Criteria();
+        crit1.addEqualTo("cSet.c1Attrib", new Integer("12001"));
+        //crit1.addPathClass("cSet", C1.class); // can use 1 query setting instead
+        crit1.setAlias("alias1");
+
+        // c2_b criteria
+        Criteria crit2 = new Criteria();
+        crit2.addEqualTo("cSet.c1Attrib", new Integer("12101"));
+        //crit2.addPathClass("cSet", C1.class); // can use 1 query setting instead
+        crit2.setAlias("alias2");
+
+        crit1.addAndCriteria(crit2);
+
+        QueryByCriteria query = QueryFactory.newQuery(B.class, crit1);
+        query.addPathClass("cSet", C1.class);
+
+        Collection allBs = broker.getCollectionByQuery(query);
+
+        java.util.Iterator itr = allBs.iterator();
+
+        assertEquals(1 * NUM_A, allBs.size());
+        output.append(eol +"testPathClassPerQuery() iteration size:" + allBs.size());
+        while (itr.hasNext())
+        {
+            B b = (B) itr.next();
+            output.append(eol +"Found B:  " + b.getId() + " " + b.getbAttrib());
+        }
+    }
+
 	/*
 	 *  Find all As having a B with both a particular C-D combination and 
 	 *  another particular C-D combination
 	 */
 	public void testThreeSegmentsAliasOnSegment2And3() throws Exception
 	{
-        try
-		{
-			// d1 criteria 
-			Criteria crit1 = new Criteria();
-			crit1.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10010"));
-			crit1.setAlias("bToCToD1", "cSet.d");
-
-			// d2 criteria
-			Criteria crit2 = new Criteria();
-			crit2.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10110"));
-			crit2.setAlias("bToCToD2", "cSet.d");
-
-			crit1.addAndCriteria(crit2);
-
-			boolean isDistinct = true;
-			Query query = QueryFactory.newQuery(A.class, crit1, isDistinct);
-
-			Collection allAs = broker.getCollectionByQuery(query);
-
-			java.util.Iterator itr = allAs.iterator();
-
-			assertEquals(1 * NUM_A, allAs.size());
-			output.append(eol +"testThreeSegmentsAliasOnSegment2And3() iteration size:" + allAs.size());
-			while (itr.hasNext())
-			{
-				A a = (A) itr.next();
-				output.append(eol +"Found A:  " + a.getId() + " " + a.getaAttrib());
-			}
-		}
-		catch (Throwable t)
-		{
-			t.printStackTrace(System.out);
-			fail("testThreeSegmentsAliasOnSegment2And3: " + t.getMessage());
-		}
-	}	
-	
+        // d1 criteria
+        Criteria crit1 = new Criteria();
+        crit1.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10010"));
+        crit1.setAlias("bToCToD1", "cSet.d");
+
+        // d2 criteria
+        Criteria crit2 = new Criteria();
+        crit2.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10110"));
+        crit2.setAlias("bToCToD2", "cSet.d");
+
+        crit1.addAndCriteria(crit2);
+
+        boolean isDistinct = true;
+        Query query = QueryFactory.newQuery(A.class, crit1, isDistinct);
+
+        Collection allAs = broker.getCollectionByQuery(query);
+
+        java.util.Iterator itr = allAs.iterator();
+
+        assertEquals(1 * NUM_A, allAs.size());
+        output.append(eol +"testThreeSegmentsAliasOnSegment2And3() iteration size:" + allAs.size());
+        while (itr.hasNext())
+        {
+            A a = (A) itr.next();
+            output.append(eol +"Found A:  " + a.getId() + " " + a.getaAttrib());
+        }
+    }
+
 	/*
 	 *  Same as above using an explicit UserAlias
 	 */
 	public void testThreeSegmentsAliasOnSegment2And3UserAlias() throws Exception
 	{
-        try
-		{
-			UserAlias userAlias1 = new UserAlias("alias1");
-			userAlias1.add("bSet.cSet");
-			userAlias1.add("bSet.cSet.d");
-			
-			// d1 criteria 
-			Criteria crit1 = new Criteria();
-			crit1.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10010"));
-			crit1.setAlias(userAlias1);
-
-			// d2 criteria
-			UserAlias userAlias2 = new UserAlias("alias2");
-			userAlias2.add("bSet.cSet");
-			userAlias2.add("bSet.cSet.d");
-
-			Criteria crit2 = new Criteria();
-			crit2.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10110"));
-			crit2.setAlias(userAlias2);
-
-			crit1.addAndCriteria(crit2);
-
-			boolean isDistinct = true;
-			Query query = QueryFactory.newQuery(A.class, crit1, isDistinct);
-
-			Collection allAs = broker.getCollectionByQuery(query);
-
-			java.util.Iterator itr = allAs.iterator();
-
-			assertEquals(1 * NUM_A, allAs.size());
-			output.append(eol +"testThreeSegmentsAliasOnSegment2And3UserAlias() iteration size:" +
allAs.size());
-			while (itr.hasNext())
-			{
-				A a = (A) itr.next();
-				output.append(eol +"Found A:  " + a.getId() + " " + a.getaAttrib());
-			}
-		}
-		catch (Throwable t)
-		{
-			t.printStackTrace(System.out);
-			fail("testThreeSegmentsAliasOnSegment2And3UserAlias: " + t.getMessage());
-		}
-	}	
-	
+        UserAlias userAlias1 = new UserAlias("alias1");
+        userAlias1.add("bSet.cSet");
+        userAlias1.add("bSet.cSet.d");
+
+        // d1 criteria
+        Criteria crit1 = new Criteria();
+        crit1.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10010"));
+        crit1.setAlias(userAlias1);
+
+        // d2 criteria
+        UserAlias userAlias2 = new UserAlias("alias2");
+        userAlias2.add("bSet.cSet");
+        userAlias2.add("bSet.cSet.d");
+
+        Criteria crit2 = new Criteria();
+        crit2.addEqualTo("bSet.cSet.d.dAttrib", new Integer("10110"));
+        crit2.setAlias(userAlias2);
+
+        crit1.addAndCriteria(crit2);
+
+        boolean isDistinct = true;
+        Query query = QueryFactory.newQuery(A.class, crit1, isDistinct);
+
+        Collection allAs = broker.getCollectionByQuery(query);
+
+        java.util.Iterator itr = allAs.iterator();
+
+        assertEquals(1 * NUM_A, allAs.size());
+        output.append(eol +"testThreeSegmentsAliasOnSegment2And3UserAlias() iteration size:"
+ allAs.size());
+        while (itr.hasNext())
+        {
+            A a = (A) itr.next();
+            output.append(eol +"Found A:  " + a.getId() + " " + a.getaAttrib());
+        }
+    }
+
 	public void testSubQueryExists()
     {
         // subquery

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java?view=diff&rev=452266&r1=452265&r2=452266
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java Mon Oct  2 16:46:16 2006
@@ -100,7 +100,7 @@
             Object[] row = (Object[]) iter.next();
             assertEquals(3, row.length);
             results.add(row);
-            result += ((Integer) row[2]).intValue();
+            result += ((Number) row[2]).intValue();
             //System.out.println("Result_1: " + ArrayUtils.toString(row));
         }
         assertEquals(2, result);
@@ -123,7 +123,7 @@
             Object[] row = (Object[]) iter.next();
             assertEquals(3, row.length);
             results.add(row);
-            result += ((Integer) row[2]).intValue();
+            result += ((Number) row[2]).intValue();
             //System.out.println("Result_2: " + ArrayUtils.toString(row));
         }
         assertEquals(3, result);
@@ -684,10 +684,14 @@
         subCrit.addLike("articleName", "%Tofu%");
         subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
         subQuery.setAttributes(new String[]{"articleId"});
+        // add ORDER BY in sub-select --> not all databases support this
+        // check Platform#supportsOrder#supportsOrderByInSubSelect()
         subQuery.addOrderByAscending("articleId");
 
         crit.addExists(subQuery);
-        Query q = QueryFactory.newQuery(ProductGroup.class, crit);
+        QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit);
+        // oder the result
+        q.addOrderBy("groupId", true);
 
         Collection results = broker.getCollectionByQuery(q);
         assertNotNull(results);
@@ -1215,7 +1219,7 @@
         {
             results.add(iter.next());
         }
-        assertTrue(results.size() == 3);
+        assertEquals(3, results.size());
 
         results.clear();
         q.setStartAtIndex(1);
@@ -1226,7 +1230,7 @@
         {
             results.add(iter.next());
         }
-        assertTrue(results.size() == 5);
+        assertEquals(5, results.size());
     }
 
     /**

Modified: db/ojb/trunk/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java?view=diff&rev=452266&r1=452265&r2=452266
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java Mon Oct  2 16:46:16
2006
@@ -28,8 +28,8 @@
     // number of updates each thread performs against the object
     private final int objectUpdates = 30;
     // max number of attemps to get a lock
-    private static final int maxAttempts = 150;
-    private static final int nearMax = (int) (maxAttempts * 0.75);
+    private static final int maxAttempts = 200;
+    private static final int nearMax = (int) (maxAttempts * 0.90);
 
 
     public static void main(String[] args)
@@ -167,7 +167,7 @@
                                 + ". This can be a result of low hardware.");
                     try
                     {
-                        Thread.sleep(30);
+                        Thread.sleep((long) Math.random() * 100);
                     }
                     catch(InterruptedException e1)
                     {



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