Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updates for #1385: renamed logback.xml to default.logback.xml, update…

…d Hibernate to 4.2, removed obsolete tests, sync'd with latest sbt templates
  • Loading branch information...
commit a1eb73ca4ab382ff85a86abadf749b588cdba26d 1 parent c98d8c1
@ldeck authored
Showing with 195 additions and 457 deletions.
  1. +10 −5 lift-archetype-basic/src/main/resources/archetype-resources/pom.xml
  2. 0  ...l → lift-archetype-basic/src/main/resources/archetype-resources/src/main/resources/default.logback.xml
  3. +1 −1  lift-archetype-basic/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
  4. 0  ...rr; lift-archetype-basic/src/main/resources/archetype-resources/src/test/resources/test.default.logback.xml
  5. +0 −85 lift-archetype-basic/src/main/resources/archetype-resources/src/test/scala/AppTest.scala
  6. +10 −5 lift-archetype-blank/src/main/resources/archetype-resources/pom.xml
  7. 0  ...sources/archetype-resources/src/{test/resources/logback-test.xml → main/resources/default.logback.xml}
  8. +1 −1  lift-archetype-blank/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
  9. +1 −1  lift-archetype-blank/src/main/resources/archetype-resources/src/main/scala/snippet/HelloWorld.scala
  10. +7 −4 lift-archetype-blank/src/main/resources/archetype-resources/src/main/webapp/index.html
  11. 0  ...sources/archetype-resources/src/{main/resources/logback.xml → test/resources/test.default.logback.xml}
  12. +0 −86 lift-archetype-blank/src/main/resources/archetype-resources/src/test/scala/AppTest.scala
  13. +1 −1  lift-archetype-blank/src/main/resources/archetype-resources/src/test/scala/RunWebApp.scala
  14. +1 −1  lift-archetype-jpa-basic/src/main/resources/archetype-resources/README
  15. +2 −2 lift-archetype-jpa-basic/src/main/resources/archetype-resources/pom.xml
  16. +5 −2 ...-archetype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/resources/META-INF/persistence.xml
  17. +0 −1  lift-archetype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/AU.scala
  18. +1 −1  lift-archetype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/Author.scala
  19. +10 −9 ...-archetype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/CurrencyUserType.scala
  20. +7 −8 lift-archetype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/CurrencyZone.scala
  21. +1 −1  lift-archetype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/Enumv.scala
  22. +8 −11 lift-archetype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/EnumvType.scala
  23. +8 −8 lift-archetype-jpa-basic/src/main/resources/archetype-resources/spa/src/test/scala/model/TestJPAWeb.scala
  24. +6 −6 lift-archetype-jpa-basic/src/main/resources/archetype-resources/web/pom.xml
  25. 0  ... lift-archetype-jpa-basic/src/main/resources/archetype-resources/web/src/main/resources/default.logback.xml
  26. +2 −15 ...-archetype-jpa-basic/src/main/resources/archetype-resources/web/src/main/scala/bootstrap/liftweb/Boot.scala
  27. +17 −12 lift-archetype-jpa-basic/src/main/resources/archetype-resources/web/src/main/scala/snippet/Books.scala
  28. +0 −6 lift-archetype-jpa-basic/src/main/resources/archetype-resources/web/src/main/webapp/books/add.html
  29. +9 −8 lift-archetype-jpa-basic/src/main/resources/archetype-resources/web/src/test/scala/RunWebApp.scala
  30. +1 −1  lift-archetype-jpa-blank-single/src/main/resources/archetype-resources/README
  31. +8 −8 lift-archetype-jpa-blank-single/src/main/resources/archetype-resources/pom.xml
  32. +5 −2 ...chetype-jpa-blank-single/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
  33. +2 −2 ...chetype-jpa-blank-single/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
  34. +9 −8 lift-archetype-jpa-blank-single/src/main/resources/archetype-resources/src/test/scala/RunWebApp.scala
  35. +1 −1  lift-archetype-jpa-blank/src/main/resources/archetype-resources/README
  36. +2 −2 lift-archetype-jpa-blank/src/main/resources/archetype-resources/pom.xml
  37. +5 −2 ...-archetype-jpa-blank/src/main/resources/archetype-resources/spa/src/main/resources/META-INF/persistence.xml
  38. +6 −6 lift-archetype-jpa-blank/src/main/resources/archetype-resources/web/pom.xml
  39. +2 −2 ...-archetype-jpa-blank/src/main/resources/archetype-resources/web/src/main/scala/bootstrap/liftweb/Boot.scala
  40. +9 −8 lift-archetype-jpa-blank/src/main/resources/archetype-resources/web/src/test/scala/RunWebApp.scala
  41. +10 −5 lift-archetype-mvc/src/main/resources/archetype-resources/pom.xml
  42. 0  ...xml → lift-archetype-mvc/src/main/resources/archetype-resources/src/main/resources/default.logback.xml
  43. +3 −2 lift-archetype-mvc/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
  44. +1 −1  lift-archetype-mvc/src/main/resources/archetype-resources/src/main/scala/controller/RootController.scala
  45. +23 −0 lift-archetype-mvc/src/main/resources/archetype-resources/src/test/resources/test.default.logback.xml
  46. +0 −85 lift-archetype-mvc/src/main/resources/archetype-resources/src/test/scala/AppTest.scala
  47. +0 −42 lift-archetype-mvc/src/main/resources/archetype-resources/src/test/scala/snippet/HelloWorldTest.scala
View
15 lift-archetype-basic/src/main/resources/archetype-resources/pom.xml
@@ -65,11 +65,16 @@
<artifactId>lift-mapper_$scalaVersion</artifactId>
<version>$liftVersion</version>
</dependency>
+ <dependency>
+ <groupId>net.liftmodules</groupId>
+ <artifactId>lift-jquery-module_$scalaVersion</artifactId>
+ <version>${liftVersion}-2.0</version>
+ </dependency>
#if ($logBackend.equalsIgnoreCase("logback"))
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.0.11</version>
+ <version>1.0.12</version>
</dependency>
#elseif ($logBackend.equalsIgnoreCase("log4j"))
<dependency>
@@ -110,7 +115,7 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
- <version>9.0.1.v20130408</version>
+ <version>8.1.10.v20130312</version>
<scope>test</scope>
</dependency>
<!-- for LiftConsole -->
@@ -174,9 +179,9 @@
</executions>
</plugin>
<plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>9.0.1.v20130408</version>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.26</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
View
0  ...urces/src/test/resources/logback-test.xml → ...es/src/main/resources/default.logback.xml
File renamed without changes
View
2  ...-basic/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -39,7 +39,7 @@ class Boot {
Schemifier.schemify(true, Schemifier.infoF _, User)
// where to search snippet
- LiftRules.addToPackages("code")
+ LiftRules.addToPackages("${package}")
// Build SiteMap
def sitemap = SiteMap(
View
0  ...-resources/src/main/resources/logback.xml → ...c/test/resources/test.default.logback.xml
File renamed without changes
View
85 lift-archetype-basic/src/main/resources/archetype-resources/src/test/scala/AppTest.scala
@@ -1,85 +0,0 @@
-package ${package}
-
-import java.io.File
-import junit.framework._
-import Assert._
-import scala.xml.XML
-import net.liftweb.util._
-import net.liftweb.common._
-
-object AppTest {
- def suite: Test = {
- val suite = new TestSuite(classOf[AppTest])
- suite
- }
-
- def main(args : Array[String]) {
- junit.textui.TestRunner.run(suite)
- }
-}
-
-/**
- * Unit test for simple App.
- */
-class AppTest extends TestCase("app") {
-
- /**
- * Rigourous Tests :-)
- */
- def testOK() = assertTrue(true)
- // def testKO() = assertTrue(false);
-
- /**
- * Tests to make sure the project's XML files are well-formed.
- *
- * Finds every *.html and *.xml file in src/main/webapp (and its
- * subdirectories) and tests to make sure they are well-formed.
- */
- def testXml() = {
- var failed: List[File] = Nil
-
- def handledXml(file: String) =
- file.endsWith(".xml")
-
- def handledXHtml(file: String) =
- file.endsWith(".html") || file.endsWith(".htm") || file.endsWith(".xhtml")
-
- def wellFormed(file: File) {
- if (file.isDirectory)
- for (f <- file.listFiles) wellFormed(f)
-
- /*
- if (file.isFile && file.exists && handledXml(file.getName)) {
- try {
- import java.io.FileInputStream
- val fis = new FileInputStream(file)
- try {
- XML.load(fis)
- } finally {
- fis.close()
- }
- } catch {
- case e: _root_.org.xml.sax.SAXParseException => failed = file :: failed
- }
- }
- */
-
- if (file.isFile && file.exists && handledXHtml(file.getName)) {
- PCDataXmlParser(new _root_.java.io.FileInputStream(file.getAbsolutePath)) match {
- case Full(_) => // file is ok
- case _ => failed = file :: failed
- }
- }
- }
-
- wellFormed(new File("src/main/webapp"))
-
- val numFails = failed.size
- if (numFails > 0) {
- val fileStr = if (numFails == 1) "file" else "files"
- val msg = "Malformed XML in " + numFails + " " + fileStr + ": " + failed.mkString(", ")
- println(msg)
- fail(msg)
- }
- }
-}
View
15 lift-archetype-blank/src/main/resources/archetype-resources/pom.xml
@@ -65,11 +65,16 @@
<artifactId>lift-mapper_$scalaVersion</artifactId>
<version>$liftVersion</version>
</dependency>
+ <dependency>
+ <groupId>net.liftmodules</groupId>
+ <artifactId>lift-jquery-module_$scalaVersion</artifactId>
+ <version>${liftVersion}-2.0</version>
+ </dependency>
#if ($logBackend.equalsIgnoreCase("logback"))
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.0.11</version>
+ <version>1.0.12</version>
</dependency>
#elseif ($logBackend.equalsIgnoreCase("log4j"))
<dependency>
@@ -104,7 +109,7 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
- <version>9.0.1.v20130408</version>
+ <version>8.1.10.v20130312</version>
<scope>test</scope>
</dependency>
<!-- for LiftConsole -->
@@ -168,9 +173,9 @@
</executions>
</plugin>
<plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>9.0.1.v20130408</version>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.26</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
View
0  ...urces/src/test/resources/logback-test.xml → ...es/src/main/resources/default.logback.xml
File renamed without changes
View
2  ...-blank/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -19,7 +19,7 @@ import net.liftweb.http.js.jquery._
class Boot {
def boot {
// where to search snippet
- LiftRules.addToPackages("code")
+ LiftRules.addToPackages("${package}")
// Build SiteMap
val entries = List(
View
2  ...type-blank/src/main/resources/archetype-resources/src/main/scala/snippet/HelloWorld.scala
@@ -5,7 +5,7 @@ import scala.xml.{NodeSeq, Text}
import net.liftweb.util._
import net.liftweb.common._
import java.util.Date
-import code.lib._
+import ${package}.lib._
import Helpers._
class HelloWorld {
View
11 lift-archetype-blank/src/main/resources/archetype-resources/src/main/webapp/index.html
@@ -1,13 +1,16 @@
<!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>
+ <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>
+ <span class="lift:helloWorld.howdy">
+ Welcome to your Lift app at <span id="time">Time goes here</span>
+ </span>
</p>
</div>
</body>
View
0  ...-resources/src/main/resources/logback.xml → ...c/test/resources/test.default.logback.xml
File renamed without changes
View
86 lift-archetype-blank/src/main/resources/archetype-resources/src/test/scala/AppTest.scala
@@ -1,86 +0,0 @@
-package ${package}
-
-import java.io.File
-import junit.framework._
-import Assert._
-import scala.xml.XML
-import net.liftweb.util._
-import net.liftweb.common._
-
-object AppTest {
- def suite: Test = {
- val suite = new TestSuite(classOf[AppTest])
- suite
- }
-
- def main(args : Array[String]) {
- _root_.junit.textui.TestRunner.run(suite)
- }
-}
-
-/**
- * Unit test for simple App.
- */
-class AppTest extends TestCase("app") {
-
- /**
- * Rigourous Tests :-)
- */
- def testOK() = assertTrue(true)
- // def testKO() = assertTrue(false)
-
- /**
- * Tests to make sure the project's XML files are well-formed.
- *
- * Finds every *.html and *.xml file in src/main/webapp (and its
- * subdirectories) and tests to make sure they are well-formed.
- */
- def testXml() = {
- var failed: List[File] = Nil
-
- def handledXml(file: String) =
- file.endsWith(".xml")
-
- def handledXHtml(file: String) =
- file.endsWith(".html") || file.endsWith(".htm") || file.endsWith(".xhtml")
-
- def wellFormed(file: File) {
- if (file.isDirectory)
- for (f <- file.listFiles) wellFormed(f)
-
- /*
- // disable SAX parser validation
- if (file.isFile && file.exists && handledXml(file.getName)) {
- try {
- import java.io.FileInputStream
- val fis = new FileInputStream(file)
- try {
- XML.load(fis)
- } finally {
- fis.close()
- }
- } catch {
- case e: _root_.org.xml.sax.SAXParseException => failed = file :: failed
- }
- }
- */
-
- if (file.isFile && file.exists && handledXHtml(file.getName)) {
- PCDataXmlParser(new _root_.java.io.FileInputStream(file.getAbsolutePath)) match {
- case Full(_) => // file is ok
- case _ => failed = file :: failed
- }
- }
- }
-
- wellFormed(new File("src/main/webapp"))
-
- val numFails = failed.size
- if (numFails > 0) {
- val fileStr = if (numFails == 1) "file" else "files"
- val msg = "Malformed XML in " + numFails + " " + fileStr + ": " + failed.mkString(", ")
- println(msg)
- fail(msg)
- }
- }
-}
View
2  lift-archetype-blank/src/main/resources/archetype-resources/src/test/scala/RunWebApp.scala
@@ -13,7 +13,7 @@ object RunWebApp extends App {
context.setServer(server)
context.setWar("src/main/webapp")
- val context0: ContextHandler = new ContextHandler();
+ val context0: ContextHandler = new ContextHandler()
context0.setHandler(context)
server.setHandler(context0)
View
2  lift-archetype-jpa-basic/src/main/resources/archetype-resources/README
@@ -4,4 +4,4 @@ mvn install
cd web
mvn jetty:run
-Then point your favorite browser to http://localhost:9090/
+Then point your favorite browser to http://localhost:8080/
View
4 lift-archetype-jpa-basic/src/main/resources/archetype-resources/pom.xml
@@ -76,7 +76,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.0.11</version>
+ <version>1.0.12</version>
</dependency>
#elseif ($logBackend.equalsIgnoreCase("log4j"))
<dependency>
@@ -99,7 +99,7 @@
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
- <version>10.9.1.0</version>
+ <version>10.10.1.1</version>
<optional>true</optional>
</dependency>
<dependency>
View
7 ...ic/src/main/resources/archetype-resources/spa/src/main/resources/META-INF/persistence.xml
@@ -1,7 +1,10 @@
-<persistence>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
<persistence-unit name="jpaweb" transaction-type="RESOURCE_LOCAL">
<properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="hibernate.connection.url" value="jdbc:derby:lift_example;create=true"/>
<property name="hibernate.max_fetch_depth" value="3"/>
View
1  ...hetype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/AU.scala
@@ -16,7 +16,6 @@
package ${package}
package model
-import java.util.Currency
import java.util.Locale
import java.text.NumberFormat
View
2  ...pe-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/Author.scala
@@ -31,5 +31,5 @@ class Author {
var name : String = ""
@OneToMany(mappedBy = "author", targetEntity = classOf[Book])
- var books : _root_.java.util.Set[Book] = new _root_.java.util.HashSet[Book]()
+ var books : java.util.Set[Book] = new java.util.HashSet[Book]()
}
View
19 ...ic/src/main/resources/archetype-resources/spa/src/main/scala/model/CurrencyUserType.scala
@@ -24,6 +24,7 @@ import java.sql.Types
import org.hibernate.HibernateException
import org.hibernate.usertype.UserType
+import org.hibernate.engine.spi.SessionImplementor
/**
* Helper class to translate money amount for hibernate
@@ -32,26 +33,26 @@ abstract class CurrencyUserType[CZ <: CurrencyZone](cz: CZ) extends UserType {
type MyCurrency = CZ#Currency
- val SQL_TYPES = Array(Types.NUMERIC.asInstanceOf[Int])
+ val SQL_TYPES = Array(Types.NUMERIC)
override def sqlTypes() = SQL_TYPES
- override def returnedClass = cz.CurrencyUnit.getClass
+ override def returnedClass = cz.getClass
override def equals(x: Object, y: Object): Boolean = {
- if (x == null || y == null) return false
- else return x == y
+ if (x == null || y == null) false
+ else x == y
}
override def hashCode(x: Object) = x.hashCode
- override def nullSafeGet(resultSet: ResultSet, names: Array[String], owner: Object): Object = {
+ override def nullSafeGet(resultSet: ResultSet, names: Array[String], sessionImplementor: SessionImplementor, owner: Object) : Object = {
val dollarVal = resultSet.getBigDecimal(names(0))
- if (resultSet.wasNull()) return cz.make(0)
- else return cz.make(new BigDecimal(dollarVal))
+ if (resultSet.wasNull()) cz.make(0)
+ else cz.make(new BigDecimal(dollarVal))
}
- override def nullSafeSet(statement: PreparedStatement, value: Object, index: Int): Unit = {
+ override def nullSafeSet(statement: PreparedStatement, value: Object, index: Int, sessionImplementor: SessionImplementor) {
if (value == null) {
statement.setNull(index, Types.NUMERIC)
} else {
@@ -62,7 +63,7 @@ abstract class CurrencyUserType[CZ <: CurrencyZone](cz: CZ) extends UserType {
override def deepCopy(value: Object): Object = value
- override def isMutable() = false
+ override def isMutable = false
override def disassemble(value: Object) = value.asInstanceOf[Serializable]
View
15 ...-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/CurrencyZone.scala
@@ -16,7 +16,6 @@
package ${package}
package model
-import java.util.Currency
import java.util.Locale
import java.text.NumberFormat
@@ -41,7 +40,7 @@ abstract class CurrencyZone {
def -(that: Currency): Currency = this - that
def /(that: Currency): Currency =
- make(new BigDecimal(this.amount.bigDecimal.divide(that.amount.bigDecimal, scale, _root_.java.math.BigDecimal.ROUND_HALF_UP)) )
+ make(new BigDecimal(this.amount.bigDecimal.divide(that.amount.bigDecimal, scale, java.math.BigDecimal.ROUND_HALF_UP)))
override def toString = format("", numberOfFractionDigits)
@@ -51,12 +50,12 @@ abstract class CurrencyZone {
var moneyValue = amount
if (amount == null) moneyValue = 0
- moneyValue = moneyValue.setScale(numberOfFractionDigits, BigDecimal.RoundingMode.HALF_UP);
- val numberFormat = NumberFormat.getInstance(auLocale);
- numberFormat.setMinimumFractionDigits(numberOfFractionDigits);
- numberFormat.setMaximumFractionDigits(numberOfFractionDigits);
- if (moneyValue.doubleValue() < 0) return "-"+currencySymbol+numberFormat.format(moneyValue.abs.doubleValue());
- else return currencySymbol+numberFormat.format(moneyValue.doubleValue());
+ moneyValue = moneyValue.setScale(numberOfFractionDigits, BigDecimal.RoundingMode.HALF_UP)
+ val numberFormat = NumberFormat.getInstance(auLocale)
+ numberFormat.setMinimumFractionDigits(numberOfFractionDigits)
+ numberFormat.setMaximumFractionDigits(numberOfFractionDigits)
+ if (moneyValue.doubleValue() < 0) "-"+currencySymbol+numberFormat.format(moneyValue.abs.doubleValue())
+ else currencySymbol+numberFormat.format(moneyValue.doubleValue())
}
def get: String = get(numberOfFractionDigits)
View
2  ...ype-jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/Enumv.scala
@@ -40,5 +40,5 @@ trait Enumv {
}
/* get name description pair list for forms */
- def getNameDescriptionList = this.map(v => (v.toString, getDescriptionOrName(v) ) ).toList
+ def getNameDescriptionList = values.map(v => (v.toString, getDescriptionOrName(v))).toList
}
View
19 ...jpa-basic/src/main/resources/archetype-resources/spa/src/main/scala/model/EnumvType.scala
@@ -24,6 +24,7 @@ import java.sql.Types
import org.hibernate.HibernateException
import org.hibernate.usertype.UserType
+import org.hibernate.engine.spi.SessionImplementor
/**
* Helper class to translate enum for hibernate
@@ -32,25 +33,21 @@ abstract class EnumvType(val et: Enumeration with Enumv) extends UserType {
val SQL_TYPES = Array({Types.VARCHAR})
- override def sqlTypes() = SQL_TYPES
+ override def sqlTypes = SQL_TYPES
override def returnedClass = classOf[et.Value]
- override def equals(x: Object, y: Object): Boolean = {
- return x == y
- }
+ override def equals(x: Object, y: Object): Boolean = x == y
override def hashCode(x: Object) = x.hashCode
- override def nullSafeGet(resultSet: ResultSet, names: Array[String], owner: Object): Object = {
+ override def nullSafeGet(resultSet: ResultSet, names: Array[String], sessionImplementor: SessionImplementor, owner: Object) : Object = {
val value = resultSet.getString(names(0))
- if (resultSet.wasNull()) return null
- else {
- return et.valueOf(value).getOrElse(null)
- }
+ if (resultSet.wasNull()) null
+ else et.values.find(_.toString == value).getOrElse(null)
}
- override def nullSafeSet(statement: PreparedStatement, value: Object, index: Int): Unit = {
+ override def nullSafeSet(statement: PreparedStatement, value: Object, index: Int, sessionImplementor: SessionImplementor) {
if (value == null) {
statement.setNull(index, Types.VARCHAR)
} else {
@@ -61,7 +58,7 @@ abstract class EnumvType(val et: Enumeration with Enumv) extends UserType {
override def deepCopy(value: Object): Object = value
- override def isMutable() = false
+ override def isMutable = false
override def disassemble(value: Object) = value.asInstanceOf[Serializable]
View
16 ...pa-basic/src/main/resources/archetype-resources/spa/src/test/scala/model/TestJPAWeb.scala
@@ -32,13 +32,13 @@ class TestJPAWeb {
emf = Persistence.createEntityManagerFactory("jpaweb")
} catch {
case e: Exception => {
- def printAndDescend(ex : Throwable) : Unit = {
- println(e.getMessage())
- if (ex.getCause() != null) {
- printAndDescend(ex.getCause())
- }
- }
- printAndDescend(e)
+ def printAndDescend(ex : Throwable) : Unit = {
+ println(e.getMessage())
+ if (ex.getCause() != null) {
+ printAndDescend(ex.getCause())
+ }
+ }
+ printAndDescend(e)
}
}
}
@@ -63,7 +63,7 @@ class TestJPAWeb {
val book = new Book
book.title = "Huh?"
- book.published = new _root_.java.util.Date
+ book.published = new java.util.Date
book.author = author
book.genre = Genre.Mystery
View
12 lift-archetype-jpa-basic/src/main/resources/archetype-resources/web/pom.xml
@@ -42,7 +42,7 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
- <version>9.0.1.v20130408</version>
+ <version>8.1.10.v20130312</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -50,15 +50,15 @@
<build>
<plugins>
<plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>9.0.1.v20130408</version>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.26</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
<connectors>
- <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
- <port>9090</port>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
View
0  ...urces/src/test/resources/logback-test.xml → ...eb/src/main/resources/default.logback.xml
File renamed without changes
View
17 ...ic/src/main/resources/archetype-resources/web/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -17,8 +17,8 @@ package bootstrap.liftweb
import java.util.Locale
-import net.liftweb.common.{Box,Empty,Full}
-import net.liftweb.util.{LoanWrapper,LogBoot}
+import net.liftweb.common.{Box,Empty,Full,Logger}
+import net.liftweb.util.{LoanWrapper}
import net.liftweb.http._
import net.liftweb.http.provider._
import net.liftweb.sitemap._
@@ -32,19 +32,6 @@ import S.?
*/
class Boot {
def boot {
- LogBoot.defaultProps =
- """<?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
- <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="appender" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.SimpleLayout"/>
- </appender>
- <root>
- <priority value ="DEBUG"/>
- <appender-ref ref="appender"/>
- </root>
- </log4j:configuration>
- """
// where to search snippet
LiftRules.addToPackages("${package}")
View
29 ...e-jpa-basic/src/main/resources/archetype-resources/web/src/main/scala/snippet/Books.scala
@@ -16,21 +16,22 @@
package ${package}
package snippet
-import java.text.{ParseException,SimpleDateFormat}
+import java.text.{SimpleDateFormat, ParseException}
import scala.xml.{NodeSeq,Text}
import net.liftweb.http.{RequestVar,S,SHtml}
+import net.liftweb.http.js.JsCmds.Run
import net.liftweb.common.{Box,Empty,Full, Loggable}
-import net.liftweb.util.{Helpers}
import S._
-import Helpers._
+import net.liftweb.util.Helpers._
import javax.persistence.{EntityExistsException,PersistenceException}
import ${package}.model._
import Model._
+
// Make an object so that other pages can access (ie Authors)
object BookOps {
// Object to hold search results
@@ -38,18 +39,18 @@ object BookOps {
}
class BookOps extends Loggable {
- val formatter = new _root_.java.text.SimpleDateFormat("yyyyMMdd")
+ val formatter = new SimpleDateFormat("dd/MM/yyyy", S.locale)
def list (xhtml : NodeSeq) : NodeSeq = {
val books = Model.createNamedQuery[Book]("findAllBooks").getResultList()
books.flatMap(book =>
bind("book", xhtml,
- "title" -> Text(book.title),
- "published" -> Text(formatter.format(book.published)),
- "genre" -> Text(if (book.genre != null) book.genre.toString else ""),
- "author" -> Text(book.author.name),
- "edit" -> SHtml.link("add.html", () => bookVar(book), Text(?("Edit")))))
+ "title" -> Text(book.title),
+ "published" -> Text(formatter.format(book.published)),
+ "genre" -> Text(if (book.genre != null) book.genre.toString else ""),
+ "author" -> Text(book.author.name),
+ "edit" -> SHtml.link("add.html", () => bookVar(book), Text(?("Edit")))))
}
// Set up a requestVar to track the book object for edits and adds
@@ -60,8 +61,8 @@ class BookOps extends Loggable {
def is_valid_Book_? (toCheck : Book) : Boolean =
List((if (toCheck.title.length == 0) { S.error("You must provide a title"); false } else true),
(if (toCheck.published == null) { S.error("You must provide a publish date"); false } else true),
- (if (toCheck.genre == null) { S.error("You must select a genre"); false } else true),
- (if (toCheck.author == null) { S.error("You must select an author"); false } else true)).forall(_ == true)
+ (if (toCheck.genre == null) { S.error("You must select a genre"); false } else true),
+ (if (toCheck.author == null) { S.error("You must select an author"); false } else true)).forall(_ == true)
def setDate (input : String, toSet : Book) {
try {
@@ -91,16 +92,20 @@ class BookOps extends Loggable {
val choices = authors.map(author => (author.id.toString -> author.name)).toList
val default = if (book.author != null) { Full(book.author.id.toString) } else { Empty }
+ S.appendJs(calendarPicker)
+
bind("book", xhtml,
"id" -> SHtml.hidden(() => bookVar(current)),
"title" -> SHtml.text(book.title, book.title = _),
"published" -> SHtml.text(formatter.format(book.published), setDate(_, book)) % ("id" -> "published"),
- "genre" -> SHtml.select(Genre.getNameDescriptionList, (Box.legacyNullTest(book.genre).map(_.toString) or Full("")), choice => book.genre = Genre.valueOf(choice).getOrElse(null)),
+ "genre" -> SHtml.select(Genre.getNameDescriptionList, (Box.legacyNullTest(book.genre).map(_.toString) or Full("")), choice => book.genre = Genre.values.find(_.toString == choice).getOrElse(null)),
"author" -> SHtml.select(choices, default, {authId : String => book.author = Model.getReference(classOf[Author], authId.toLong)}),
"save" -> SHtml.submit(?("Save"), doAdd)
)
}
+ private def calendarPicker = Run("$('#published').datePicker({dateFormat: '%s'});".format(formatter.toLocalizedPattern))
+
def searchResults (xhtml : NodeSeq) : NodeSeq = BookOps.resultVar.is.flatMap(result =>
bind("result", xhtml, "title" -> Text(result.title), "author" -> Text(result.author.name)))
View
6 ...etype-jpa-basic/src/main/resources/archetype-resources/web/src/main/webapp/books/add.html
@@ -46,10 +46,4 @@
</lift:BookOps.add>
</table>
- <script type="text/javascript">
- Date.format = 'yyyymmdd';
- jQuery(function () {
- jQuery('#published').datePicker({startDate:'00010101'});
- })
- </script>
</lift:surround>
View
17 ...etype-jpa-basic/src/main/resources/archetype-resources/web/src/test/scala/RunWebApp.scala
@@ -1,9 +1,9 @@
-import org.mortbay.jetty.Connector
-import org.mortbay.jetty.Server
-import 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)
@@ -11,10 +11,11 @@ object RunWebApp extends Application {
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
2  lift-archetype-jpa-blank-single/src/main/resources/archetype-resources/README
@@ -4,4 +4,4 @@ mvn install
cd web
mvn jetty:run
-Then point your favorite browser to http://localhost:9090/
+Then point your favorite browser to http://localhost:8080/
View
16 lift-archetype-jpa-blank-single/src/main/resources/archetype-resources/pom.xml
@@ -75,7 +75,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.0.11</version>
+ <version>1.0.12</version>
</dependency>
#elseif ($logBackend.equalsIgnoreCase("log4j"))
<dependency>
@@ -108,7 +108,7 @@
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
- <version>10.4.2.0</version>
+ <version>10.10.1.1</version>
<optional>true</optional>
</dependency>
<dependency>
@@ -127,7 +127,7 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
- <version>9.0.1.v20130408</version>
+ <version>8.1.10.v20130312</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -200,15 +200,15 @@
</executions>
</plugin>
<plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>9.0.1.v20130408</version>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.26</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
<connectors>
- <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
- <port>9090</port>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
View
7 ...single/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
@@ -1,11 +1,14 @@
-<persistence>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
<!-- The following configuration is left as a placeholder. Please
replace with your own config
There are several options. First, a local EM using Hibernate: -->
<persistence-unit name="jpaweb" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="hibernate.connection.url" value="jdbc:derby:lift_example;create=true"/>
<property name="hibernate.max_fetch_depth" value="3"/>
View
4 ...single/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -17,8 +17,8 @@ package bootstrap.liftweb
import java.util.Locale
-import net.liftweb.common.{Box,Empty,Full}
-import net.liftweb.util.{LoanWrapper,LogBoot}
+import net.liftweb.common.{Box,Empty,Full,Logger}
+import net.liftweb.util.{LoanWrapper}
import net.liftweb.http._
import net.liftweb.http.provider._
import net.liftweb.sitemap._
View
17 ...pe-jpa-blank-single/src/main/resources/archetype-resources/src/test/scala/RunWebApp.scala
@@ -1,9 +1,9 @@
-import org.mortbay.jetty.Connector
-import org.mortbay.jetty.nio._
-import org.mortbay.jetty.Server
-import org.mortbay.jetty.webapp.WebAppContext
+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)
@@ -11,10 +11,11 @@ object RunWebApp extends Application {
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
2  lift-archetype-jpa-blank/src/main/resources/archetype-resources/README
@@ -4,4 +4,4 @@ mvn install
cd web
mvn jetty:run
-Then point your favorite browser to http://localhost:9090/
+Then point your favorite browser to http://localhost:8080/
View
4 lift-archetype-jpa-blank/src/main/resources/archetype-resources/pom.xml
@@ -82,7 +82,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.0.11</version>
+ <version>1.0.12</version>
</dependency>
#elseif ($logBackend.equalsIgnoreCase("log4j"))
<dependency>
@@ -99,7 +99,7 @@
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
- <version>10.4.2.0</version>
+ <version>10.10.1.1</version>
<optional>true</optional>
</dependency>
<dependency>
View
7 ...nk/src/main/resources/archetype-resources/spa/src/main/resources/META-INF/persistence.xml
@@ -1,9 +1,12 @@
-<persistence>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
<!-- The following configuration is left as a placeholder. Please
replace with your own config -->
<persistence-unit name="jpaweb" transaction-type="RESOURCE_LOCAL">
<properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="hibernate.connection.url" value="jdbc:derby:lift_example;create=true"/>
<property name="hibernate.max_fetch_depth" value="3"/>
View
12 lift-archetype-jpa-blank/src/main/resources/archetype-resources/web/pom.xml
@@ -42,7 +42,7 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
- <version>9.0.1.v20130408</version>
+ <version>8.1.10.v20130312</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -50,15 +50,15 @@
<build>
<plugins>
<plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>9.0.1.v20130408</version>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.26</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
<connectors>
- <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
- <port>9090</port>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
View
4 ...nk/src/main/resources/archetype-resources/web/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -17,8 +17,8 @@ package bootstrap.liftweb
import java.util.Locale
-import net.liftweb.common.{Box,Empty,Full}
-import net.liftweb.util.{LoanWrapper,LogBoot}
+import net.liftweb.common.{Box,Empty,Full,Logger}
+import net.liftweb.util.{LoanWrapper}
import net.liftweb.http._
import net.liftweb.http.provider._
import net.liftweb.sitemap._
View
17 ...etype-jpa-blank/src/main/resources/archetype-resources/web/src/test/scala/RunWebApp.scala
@@ -1,9 +1,9 @@
-import org.mortbay.jetty.Connector
-import org.mortbay.jetty.Server
-import 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)
@@ -11,10 +11,11 @@ object RunWebApp extends Application {
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
15 lift-archetype-mvc/src/main/resources/archetype-resources/pom.xml
@@ -65,11 +65,16 @@
<artifactId>lift-mapper_$scalaVersion</artifactId>
<version>$liftVersion</version>
</dependency>
+ <dependency>
+ <groupId>net.liftmodules</groupId>
+ <artifactId>lift-jquery-module_$scalaVersion</artifactId>
+ <version>${liftVersion}-2.0</version>
+ </dependency>
#if ($logBackend.equalsIgnoreCase("logback"))
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.0.11</version>
+ <version>1.0.12</version>
</dependency>
#elseif ($logBackend.equalsIgnoreCase("log4j"))
<dependency>
@@ -110,7 +115,7 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
- <version>9.0.1.v20130408</version>
+ <version>8.1.10.v20130312</version>
<scope>test</scope>
</dependency>
<!-- for LiftConsole -->
@@ -174,9 +179,9 @@
</executions>
</plugin>
<plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>9.0.1.v20130408</version>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.26</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
View
0  ...-resources/src/main/resources/logback.xml → ...es/src/main/resources/default.logback.xml
File renamed without changes
View
5 ...pe-mvc/src/main/resources/archetype-resources/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -6,8 +6,9 @@ import Helpers._
import common._
import http._
+import js.jquery._
-import ${package}.conroller._
+import ${package}.controller._
import net.liftmodules.JQueryModule
@@ -18,7 +19,7 @@ import net.liftmodules.JQueryModule
class Boot {
def boot {
// where to search snippet
- LiftRules.addToPackages("code")
+ LiftRules.addToPackages("${package}")
//Init the jQuery module, see http://liftweb.net/jquery for more information.
LiftRules.jsArtifacts = JQueryArtifacts
View
2  ...mvc/src/main/resources/archetype-resources/src/main/scala/controller/RootController.scala
@@ -4,7 +4,7 @@ package controller
import net.liftweb.http._
import net.liftweb.util._
import java.util.Date
-import code.lib._
+import ${package}.lib._
import Helpers._
/**
View
23 ...pe-mvc/src/main/resources/archetype-resources/src/test/resources/test.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
85 lift-archetype-mvc/src/main/resources/archetype-resources/src/test/scala/AppTest.scala
@@ -1,85 +0,0 @@
-package ${package}
-
-import java.io.File
-import junit.framework._
-import Assert._
-import scala.xml.XML
-import net.liftweb.util._
-import net.liftweb.common._
-
-object AppTest {
- def suite: Test = {
- val suite = new TestSuite(classOf[AppTest])
- suite
- }
-
- def main(args : Array[String]) {
- junit.textui.TestRunner.run(suite)
- }
-}
-
-/**
- * Unit test for simple App.
- */
-class AppTest extends TestCase("app") {
-
- /**
- * Rigourous Tests :-)
- */
- def testOK() = assertTrue(true)
- // def testKO() = assertTrue(false);
-
- /**
- * Tests to make sure the project's XML files are well-formed.
- *
- * Finds every *.html and *.xml file in src/main/webapp (and its
- * subdirectories) and tests to make sure they are well-formed.
- */
- def testXml() = {
- var failed: List[File] = Nil
-
- def handledXml(file: String) =
- file.endsWith(".xml")
-
- def handledXHtml(file: String) =
- file.endsWith(".html") || file.endsWith(".htm") || file.endsWith(".xhtml")
-
- def wellFormed(file: File) {
- if (file.isDirectory)
- for (f <- file.listFiles) wellFormed(f)
-
- /*
- if (file.isFile && file.exists && handledXml(file.getName)) {
- try {
- import java.io.FileInputStream
- val fis = new FileInputStream(file)
- try {
- XML.load(fis)
- } finally {
- fis.close()
- }
- } catch {
- case e: _root_.org.xml.sax.SAXParseException => failed = file :: failed
- }
- }
- */
-
- if (file.isFile && file.exists && handledXHtml(file.getName)) {
- PCDataXmlParser(new _root_.java.io.FileInputStream(file.getAbsolutePath)) match {
- case Full(_) => // file is ok
- case _ => failed = file :: failed
- }
- }
- }
-
- wellFormed(new File("src/main/webapp"))
-
- val numFails = failed.size
- if (numFails > 0) {
- val fileStr = if (numFails == 1) "file" else "files"
- val msg = "Malformed XML in " + numFails + " " + fileStr + ": " + failed.mkString(", ")
- println(msg)
- fail(msg)
- }
- }
-}
View
42 ...pe-mvc/src/main/resources/archetype-resources/src/test/scala/snippet/HelloWorldTest.scala
@@ -1,42 +0,0 @@
-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")
- }
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.