Skip to content

Commit

Permalink
Incorporating comments for SPARK-2168
Browse files Browse the repository at this point in the history
  • Loading branch information
elyast committed Feb 27, 2015
1 parent 6d7866d commit 0c07fab
Showing 1 changed file with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 0c07fab

Please sign in to comment.