Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add lame war and jar mode tests

  • Loading branch information...
commit 1e7c160ef43c196cfab5ee41cbcae962b796af9f 1 parent 5983fde
@havocp havocp authored
View
12 src/sbt-test/start/01jar/build.sbt
@@ -0,0 +1,12 @@
+import com.typesafe.startscript.StartScriptPlugin
+
+seq(StartScriptPlugin.startScriptForJarSettings: _*)
+
+version := "0.1"
+
+TaskKey[Unit]("check") <<= (target) map { (target) =>
+ val process = sbt.Process((target / "start").toString)
+ val out = (process!!)
+ if (out.trim != "Hello") error("unexpected output: " + out)
+ ()
+}
View
1  src/sbt-test/start/01jar/project/plugins.sbt
@@ -0,0 +1 @@
+addSbtPlugin("com.typesafe.startscript" % "xsbt-start-script-plugin" % "0.5.2-SNAPSHOT")
View
3  src/sbt-test/start/01jar/src/main/scala/Hello.scala
@@ -0,0 +1,3 @@
+object Main extends App {
+ println("Hello")
+}
View
4 src/sbt-test/start/01jar/test
@@ -0,0 +1,4 @@
+> start-script
+$ exists target/start
+> check
+
View
11 src/sbt-test/start/02war/build.sbt
@@ -0,0 +1,11 @@
+import com.typesafe.startscript.StartScriptPlugin
+import com.github.siasia.WebPlugin
+
+seq(StartScriptPlugin.startScriptForWarSettings: _*)
+
+seq(WebPlugin.webSettings: _*)
+
+version := "0.1"
+
+libraryDependencies ++= Seq("javax.servlet" % "servlet-api" % "2.5" % "provided",
+ "org.eclipse.jetty" % "jetty-webapp" % "7.3.1.v20110307" % "container")
View
5 src/sbt-test/start/02war/project/plugins.sbt
@@ -0,0 +1,5 @@
+addSbtPlugin("com.typesafe.startscript" % "xsbt-start-script-plugin" % "0.5.2-SNAPSHOT")
+
+libraryDependencies <+= (sbtVersion)(sbtVersion =>
+ "com.github.siasia" % "xsbt-web-plugin_2.9.2" % (sbtVersion + "-0.2.11.1")
+)
View
20 src/sbt-test/start/02war/src/main/scala/Hello.scala
@@ -0,0 +1,20 @@
+object Main extends App {
+ println("Hello")
+}
+
+package test {
+
+ import javax.servlet.http._
+
+ class MyServlet extends HttpServlet {
+ val html = <html>
+ <head><title>MyServlet</title></head>
+ <body>Hello</body>
+ </html>
+
+ override def doGet(request: HttpServletRequest, response: HttpServletResponse) {
+ response.setContentType("text/html")
+ response.getWriter().print(html.toString)
+ }
+ }
+}
View
18 src/sbt-test/start/02war/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,18 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+ <display-name>Test App</display-name>
+
+ <servlet>
+ <servlet-name>MyServlet</servlet-name>
+ <servlet-class>test.MyServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>MyServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
View
6 src/sbt-test/start/02war/test
@@ -0,0 +1,6 @@
+> start-script
+$ exists target/start
+
+# FIXME we should run the web server and test but will
+# take some figuring out how to run target/start and
+# then http GET
Please sign in to comment.
Something went wrong with that request. Please try again.