mirror of https://github.com/sbt/sbt.git
JSP test
git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@940 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
parent
84e98aae1a
commit
a3f1c671a6
|
|
@ -0,0 +1,2 @@
|
|||
project.name=JSP Test
|
||||
project.version=a
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import sbt._
|
||||
|
||||
class JSP(info: ProjectInfo) extends DefaultWebProject(info)
|
||||
{
|
||||
val j6 = "org.mortbay.jetty" % "jetty" % "6.1.17" % "test->default"
|
||||
val j = "org.mortbay.jetty" % "jsp-2.0" % "6.1.17" % "test->default"
|
||||
|
||||
def indexURL = new java.net.URL("http://localhost:8080")
|
||||
def indexFile = new java.io.File("index.html")
|
||||
import Process._
|
||||
lazy val getPage = execTask { indexURL #> indexFile }
|
||||
lazy val checkPage = task { checkHelloWorld() } dependsOn getPage
|
||||
|
||||
private def checkHelloWorld() =
|
||||
{
|
||||
try
|
||||
{
|
||||
FileUtilities.readString(indexFile, log) match
|
||||
{
|
||||
case Right(value) =>
|
||||
if(value.contains("Hello World!")) None
|
||||
else Some("index.html did not contain 'Hello World!' :\n" +value)
|
||||
case Left(msg) => Some(msg)
|
||||
}
|
||||
}
|
||||
finally { jettyInstance.stop() }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
<% out.println(" Hello World!"); %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
> update
|
||||
[success]
|
||||
|
||||
> jetty-run
|
||||
[success]
|
||||
|
||||
> check-page
|
||||
[success]
|
||||
|
||||
> jetty-stop
|
||||
[success]
|
||||
Loading…
Reference in New Issue