2
votes

I am using the GORM method findAll("query", [params], [pagination]), as per documentation : http://grails.org/doc/latest/ref/Domain%20Classes/findAll.html

It works fine at runtime, but it is not available during integration tests. It seems that only the findAll('query', [params]) and findAll('query') methods are available.

MORE DETAILS:

Query:

MyDomain.findAll("From MyDomain as domain Where domain.something = :something", [something:aThing], [max:10])

Test Setup:

I execute this method through an integration test (under test/integration, and my test class extends GroovyTestCase)

Environment: I am using grails 1.3.7, mac osx

StackTrace:

I get the following error: No signature of method: a.b.c.d.e.MyDomain.findAll() is applicable for argument types: (java.lang.String, java.util.LinkedHashMap, java.util.LinkedHashMap) Possible solutions: findAll(), findAll(java.lang.Object), findAll(java.lang.Object, java.util.Map), findAll(groovy.lang.Closure).

To reproduce it :

class MyTestClass extends GroovyTestCase{

void testFindAllFailsWithThreeParameters(){

  Domain.findAll('From Domain as domain where domain.property = :value', [value:value],[max:10])

 }
}

Thanks in advance for your help,

Vincent

1
I recall once it helped me to pile both the maps into one. Don't be afraid to mix fields and pagnators. - Victor Sergienko
interesting... have you tried running the grails clean command? - Michael J. Lee
Yeah, I ran grails clean, rebooted, ran it through my IDE or through a command line (grails test-app integration:)... it fails. Worst things, I just found out that one of my colleague is able to run the query on his PC. - Vincent Giguère
can you verify that your colleague is also running 1.3.7? - Michael J. Lee
He is using the exact same configuration. Only difference that I can think of so far : I am using a mac, he is using a PC, though I doubt it has anything to do. - Vincent Giguère

1 Answers

0
votes

Are you using the same data source for the test environment vs the run time?

If not the method you are using may not be supported by that data source such as testing again an in memory database vs MySQL for production.