juliuszsompolski commented on a change in pull request #26378:
[SPARK-29724][SPARK-29726][WEBUI][SQL] Support JDBC/ODBC tab for HistoryServer
WebUI
URL: https://github.com/apache/spark/pull/26378#discussion_r351203676
##########
File path:
sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/ui/ThriftServerPageSuite.scala
##########
@@ -17,39 +17,63 @@
package org.apache.spark.sql.hive.thriftserver.ui
-import java.util.Locale
+import java.util.{Calendar, Locale}
import javax.servlet.http.HttpServletRequest
import org.mockito.Mockito.{mock, when, RETURNS_SMART_NULLS}
+import org.scalatest.BeforeAndAfter
-import org.apache.spark.SparkFunSuite
+import org.apache.spark.{SparkConf, SparkFunSuite}
import org.apache.spark.scheduler.SparkListenerJobStart
-import org.apache.spark.sql.hive.thriftserver.HiveThriftServer2
-import
org.apache.spark.sql.hive.thriftserver.HiveThriftServer2.HiveThriftServer2Listener
-import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.hive.thriftserver._
+import org.apache.spark.status.ElementTrackingStore
+import org.apache.spark.util.kvstore.InMemoryStore
-class ThriftServerPageSuite extends SparkFunSuite {
+
+class ThriftServerPageSuite extends SparkFunSuite with BeforeAndAfter {
+
+ private var kvstore: ElementTrackingStore = _
+
+ after {
+ if (kvstore != null) {
+ kvstore.close()
+ kvstore = null
+ }
+ }
/**
- * Run a dummy session and return the listener
+ * Run a dummy session and return the store
*/
- private def getListener: HiveThriftServer2Listener = {
- val listener = new
HiveThriftServer2Listener(mock(classOf[HiveThriftServer2]), new SQLConf)
-
- listener.onSessionCreated("localhost", "sessionid", "user")
- listener.onStatementStart("id", "sessionid", "dummy query", "groupid",
"user")
- listener.onStatementParsed("id", "dummy plan")
- listener.onJobStart(SparkListenerJobStart(0, System.currentTimeMillis(),
Seq()))
- listener.onStatementFinish("id")
- listener.onOperationClosed("id")
- listener.onSessionClosed("sessionid")
- listener
+ private def getStatusStore: HiveThriftServer2AppStatusStore = {
+ kvstore = new ElementTrackingStore(new InMemoryStore, new SparkConf())
+ val server = mock(classOf[HiveThriftServer2], RETURNS_SMART_NULLS)
+ val sparkConf = new SparkConf
+
+ val listener = new HiveThriftServer2Listener(kvstore, sparkConf,
Some(server))
+ val statusStore = new HiveThriftServer2AppStatusStore(kvstore,
Some(listener))
+
+ listener.onOtherEvent(SparkListenerThriftServerSessionCreated("localhost",
"sessionid", "user",
+ System.currentTimeMillis()))
+ listener.onOtherEvent(SparkListenerThriftServerOperationStart("id",
"sessionid",
+ "dummy query", "groupid", System.currentTimeMillis(), "user"))
+ listener.onOtherEvent(SparkListenerThriftServerOperationParsed("id",
"dummy plan"))
+ listener.onOtherEvent(SparkListenerJobStart(0, System.currentTimeMillis(),
Seq()))
+ listener.onOtherEvent(SparkListenerThriftServerOperationFinish("id",
+ System.currentTimeMillis()))
+ listener.onOtherEvent(SparkListenerThriftServerOperationClosed("id",
+ System.currentTimeMillis()))
+ listener.onOtherEvent(SparkListenerThriftServerSessionClosed("sessionid",
System.currentTimeMillis()))
Review comment:
`[error]
/home/runner/work/spark/spark/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/ui/ThriftServerPageSuite.scala:65:
File line length exceeds 100 characters`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]