Skip to content
Browse files

fix merge conflicts

  • Loading branch information...
2 parents 2724292 + ca63585 commit 1c6836faa741c7f4e97ebea43184aa4329f7c134 @casualjim casualjim committed Apr 7, 2013
View
1 jetty/src/main/scala/org/scalatra/jetty/JettyServer.scala
@@ -15,7 +15,6 @@ class JettyServer(
resourceBase: String = "src/main/webapp")
{
private[this] val server = new Server(socketAddress)
- server.setHandler(context)
val context = new ServletContextHandler(ServletContextHandler.SESSIONS)
context.setContextPath("/")
View
11 project/build.scala
@@ -78,7 +78,7 @@ object ScalatraBuild extends Build {
description := "Scalatra authentication module",
LsKeys.tags in LsKeys.lsync += "auth"
)
- ) dependsOn(scalatraCore % "compile;test->test;provided->provided", scalatraCommands)
+ ) dependsOn(scalatraCore % "compile;test->test;provided->provided")
lazy val scalatraFileupload = Project(
@@ -173,7 +173,9 @@ object ScalatraBuild extends Build {
httpclient,
httpmime,
jodaTime % "provided",
- jodaConvert % "provided"
+ jodaConvert % "provided",
+ scalatest(sv),
+ seleniumjava
)),
description := "The abstract Scalatra test framework"
)
@@ -261,7 +263,7 @@ object ScalatraBuild extends Build {
lazy val jerkson = "io.backchat.jerkson" %% "jerkson" % "0.7.0"
lazy val jettyServer = "org.eclipse.jetty" % "jetty-server" % jettyVersion
lazy val jettyServlet = "org.eclipse.jetty" % "jetty-servlet" % jettyVersion
- lazy val jettyWebsocket = "org.eclipse.jetty" % "jetty-websocket" % jettyVersion
+ lazy val jettyWebsocket = "org.eclipse.jetty.websocket" % "websocket-server" % jettyVersion
lazy val jettyWebapp = "org.eclipse.jetty" % "jetty-webapp" % jettyVersion
lazy val jodaConvert = "org.joda" % "joda-convert" % "1.2"
lazy val jodaTime = "joda-time" % "joda-time" % "2.2"
@@ -279,6 +281,7 @@ object ScalatraBuild extends Build {
lazy val scalate: MM = sv => "org.fusesource.scalate" % scalateArtifact(sv) % scalateVersion(sv)
lazy val scalatest: MM = sv => "org.scalatest" %% "scalatest" % scalatestVersion(sv)
lazy val scalaz = "org.scalaz" %% "scalaz-core" % "7.0.0-RC1"
+ lazy val seleniumjava = "org.seleniumhq.selenium" % "selenium-java" % "2.31.0"
lazy val servletApi = "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" artifacts (Artifact("javax.servlet", "jar", "jar"))
lazy val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.5"
lazy val slf4jSimple = "org.slf4j" % "slf4j-simple" % "1.7.5"
@@ -327,7 +330,7 @@ object ScalatraBuild extends Build {
}
private val scalatestVersion: String => String =
- defaultOrMapped("1.9.1", "2.8.0" -> "1.8", "2.8.1" -> "1.8", "2.8.2" -> "1.8")
+ defaultOrMapped("2.0.M5b", "2.8.0" -> "1.8", "2.8.1" -> "1.8", "2.8.2" -> "1.8")
private val specsCross = crossMapped("2.8.2" -> "2.8.1", "2.9.2" -> "2.9.1")
private val specsVersion: String => String =
View
22 specs2/src/main/scala/org/scalatra/test/specs2/SeleniumSpec.scala
@@ -0,0 +1,22 @@
+package org.scalatra
+package test
+package specs2
+
+import org.specs2.Specification
+import org.specs2.specification._
+import org.specs2.main.ArgumentsShortcuts._
+
+import SeleniumWebBrowser._
+
+/**
+ * A base specification structure that starts the tester before the
+ * specification and stops it afterward. Clients probably want to extend
+ * ScalatraSpec or MutableScalatraSpec.
+ */
+trait BaseSeleniumSpec extends BaseSpecification with SeleniumTests {
+ override def map(fs: =>Fragments) = sequential ^ Step(start()) ^ super.map(fs) ^ Step(stop())
+}
+
+trait MutableSeleniumSpec extends Specification with BaseSeleniumSpec
+
+trait SeleniumSpec extends Specification with BaseSeleniumSpec
View
12 test/src/main/scala/org/scalatra/test/EmbeddedJettyContainer.scala
@@ -1,6 +1,7 @@
package org.scalatra.test
import org.eclipse.jetty.server.Server
+import org.eclipse.jetty.server.ServerConnector
import org.eclipse.jetty.servlet.ServletContextHandler
trait EmbeddedJettyContainer extends JettyContainer {
@@ -11,10 +12,13 @@ trait EmbeddedJettyContainer extends JettyContainer {
/**
* The port of the currently running Jetty. May differ from port if port is 0.
- *
+ *
* @return Some port if Jetty is currently listening, or None if it is not.
*/
- def localPort: Option[Int] = server.getConnectors.headOption map { _.getLocalPort }
+ def localPort: Option[Int] = server.getConnectors.headOption map {
+ case conn: ServerConnector => conn.getLocalPort
+ case _ => sys.error("can't get local port")
+ }
def contextPath = "/"
@@ -36,12 +40,12 @@ trait EmbeddedJettyContainer extends JettyContainer {
def baseUrl: String =
server.getConnectors.headOption match {
- case Some(conn) =>
+ case Some(conn: ServerConnector) =>
val host = Option(conn.getHost) getOrElse "localhost"
val port = conn.getLocalPort
require(port > 0, "The detected local port is < 1, that's not allowed")
"http://%s:%d".format(host, port)
- case None =>
+ case _ =>
sys.error("can't calculate base URL: no connector")
}
}
View
55 test/src/main/scala/org/scalatra/test/SeleniumWebBrowser.scala
@@ -0,0 +1,55 @@
+package org.scalatra.test
+
+object SeleniumWebBrowser {
+ trait Chrome extends org.scalatest.selenium.Chrome {
+ /**
+ * remapping of a selenium/scalatest method since it conflicts with
+ * a specs2 method
+ */
+ def nameQuery(elementName: String): NameQuery = {
+ name(elementName)
+ }
+ }
+
+ trait Firefox extends org.scalatest.selenium.Firefox {
+ /**
+ * remapping of a selenium/scalatest method since it conflicts with
+ * a specs2 method
+ */
+ def nameQuery(elementName: String): NameQuery = {
+ name(elementName)
+ }
+ }
+
+ trait HtmlUnit extends org.scalatest.selenium.HtmlUnit {
+ /**
+ * remapping of a selenium/scalatest method since it conflicts with
+ * a specs2 method
+ */
+ def nameQuery(elementName: String): NameQuery = {
+ name(elementName)
+ }
+ }
+
+ trait InternetExplorer extends org.scalatest.selenium.InternetExplorer {
+ /**
+ * remapping of a selenium/scalatest method since it conflicts with
+ * a specs2 method
+ */
+ def nameQuery(elementName: String): NameQuery = {
+ name(elementName)
+ }
+ }
+
+ trait Safari extends org.scalatest.selenium.Safari {
+ /**
+ * remapping of a selenium/scalatest method since it conflicts with
+ * a specs2 method
+ */
+ def nameQuery(elementName: String): NameQuery = {
+ name(elementName)
+ }
+ }
+
+ trait SeleniumTests extends EmbeddedJettyContainer with HttpComponentsClient { }
+}

0 comments on commit 1c6836f

Please sign in to comment.
Something went wrong with that request. Please try again.