Results 1 to 2 of 2

Thread: Tests with AbstractTransactionalSpringContextTests

  1. #1
    Join Date
    Feb 2005
    Posts
    13

    Default Tests with AbstractTransactionalSpringContextTests

    Hello,
    I want to write some integration test with the AbstractTransactionalSpringContextTests of Spring. But I already get this exception:

    Code:
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.bosch.samos.test.service.MigrationManagerTest' defined in null: Unsatisfied dependency expressed through bean property 'transactionManager': set this property value or disable dependency checking for this bean
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.checkDependencies(AbstractAutowireCapableBeanFactory.java:961)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:822)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:200)
    	at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:138)
    	at junit.framework.TestCase.runBare(TestCase.java:125)
    	at junit.framework.TestResult$1.protect(TestResult.java:106)
    	at junit.framework.TestResult.runProtected(TestResult.java:124)
    	at junit.framework.TestResult.run(TestResult.java:109)
    	at junit.framework.TestCase.run(TestCase.java:118)
    	at junit.framework.TestSuite.runTest(TestSuite.java:208)
    	at junit.framework.TestSuite.run(TestSuite.java:203)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    How do I set this transactionManager. Have I to insert some code in applicationContext.xml?

    It would be nice to get some examples, how to do this.
    Thanks.

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    You need to define a bean of type PlatformTransactionManager in your Spring configuration file. This bean will be picked up automatically by the test classes. You should be sure to use the correct implementation of PTM for your particular data access technology.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

Similar Threads

  1. Unit Tests for data access layer
    By kuzman in forum Data
    Replies: 16
    Last Post: Oct 25th, 2007, 11:42 AM
  2. Generate Unit Tests
    By schuer in forum Container
    Replies: 4
    Last Post: Oct 2nd, 2005, 11:27 AM
  3. Replies: 4
    Last Post: Mar 28th, 2005, 04:00 AM
  4. Tests guidelines for DAO using hibernate
    By schuer in forum Container
    Replies: 2
    Last Post: Feb 5th, 2005, 06:06 PM
  5. Unit tests
    By yanis97 in forum Data
    Replies: 2
    Last Post: Jan 9th, 2005, 09:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •