Skip to content
Snippets Groups Projects
Commit b40d4898 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

persist module uses test db for unit testing

parent 2bf2e412
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!386Resolve "Continous integration tests"
......@@ -11,7 +11,7 @@
<context:property-placeholder
ignore-resource-not-found="true"
location="classpath:db.properties,file:/etc/minerva/db.properties" />
location="classpath:test-db.properties,file:/etc/minerva/db.properties" />
<!-- Data Source Declaration -->
......
......@@ -58,7 +58,7 @@ import lcsb.mapviewer.persist.dao.user.UserDao;
@Rollback(true)
@ContextConfiguration(locations = { "/applicationContext-persist.xml", //
"/test-applicationContext.xml", //
"/dataSource.xml" //
"/test-dataSource.xml" //
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class PersistTestFunctions {
......
......@@ -40,7 +40,9 @@ public class ConfigurationDaoTest extends PersistTestFunctions {
// remove data from database
ConfigurationOption obj = configurationDao.getByType(ConfigurationElementType.LOGO_TEXT);
configurationDao.delete(obj);
if (obj != null) {
configurationDao.delete(obj);
}
// and now check data for something that is not in database
assertNotNull(configurationDao.getValueByType(ConfigurationElementType.LOGO_TEXT));
......
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:property-placeholder location="classpath:test-db.properties" />
<!-- Data Source Declaration -->
<bean id="DataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="org.postgresql.Driver" />
<property name="jdbcUrl" value="${database.uri}" />
<property name="user" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="maxPoolSize" value="90" />
<property name="maxStatements" value="5" />
<property name="minPoolSize" value="5" />
</bean>
<bean id="DbInit" class="lcsb.mapviewer.persist.CustomDatabasePopulator">
<property name="dataSource"><ref bean="DataSource"/></property>
</bean>
<bean id="startupScripts" class="org.springframework.jdbc.datasource.init.DataSourceInitializer">
<property name="dataSource"><ref bean="DataSource"/></property>
<property name="databasePopulator"><ref bean="DbInit"/></property>
<property name="enabled" value="true"/>
</bean>
</beans>
database.uri=jdbc:postgresql://localhost:5432/map_viewer-test
database.username=map_viewer
database.password=123qweasdzxc
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment