esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r995209 - /incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/TwitterAPITest.scala
Date Wed, 08 Sep 2010 19:08:53 GMT
Author: vdichev
Date: Wed Sep  8 19:08:53 2010
New Revision: 995209

URL: http://svn.apache.org/viewvc?rev=995209&view=rev
Log:
Fix occasionally failing TwitterAPI test

Modified:
    incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/TwitterAPITest.scala

Modified: incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/TwitterAPITest.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/TwitterAPITest.scala?rev=995209&r1=995208&r2=995209&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/TwitterAPITest.scala (original)
+++ incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/TwitterAPITest.scala Wed
Sep  8 19:08:53 2010
@@ -118,6 +118,12 @@ object TwitterAPISpecs extends Specifica
     }
   }
   
+  // register an actor to be notified when a new message is received
+  val conductor = new ConductorActor
+  conductor.start
+  val liftActor = new BridgeActor(conductor)
+  Distributor ! PublicTimelineListeners(liftActor)
+  
   trait XmlResponse {
     self: TestResponse =>
     def xmlMatch(f: Elem => Unit)(implicit errorFunc: ReportFailure): TestResponse = {
@@ -147,6 +153,10 @@ object TwitterAPISpecs extends Specifica
   
     "post a message" in {
       post("/statuses/update.xml", "status" -> "test_msg1") \\(<text>test_msg1</text>)
+      // wait till the message appears in the timeline
+      // or fail after 5 seconds
+      val msgReceived = conductor !? (5000L, Wait)
+      if (msgReceived.isEmpty) fail("no message received")
     }
     
     "fail to post a message with no status parameter" in {
@@ -189,18 +199,13 @@ object TwitterAPISpecs extends Specifica
     }
     
     "let follower see user's message in home timeline" in {
-      // register an actor to be notified when a new message is received
-      val conductor = new ConductorActor
-      conductor.start
-      val liftActor = new BridgeActor(conductor)
-      Distributor ! PublicTimelineListeners(liftActor)
-      
       post("/statuses/update.xml", "status" -> "user_msg") \\(<text>user_msg</text>)
       
       // wait till the message appears in the timeline
       // or fail after 5 seconds
       val msgReceived = conductor !? (5000L, Wait)
       if (msgReceived.isEmpty) fail("no message received")
+      Thread.sleep(1000L)
       
       get("/statuses/home_timeline.xml", followerClient, Nil) \\(<text>user_msg</text>)
     }



Mime
View raw message