• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use DBUnit with org.springframework.test.context.ContextConfiguration and

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Here is some new code I inherited:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"file:spring-configuration/unit-testing-config.xml"})
public abstract class AbstractTestCase {
...
// common ancestor sets up log4j
}

I have some old sample DBUnit code that takes the spring application context and redundantly retrieves the username and password and URL and jdbc driver out of the xml spring configuration file.

Assuming I don't want to list the file name of the configuration file twice, how do I extract the username, password, URL and jdbc driver name from org.springframework.orm.hibernate.support.HibernateDaoSupport which appears to magically get it from the configuration file?

Incidently, how does it get it from the configuration file? I don't see anything in the documentation of HiberDaoSupport or the Sesion that says it uses the file specified in the annotation ContextConfiguration.

Thanks,
Siegfried


 
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic