mirror of https://github.com/sbt/sbt.git
Adding test for jetty-env.xml support in jetty.
This commit is contained in:
parent
9cea4b80b9
commit
25bd1ebc03
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
<New id="testEnvEntry" class="org.eclipse.jetty.plus.jndi.EnvEntry">
|
||||
<Arg></Arg>
|
||||
<Arg>testValue</Arg>
|
||||
<Arg type="java.lang.String">It works</Arg>
|
||||
<Arg type="boolean">true</Arg>
|
||||
</New>
|
||||
|
||||
<!--
|
||||
<New id="DbNameDataSource" class="org.eclipse.jetty.plus.jndi.Resource">
|
||||
<Arg>jdbc/DbName</Arg>
|
||||
<Arg>
|
||||
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
|
||||
<Set name="driverClass">com.mysql.jdbc.Driver</Set>
|
||||
<Set name="jdbcUrl">jdbc:mysql://localhost/dbName</Set>
|
||||
<Set name="User">myUsername</Set>
|
||||
<Set name="Password">myPassword</Set>
|
||||
<Set name="maxPoolSize">30</Set>
|
||||
<Set name="checkoutTimeout">1800</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</New>
|
||||
<New id="DbNameDataSource" class="org.eclipse.jetty.plus.jndi.Resource">
|
||||
<Arg>jdbc/DbName</Arg>
|
||||
<Arg>
|
||||
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
|
||||
<Set name="driverClass">org.h2.Driver</Set>
|
||||
<Set name="jdbcUrl">jdbc:h2:tcp://localhost/~/dbName</Set>
|
||||
<Set name="jdbcUrl">jdbc:h2:mem:dbName</Set>
|
||||
<Set name="User">myUsername</Set>
|
||||
<Set name="Password">myPassword</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</New>
|
||||
-->
|
||||
</Configure>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#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
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import sbt._
|
||||
import java.io.File
|
||||
import java.lang.System
|
||||
|
||||
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"
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import javax.servlet.http.{HttpServlet, HttpServletRequest => HSReq, HttpServletResponse => HSResp}
|
||||
import javax.naming.{InitialContext => IC};
|
||||
|
||||
class HelloJndi extends HttpServlet {
|
||||
|
||||
val key = "java:comp/env/testValue"
|
||||
val testValue = (new IC).lookup(key)
|
||||
|
||||
override def doGet(req : HSReq, resp : HSResp) =
|
||||
resp.getWriter().print("<HTML>" +
|
||||
"<HEAD><TITLE>Hello JNDI!</TITLE></HEAD>" +
|
||||
"<BODY>Hello JNDI, <br/>Value of " + key + ": " + testValue + "</BODY>" +
|
||||
"</HTML>")
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!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>
|
||||
<servlet>
|
||||
<servlet-name>helloJNDI</servlet-name>
|
||||
<servlet-class>HelloJndi</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>helloJNDI</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
||||
Loading…
Reference in New Issue