How about:

override def fieldOrder = List[BaseOwnedMappedField[User]](id, firstName,
lastName, email,
locale, timezone, password, textArea)

The compiler often gets the type signature wrong on Lists of MappedField.



On Tue, Apr 28, 2009 at 9:51 AM, [email protected] <
[email protected]> wrote:

>
> hello,
>
> Tried to dig a bit more. I noticed that I get the cryptic compile
> error with the mock objects if I have the following code for User:
> ---
> object User extends MetaUser {
>
>  override def dbTableName = "users" // define the DB table name
>  override def screenWrap = Full(<lift:surround with="default"
> at="content">
>                               <lift:bind /></lift:surround>)
>
>   override def fieldOrder = List(id, firstName, lastName, email,
> locale, timezone, password, textArea)
>   override def skipEmailValidation = true
> }
>
> trait MetaUser extends User with MetaMegaProtoUser[User]
>
> /**
>  * An O-R mapped "User" class that includes first name, last name,
> password and we add a "Personal Essay" to it
>  */
> class User extends MegaProtoUser[User] {
>  def getSingleton = User // what's the "meta" server
>
>  // define an additional field for a personal essay
>  object textArea extends MappedTextarea(this, 2048) {
>    override def textareaRows  = 10
>    override def textareaCols = 50
>    override def displayName = "Personal Essay"
>  }
> }
> ---
>
> However, if I change the line:
>
> override def fieldOrder = List(id, firstName, lastName, email, locale,
> timezone, password, textArea)
>
> to:
>
> override def fieldOrder = List(firstName, lastName, email, locale,
> timezone, password,textArea)
>
> then things get compiled nicely. I noticed that if I putt the Id
> anywhere inside the list the compile error hits.
> Am I just doing something really stupid or have I hit some real issue
> with the compiler? I think more about the first option.
>
> br,
> - Erik
>
> On Apr 28, 12:52 am, "[email protected]"
> <[email protected]> wrote:
> > Hi,
> >
> > I have noticed this and I always run mvn clean before running the
> > tests or just compiling them. So I get the issue even I run the clean
> > command.
> >
> > -erik
> >
> > David Pollak kirjoitti:
> >
> > > Erik,
> >
> > > Please do an:
> >
> > > mvn clean test
> >
> > > From the command line.
> >
> > > The Eclipse plugin uses a different version of Scala than does Lift.
>  There
> > > will be weird errors like the one you've seen.
> >
> > > Thanks,
> >
> > > David
> >
> > > On Mon, Apr 27, 2009 at 2:24 PM, [email protected] <
> > > [email protected]> wrote:
> >
> > > > Weird thing is  that I'm able to mock "MetaTeam":
> >
> > > > ---
> > > > trait MetaTeam extends Team with LongKeyedMetaMapper[Team] {
> > > >  def findByUser(user:User): List[Team]
> > > > }
> >
> > > > object Team extends MetaTeam {
> > > >  def findByUser(user:User): List[Team] =
> > > >    UserTeam.findAll(
> > > >      By(UserTeam.user, user.id),
> > > >      OrderBy(UserTeam.team, Ascending)).map(_.team.obj.open_!)
> > > > }
> > > > ---
> >
> > > > - Erik
> >
> > > > On Apr 28, 12:19 am, "[email protected]"
> > > > <[email protected]> wrote:
> > > > > Hi,
> >
> > > > > I have set of specs test and I'm using mockito
> >
> > > > > I noticed that if I have a list of Users (pretty much same class
> that
> > > > > is coming from archetype) and do following test:
> >
> > > > > users(1).firstName must beEqualTo(name2)
> >
> > > > > Then I get :
> > > > > [WARNING] Exception in thread "main" java.lang.RuntimeException:
> > > > > malformed Scala signature of User at 13798; reference type _5 of
> > > > > <none> refers to nonexisting symbol.
> >
> > > > > If the line is changed to:
> >
> > > > > (users(1).firstName == name2) must beTrue
> >
> > > > > it compiles really nicely. Based on previous posts here it seams to
> be
> > > > > that this is scala bug (I use 2.7.4|3)
> >
> > > > > Much bigger problem for me is that when trying to mock the User:
> >
> > > > > var userDbMock = mock[MetaUser]
> >
> > > > > causes the same issue:
> > > > > [WARNING] Exception in thread "main" java.lang.RuntimeException:
> > > > > malformed Scala signature of User at 13798; reference type _5 of
> > > > > <none> refers to nonexisting symbol.
> >
> > > > > MetaUser is trait:
> >
> > > > > object User extends MetaUser {
> >
> > > > >   override def dbTableName = "users" // define the DB table name
> > > > >   override def screenWrap = Full(<lift:surround with="default"
> > > > > at="content">
> > > > >                                <lift:bind /></lift:surround>)
> > > > >   // define the order fields will appear in forms and output
> > > > >   override def fieldOrder = List(id, firstName, lastName, email,
> > > > >   locale, timezone, password, textArea)
> >
> > > > >   // comment this line out to require email validations
> > > > >   override def skipEmailValidation = true
> >
> > > > > }
> >
> > > > > trait MetaUser extends User with MetaMegaProtoUser[User]  {
> >
> > > > > }
> >
> > > > > Have anybody encountered similar problem when mocking or even found
> a
> > > > > workaround for this case?
> >
> > > > > br,
> > > > > - Erik
> >
> > > > > PS. Weirdest thing is that I'm able to run the test cases in
> > > > > Eclipse...
> >
> > > --
> > > 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to