代码之家  ›  专栏  ›  技术社区  ›  Charmy Garg

卡桑德拉·科姆。税收。驾驶员果心ControlConnection$1 onConnectionException

  •  1
  • Charmy Garg  · 技术社区  · 6 年前

    我在用 卡桑德拉3.11.3 具有 Lagom 1.4.7 .我为Impl编写了集成测试用例,但面临ControlConnection异常。 以下是测试文件:

     class BookingServiceImplIntegrationTest extends AsyncWordSpec with Matchers with BeforeAndAfterAll {
    
      private val server = ServiceTest.startServer(ServiceTest.defaultSetup.withCassandra(true)) { ctx =>
        new BookingApplication(ctx) with LocalServiceLocator {
          override def additionalConfiguration: AdditionalConfiguration =
            super.additionalConfiguration ++ Configuration.from(Map(
              "cassandra-query-journal.eventual-consistency-delay" -> "0"
            ))
        }
      }
    
      val bookingService: BookingService = server.serviceClient.implement[BookingService]
    
      import server.materializer
    
      override def afterAll: Unit = server.stop()
    
      "The Booking service" should {
    
        "allow add bookings" in {
          for {
            created <- addBooking(BookingDetails)
            retrieved <- retrieveBookings(created)
          } yield {
            created should ===(retrieved)
          }
        }
      }
    
      def awaitSuccess[T](maxDuration: FiniteDuration = 10.seconds, checkEvery: FiniteDuration = 100.milliseconds)(block: => Future[T]): Future[T] = {
        val checkUntil = System.currentTimeMillis() + maxDuration.toMillis
    
        def doCheck(): Future[T] = {
          block.recoverWith {
            case recheck if checkUntil > System.currentTimeMillis() =>
              val timeout = Promise[T]()
              server.application.actorSystem.scheduler.scheduleOnce(checkEvery) {
                timeout.completeWith(doCheck())
              }(server.executionContext)
              timeout.future
          }
        }
    
        doCheck()
      }
    

    运行此测试文件时,我遇到了一个异常: enter image description here

    请建议如何解决!! 提前谢谢

    0 回复  |  直到 6 年前