cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1383207 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java
Date Tue, 11 Sep 2012 01:23:50 GMT
Author: aadamchik
Date: Tue Sep 11 01:23:49 2012
New Revision: 1383207

URL: http://svn.apache.org/viewvc?rev=1383207&view=rev
Log:
CAY-1737 ObjectContexts listening to DataChannel events must be non-blocking

adding delays to mt unit tests

(cherry picked from commit 434e04f73221db9548f348e95559890f22e1aa93)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java?rev=1383207&r1=1383206&r2=1383207&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java
Tue Sep 11 01:23:49 2012
@@ -45,6 +45,7 @@ import org.apache.cayenne.unit.di.DataCh
 import org.apache.cayenne.unit.di.UnitTestClosure;
 import org.apache.cayenne.unit.di.client.ClientCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
+import org.apache.cayenne.unit.util.ThreadedTestHelper;
 
 @UseServerRuntime(ClientCase.MULTI_TIER_PROJECT)
 public class CayenneContextWithDataContextTest extends ClientCase {
@@ -199,7 +200,7 @@ public class CayenneContextWithDataConte
 
     public void testPostAddOnObjectCallback() throws Exception {
 
-        DataContext serverContext = (DataContext) clientServerChannel.getParentChannel();
+        final DataContext serverContext = (DataContext) clientServerChannel.getParentChannel();
 
         LifecycleCallbackRegistry callbackRegistry = serverContext
                 .getEntityResolver()
@@ -211,15 +212,23 @@ public class CayenneContextWithDataConte
                     MtTable1.class,
                     "prePersistMethod");
 
-            Persistent clientObject = clientContext.newObject(ClientMtTable1.class);
+            final Persistent clientObject = clientContext.newObject(ClientMtTable1.class);
             clientContext.commitChanges();
 
-            // find peer
-            MtTable1 peer = (MtTable1) serverContext.getGraphManager().getNode(
+        new ThreadedTestHelper() {
+
+            @Override
+            protected void assertResult() throws Exception {
+            	// find peer
+            	MtTable1 peer = (MtTable1) serverContext.getGraphManager().getNode(
                     clientObject.getObjectId());
 
-            assertNotNull(peer);
-            assertTrue(peer.isPrePersisted());
+            	assertNotNull(peer);
+            	assertTrue(peer.isPrePersisted());
+            }
+        }.assertWithTimeout(1000);
+
+
         }
         finally {
             callbackRegistry.clear();



Mime
View raw message