2012-04-24 15 views
5

sto sviluppando un plug-graal, ma quando cerco di creare un test di integrazione per un servizio sto ottenendo questo errorein via di sviluppo graal plugin "No fagiolo di nome 'transactionManager' è definito" in test di integrazione

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aService': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined 
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) 
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) 
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) 
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:232) 
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:61) 
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) 
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) 
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:223) 
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:29) 
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) 
at org.junit.runners.ParentRunner.run(ParentRunner.java:300) 
at org.junit.runners.Suite.runChild(Suite.java:129) 
at org.junit.runners.Suite.runChild(Suite.java:24) 
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:232) 
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:61) 
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) 
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) 
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:223) 
at org.junit.runners.ParentRunner.run(ParentRunner.java:300) 
at _GrailsTest_groovy$_run_closure4.doCall(_GrailsTest_groovy:290) 
at _GrailsTest_groovy$_run_closure2.doCall(_GrailsTest_groovy:249) 
at _GrailsTest_groovy$_run_closure1_closure21.doCall(_GrailsTest_groovy:195) 
at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:184) 
at TestApp$_run_closure1.doCall(TestApp.groovy:82) 
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined 
... 24 more 

come posso risolverlo?

+0

Cosa stai testando? Unità? Integrazione? Controllore? Quale cartella i tuoi test sono in questione in graal. Non ho avuto molto successo con i test nei graal ... – marko

+0

Ho provato a creare un test di integrazione per un servizio ... il servizio rimane nella cartella standard di Grails, il test di integrazione rimane nella cartella standard di grails ... l'errore è dopo che ho lanciato 'grails test-app: integration', ho anche annotato la classe con @TestMixin (GrailsUnitTestMixin) – rascio

+0

Se stai creando un test di integrazione devi metterlo in un cartella chiamata integrazione, sotto test/integrazione penso. – marko

risposta

18

Credo che ciò possa accadere se si è disinstallato Hibernate e non si specifica un altro gestore transazioni. I servizi Grails per impostazione predefinita sono transazionali e Hibernate è ciò che gestisce quella transazione. Se non stai utilizzando Hibernate puoi impostare il servizio come non transazionale con def transactional = false