By default we use hsqldb inmemory database with dbunit for unit testing. To use same configuration for test as for production you can add the following annotation to your unit test class (which is extending AbstractDbUnitJpaTests)
@ContextConfiguration(locations={"classpath:applicationContext.xml"}, inheritLocations=false) I doubt that using real oracle for junit test is a good approach, but maybe a few integration tests using a real database is reasonable. All 3 samples (library, DDDSample, and helloworld) have junit test examples, using the default approach with hsqldb. /Patrik PS. I will soon write something about how to use Mockito together with Spring/Sculptor. deepshar027 wrote: > > Hey Guys, > > I have been working diligently to run a unit test after code generation > from sculptor(version 1.6).Havent been there yet. > > few queries. > > 1) I see there is difference in config files generated for main and test > with regards to EntityManagerFactory.xml specifically. > for e.g Test file has a datasource specified while main file doesnt. > Also following bean is specified in test EntitymanagerFactory.xml but not > in main. > > <bean id="persistenceUnitManager" > class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager"> > > <property name="defaultDataSource" ref="hsqldbDataSource"/> > <property name="persistenceXmlLocations"> > <list> > <value>classpath:META-INF/persistence-test.xml</value> > </list> > </property> > </bean> > > I want to have my main EntitymanagerFactory.xml file have same stuff its > there in test file.Not sure why there is discrepency. > > 2) The tests file uses hsqldb by default.Is there a way I can override > that to use oracle for tests as well? > > 3) When I run my tests I get an error > 14:20:29,984 INFO UserServiceTest:162 - Custom transaction definition > [PROPAGAT > ION_REQUIRED,ISOLATION_DEFAULT] for test method [testCreateAccount]. > 14:20:29,984 INFO UserServiceTest:175 - ApplicationContext has not > been configu > red for test [com.bookonz.account.serviceapi.UserServiceTest]: > dependency inject > ion will NOT be performed. > > I think this is becoz I need to define the test bean(UserServiceTest) in > applicationContext.xml and configure transaction params. > Do you guys have any working example of this? > > I really want to get past configuring spring/hibernate/jpa stuff and be > able to run a few tests. > > Thanks, > Deepak > > -- View this message in context: http://www.nabble.com/Configuration-running-Unit-Tests-tp23918262s17564p23918631.html Sent from the Fornax-Platform mailing list archive at Nabble.com. ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ Fornax-developer mailing list Fornax-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fornax-developer