我目前正在尝试从 Scala模拟一个 livy 服务器来运行单元测试。
基本上,我想测试将 jar 提交给 livy 客户端。我正在尝试修改我在此处找到的代码(livy)HttpClientSpec.scala,但在编译时出现错误。
更确切地说,我发现了一个错误,每当我试图重写方法createSession的的InteractiveSessionServlet类。这很奇怪,因为InteractiveSessionServlet它不是私人课程。
如果有人能帮我解决这个问题,我将不胜感激。
这是我的代码:
import java.util.concurrent.atomic.AtomicLong
import org.scalatra.servlet.ScalatraListener
import org.apache.livy.{LivyClient, LivyConf}
import org.apache.livy.client.common.Serializer
import org.apache.livy.server.WebServer
import org.apache.livy.server.interactive.InteractiveSession
import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers}
private object LivyServerMock {
// Hack warning: keep the session object available so that individual tests can mock
// the desired behavior before making requests to the server.
var session: InteractiveSession = _
}
class LivyServerMock extends FlatSpec with …Run Code Online (Sandbox Code Playgroud)