openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dez...@apache.org
Subject svn commit: r618786 - in /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence: jdbc/annotations/TestVersion.java simple/TestCaseInsensitiveKeywordsInJPQL.java
Date Tue, 05 Feb 2008 21:46:11 GMT
Author: dezzio
Date: Tue Feb  5 13:46:09 2008
New Revision: 618786

URL: http://svn.apache.org/viewvc?rev=618786&view=rev
Log:
Improved the robustness of these test cases

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestCaseInsensitiveKeywordsInJPQL.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java?rev=618786&r1=618785&r2=618786&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java
Tue Feb  5 13:46:09 2008
@@ -88,6 +88,15 @@
     }
 
     public void testVersionTimestamp() {
+        // ensure that some time has passed
+        // since the records were created
+        try {
+            Thread.sleep(50);
+        }
+        catch (InterruptedException e) {
+            // do nothing
+        }
+        
         EntityManager em1 = emf.createEntityManager();
         em1.getTransaction().begin();
         EntityManager em2 = emf.createEntityManager();
@@ -107,7 +116,9 @@
         em1 = emf.createEntityManager();
         pc1 = em1.find(AnnoTest2.class,
             new AnnoTest2.Oid(5, "bar"));
-        assertTrue(pc1.getVersion().compareTo(pc2.getVersion()) > 0);
+        java.util.Date pc1Version = pc1.getVersion();
+        java.util.Date pc2Version = pc2.getVersion();
+        assertTrue(pc1Version.compareTo(pc2Version) > 0);
         em1.close();
         try {
             em2.getTransaction().commit();

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestCaseInsensitiveKeywordsInJPQL.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestCaseInsensitiveKeywordsInJPQL.java?rev=618786&r1=618785&r2=618786&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestCaseInsensitiveKeywordsInJPQL.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestCaseInsensitiveKeywordsInJPQL.java
Tue Feb  5 13:46:09 2008
@@ -27,7 +27,8 @@
     extends SingleEMFTestCase {
 
     public void setUp() {
-        setUp(AllFieldTypes.class);
+        // expecting only data that is inserted in this test case
+        setUp(AllFieldTypes.class, CLEAR_TABLES);
     }
 
     public void testCaseInsensitiveBooleans() {



Mime
View raw message