make jetty-env test runnable

This commit is contained in:
Mark Harrah 2010-10-09 14:06:48 -04:00
parent 25bd1ebc03
commit 1954977c98
3 changed files with 23 additions and 5 deletions

View File

@ -1,8 +1,3 @@
#Project properties
#Thu Aug 12 11:18:54 CEST 2010
project.organization=sbt
project.name=JettyEnvTest
sbt.version=0.7.5-SNAPSHOT
project.version=1.0
build.scala.versions=2.7.7
project.initialize=false

View File

@ -1,10 +1,24 @@
import sbt._
import java.io.File
import java.lang.System
import Process._
class JettyEnvTestProject(info: ProjectInfo) extends DefaultWebProject(info){
override def jettyEnvXml = Some( (info.projectPath / "conf" / "jetty" / "jetty-env.xml").asFile)
val jetty7WebApp = "org.eclipse.jetty" % "jetty-webapp" % "7.0.2.RC0" % "test"
val jetty7Plus = "org.eclipse.jetty" % "jetty-plus" % "7.0.2.RC0" % "test"
val servletApiDep = "javax.servlet" % "servlet-api" % "2.5" % "provided"
def indexURL = new java.net.URL("http://localhost:" + jettyPort)
def indexFile = new java.io.File("index.html")
override def jettyPort = 7127
lazy val getPage = execTask { indexURL #> indexFile }
lazy val checkPage = task { args => task { checkHelloWorld(args.mkString(" ")) } dependsOn getPage }
private def checkHelloWorld(checkString: String) =
{
val value = xsbt.FileUtilities.read(indexFile)
if(value.contains(checkString)) None else Some("index.html did not contain '" + checkString + "' :\n" +value)
}
}

View File

@ -0,0 +1,9 @@
> ++2.7.7
> update
# verify that it fails without Jetty running
-> check-page It works
> jetty-run
# verify it now works with our servlet running
> check-page It works
> jetty-stop