Announcement Announcement Module
Collapse
No announcement yet.
Roo Integration Tests - failing for me on 1.0.0.M2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roo Integration Tests - failing for me on 1.0.0.M2

    I'm not sure what I'm doing wrong...

    I have been trying to create and then test a Roo domain class in integration mode. I see that you can generate an integration test with new integration test and then it creates a class called DomainnameDataOnDemand.

    It seems to weave out lots of interesting methods, like getRandomDomain() etc... But no matter what, when I try to do a mvn integration-test or run the JUnit of the integration test from STS 2.1.0.RC1, the project fails with the error below. Any ideas?

    I have used the following sample domain:

    package com.chariot.roo.demo.domain;

    import javax.persistence.Entity;
    import org.springframework.roo.addon.entity.RooEntity;
    import org.springframework.roo.addon.javabean.RooJavaBean ;
    import org.springframework.roo.addon.tostring.RooToString ;

    @Entity
    @RooEntity
    @RooJavaBean
    @RooToString
    public class Course {

    private String name;

    }

    Pretty simple. Is this a bug in the platform for M2? Stack trace below.



    Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener@678caeb6] to prepare test instance [com.chariot.roo.demo.domain.CourseIntegrationTest@ 452263d6]
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'com.chariot.roo.demo.domain.CourseIntegrationTest ': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: public com.chariot.roo.demo.domain.CourseDataOnDemand com.chariot.roo.demo.domain.CourseIntegrationTest. ajc$interField$com_chariot_roo_demo_domain_CourseI ntegrationTest_Roo_IntegrationTest$dod; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [com.chariot.roo.demo.domain.CourseDataOnDemand] is defined: Unsatisfied dependency of type [class com.chariot.roo.demo.domain.CourseDataOnDemand]: expected at least 1 matching bean
    at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessAfterIn stantiation(AutowiredAnnotationBeanPostProcessor.j ava:259)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:961)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireBeanProperties( AbstractAutowireCapableBeanFactory.java:333)
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.injectDependencies (DependencyInjectionTestExecutionListener.java:110 )
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.prepareTestInstanc e(DependencyInjectionTestExecutionListener.java:75 )
    at org.springframework.test.context.TestContextManage r.prepareTestInstance(TestContextManager.java:267)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTest(SpringJUnit4ClassRunner.j ava:155)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner$1.runReflectiveCall(SpringJUnit4Clas sRunner.java:263)
    at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.methodBlock(SpringJUnit4ClassRunner. java:265)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:210)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRu nner.java:173)
    at org.junit.internal.runners.statements.RunBefores.e valuate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.ev aluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.ja va:220)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.run(SpringJUnit4ClassRunner.java:191 )
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:46)
    at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: public com.chariot.roo.demo.domain.CourseDataOnDemand com.chariot.roo.demo.domain.CourseIntegrationTest. ajc$interField$com_chariot_roo_demo_domain_CourseI ntegrationTest_Roo_IntegrationTest$dod; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [com.chariot.roo.demo.domain.CourseDataOnDemand] is defined: Unsatisfied dependency of type [class com.chariot.roo.demo.domain.CourseDataOnDemand]: expected at least 1 matching bean
    at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor$AutowiredFieldElem ent.inject(AutowiredAnnotationBeanPostProcessor.ja va:477)
    at org.springframework.beans.factory.annotation.Injec tionMetadata.injectFields(InjectionMetadata.java:1 05)
    at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessAfterIn stantiation(AutowiredAnnotationBeanPostProcessor.j ava:256)
    ... 24 more
    Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [com.chariot.roo.demo.domain.CourseDataOnDemand] is defined: Unsatisfied dependency of type [class com.chariot.roo.demo.domain.CourseDataOnDemand]: expected at least 1 matching bean
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.resolveDependency(DefaultListab leBeanFactory.java:680)
    at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor$AutowiredFieldElem ent.inject(AutowiredAnnotationBeanPostProcessor.ja va:448)
    ... 26 more

  • #2
    Hi krimple,

    I have just tried to replicate this but it seems to work fine for me. So in order to replicate this, can you please send me the Roo commands you used as well as info about your environment (OS, JDK, etc)?

    Here is what works for me:

    Code:
    create project -topLevelPackage com.chariot.roo.demo
    install jpa -provider HIBERNATE -database HYPERSONIC_IN_MEMORY
    new persistent class jpa -name ~.domain.Course
    add field string -fieldName name
    new integration test
    If you quit the Roo shell and run 'mvn test' the tests should pass.

    Importing this project into STS 2.1 RC1 and running the tests there also works for me.

    Regards,
    Stefan

    Comment


    • #3
      I tried what you sent me and it worked, 100%.

      I think there is some sort of corruption / configuration problem with the one I was playing with. I'll PM you a link to the tar of the project file. Check your PMs tonight if you want to take a look.

      Thanks,

      Ken

      Comment

      Working...
      X