Dmitry G
unread,Oct 19, 2011, 3:02:03 PM10/19/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pinky webframework
Folks,
A pinky noob here.. Can someone point me at any samples of how you'd
go about serializing/deserializing a case class to/from json with
pinky?
Also, how do you unit test the http requests, is there an embedded
jetty or anything?
Basically, I just have a bare-bones myapp bootstrap and trying to hit
it from within a specs2 test. Any hints would be appreciated
Thanks
==================================================
class MyAppBootstrap extends PinkyServletContextListener {
modules = Array(
new CakeServletModule with CakeExampleServlet{
override def configureServlets {
val hello = new CakeExampleServletImpl
bindServlet(hello) toUrl ("/hello")
}
}
)
}
trait CakeExampleServlet {
import org.pinky.core.PinkySimpleServlet
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
class CakeExampleServletImpl extends PinkySimpleServlet {
GET {
(request: HttpServletRequest, response: HttpServletResponse) =>
"text/html" -> "hello World!"
}
// a simple post example
POST {
(request: HttpServletRequest, response: HttpServletResponse) =>
"text/html"-> "Hello World with POST"
}
}
}
==================================================
package com.sampleservice
import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.execute.Result
import org.specs2.execute.Success
class SampleServiceSpec extends SpecificationWithJUnit {
"The Pinky Sample Service" should {
"execute json-based data roundtrip successfully" in {
Success("OK")
}
}
}