From 0c07fab88a891049b973ef020683d09b69062fd3 Mon Sep 17 00:00:00 2001 From: Lukasz Jastrzebski Date: Thu, 26 Feb 2015 21:09:47 -0800 Subject: [PATCH] Incorporating comments for SPARK-2168 --- .../deploy/history/HistoryServerSuite.scala | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala b/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala index 1ec3e0ffede85..3a9963a5ce7b7 100644 --- a/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala +++ b/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala @@ -14,40 +14,43 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.spark.deploy.history +import javax.servlet.http.HttpServletRequest + +import scala.collection.mutable + +import org.apache.hadoop.fs.Path +import org.mockito.Mockito.{when} import org.scalatest.FunSuite import org.scalatest.Matchers import org.scalatest.mock.MockitoSugar -import javax.servlet.http.HttpServletRequest -import org.mockito.Mockito.{when} -import org.apache.hadoop.fs.Path + import org.apache.spark.ui.SparkUI -import scala.collection.mutable class HistoryServerSuite extends FunSuite with Matchers with MockitoSugar { - - val historyServer = mock[HistoryServer] - val request = mock[HttpServletRequest] - - test("generate history page with relative links") { + + test("generate history page with relative links") { + val historyServer = mock[HistoryServer] + val request = mock[HttpServletRequest] val ui = mock[SparkUI] val link = "/history/app1" - val info = new ApplicationHistoryInfo("app1", "app1", 0, 2, 1, "xxx", true ) + val info = new ApplicationHistoryInfo("app1", "app1", 0, 2, 1, "xxx", true) when(historyServer.getApplicationList()).thenReturn(Seq(info)) when(ui.basePath).thenReturn(link) when(historyServer.getProviderConfig()).thenReturn(Map[String, String]()) val page = new HistoryPage(historyServer) - + //when val response = page.render(request) - + //then - val links = response \\ "a" - val justHrefs = for { - l <- links - attrs <- l.attribute("href") - } yield (attrs.toString) - justHrefs should contain(link) + val links = response \\ "a" + val justHrefs = for { + l <- links + attrs <- l.attribute("href") + } yield (attrs.toString) + justHrefs should contain(link) } }