Skip to content
Browse files

Updates for #1385: Lift-2.5 blank template

  • Loading branch information...
1 parent 005c0b9 commit 13470db3c32be77256273dcbf0c8a4dc0da5be08 @ldeck committed Jan 17, 2013
Showing with 416 additions and 86 deletions.
  1. +1 −1 lift-archetype-blank/pom.xml
  2. +30 −0 lift-archetype-blank/src/main/resources/archetype-resources/build.sbt
  3. +23 −17 lift-archetype-blank/src/main/resources/archetype-resources/pom.xml
  4. +0 −7 lift-archetype-blank/src/main/resources/archetype-resources/project/build.properties
  5. +0 −13 lift-archetype-blank/src/main/resources/archetype-resources/project/build/LiftProject.scala
  6. +14 −0 lift-archetype-blank/src/main/resources/archetype-resources/project/plugins.sbt
  7. +1 −0 lift-archetype-blank/src/main/resources/archetype-resources/sbt
  8. BIN lift-archetype-blank/src/main/resources/archetype-resources/sbt-launch-0.12.jar
  9. +2 −0 lift-archetype-blank/src/main/resources/archetype-resources/sbt.bat
  10. 0 lift-archetype-blank/src/main/resources/archetype-resources/src/main/resources/.keep
  11. +23 −0 ...chetype-blank/src/main/resources/archetype-resources/src/main/resources/props/default.logback.xml
  12. 0 lift-archetype-blank/src/main/resources/archetype-resources/src/main/resources/props/default.props
  13. +45 −11 ...rchetype-blank/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
  14. +55 −0 ...archetype-blank/src/main/resources/archetype-resources/src/main/scala/lib/DependencyFactory.scala
  15. +17 −8 lift-archetype-blank/src/main/resources/archetype-resources/src/main/scala/snippet/HelloWorld.scala
  16. BIN lift-archetype-blank/src/main/resources/archetype-resources/src/main/webapp/images/ajax-loader.gif
  17. +14 −8 lift-archetype-blank/src/main/resources/archetype-resources/src/main/webapp/index.html
  18. +11 −0 lift-archetype-blank/src/main/resources/archetype-resources/src/main/webapp/static/index.html
  19. +83 −13 ...hetype-blank/src/main/resources/archetype-resources/src/main/webapp/templates-hidden/default.html
  20. +23 −0 ...ype-blank/src/main/resources/archetype-resources/src/main/webapp/templates-hidden/wizard-all.html
  21. 0 lift-archetype-blank/src/main/resources/archetype-resources/src/test/resources/.keep
  22. +23 −0 lift-archetype-blank/src/main/resources/archetype-resources/src/test/resources/logback-test.xml
  23. +9 −8 lift-archetype-blank/src/main/resources/archetype-resources/src/test/scala/RunWebApp.scala
  24. +42 −0 ...rchetype-blank/src/main/resources/archetype-resources/src/test/scala/snippet/HelloWorldTest.scala
View
2 lift-archetype-blank/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>net.liftweb</groupId>
<artifactId>archetypes_2.9.1</artifactId>
- <version>2.4-SNAPSHOT</version>
+ <version>2.5-SNAPSHOT</version>
</parent>
<artifactId>lift-archetype-blank_2.9.1</artifactId>
<packaging>maven-archetype</packaging>
View
30 lift-archetype-blank/src/main/resources/archetype-resources/build.sbt
@@ -0,0 +1,30 @@
+name := "Lift 2.5 starter template"
+
+version := "0.0.1"
+
+organization := "net.liftweb"
+
+scalaVersion := "2.9.1"
+
+resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
+ "releases" at "http://oss.sonatype.org/content/repositories/releases"
+ )
+
+seq(com.github.siasia.WebPlugin.webSettings :_*)
+
+unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }
+
+scalacOptions ++= Seq("-deprecation", "-unchecked")
+
+libraryDependencies ++= {
+ val liftVersion = "2.5-M4"
+ Seq(
+ "net.liftweb" %% "lift-webkit" % liftVersion % "compile",
+ "net.liftmodules" %% "lift-jquery-module" % (liftVersion + "-2.0"),
+ "org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container,test",
+ "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
+ "ch.qos.logback" % "logback-classic" % "1.0.6",
+ "org.specs2" %% "specs2" % "1.12.1" % "test"
+ )
+}
+
View
40 lift-archetype-blank/src/main/resources/archetype-resources/pom.xml
@@ -24,17 +24,17 @@
<maven.scaladoc.vscaladocVersion>1.2-m1</maven.scaladoc.vscaladocVersion>
<vscaladoc.links.liftweb.pathsufix>scaladocs/</vscaladoc.links.liftweb.pathsufix>
#if ($liftVersion.endsWith("SNAPSHOT"))
- <vscaladoc.links.liftweb.baseurl>http://scala-tools.org/mvnsites-snapshots/liftweb</vscaladoc.links.liftweb.baseurl>
+ <vscaladoc.links.liftweb.baseurl>https://oss.sonatype.org/content/repositories/snapshots/liftweb</vscaladoc.links.liftweb.baseurl>
#else
- <vscaladoc.links.liftweb.baseurl>http://scala-tools.org/mvnsites/liftweb</vscaladoc.links.liftweb.baseurl>
+ <vscaladoc.links.liftweb.baseurl>https://oss.sonatype.org/content/groups/scala-tools/liftweb</vscaladoc.links.liftweb.baseurl>
#end
</properties>
<repositories>
<repository>
<id>scala-tools.releases</id>
<name>Scala-Tools Dependencies Repository for Releases</name>
- <url>http://scala-tools.org/repo-releases</url>
+ <url>https://oss.sonatype.org/content/groups/scala-tools</url>
</repository>
<repository>
<id>java.net.maven2</id>
@@ -45,7 +45,7 @@
<repository>
<id>scala-tools.snapshots</id>
<name>Scala-Tools Dependencies Repository for Snapshots</name>
- <url>http://scala-tools.org/repo-snapshots</url>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots/>
</repository>
#end
@@ -55,7 +55,7 @@
<pluginRepository>
<id>scala-tools.releases</id>
<name>Scala-Tools Plugins Repository for Releases</name>
- <url>http://scala-tools.org/repo-releases</url>
+ <url>https://oss.sonatype.org/content/groups/scala-tools</url>
</pluginRepository>
</pluginRepositories>
@@ -69,18 +69,18 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>0.9.26</version>
+ <version>1.0.6</version>
</dependency>
#elseif ($logBackend.equalsIgnoreCase("log4j"))
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.16</version>
+ <version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.6.1</version>
+ <version>1.7.2</version>
</dependency>
#end
<dependency>
@@ -92,13 +92,19 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.7</version>
+ <version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.25</version>
+ <groupId>org.scala-tools.testing</groupId>
+ <artifactId>specs_${scala.version}</artifactId>
+ <version>${specs.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ <version>8.1.8.v20121106</version>
<scope>test</scope>
</dependency>
<!-- for LiftConsole -->
@@ -137,7 +143,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
- <version>2.5</version>
+ <version>2.6</version>
<executions>
<execution>
<id>default-copy-resources</id>
@@ -162,9 +168,9 @@
</executions>
</plugin>
<plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <version>6.1.25</version>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>9.0.0.M4</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
@@ -196,7 +202,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
- <version>2.7</version>
+ <version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<additionalProjectnatures>
View
7 lift-archetype-blank/src/main/resources/archetype-resources/project/build.properties
@@ -1,7 +0,0 @@
-project.organization=$groupId
-project.name=$artifactId
-project.version=$version
-sbt.version=0.7.4
-def.scala.version=2.7.7
-build.scala.versions=$scalaVersion
-project.initialize=false
View
13 lift-archetype-blank/src/main/resources/archetype-resources/project/build/LiftProject.scala
@@ -1,13 +0,0 @@
-import sbt._
-
-class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) {
-
- // Add Maven Local repository for SBT to search for (disable if this doesn't suit you)
- val mavenLocal = "Local Maven Repository" at "file://"+Path.userHome+"/.m2/repository"
-
-#if ($liftVersion.endsWith("SNAPSHOT"))
- // Add snapshot repo, since Lift SNAPSHOT in use
- val snapshots = ScalaToolsSnapshots
-#end
-
-}
View
14 lift-archetype-blank/src/main/resources/archetype-resources/project/plugins.sbt
@@ -0,0 +1,14 @@
+libraryDependencies <+= sbtVersion(v => v match {
+ case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
+ case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
+ case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.10"
+ case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
+ case "0.12.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
+ case "0.12.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
+})
+
+//Uncoment this line to enable the sbt idea plugin
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0")
+
+//Uncoment this line to enable the sbt eclipse plugin
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
View
1 lift-archetype-blank/src/main/resources/archetype-resources/sbt
@@ -0,0 +1 @@
+java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launch-0.12.jar "$@"
View
BIN lift-archetype-blank/src/main/resources/archetype-resources/sbt-launch-0.12.jar
Binary file not shown.
View
2 lift-archetype-blank/src/main/resources/archetype-resources/sbt.bat
@@ -0,0 +1,2 @@
+set SCRIPT_DIR=%~dp0
+java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx1024M -Xss2M -jar "%SCRIPT_DIR%\sbt-launch-0.12.jar" %*
View
0 lift-archetype-blank/src/main/resources/archetype-resources/src/main/resources/.keep
No changes.
View
23 ...blank/src/main/resources/archetype-resources/src/main/resources/props/default.logback.xml
@@ -0,0 +1,23 @@
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>console.devmode.log</file>
+ <append>true</append>
+ <encoder>
+ <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+
+ <logger name="code.snippet" level="info" />
+ <logger name="net.liftweb" level="warn" />
+ <logger name="bootstrap.liftweb" level="info" />
+ <root level="warn">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
View
0 ...etype-blank/src/main/resources/archetype-resources/src/main/resources/props/default.props
No changes.
View
56 ...-blank/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -1,24 +1,58 @@
package bootstrap.liftweb
-import _root_.net.liftweb.common._
-import _root_.net.liftweb.util._
-import _root_.net.liftweb.http._
-import _root_.net.liftweb.sitemap._
-import _root_.net.liftweb.sitemap.Loc._
+import net.liftweb._
+import util._
import Helpers._
+import common._
+import http._
+import sitemap._
+import Loc._
+import net.liftmodules.JQueryModule
+import net.liftweb.http.js.jquery._
+
+
/**
- * A class that's instantiated early and run. It allows the application
- * to modify lift's environment
- */
+ * A class that's instantiated early and run. It allows the application
+ * to modify lift's environment
+ */
class Boot {
def boot {
// where to search snippet
- LiftRules.addToPackages("${package}")
+ LiftRules.addToPackages("code")
// Build SiteMap
- val entries = Menu(Loc("Home", List("index"), "Home")) :: Nil
+ val entries = List(
+ Menu.i("Home") / "index", // the simple way to declare a menu
+
+ // more complex because this menu allows anything in the
+ // /static path to be visible
+ Menu(Loc("Static", Link(List("static"), true, "/static/index"),
+ "Static Content")))
+
+ // set the sitemap. Note if you don't want access control for
+ // each page, just comment this line out.
LiftRules.setSiteMap(SiteMap(entries:_*))
+
+ //Show the spinny image when an Ajax call starts
+ LiftRules.ajaxStart =
+ Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
+
+ // Make the spinny image go away when it ends
+ LiftRules.ajaxEnd =
+ Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
+
+ // Force the request to be UTF-8
+ LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
+
+ // Use HTML5 for rendering
+ LiftRules.htmlProperties.default.set((r: Req) =>
+ new Html5Properties(r.userAgent))
+
+ //Init the jQuery module, see http://liftweb.net/jquery for more information.
+ LiftRules.jsArtifacts = JQueryArtifacts
+ JQueryModule.InitParam.JQuery=JQueryModule.JQuery172
+ JQueryModule.init()
+
}
}
-
View
55 ...e-blank/src/main/resources/archetype-resources/src/main/scala/lib/DependencyFactory.scala
@@ -0,0 +1,55 @@
+package ${package}
+package lib
+
+import net.liftweb._
+import http._
+import util._
+import common._
+import java.util.Date
+
+/**
+ * A factory for generating new instances of Date. You can create
+ * factories for each kind of thing you want to vend in your application.
+ * An example is a payment gateway. You can change the default implementation,
+ * or override the default implementation on a session, request or current call
+ * stack basis.
+ */
+object DependencyFactory extends Factory {
+ implicit object time extends FactoryMaker(Helpers.now _)
+
+ /**
+ * objects in Scala are lazily created. The init()
+ * method creates a List of all the objects. This
+ * results in all the objects getting initialized and
+ * registering their types with the dependency injector
+ */
+ private def init() {
+ List(time)
+ }
+ init()
+}
+
+/*
+/**
+ * Examples of changing the implementation
+ */
+sealed abstract class Changer {
+ def changeDefaultImplementation() {
+ DependencyFactory.time.default.set(() => new Date())
+ }
+
+ def changeSessionImplementation() {
+ DependencyFactory.time.session.set(() => new Date())
+ }
+
+ def changeRequestImplementation() {
+ DependencyFactory.time.request.set(() => new Date())
+ }
+
+ def changeJustForCall(d: Date) {
+ DependencyFactory.time.doWith(d) {
+ // perform some calculations here
+ }
+ }
+}
+*/
View
25 ...type-blank/src/main/resources/archetype-resources/src/main/scala/snippet/HelloWorld.scala
@@ -1,14 +1,23 @@
-package ${package} {
-package snippet {
+package ${package}
+package snippet
-import _root_.scala.xml.NodeSeq
-import _root_.net.liftweb.util.Helpers
+import scala.xml.{NodeSeq, Text}
+import net.liftweb.util._
+import net.liftweb.common._
+import java.util.Date
+import code.lib._
import Helpers._
class HelloWorld {
- def howdy(in: NodeSeq): NodeSeq =
- Helpers.bind("b", in, "time" -> (new _root_.java.util.Date).toString)
-}
+ lazy val date: Box[Date] = DependencyFactory.inject[Date] // inject the date
+ // replace the contents of the element with id "time" with the date
+ def howdy = "#time *" #> date.map(_.toString)
+
+ /*
+ lazy val date: Date = DependencyFactory.time.vend // create the date via factory
+
+ def howdy = "#time *" #> date.toString
+ */
}
-}
+
View
BIN ...etype-blank/src/main/resources/archetype-resources/src/main/webapp/images/ajax-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
22 lift-archetype-blank/src/main/resources/archetype-resources/src/main/webapp/index.html
@@ -1,9 +1,15 @@
-<lift:surround with="default" at="content">
- <h2>Welcome to your project!</h2>
- <p>
- <lift:helloWorld.howdy>
- <span>Welcome to $artifactId at <b:time/></span>
- </lift:helloWorld.howdy>
- </p>
-</lift:surround>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><title>Home</title></head>
+ <body class="lift:content_id=main">
+ <div id="main" class="lift:surround?with=default;at=content">
+ <h2>Welcome to your project!</h2>
+ <p>
+ <span class="lift:helloWorld.howdy">
+ Welcome to your Lift app at <span id="time">Time goes here</span>
+ </span>
+ </p>
+ </div>
+ </body>
+</html>
View
11 ...-archetype-blank/src/main/resources/archetype-resources/src/main/webapp/static/index.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><title>Home</title></head>
+ <body class="lift:content_id=main">
+ <div id="main" class="lift:surround?with=default;at=content">
+ Static content... everything you put in the /static
+ directory will be served without additions to SiteMap
+ </div>
+ </body>
+</html>
+
View
96 ...lank/src/main/resources/archetype-resources/src/main/webapp/templates-hidden/default.html
@@ -1,15 +1,85 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:lift="http://liftweb.net/">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <meta name="description" content="" />
- <meta name="keywords" content="" />
-
- <title>$groupId:$artifactId:$version</title>
- <script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
- </head>
- <body>
- <lift:bind name="content" />
- <lift:Menu.builder />
- <lift:msgs/>
- </body>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <meta name="description" content="" />
+ <meta name="keywords" content="" />
+ <title class="lift:Menu.title">App: </title>
+ <style class="lift:CSS.blueprint"></style>
+ <style class="lift:CSS.fancyType"></style>
+ <script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
+ <script id="json" src="/classpath/json.js" type="text/javascript"></script>
+ <style type="text/css">
+/* <![CDATA[ */
+.edit_error_class {
+ display: block;
+ color: red;
+}
+
+.sidebar ul {
+ margin:0;
+ padding:0;
+ border-bottom:1px solid #ccc;
+}
+
+
+.sidebar ul li {
+ margin:0;
+ padding:0;
+ list-style:none;
+ border:1px solid #ccc;
+ border-bottom:none;
+}
+
+.sidebar ul li a {
+ display:block;
+ padding:3px;
+ text-indent:30px;
+ text-decoration:none;
+}
+
+.sidebar ul li span {
+ display:block;
+ padding:3px;
+ text-indent:30px;
+ text-decoration:none;
+}
+
+.sidebar ul li a:hover {
+ background-color: #eee;
+}
+
+
+ /* ]]> */
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <div class="column span-12 last" style="text-align: right">
+ <h1 class="alt">app<img alt="" id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"></h1>
+ </div>
+
+ <hr>
+
+ <div class="column span-6 colborder sidebar">
+ <hr class="space" >
+
+ <span class="lift:Menu.builder"></span>
+
+ <div class="lift:Msgs?showAll=true"></div>
+ <hr class="space" />
+ </div>
+
+ <div class="column span-17 last">
+ <div id="content">The main content will get bound here</div>
+ </div>
+
+ <hr />
+ <div class="column span-23 last" style="text-align: center">
+ <h4 class="alt">
+ <a href="http://www.liftweb.net"><i>Lift</i></a>
+ is Copyright 2007-2012 WorldWide Conferencing, LLC.
+ Distributed under an Apache 2.0 License.</h4>
+ </div>
+ </div>
+ </body>
</html>
View
23 ...k/src/main/resources/archetype-resources/src/main/webapp/templates-hidden/wizard-all.html
@@ -0,0 +1,23 @@
+<div>
+ <wizard:screen_info><div>Page <wizard:screen_number/> of <wizard:total_screens/></div></wizard:screen_info>
+ <wizard:wizard_top> <div> <wizard:bind/> </div> </wizard:wizard_top>
+ <wizard:screen_top> <div> <wizard:bind/> </div> </wizard:screen_top>
+ <wizard:errors> <div> <ul> <wizard:item> <li> <wizard:bind/> </li> </wizard:item> </ul> </div> </wizard:errors>
+ <div> <wizard:fields>
+ <table>
+ <wizard:line>
+ <tr>
+ <td>
+ <wizard:label><label wizard:for=""><wizard:bind/></label></wizard:label>
+ <wizard:help><span><wizard:bind/></span></wizard:help>
+ <wizard:field_errors> <ul> <wizard:error> <li> <wizard:bind/> </li> </wizard:error> </ul> </wizard:field_errors>
+ </td>
+ <td> <wizard:form/> </td>
+ </tr>
+ </wizard:line>
+ </table>
+ </wizard:fields> </div>
+ <div> <table> <tr> <td> <wizard:prev/> </td> <td> <wizard:cancel/> </td> <td> <wizard:next/> </td> </tr> </table> </div>
+ <wizard:screen_bottom> <div> <wizard:bind/> </div> </wizard:screen_bottom>
+ <wizard:wizard_bottom> <div> <wizard:bind/> </div> </wizard:wizard_bottom>
+</div>
View
0 lift-archetype-blank/src/main/resources/archetype-resources/src/test/resources/.keep
No changes.
View
23 ...rchetype-blank/src/main/resources/archetype-resources/src/test/resources/logback-test.xml
@@ -0,0 +1,23 @@
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>console.devmode.log</file>
+ <append>true</append>
+ <encoder>
+ <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+
+ <logger name="code.snippet" level="info" />
+ <logger name="net.liftweb" level="warn" />
+ <logger name="bootstrap.liftweb" level="info" />
+ <root level="warn">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
View
17 lift-archetype-blank/src/main/resources/archetype-resources/src/test/scala/RunWebApp.scala
@@ -1,20 +1,21 @@
-import _root_.org.mortbay.jetty.Connector
-import _root_.org.mortbay.jetty.Server
-import _root_.org.mortbay.jetty.webapp.WebAppContext
-import org.mortbay.jetty.nio._
+import org.eclipse.jetty.server.handler.ContextHandler
+import org.eclipse.jetty.server.nio.SelectChannelConnector
+import org.eclipse.jetty.server.{Handler, Server}
+import org.eclipse.jetty.webapp.WebAppContext
-object RunWebApp extends Application {
+object RunWebApp extends App {
val server = new Server
val scc = new SelectChannelConnector
scc.setPort(8080)
server.setConnectors(Array(scc))
val context = new WebAppContext()
context.setServer(server)
- context.setContextPath("/")
context.setWar("src/main/webapp")
- server.addHandler(context)
+ val context0: ContextHandler = new ContextHandler();
+ context0.setHandler(context)
+ server.setHandler(context0)
try {
println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP")
@@ -25,7 +26,7 @@ object RunWebApp extends Application {
server.stop()
server.join()
} catch {
- case exc : Exception => {
+ case exc: Exception => {
exc.printStackTrace()
System.exit(100)
}
View
42 ...-blank/src/main/resources/archetype-resources/src/test/scala/snippet/HelloWorldTest.scala
@@ -0,0 +1,42 @@
+package ${package}
+package snippet
+
+import net.liftweb._
+import http._
+import net.liftweb.util._
+import net.liftweb.common._
+import Helpers._
+import lib._
+import org.specs2.mutable.Specification
+import org.specs2.specification.AroundExample
+import org.specs2.execute.Result
+
+
+object HelloWorldTestSpecs extends Specification with AroundExample{
+ val session = new LiftSession("", randomString(20), Empty)
+ val stableTime = now
+
+ /**
+ * For additional ways of writing tests,
+ * please see http://www.assembla.com/spaces/liftweb/wiki/Mocking_HTTP_Requests
+ */
+ def around[T <% Result](body: => T) = {
+ S.initIfUninitted(session) {
+ DependencyFactory.time.doWith(stableTime) {
+ body
+ }
+ }
+ }
+
+ "HelloWorld Snippet" should {
+ "Put the time in the node" in {
+ val hello = new HelloWorld
+ Thread.sleep(1000) // make sure the time changes
+
+ val str = hello.howdy(<span>Welcome to your Lift app at <span id="time">Time goes here</span></span>).toString
+
+ str.indexOf(stableTime.toString) must be >= 0
+ str must startWith("<span>Welcome to")
+ }
+ }
+}

0 comments on commit 13470db

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