Revert "CAMEL: Used endpoint replyTimeout in processExchangeAdapter, fixed ActorProducerTest which did not wait for completion"

This reverts commit ecf970dd4d.
This commit is contained in:
Viktor Klang 2012-10-04 07:33:25 +02:00
parent d6780f5123
commit af184250cc
2 changed files with 4 additions and 14 deletions

View file

@ -135,7 +135,7 @@ private[camel] class ActorProducer(val endpoint: ActorEndpoint, camel: Camel) ex
private[camel] def processExchangeAdapter(exchange: CamelExchangeAdapter): Unit = {
val isDone = new CountDownLatch(1)
processExchangeAdapter(exchange, new AsyncCallback { def done(doneSync: Boolean) { isDone.countDown() } })
isDone.await(endpoint.replyTimeout.toMillis, TimeUnit.MILLISECONDS)
isDone.await(camel.settings.ReplyTimeout.toMillis, TimeUnit.MILLISECONDS)
}
/**

View file

@ -24,12 +24,11 @@ import akka.actor.Status.{ Success, Failure }
import com.typesafe.config.ConfigFactory
import akka.actor.ActorSystem.Settings
import akka.event.LoggingAdapter
import akka.testkit.{ TestLatch, TimingTest, TestKit, TestProbe }
import akka.testkit.{ TimingTest, TestKit, TestProbe }
import org.apache.camel.impl.DefaultCamelContext
import concurrent.{ Await, Promise, Future }
import akka.util.Timeout
import akka.actor._
import akka.testkit._
class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpec with MustMatchers with ActorProducerFixture {
implicit val timeout = Timeout(10 seconds)
@ -112,18 +111,10 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpec with
}
"response is not sent by actor" must {
val latch = TestLatch(1)
val callback = new AsyncCallback {
def done(doneSync: Boolean) {
latch.countDown()
}
}
def process() = {
producer = given(outCapable = true, replyTimeout = 100 millis)
val duration = time(producer.processExchangeAdapter(exchange, callback))
Await.ready(latch, 1.seconds.dilated)
latch.reset
duration
time(producer.processExchangeAdapter(exchange))
}
"timeout after replyTimeout" taggedAs TimingTest in {
@ -138,7 +129,6 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpec with
"set failure message to timeout" in {
process()
verify(exchange).setFailure(any[FailureResult])
}
}