Показаны сообщения с ярлыком test. Показать все сообщения
Показаны сообщения с ярлыком test. Показать все сообщения

пятница, 23 апреля 2010 г.

"Statement is closed" SQLExeption or OutOfMemory exception during dbunit testing.

Do you have a problem with "Statement is closed" SQLExeption during dbunit testing ?
I had, because wrong dataSource configuration, so check the maxOpenPreparedStatements parameter. Your dataSource should looks like described below:
  1 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
2 <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
3 <property name="url" value="jdbc:hsqldb:mem:testnpadb"/>
4 <property name="username" value="sa"/>
5 <property name="password" value=""/>
6 <property name="initialSize" value="5"/>
7 <property name="maxActive" value="100"/>
8 <property name="poolPreparedStatements" value="true"/>
9 <property name="maxOpenPreparedStatements" value="100"/>
10 <property name="defaultAutoCommit" value="true"/>
11 </bean>


OutOfMemory ? Check the tear down method, guess you have to shutdown spring context.

четверг, 26 ноября 2009 г.

DbUnit. Nil in flat xml file.

Sometimes DbUnit insert 32768 value into database instead of specified 0 in flat xml file. So <TABLE_NAME id="0"/> become INSERT INTO TABLE_NAME(ID) VALUES (32768); I dont have a time to "wash inside out" it. And do not forget about column sensing with DbUnit, it can save a lot of time for you.