2012-02-16 17:28:31 +01:00
|
|
|
package akka.dispatch
|
|
|
|
|
|
|
|
|
|
import akka.testkit.AkkaSpec
|
|
|
|
|
import akka.testkit.DefaultTimeout
|
|
|
|
|
import java.util.concurrent.{ ExecutorService, Executor, Executors }
|
2012-06-29 16:06:26 +02:00
|
|
|
import scala.concurrent.ExecutionContext
|
2012-02-16 17:28:31 +01:00
|
|
|
|
|
|
|
|
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
|
|
|
|
|
class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
|
|
|
|
|
|
|
|
|
|
"An ExecutionContext" must {
|
|
|
|
|
|
|
|
|
|
"be instantiable" in {
|
|
|
|
|
val es = Executors.newCachedThreadPool()
|
|
|
|
|
try {
|
|
|
|
|
val executor: Executor with ExecutionContext = ExecutionContext.fromExecutor(es)
|
|
|
|
|
executor must not be (null)
|
|
|
|
|
|
|
|
|
|
val executorService: ExecutorService with ExecutionContext = ExecutionContext.fromExecutorService(es)
|
|
|
|
|
executorService must not be (null)
|
|
|
|
|
|
2012-06-29 16:06:26 +02:00
|
|
|
/*val jExecutor: ExecutionContextExecutor = ExecutionContext.fromExecutor(es)
|
2012-02-16 17:28:31 +01:00
|
|
|
jExecutor must not be (null)
|
|
|
|
|
|
|
|
|
|
val jExecutorService: ExecutionContextExecutorService = ExecutionContexts.fromExecutorService(es)
|
|
|
|
|
jExecutorService must not be (null)
|
2012-06-29 16:06:26 +02:00
|
|
|
*/
|
2012-02-16 17:28:31 +01:00
|
|
|
} finally {
|
|
|
|
|
es.shutdown
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|