René Scheibe | 1 Sep 2010 01:34
Gravatar

[groovy-user] <at> Mixin with classes containing annotated methods

Does  <at> Mixin work correctly on classes with annotated methods?

I tried to mixin some helpers to my JUnit tests that eg. do some
setup/teardown. But when running the tests the methods annotated eg.
with  <at> Before haven't been run.

import org.junit.*

class SomeHelper {
     <at> Before
    void mixinSetup() { println "mixin setup" }
}

 <at> Mixin(SomeHelper)
class SomeTest {
     <at> Before
    void testClassSetup() { println "test class setup" }

     <at> Test
    void hardTest() { println "hard test" }
}

Regards,
Rene

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

(Continue reading)

Guillaume Laforge | 1 Sep 2010 01:38
Gravatar

Re: [groovy-user] <at> Mixin with classes containing annotated methods

The <at> Mixin transformation is actually a "runtime" mixin in the sens that the mixinSetup() method is going to be added via a dynamic mechanism.

The mixinSetup() method won't really be available as a "normal" method, it'll be a dynamic method.
And I guess that the problem you're facing here, is that it's JUnit that doesn't see the dynamic method from the Java side (if JUnit had been written in Groovy, it would have seen it probably).
Perhaps you could go with an <at> Delegate instead, as <at> Delegate really creates "real" methods.

On Wed, Sep 1, 2010 at 01:34, René Scheibe <rene.scheibe-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
Does <at> Mixin work correctly on classes with annotated methods?

I tried to mixin some helpers to my JUnit tests that eg. do some
setup/teardown. But when running the tests the methods annotated eg.
with <at> Before haven't been run.

import org.junit.*

class SomeHelper {
    <at> Before
   void mixinSetup() { println "mixin setup" }
}

<at> Mixin(SomeHelper)
class SomeTest {
    <at> Before
   void testClassSetup() { println "test class setup" }

    <at> Test
   void hardTest() { println "hard test" }
}

Regards,
Rene

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
Peter Niederwieser | 1 Sep 2010 08:28
Picon
Gravatar

[groovy-user] Re: Groovy DSL: handling labels


Probably means that the user reads and posts messages through Nabble (like I
do), but some of the messages didn't go through to the mailing list.

Cheers,
Peter
--

-- 
View this message in context: http://groovy.329449.n5.nabble.com/Groovy-DSL-handling-labels-tp2797930p2798952.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Bellemo Maurizio | 1 Sep 2010 09:19
Picon
Favicon

[groovy-user] How many belongsTo? and what about QBE?

Hi,

 

I have four domain classes in my application.

 

class Event {

 

      static hasMany = [ broadcasts: Broadcast ]

     

     

Integer siEventId

     

      static constraints = {

            broadcasts(nullable: true)

      }

}

 

class Service {

     

      static hasMany = [ broadcasts: Broadcast ]

     

Integer siServiceId

     

     

      static constraints = {

            siServiceId(unique: true)

            broadcasts(nullable: true)

      }

}

 

class Serie {

     

      static hasMany = [ broadcasts: Broadcast ]

 

      Integer groupId

 

      static constraints = {

            groupId(unique: true)

      }

}

 

class Broadcast {

     

      static belongsTo = [ service: Service,

                             event: Event,

                             serie: Serie ]

 

      static constraints = {

            serie( nullable : true )

      }

}

 

1.       Is it possible to have more than one belongsTo in one domain class???

2.       Is it also possible to use QBE this way?

def broadcastInstance = Broadcast.find(service: new Service(siServiceId: serviceId), event: new Event(siEventId: eventId))

because I got an error message of this type

No signature of method: eu.sytel.Broadcast.find() is applicable for argument types: (java.util.LinkedHashMap) values: [[service:eu.sytel.Service : null, event:eu.sytel.Event : null]]

Possible solutions: find(java.lang.String), find(java.lang.Object), find(groovy.lang.Closure), find(java.lang.String, java.util.Map), find(java.lang.String, java.util.Collection), find(java.lang.String, [Ljava.lang.Object;)

 

 

Thanks

 

 

Maurizio Bellemo
Consultant

 

E-mail:   m.bellemo <at> reply.eu

Mobile:  004915257907704

Desk:      00492113399026

Fax:        004921133990599

 

Sytel Reply GmbH

Hansaallee 201, D-40549 Duesseldorf

Geschaeftsfuehrer: Giovanni Ambrogio, Daniele Angelucci

Amtsgericht Duesseldorf, HRB 60665

 

www.reply.eu

 


--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
Paul King | 1 Sep 2010 09:21
Picon
Favicon
Gravatar

Re: [groovy-user] Re: Groovy DSL: handling labels


That's what I figured. From memory though I thought the messages
did come through at some point.

Paul.

On 1/09/2010 4:28 PM, Peter Niederwieser wrote:
>
> Probably means that the user reads and posts messages through Nabble (like I
> do), but some of the messages didn't go through to the mailing list.
>
> Cheers,
> Peter

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Guillaume Laforge | 1 Sep 2010 09:37
Gravatar

Re: [groovy-user] How many belongsTo? and what about QBE?

Message for the Grails user list instead of the Groovy user list?

On Wed, Sep 1, 2010 at 09:19, Bellemo Maurizio <m.bellemo-pUheSBUwikQ@public.gmane.org> wrote:

Hi,

 

I have four domain classes in my application.

 

class Event {

 

      static hasMany = [ broadcasts: Broadcast ]

     

     

Integer siEventId

     

      static constraints = {

            broadcasts(nullable: true)

      }

}

 

class Service {

     

      static hasMany = [ broadcasts: Broadcast ]

     

Integer siServiceId

     

     

      static constraints = {

            siServiceId(unique: true)

            broadcasts(nullable: true)

      }

}

 

class Serie {

     

      static hasMany = [ broadcasts: Broadcast ]

 

      Integer groupId

 

      static constraints = {

            groupId(unique: true)

      }

}

 

class Broadcast {

     

      static belongsTo = [ service: Service,

                             event: Event,

                             serie: Serie ]

 

      static constraints = {

            serie( nullable : true )

      }

}

 

1.       Is it possible to have more than one belongsTo in one domain class???

2.       Is it also possible to use QBE this way?

def broadcastInstance = Broadcast.find(service: new Service(siServiceId: serviceId), event: new Event(siEventId: eventId))

because I got an error message of this type

No signature of method: eu.sytel.Broadcast.find() is applicable for argument types: (java.util.LinkedHashMap) values: [[service:eu.sytel.Service : null, event:eu.sytel.Event : null]]

Possible solutions: find(java.lang.String), find(java.lang.Object), find(groovy.lang.Closure), find(java.lang.String, java.util.Map), find(java.lang.String, java.util.Collection), find(java.lang.String, [Ljava.lang.Object;)

 

 

Thanks

 

 

Maurizio Bellemo
Consultant

 

E-mail:   m.bellemo-pUheSBUwikQ@public.gmane.org

Mobile:  004915257907704

Desk:      00492113399026

Fax:        004921133990599

 

Sytel Reply GmbH

Hansaallee 201, D-40549 Duesseldorf

Geschaeftsfuehrer: Giovanni Ambrogio, Daniele Angelucci

Amtsgericht Duesseldorf, HRB 60665

 

www.reply.eu

 


--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.



--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
Bellemo Maurizio | 1 Sep 2010 10:10
Picon
Favicon

RE: [groovy-user] How many belongsTo? and what about QBE?

Sorry you are right. The problem is that I tried to subscribe to Grails mailing list without success...

 

 

 

From: glaforge-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [mailto:glaforge-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of Guillaume Laforge
Sent: Mittwoch, 1. September 2010 09:37
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@public.gmane.org
Subject: Re: [groovy-user] How many belongsTo? and what about QBE?

 

Message for the Grails user list instead of the Groovy user list?

On Wed, Sep 1, 2010 at 09:19, Bellemo Maurizio <m.bellemo-pUheSBUwikQ@public.gmane.org> wrote:

Hi,

 

I have four domain classes in my application.

 

class Event {

 

      static hasMany = [ broadcasts: Broadcast ]

     

     

Integer siEventId

     

      static constraints = {

            broadcasts(nullable: true)

      }

}

 

class Service {

     

      static hasMany = [ broadcasts: Broadcast ]

     

Integer siServiceId

     

     

      static constraints = {

            siServiceId(unique: true)

            broadcasts(nullable: true)

      }

}

 

class Serie {

     

      static hasMany = [ broadcasts: Broadcast ]

 

      Integer groupId

 

      static constraints = {

            groupId(unique: true)

      }

}

 

class Broadcast {

     

      static belongsTo = [ service: Service,

                             event: Event,

                             serie: Serie ]

 

      static constraints = {

            serie( nullable : true )

      }

}

 

1.       Is it possible to have more than one belongsTo in one domain class???

2.       Is it also possible to use QBE this way?

def broadcastInstance = Broadcast.find(service: new Service(siServiceId: serviceId), event: new Event(siEventId: eventId))

because I got an error message of this type

No signature of method: eu.sytel.Broadcast.find() is applicable for argument types: (java.util.LinkedHashMap) values: [[service:eu.sytel.Service : null, event:eu.sytel.Event : null]]

Possible solutions: find(java.lang.String), find(java.lang.Object), find(groovy.lang.Closure), find(java.lang.String, java.util.Map), find(java.lang.String, java.util.Collection), find(java.lang.String, [Ljava.lang.Object;)

 

 

Thanks

 

 

Maurizio Bellemo
Consultant

 

E-mail:   m.bellemo-pUheSBUwikQ@public.gmane.org

Mobile:  004915257907704

Desk:      00492113399026

Fax:        004921133990599

 

Sytel Reply GmbH

Hansaallee 201, D-40549 Duesseldorf

Geschaeftsfuehrer: Giovanni Ambrogio, Daniele Angelucci

Amtsgericht Duesseldorf, HRB 60665

 

www.reply.eu

 

 

--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.




--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one


--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
Omar Abou Mrad | 1 Sep 2010 12:18
Picon
Gravatar

[groovy-user] Lists and Ranges

Hello,

As per the documentation: Ranges allow you to create a list of sequential values. These can be used as Lists since Range extends java.util.List.

Yet the following

def a = 1..5
Collections.shuffle(a)

yields java.lang.UnsupportedOperationException

whereas

def b = [1,2,3,4,5]
Collections.shuffle(b)

Works quite fine.

Am i missing something?

Regards,

Omar
Omar Abou Mrad | 1 Sep 2010 12:21
Picon
Gravatar

[groovy-user] Re: Lists and Ranges

Spoke too soon, sorry.

It makes sense, I'll just a.toList()

On Wed, Sep 1, 2010 at 1:18 PM, Omar Abou Mrad <omar.aboumrad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello,

As per the documentation: Ranges allow you to create a list of sequential values. These can be used as Lists since Range extends java.util.List.

Yet the following

def a = 1..5
Collections.shuffle(a)

yields java.lang.UnsupportedOperationException

whereas

def b = [1,2,3,4,5]
Collections.shuffle(b)

Works quite fine.

Am i missing something?

Regards,

Omar

Gideon Kaplan | 1 Sep 2010 21:02
Picon

[groovy-user] Re: Invoking multiple arg constructors from java and casting the results


Hey,
I think I found the reason for this
The compiler doesn't know about the existence of a java class created by the
GroovyScriptEngine since it hasn't been created yet
I guess that's why one has to code to interfaces, that are known at compile
time?

Maybe there's a way to pre-compile the groovy classes first, not sure if
that's possible when building a war from NetBeans 6.8

Also don't know how that would behave when running in Tomcat 6x

--

-- 
View this message in context: http://groovy.329449.n5.nabble.com/Invoking-multiple-arg-constructors-from-java-and-casting-the-results-tp2740492p2799751.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Gmane