[Lift] Unique constraint

2009-07-02 Thread Naftoli Gugenhem

Does lift have any way to specify a unique constraint on a field, via schemify 
(or validation)?
If not, how complex would it be to implement?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Maven License Expired

2009-07-02 Thread Timothy Perrett

Hey Jevgeni,

Thats strange, I mailed you from my gmail account to your gmail, so
perhaps it got spammed or something?

Probably the best thing to do then would be for us to remove the
current .lic from the lift installer - perhaps i'll include the latest
JAR and then display a screen saying if you want a license get in
touch with XYZ

Thoughts?

Cheers, Tim

On Jul 1, 6:03 pm, Jevgeni Kabanov ekaba...@gmail.com wrote:
 Interestingly enough I didn't get an email from Tim yet, but I got a
 google alert for this message :)

 The original free Scala license was given for a limited period to be
 prolonged (or not) later. We knew that the current license is ending
 on 30th June and have already decided to prolong it. However we also
 decided to do it differently from the current setup (one license
 issued to the community). Instead we'll give free personal annual
 JavaRebel for Scala licenses individually through a website. This will
 give us a better sense of the current JavaRebel/Scala community :)

 But (and here comes the embarrassing part) the ZeroTurnaround team was
 so overworked lately that we didn't get to implementing the actual
 infrastructure yet. We have most of the stuff ready, and hopefully
 next week we'll send the announcement to the list. Until then I can
 recommend to download 2.0.1 from ZeroTurnaround.com and delete the
 current javarebel.lic so you can use the 30 day evaluation. Or just
 buy the personal license, it's worth it :)

 Sorry for the hassle!
 Jevgeni Kabanov
 ZeroTurnaround

 On Jul 1, 6:49 pm, Timothy Perrett timo...@getintheloop.eu wrote:



  I've mailed Jevgeni (at javarebel), so will see what's what. If he doesn't
  come back in a day or two I'll try to get in touch with him again.

  Cheers, Tim

  On 01/07/2009 16:18, Peter Robinett pe...@bubblefoundry.com wrote:

   Yep, in /Applications/liftweb-1.0/java-rebel/ I have both a
   javarebel.jar and a javarebel.lic. Removing both of those 1.2.2 files
   and copying in the 2.0.1 jar works, though it says it's only licensed
   for a 30 day trial. Timothy, if you can get a longer license that
   would be awesome. Thanks!

   Peter

   On Jul 1, 3:25 am, Timothy Perrett timo...@getintheloop.eu wrote:
   The way we are handling it in the installer is all JR users have a .lic 
   file
   for the license... The actual JAR for javarebel is separate so I think it
   would still persist to be an issue.

   Either way, I've gotten in touch with Jevgeni to see what he says.

   Cheers, Tim  

   On 01/07/2009 11:19, TylerWeir tyler.w...@gmail.com wrote:

   You're using an old version, grab 2.0.1 and try that.

   1.X may have expired.

   On Jul 1, 3:46 am, Timothy Perrett timo...@getintheloop.eu wrote:
   Hey Peter,

   That is odd! I'll speak with the folk at javarebel and get them to  
   give us a new license file for the comunity.

   Cheers

   Tim

   Sent from my iPhone

   On 1 Jul 2009, at 08:28, Peter Robinett pe...@bubblefoundry.com 
   wrote:

   Hi all,

   I just launched Maven and got the following error:
   $ mvn jetty:run

   ##

   ZeroTurnaround JavaRebel 1.2.2 (200812021546)
   (c) Copyright Webmedia, Ltd, 2007, 2008. All rights reserved.

   YOUR JAVAREBEL LIMITED LICENSE HAS EXPIRED!
   This product is licensed to Scala Community
   until June 30, 2009
   for unlimited number of developer seats on site.
   With the following restrictions:
   For use with Scala only

   ##

   I got Maven via the Lift Mac OS X .dmg installer. Any idea how I can
   address this licensing issue and continue developing?

   Thanks!

   Peter Robinett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: grabbing rss or other type of feeds within lift

2009-07-02 Thread Mark Essel

ps found a nice code framework to help with my initial setup here from
Ted Neward
http://www.ibm.com/developerworks/java/library/j-scala06029.html
Will use some of those classes/objects to get started (Ted's cool with
it as long as I show him how it ends up)

On Jul 1, 6:28 pm, Naftoli Gugenhem naftoli...@gmail.com wrote:
 Which maven plugin did you try for eclipse? M2eclipse works for me...

 -

 Mark Esselmes...@gmail.com wrote:

 Thanks think I'm making progress
 following this:http://wiki.netbeans.org/Scala
 after the install of 6.7RC3, jdk, scala plugin, lift, maven (used it
 to get a test lift project)
 my lift project worked with scala code inside the project

 but what I didn't do was set SCALA_HOME, my class path appended with
 that SCALA_HOME\bin and finally
 add that option -J-Dscala.home=SCALA_HOME  to the netbeans.conf

 hoping that does it.

 Not for nothing but I wonder why all the hoops to get a compiler + IDE
 has so many little steps. Eclipse I tried something similar with but
 never even got the lift project or maven working.

 I come from an old makefile /command line library background, and
 recently .NET libraries, mains (various languages).
 Netbeans is still new to me (used once before for gcc in cygwin).

 On Jul 1, 5:24 pm, David Pollak feeder.of.the.be...@gmail.com wrote:



  On Wed, Jul 1, 2009 at 2:16 PM, Mark Essel mes...@gmail.com wrote:

   Thanks David. I'm going with some direct calls for simplicity (along
   the path you suggested).
   along the lines of:

   val rssFeed = XML.load( (new URL
   (feedUrl)).openConnection.getInputStream )

   One more oddity, I'm getting problems compiling normal scala code but
   I can build lift projects (with scala inside them).

  No clue about this... sorry.

   Something that I need to add in the config file like a path to the
   scala binaries? (installed it in windows default spot)
   for netbeans.conf
   the netbeans_default_options var, adding
   -J-Dscala.home=SCALA_HOME
   where's SCALA_HOME supposed to point to?
   I tried:
   -D\c:\Users\Dude Jones\.netbeans\6.7rc3\scala\scala-2.7.3.final\\
   where the binaries are no luck

   Getting the error:
   init:
   deps-jar:
   Compiling 1 source file to C:\Mark\misc\EntrepreneurInfo
   \IntelligentAdvertisingSoftware\testo\build\classes
   Could not connect to compilation daemon.
   org.netbeans.core.execution.ExitSecurityException: Exit from within
   execution engine, normal
          at org.netbeans.core.execution.SecMan.checkExitImpl
   (SecMan.java:85)
          at org.netbeans.core.execution.SecMan$PrivilegedCheck.run
   (SecMan.java:160)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.netbeans.core.execution.SecMan$PrivilegedCheck.check
   (SecMan.java:175)
          at org.netbeans.core.execution.SecMan$PrivilegedCheck.checkExit
   (SecMan.java:170)
          at org.netbeans.core.execution.SecMan.checkExit(SecMan.java:
   69)
          at org.netbeans.TopSecurityManager.checkExit
   (TopSecurityManager.java:149)
          at java.lang.Runtime.exit(Runtime.java:88)
          at java.lang.System.exit(System.java:904)
          at scala.Predef$.exit(Predef.scala:81)
          at scala.tools.nsc.CompileSocket.fatal(CompileSocket.scala:53)
          at scala.tools.nsc.CompileSocket.getPort(CompileSocket.scala:
   175)
          at scala.tools.nsc.CompileSocket.getsock$1(CompileSocket.scala:
   206)
          at scala.tools.nsc.CompileSocket.getOrCreateSocket
   (CompileSocket.scala:227)
          at scala.tools.nsc.StandardCompileClient.main0
   (CompileClient.scala:94)
          at scala.tools.ant.FastScalac.execute(FastScalac.scala:96)
          at org.apache.tools.ant.UnknownElement.execute
   (UnknownElement.java:288)
          at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown
   Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke
   (DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute
   (DispatchUtils.java:106)
          at org.apache.tools.ant.Task.perform(Task.java:348)
          at org.apache.tools.ant.taskdefs.Sequential.execute
   (Sequential.java:62)
          at org.apache.tools.ant.UnknownElement.execute
   (UnknownElement.java:288)
          at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown
   Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke
   (DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute
   (DispatchUtils.java:106)
          at org.apache.tools.ant.Task.perform(Task.java:348)
          at org.apache.tools.ant.taskdefs.MacroInstance.execute
   (MacroInstance.java:394)
          at org.apache.tools.ant.UnknownElement.execute
   (UnknownElement.java:288)
          at 

[Lift] Re: grabbing rss or other type of feeds within lift

2009-07-02 Thread Mark Essel

Yeah Naftoli it was m2eclipse. May have been my failure to set
SCALA_HOME and the path properly.
I'll review it next time I do an eclipse setup (hopefully not for a
while now that netbeans is cooking with scala/lift)

Seriously, thanks much for all the feedback and help gents.

On Jul 1, 6:28 pm, Naftoli Gugenhem naftoli...@gmail.com wrote:
 Which maven plugin did you try for eclipse? M2eclipse works for me...

 -

 Mark Esselmes...@gmail.com wrote:

 Thanks think I'm making progress
 following this:http://wiki.netbeans.org/Scala
 after the install of 6.7RC3, jdk, scala plugin, lift, maven (used it
 to get a test lift project)
 my lift project worked with scala code inside the project

 but what I didn't do was set SCALA_HOME, my class path appended with
 that SCALA_HOME\bin and finally
 add that option -J-Dscala.home=SCALA_HOME  to the netbeans.conf

 hoping that does it.

 Not for nothing but I wonder why all the hoops to get a compiler + IDE
 has so many little steps. Eclipse I tried something similar with but
 never even got the lift project or maven working.

 I come from an old makefile /command line library background, and
 recently .NET libraries, mains (various languages).
 Netbeans is still new to me (used once before for gcc in cygwin).

 On Jul 1, 5:24 pm, David Pollak feeder.of.the.be...@gmail.com wrote:



  On Wed, Jul 1, 2009 at 2:16 PM, Mark Essel mes...@gmail.com wrote:

   Thanks David. I'm going with some direct calls for simplicity (along
   the path you suggested).
   along the lines of:

   val rssFeed = XML.load( (new URL
   (feedUrl)).openConnection.getInputStream )

   One more oddity, I'm getting problems compiling normal scala code but
   I can build lift projects (with scala inside them).

  No clue about this... sorry.

   Something that I need to add in the config file like a path to the
   scala binaries? (installed it in windows default spot)
   for netbeans.conf
   the netbeans_default_options var, adding
   -J-Dscala.home=SCALA_HOME
   where's SCALA_HOME supposed to point to?
   I tried:
   -D\c:\Users\Dude Jones\.netbeans\6.7rc3\scala\scala-2.7.3.final\\
   where the binaries are no luck

   Getting the error:
   init:
   deps-jar:
   Compiling 1 source file to C:\Mark\misc\EntrepreneurInfo
   \IntelligentAdvertisingSoftware\testo\build\classes
   Could not connect to compilation daemon.
   org.netbeans.core.execution.ExitSecurityException: Exit from within
   execution engine, normal
          at org.netbeans.core.execution.SecMan.checkExitImpl
   (SecMan.java:85)
          at org.netbeans.core.execution.SecMan$PrivilegedCheck.run
   (SecMan.java:160)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.netbeans.core.execution.SecMan$PrivilegedCheck.check
   (SecMan.java:175)
          at org.netbeans.core.execution.SecMan$PrivilegedCheck.checkExit
   (SecMan.java:170)
          at org.netbeans.core.execution.SecMan.checkExit(SecMan.java:
   69)
          at org.netbeans.TopSecurityManager.checkExit
   (TopSecurityManager.java:149)
          at java.lang.Runtime.exit(Runtime.java:88)
          at java.lang.System.exit(System.java:904)
          at scala.Predef$.exit(Predef.scala:81)
          at scala.tools.nsc.CompileSocket.fatal(CompileSocket.scala:53)
          at scala.tools.nsc.CompileSocket.getPort(CompileSocket.scala:
   175)
          at scala.tools.nsc.CompileSocket.getsock$1(CompileSocket.scala:
   206)
          at scala.tools.nsc.CompileSocket.getOrCreateSocket
   (CompileSocket.scala:227)
          at scala.tools.nsc.StandardCompileClient.main0
   (CompileClient.scala:94)
          at scala.tools.ant.FastScalac.execute(FastScalac.scala:96)
          at org.apache.tools.ant.UnknownElement.execute
   (UnknownElement.java:288)
          at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown
   Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke
   (DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute
   (DispatchUtils.java:106)
          at org.apache.tools.ant.Task.perform(Task.java:348)
          at org.apache.tools.ant.taskdefs.Sequential.execute
   (Sequential.java:62)
          at org.apache.tools.ant.UnknownElement.execute
   (UnknownElement.java:288)
          at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown
   Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke
   (DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute
   (DispatchUtils.java:106)
          at org.apache.tools.ant.Task.perform(Task.java:348)
          at org.apache.tools.ant.taskdefs.MacroInstance.execute
   (MacroInstance.java:394)
          at org.apache.tools.ant.UnknownElement.execute
   (UnknownElement.java:288)
          at 

[Lift] Re: Changes to ajax handling?

2009-07-02 Thread marius d.

Corrected and pushed. Please do an update and give it a try.

Br's,
Marius

On Jul 2, 8:56 am, marius d. marius.dan...@gmail.com wrote:
 On Jul 2, 12:40 am, Kris Nuttycombe kris.nuttyco...@gmail.com wrote:



  To answer my own question, looking over the commit log 28595307 looks
  extremely suspicious. I can revert it locally but would prefer a
  mainline fix, and don't want to attempt it myself. Marius?

  Kris

  On Wed, Jul 1, 2009 at 3:33 PM, Kris

  Nuttycombekris.nuttyco...@gmail.com wrote:
   Hi, all,

   Have there been recent changes made to liftAjax.js? I am encountering
   new errors from an ajaxSelect() today that were not present yesterday.
   Firebug complains:

   Use of getBoxObjectFor() is deprecated. Try to use
   element.getBoundingClientRect() if possible.
   [Break on this error] undefined
   liftAjax.js (line 111)
   aboutToSend.responseType is null
   lift_doAjaxCycle()()liftAjax.js (line 111)
   lift_ajaxHandler()()liftAjax.js (line 21)
   onchange(change )add_trig...Gyw%3D%3D (line 2)
   [Break on this error] if (aboutToSend.responseType.toLowerCase() === 
   json)

 That is my commt but right now I don,t see how it affects other
 things ... But I,ll definitely look on it today. Note that there is no
 intent for ajax behavior changes .. Just an augmentation ...

   Thanks,

   Kris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: can a Snippet call a Snippet?

2009-07-02 Thread David Pollak
On Wed, Jul 1, 2009 at 10:43 PM, g-man gregor...@gmail.com wrote:


 I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
 (todos).open_!


Don't use open_!  It's dangerous.

That's why Boxes exist.  They contain (or don't) something that may or may
not exist.  If you use open_! in your code, it is a major mistake (a logic
error) unless the line before the open contains if (thing.isDefined) {

Thanks,

David




 Here's my layout:

 todo.html template 

 lift:TD.listTodos todos=todos
 --- Todo list table stuff ---
 lift:TD.listTags tags=tags
 --- Tag list table stuff (where the selection to filter comes from)
 ---

 TD.scala snippet =

 // this arity is for the default 'show all Todos' condition
 def list(html: NodeSeq) = {
val id = S.attr(todos).open_!

 // this arity is for the 'filter by Tag' case
 def list(filterTag: Long)(html: NodeSeq) = {
val id = S.attr(todos).open_!

 The two snippet methods could probably be combined with a (param:
 Long*) signature, but Scala does not seem to care right now. The
 default works perfectly, but when a Tag is selected to filter by, the
 'todos' id Box cannot be seen when attempting to open.

 Is this because it is probably out of scope? I am using an ajaxbutton
 to make the call and pass in the tag.id, but it is hard to see how an
 S.attr could exist for one request, then be gone for the next, unless
 I am confusing this with a stateful attribute.


 On Jul 1, 2:42 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Wed, Jul 1, 2009 at 2:28 PM, g-man gregor...@gmail.com wrote:
 
   I will look into the nested snippets.
 
   For expediency, I folded all the snippets that interact with my
   template into one file, so I can concentrate on the business logic.
 
   For my Todo app enhancement, I need to pass the id of my selected Tag
   (which I have confirmed is correctly gathered from the page request)
   in to the TD.list method, so that the filtered Todos (those bearing
   the required Tag) will be found and rendered.
 
   My problem is that if I try to pass an additional argument (tagId:
   Long), the TD.list method is not happy and will not even render the
   template.
 
   I have tried both paired (html: NodeSeq, tagId: Long) as well as
   curried style (html: NodeSeq)(tagId: Long), but neither works.
 
  Try:
 
  list(tagId: Long)(html: NodeSeq): NodeSeq
 
  That way list(44L) _ becomes a NodeSeq = NodeSeq
 
 
 
 
 
   There must be a simple way to accomplish such a common task!
 
   Thanks to all the members for commenting...
 
   On Jun 29, 11:25 pm, marius d. marius.dan...@gmail.com wrote:
Or you can use S.locateMappedSnippet ... but first try to see if
nested snippet won't do the trick for you ...
 
On Jun 30, 10:17 am, marius d. marius.dan...@gmail.com wrote:
 
 Can you paste some code?
 
 Essentially we support nested snippets so your snippet can simply
 return a markup containing another snippet and it will be invoked.
 If
 you really want to manually invoke a snippet from another snippet
 and
 if you are not using StatefulSnippets you can just instantiate the
 class and call your function and pass it the right NodeSeq.
 
 Br's,
 Marius
 
 On Jun 30, 5:36 am, g-man gregor...@gmail.com wrote:
 
  I am enhancing the Todo app by adding tags.
 
  I have retained the TD.scala snippet to manage the Todos on my
 page,
  and added a TG.scala snippet to handle tags on the same page,
 which
  works well for creating new and listing in both cases.
 
  Now I want to filter my Todos list by a Tag instance I select
 from my
  list, and therefore need to pass the id of the selected tag over
 from
  the TG snippet to the TD snippet, where it can be used as a
 filter
  argument for a find method.
 
  The problem is that scala says it cannot find snippet TD, whose
   method
  I am calling as TD.list from the TG.scala snippet. I have tried
 all
  kinds of explicit importing, but no luck.
 
  So,  can a snippet call a snippet, or is that controlled only
 from
   the
  web page?- Hide quoted text -
 
- Show quoted text -
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp
 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en

[Lift] Re: can a Snippet call a Snippet?

2009-07-02 Thread g-man

The open_! came right from the 'Getting Started' Todo tutorial I am
enhancing:

Listing 17:  list method in TD class
def list(html: NodeSeq) = {
 val id = S.attr(all_id).open_!

Nevertheless, the question remains: How can I filter the Todo items by
a Tag and render the list?

I guess I could always link to a new page and let the template drive
the snippet, but I kind of wanted to keep one page open and just do
AJAX stuff within div elements.

Thanks again..


On Jul 2, 5:46 am, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Wed, Jul 1, 2009 at 10:43 PM, g-man gregor...@gmail.com wrote:

  I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
  (todos).open_!

 Don't use open_!  It's dangerous.

 That's why Boxes exist.  They contain (or don't) something that may or may
 not exist.  If you use open_! in your code, it is a major mistake (a logic
 error) unless the line before the open contains if (thing.isDefined) {

 Thanks,

 David







  Here's my layout:

  todo.html template 

  lift:TD.listTodos todos=todos
  --- Todo list table stuff ---
  lift:TD.listTags tags=tags
  --- Tag list table stuff (where the selection to filter comes from)
  ---

  TD.scala snippet =

  // this arity is for the default 'show all Todos' condition
  def list(html: NodeSeq) = {
     val id = S.attr(todos).open_!

  // this arity is for the 'filter by Tag' case
  def list(filterTag: Long)(html: NodeSeq) = {
     val id = S.attr(todos).open_!

  The two snippet methods could probably be combined with a (param:
  Long*) signature, but Scala does not seem to care right now. The
  default works perfectly, but when a Tag is selected to filter by, the
  'todos' id Box cannot be seen when attempting to open.

  Is this because it is probably out of scope? I am using an ajaxbutton
  to make the call and pass in the tag.id, but it is hard to see how an
  S.attr could exist for one request, then be gone for the next, unless
  I am confusing this with a stateful attribute.

  On Jul 1, 2:42 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
   On Wed, Jul 1, 2009 at 2:28 PM, g-man gregor...@gmail.com wrote:

I will look into the nested snippets.

For expediency, I folded all the snippets that interact with my
template into one file, so I can concentrate on the business logic.

For my Todo app enhancement, I need to pass the id of my selected Tag
(which I have confirmed is correctly gathered from the page request)
in to the TD.list method, so that the filtered Todos (those bearing
the required Tag) will be found and rendered.

My problem is that if I try to pass an additional argument (tagId:
Long), the TD.list method is not happy and will not even render the
template.

I have tried both paired (html: NodeSeq, tagId: Long) as well as
curried style (html: NodeSeq)(tagId: Long), but neither works.

   Try:

   list(tagId: Long)(html: NodeSeq): NodeSeq

   That way list(44L) _ becomes a NodeSeq = NodeSeq

There must be a simple way to accomplish such a common task!

Thanks to all the members for commenting...

On Jun 29, 11:25 pm, marius d. marius.dan...@gmail.com wrote:
 Or you can use S.locateMappedSnippet ... but first try to see if
 nested snippet won't do the trick for you ...

 On Jun 30, 10:17 am, marius d. marius.dan...@gmail.com wrote:

  Can you paste some code?

  Essentially we support nested snippets so your snippet can simply
  return a markup containing another snippet and it will be invoked.
  If
  you really want to manually invoke a snippet from another snippet
  and
  if you are not using StatefulSnippets you can just instantiate the
  class and call your function and pass it the right NodeSeq.

  Br's,
  Marius

  On Jun 30, 5:36 am, g-man gregor...@gmail.com wrote:

   I am enhancing the Todo app by adding tags.

   I have retained the TD.scala snippet to manage the Todos on my
  page,
   and added a TG.scala snippet to handle tags on the same page,
  which
   works well for creating new and listing in both cases.

   Now I want to filter my Todos list by a Tag instance I select
  from my
   list, and therefore need to pass the id of the selected tag over
  from
   the TG snippet to the TD snippet, where it can be used as a
  filter
   argument for a find method.

   The problem is that scala says it cannot find snippet TD, whose
method
   I am calling as TD.list from the TG.scala snippet. I have tried
  all
   kinds of explicit importing, but no luck.

   So,  can a snippet call a snippet, or is that controlled only
  from
the
   web page?- Hide quoted text -

 - Show quoted text -

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Git some:http://github.com/dpp

 --
 

[Lift] Re: can a Snippet call a Snippet?

2009-07-02 Thread David Pollak
On Thu, Jul 2, 2009 at 6:55 AM, Timothy Perrett timo...@getintheloop.euwrote:


 We really ought to get around to writing a “guides for boxes” - its easily
 one of the most confusing concepts in lift (a magnitude less confusing
 than when it was called Can[T])


http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-class-and-how-lift-uses-it.html

Options and Boxes are very similar, although Boxes have Failure as well as
Empty (None)

Also, note that the code in the example is Scala 2.3 era code, so some
syntax has changed.




 Cheers, Tim


 On 02/07/2009 14:46, David Pollak feeder.of.the.be...@gmail.com wrote:



 On Wed, Jul 1, 2009 at 10:43 PM, g-man gregor...@gmail.com wrote:


 I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
 (todos).open_!


 Don't use open_!  It's dangerous.

 That's why Boxes exist.  They contain (or don't) something that may or may
 not exist.  If you use open_! in your code, it is a major mistake (a logic
 error) unless the line before the open contains if (thing.isDefined) {

 Thanks,

 David




 Here's my layout:

 todo.html template 

 lift:TD.listTodos todos=todos
 --- Todo list table stuff ---
 lift:TD.listTags tags=tags
 --- Tag list table stuff (where the selection to filter comes from)
 ---

 TD.scala snippet =

 // this arity is for the default 'show all Todos' condition
 def list(html: NodeSeq) = {
 val id = S.attr(todos).open_!

 // this arity is for the 'filter by Tag' case
 def list(filterTag: Long)(html: NodeSeq) = {
 val id = S.attr(todos).open_!

 The two snippet methods could probably be combined with a (param:
 Long*) signature, but Scala does not seem to care right now. The
 default works perfectly, but when a Tag is selected to filter by, the
 'todos' id Box cannot be seen when attempting to open.

 Is this because it is probably out of scope? I am using an ajaxbutton
 to make the call and pass in the tag.id http://tag.id , but it is hard
 to see how an

 S.attr could exist for one request, then be gone for the next, unless
 I am confusing this with a stateful attribute.


 On Jul 1, 2:42 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Wed, Jul 1, 2009 at 2:28 PM, g-man gregor...@gmail.com wrote:
 
   I will look into the nested snippets.
 
   For expediency, I folded all the snippets that interact with my
   template into one file, so I can concentrate on the business logic.
 
   For my Todo app enhancement, I need to pass the id of my selected Tag
   (which I have confirmed is correctly gathered from the page request)
   in to the TD.list method, so that the filtered Todos (those bearing
   the required Tag) will be found and rendered.
 
   My problem is that if I try to pass an additional argument (tagId:
   Long), the TD.list method is not happy and will not even render the
   template.
 
   I have tried both paired (html: NodeSeq, tagId: Long) as well as
   curried style (html: NodeSeq)(tagId: Long), but neither works.
 
  Try:
 
  list(tagId: Long)(html: NodeSeq): NodeSeq
 
  That way list(44L) _ becomes a NodeSeq = NodeSeq
 
 
 
 
 
   There must be a simple way to accomplish such a common task!
 
   Thanks to all the members for commenting...
 
   On Jun 29, 11:25 pm, marius d. marius.dan...@gmail.com wrote:
Or you can use S.locateMappedSnippet ... but first try to see if
nested snippet won't do the trick for you ...
 
On Jun 30, 10:17 am, marius d. marius.dan...@gmail.com wrote:
 
 Can you paste some code?
 
 Essentially we support nested snippets so your snippet can simply
 return a markup containing another snippet and it will be invoked.
 If
 you really want to manually invoke a snippet from another snippet
 and
 if you are not using StatefulSnippets you can just instantiate the
 class and call your function and pass it the right NodeSeq.
 
 Br's,
 Marius
 
 On Jun 30, 5:36 am, g-man gregor...@gmail.com wrote:
 
  I am enhancing the Todo app by adding tags.
 
  I have retained the TD.scala snippet to manage the Todos on my
 page,
  and added a TG.scala snippet to handle tags on the same page,
 which
  works well for creating new and listing in both cases.
 
  Now I want to filter my Todos list by a Tag instance I select
 from my
  list, and therefore need to pass the id of the selected tag over
 from
  the TG snippet to the TD snippet, where it can be used as a
 filter
  argument for a find method.
 
  The problem is that scala says it cannot find snippet TD, whose
   method
  I am calling as TD.list from the TG.scala snippet. I have tried
 all
  kinds of explicit importing, but no luck.
 
  So,  can a snippet call a snippet, or is that controlled only
 from
   the
  web page?- Hide quoted text -
 
- Show quoted text -
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net 
 http://liftweb.net
  Beginning 

[Lift] Binding based on attributes

2009-07-02 Thread Nolan Darilek

I'm working on an app that allows users to enter their own form 
templates, which are rendered to HTML forms and filled out. The results 
are then captured and encoded for later rendering. So the user might 
input something like:

pName: form:text name=name required=true/br/
Is this your first visit? form:yesNo name=firstVisit/
../p

Is it possible to bind the various snippets, but perform special 
handling on their attribute values? So, for instance, I'd bind an 
S.text() to all form:text/, but it'd set a variable based on its name 
attribute, and perform rough validations based on whether required is 
set to true? It isn't immediately obvious how to do this, even when 
digging through the Lift sources.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: can a Snippet call a Snippet?

2009-07-02 Thread Timothy Perrett

But of course ­ I know this :-)

Thinking back to when I first started scala a couple of years ago I just
couldn¹t understand why you wanted to put something in a box... Your article
does a good job of explaining, but I think we could do with some specific
documentation.

Cheers, Tim

On 02/07/2009 15:04, David Pollak feeder.of.the.be...@gmail.com wrote:

 http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-class-and-how
 -lift-uses-it.html
 
 Options and Boxes are very similar, although Boxes have Failure as well as
 Empty (None)
 
 Also, note that the code in the example is Scala 2.3 era code, so some syntax
 has changed.
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: can a Snippet call a Snippet?

2009-07-02 Thread Timothy Perrett

We really ought to get around to writing a ³guides for boxes² - its easily
one of the most confusing concepts in lift (a magnitude less confusing
than when it was called Can[T])

Cheers, Tim

On 02/07/2009 14:46, David Pollak feeder.of.the.be...@gmail.com wrote:

 
 
 On Wed, Jul 1, 2009 at 10:43 PM, g-man gregor...@gmail.com wrote:
 
 I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
 (todos).open_!
 
 Don't use open_!  It's dangerous.
 
 That's why Boxes exist.  They contain (or don't) something that may or may not
 exist.  If you use open_! in your code, it is a major mistake (a logic error)
 unless the line before the open contains if (thing.isDefined) {
 
 Thanks,
 
 David
  
 
 
 Here's my layout:
 
 todo.html template 
 
 lift:TD.listTodos todos=todos
 --- Todo list table stuff ---
 lift:TD.listTags tags=tags
 --- Tag list table stuff (where the selection to filter comes from)
 ---
 
 TD.scala snippet =
 
 // this arity is for the default 'show all Todos' condition
 def list(html: NodeSeq) = {
     val id = S.attr(todos).open_!
 
 // this arity is for the 'filter by Tag' case
 def list(filterTag: Long)(html: NodeSeq) = {
     val id = S.attr(todos).open_!
 
 The two snippet methods could probably be combined with a (param:
 Long*) signature, but Scala does not seem to care right now. The
 default works perfectly, but when a Tag is selected to filter by, the
 'todos' id Box cannot be seen when attempting to open.
 
 Is this because it is probably out of scope? I am using an ajaxbutton
 to make the call and pass in the tag.id http://tag.id , but it is hard to
 see how an
 S.attr could exist for one request, then be gone for the next, unless
 I am confusing this with a stateful attribute.
 
 
 On Jul 1, 2:42 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Wed, Jul 1, 2009 at 2:28 PM, g-man gregor...@gmail.com wrote:
 
   I will look into the nested snippets.
 
   For expediency, I folded all the snippets that interact with my
   template into one file, so I can concentrate on the business logic.
 
   For my Todo app enhancement, I need to pass the id of my selected Tag
   (which I have confirmed is correctly gathered from the page request)
   in to the TD.list method, so that the filtered Todos (those bearing
   the required Tag) will be found and rendered.
 
   My problem is that if I try to pass an additional argument (tagId:
   Long), the TD.list method is not happy and will not even render the
   template.
 
   I have tried both paired (html: NodeSeq, tagId: Long) as well as
   curried style (html: NodeSeq)(tagId: Long), but neither works.
 
  Try:
 
  list(tagId: Long)(html: NodeSeq): NodeSeq
 
  That way list(44L) _ becomes a NodeSeq = NodeSeq
 
 
 
 
 
   There must be a simple way to accomplish such a common task!
 
   Thanks to all the members for commenting...
 
   On Jun 29, 11:25 pm, marius d. marius.dan...@gmail.com wrote:
Or you can use S.locateMappedSnippet ... but first try to see if
nested snippet won't do the trick for you ...
 
On Jun 30, 10:17 am, marius d. marius.dan...@gmail.com wrote:
 
 Can you paste some code?
 
 Essentially we support nested snippets so your snippet can simply
 return a markup containing another snippet and it will be
 invoked. If
 you really want to manually invoke a snippet from another snippet
and
 if you are not using StatefulSnippets you can just instantiate
the
 class and call your function and pass it the right NodeSeq.
 
 Br's,
 Marius
 
 On Jun 30, 5:36 am, g-man gregor...@gmail.com wrote:
 
  I am enhancing the Todo app by adding tags.
 
  I have retained the TD.scala snippet to manage the Todos on my
page,
  and added a TG.scala snippet to handle tags on the same page,
which
  works well for creating new and listing in both cases.
 
  Now I want to filter my Todos list by a Tag instance I select
from my
  list, and therefore need to pass the id of the selected tag
over from
  the TG snippet to the TD snippet, where it can be used as a
filter
  argument for a find method.
 
  The problem is that scala says it cannot find snippet TD,
whose
   method
  I am calling as TD.list from the TG.scala snippet. I have
tried all
  kinds of explicit importing, but no luck.
 
  So,  can a snippet call a snippet, or is that controlled only
from
   the
  web page?- Hide quoted text -
 
- Show quoted text -
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
 http://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
 http://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp
 
 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this 

[Lift] Re: Unique constraint

2009-07-02 Thread Calen Pennington

I actually had the same question last night. I didn't see the
valUnique on mapped string. However, it seems like a better way to do
this would be to change the Schemifier::ensureIndexes (line 260 in
Schemifier.scala) to do CREATE UNIQUE INDEX on request. Is there a
known reason why this is hard, or is it just that no one has taken the
time to do it yet? If it's the latter (and if I can figure out what's
going wrong with my attempts to build lift from source), I hope to
take a stab at it in the next day or two.

-Cale

On Thu, Jul 2, 2009 at 7:21 AM, Joe Wassj...@folktunefinder.com wrote:

 Yes for MappedString, valUnique .

 http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/mapper/MappedString.html

 Joe



 On Jul 2, 7:55 am, Naftoli Gugenhem naftoli...@gmail.com wrote:
 Does lift have any way to specify a unique constraint on a field, via 
 schemify (or validation)?
 If not, how complex would it be to implement?

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Changes to ajax handling?

2009-07-02 Thread Kris Nuttycombe

Marius, that fix appears to work fine, thank you!

Bloody nulls. :)

Kris

On Thu, Jul 2, 2009 at 7:17 AM, marius d.marius.dan...@gmail.com wrote:

 Corrected and pushed. Please do an update and give it a try.

 Br's,
 Marius

 On Jul 2, 8:56 am, marius d. marius.dan...@gmail.com wrote:
 On Jul 2, 12:40 am, Kris Nuttycombe kris.nuttyco...@gmail.com wrote:



  To answer my own question, looking over the commit log 28595307 looks
  extremely suspicious. I can revert it locally but would prefer a
  mainline fix, and don't want to attempt it myself. Marius?

  Kris

  On Wed, Jul 1, 2009 at 3:33 PM, Kris

  Nuttycombekris.nuttyco...@gmail.com wrote:
   Hi, all,

   Have there been recent changes made to liftAjax.js? I am encountering
   new errors from an ajaxSelect() today that were not present yesterday.
   Firebug complains:

   Use of getBoxObjectFor() is deprecated. Try to use
   element.getBoundingClientRect() if possible.
   [Break on this error] undefined
   liftAjax.js (line 111)
   aboutToSend.responseType is null
   lift_doAjaxCycle()()liftAjax.js (line 111)
   lift_ajaxHandler()()liftAjax.js (line 21)
   onchange(change )add_trig...Gyw%3D%3D (line 2)
   [Break on this error] if (aboutToSend.responseType.toLowerCase() === 
   json)

 That is my commt but right now I don,t see how it affects other
 things ... But I,ll definitely look on it today. Note that there is no
 intent for ajax behavior changes .. Just an augmentation ...

   Thanks,

   Kris
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] How to test/TDD lift apps?

2009-07-02 Thread Jeppe Nejsum Madsen

Hi,

Having taken the first baby steps and gotten a Lift app running, it's
time to bring back some of the old engineering practices to make sure
things keep running when new features are added at a rapid pace :-)

I'm interested in how people are testing their Lift apps, both at the
unit test level (ie. specs/scalatest with no container) and at the
integration test level (running in servlet container). Also, how are you
doing TDD with Lift (if at all).

Specifically, I've run into the following issues:

1) Testing model classes. Many require access to S (ie to read
resources) or other static Lift constructs. How can you mock these?

2) Testing snippets. Same issue with S, but more related to the actual
request, eg. S.param

For in-container testing it seems the practice of generating unique
names for form fields, makes it difficult to use tools like Selenium to
do browser based testing? How do you handle this?

Any input is appreciated

/Jeppe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: unit test framework

2009-07-02 Thread Bill Venners

Hi ph,

If you end up needing to use JUnit, you can import Assertions or
ShouldMatchers or MustMatchers from ScalaTest to get a nicer
scala-like assertion syntax inside JUnit tests. JUnit won't care it
was written in Scala or used ScalaTest assertions and will run it and
generate JUnit-compatible output, since it actually is JUnit. Here's
what that might look like:

import org.junit.Test
import org.scalatest.matchers.MustMatchers._

class MyJUnitTest {
  @Test
  def mapKeys() {
Map(one - 1, two - 2) must contain key (two)
  }
  @Test
  def stringLength() {
hello, world must have length (12)
  }
  @Test
  def stringCharAtMethodRejectsBadInput() {
intercept[StringIndexOutOfBoundsException] {
  hi.charAt(-1)
}
  }
}

http://www.artima.com/scalatest

Bill

On Wed, Jul 1, 2009 at 3:07 PM, phpkirsa...@gmail.com wrote:

 This question might be obvious to most of the people here, but since I
 new to Scala and Java I'm not clear

 Maven generates 2 different unit test files:
 MySpec  specs
 AppTest  junit

 running mvn test invokes AppTest (and other test cases with
 annotation @Test)
 running from Eclipse project as JUnit invokes MySpec

 I'm trying to figure out what unit test framework to use in my
 project. I'd prefer to have JUnit compatible output as continuous
 build system will, probably, understand it.

 Are both test frameworks generate JUnit-compatible output?
 How to make maven invoke specs test when running mvn test?
 Why is it 2 different test frameworks used? Are they complimentary? If
 yes when use which?
 I will probably use Hudson for continuous builds and also invoke unit
 tests from script and or command line and will need parse result and
 generate reports. What framework is better for these purposes? Or
 maybe use both in defferent cases?

 




-- 
Bill Venners
Artima, Inc.
http://www.artima.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Building from source - error importing _root_.org.specs

2009-07-02 Thread Calen Pennington

I'm running Ubuntu 9.04.

$ mvn -v

Maven version: 2.0.9
Java version: 1.6.0_0
OS name: linux version: 2.6.28-13-generic arch: i386 Family: unix

I get the same errors using scala 2.7.4 and 2.7.5

-Cale


On Thu, Jul 2, 2009 at 12:24 AM, David
Pollakfeeder.of.the.be...@gmail.com wrote:
 I've built Lift from source on Windows, Linux and Mac OS X within the last 2
 days without incident.

 What OS are you running, what version of Maven and what version of Java?

 On Wed, Jul 1, 2009 at 8:00 PM, Calen Pennington
 calen.penning...@gmail.com wrote:

 Hi,

 I'm trying to build Lift from the source. I pulled the latest source
 from git, and ran

 cd liftweb
 mvn install

 as suggested in the wiki (http://wiki.liftweb.net/index.php/
 Source_code)

 When I did this, I got a large number of warnings like the following:
 [WARNING] /home/cpenning/work/scala/lift/liftweb-cpenning/lift-util/
 src/test/scala/net/liftweb/util/CombParserHelpersSpec.scala:18: error:
 value specs is not a member of package org
 [WARNING] import _root_.org.specs._

 The lift-util/pom.xml includes the dependency

    dependency
      groupIdorg.scala-tools.testing/groupId
      artifactIdspecs/artifactId
      version1.5.0/version
    /dependency

 as expected, and looking at my ~/.m2/repository/org/scala-tools/
 testing/specs/1.5.0/ contains a pom and a jar.

 Anyone know why lift-utils isn't able to import specs?

 Thanks

 -Cale





 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Building from source - error importing _root_.org.specs

2009-07-02 Thread David Pollak
On Thu, Jul 2, 2009 at 4:09 PM, Calen Pennington calen.penning...@gmail.com
 wrote:


 I'm running Ubuntu 9.04.


The only difference between your setup and mine is that I'm using Sun's 1.6
JDK rather than OpenJDK.




 $ mvn -v

 Maven version: 2.0.9
 Java version: 1.6.0_0
 OS name: linux version: 2.6.28-13-generic arch: i386 Family: unix

 I get the same errors using scala 2.7.4 and 2.7.5


When you say using, do you mean that you changed the version of Scala in the
pom.xml files?




 -Cale


 On Thu, Jul 2, 2009 at 12:24 AM, David
 Pollakfeeder.of.the.be...@gmail.com wrote:
  I've built Lift from source on Windows, Linux and Mac OS X within the
 last 2
  days without incident.
 
  What OS are you running, what version of Maven and what version of Java?
 
  On Wed, Jul 1, 2009 at 8:00 PM, Calen Pennington
  calen.penning...@gmail.com wrote:
 
  Hi,
 
  I'm trying to build Lift from the source. I pulled the latest source
  from git, and ran
 
  cd liftweb
  mvn install
 
  as suggested in the wiki (http://wiki.liftweb.net/index.php/
  Source_code)
 
  When I did this, I got a large number of warnings like the following:
  [WARNING] /home/cpenning/work/scala/lift/liftweb-cpenning/lift-util/
  src/test/scala/net/liftweb/util/CombParserHelpersSpec.scala:18: error:
  value specs is not a member of package org
  [WARNING] import _root_.org.specs._
 
  The lift-util/pom.xml includes the dependency
 
 dependency
   groupIdorg.scala-tools.testing/groupId
   artifactIdspecs/artifactId
   version1.5.0/version
 /dependency
 
  as expected, and looking at my ~/.m2/repository/org/scala-tools/
  testing/specs/1.5.0/ contains a pom and a jar.
 
  Anyone know why lift-utils isn't able to import specs?
 
  Thanks
 
  -Cale
 
 
 
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
  
 

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: unit test framework

2009-07-02 Thread etorreborre

Hi Bill and ph,

Using specs matchers inside a JUnit test class is also possible using
the org.specs.SpecsMatchers trait.

However, I realize that both ScalaTest and specs suffer from the same
issue in that scenario.
When expectations are failing an exception is thrown but it is
interpreted by JUnit as an error instead of a failure.

We should instead throw an AssertionFailedError from the junit
library.

That shouldn't be a big deal to fix.

Eric.

On Jul 3, 10:34 am, Bill Venners b...@artima.com wrote:
 Hi ph,

 If you end up needing to use JUnit, you can import Assertions or
 ShouldMatchers or MustMatchers from ScalaTest to get a nicer
 scala-like assertion syntax inside JUnit tests. JUnit won't care it
 was written in Scala or used ScalaTest assertions and will run it and
 generate JUnit-compatible output, since it actually is JUnit. Here's
 what that might look like:

 import org.junit.Test
 import org.scalatest.matchers.MustMatchers._

 class MyJUnitTest {
   @Test
   def mapKeys() {
     Map(one - 1, two - 2) must contain key (two)
   }
   @Test
   def stringLength() {
     hello, world must have length (12)
   }
   @Test
   def stringCharAtMethodRejectsBadInput() {
     intercept[StringIndexOutOfBoundsException] {
       hi.charAt(-1)
     }
   }

 }

 http://www.artima.com/scalatest

 Bill





 On Wed, Jul 1, 2009 at 3:07 PM, phpkirsa...@gmail.com wrote:

  This question might be obvious to most of the people here, but since I
  new to Scala and Java I'm not clear

  Maven generates 2 different unit test files:
  MySpec  specs
  AppTest  junit

  running mvn test invokes AppTest (and other test cases with
  annotation @Test)
  running from Eclipse project as JUnit invokes MySpec

  I'm trying to figure out what unit test framework to use in my
  project. I'd prefer to have JUnit compatible output as continuous
  build system will, probably, understand it.

  Are both test frameworks generate JUnit-compatible output?
  How to make maven invoke specs test when running mvn test?
  Why is it 2 different test frameworks used? Are they complimentary? If
  yes when use which?
  I will probably use Hudson for continuous builds and also invoke unit
  tests from script and or command line and will need parse result and
  generate reports. What framework is better for these purposes? Or
  maybe use both in defferent cases?

 --
 Bill Venners
 Artima, Inc.http://www.artima.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---