Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Added lift_json project.

** It only has a specs class so you can try extractions
  • Loading branch information...
commit e779441e76a9def148c6c3e76bd79662777f8fe5 1 parent 4bc377e
@fmpwizard fmpwizard authored
View
23 scala_29/lift_json/build.sbt
@@ -0,0 +1,23 @@
+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"
+ )
+
+scalacOptions ++= Seq("-deprecation", "-unchecked")
+
+libraryDependencies ++= {
+ val liftVersion = "2.5-SNAPSHOT"
+ Seq(
+ "net.liftweb" %% "lift-json" % liftVersion % "compile",
+ "ch.qos.logback" % "logback-classic" % "1.0.6",
+ "org.specs2" %% "specs2" % "1.11" % "test"
+ )
+}
+
View
6 scala_29/lift_json/project/plugins.sbt
@@ -0,0 +1,6 @@
+
+//Uncoment this line to enable the sbt idea plugin
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")
+
+//Uncoment this line to enable the sbt eclipse plugin
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
View
1  scala_29/lift_json/sbt
@@ -0,0 +1 @@
+java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launcher.jar "$@"
View
BIN  scala_29/lift_json/sbt-launcher.jar
Binary file not shown
View
2  scala_29/lift_json/sbt.bat
@@ -0,0 +1,2 @@
+set SCRIPT_DIR=%~dp0
+java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx1024M -Xss2M -jar "%SCRIPT_DIR%\sbt-launcher.jar" %*
View
23 scala_29/lift_json/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
28 scala_29/lift_json/src/test/scala/code/json/JsonSpecs.scala
@@ -0,0 +1,28 @@
+package code.json
+
+import org.specs2.mutable.Specification
+import net.liftweb.json._
+
+class JsonSpecs extends Specification{
+
+ implicit val format = DefaultFormats
+ val json = parse("""{"name" : "John", "age" : 30}""")
+ case class Person(name: String, age: Int)
+ case class FakePerson(sudo: String, age: Int)
+
+
+
+ "Lift Json" should{
+ "extract the name value" in {
+ json.extract[Person].name must_== "John"
+ }
+ "extract the age value" in {
+ json.extract[Person].age must_== 30
+ }
+ "throw an exception" in {
+ json.extract[FakePerson].sudo must throwA[MappingException]
+ }
+
+ }
+
+}

0 comments on commit e779441

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