Commit 5d0b91ec authored by Piotr Gawron's avatar Piotr Gawron
Browse files

db migration scripts fixed, db connection extracted to file

parent 973a373d
......@@ -60,6 +60,8 @@ import lcsb.mapviewer.persist.dao.cache.CacheTypeDao;
"/applicationContext-annotation.xml", //
"/applicationContext-persist.xml", //
"/test-applicationContext.xml", //
"/test-applicationContext.xml", //
"/dataSource.xml", //
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class AnnotationTestFunctions extends AbstractTransactionalJUnit4SpringContextTests {
......
......@@ -22,6 +22,8 @@ import lcsb.mapviewer.persist.dao.map.ModelDao;
@Transactional(value = "txManager")
@ContextConfiguration(locations = { "/applicationContext-persist.xml", //
"/test-applicationContext.xml",//
"/dataSource.xml", //
})
@RunWith(SpringJUnit4ClassRunner.class)
public class DbSerializationTest {
......
......@@ -9,27 +9,13 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<!-- 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="jdbc:postgresql://localhost:5432/map_viewer" />
<property name="user" value="map_viewer" />
<property name="password" value="123qweasdzxc" />
<property name="maxPoolSize" value="100" />
<property name="maxStatements" value="5" />
<property name="minPoolSize" value="5" />
</bean>
<bean id="BaseDao" class="lcsb.mapviewer.persist.dao.BaseDao" abstract="true">
</bean>
<bean id="BaseDao" class="lcsb.mapviewer.persist.dao.BaseDao" abstract="true"/>
<bean id="UserDao" class="lcsb.mapviewer.persist.dao.user.UserDao" parent="BaseDao"/>
<bean id="PrivilegeDao" class="lcsb.mapviewer.persist.dao.user.PrivilegeDao" parent="BaseDao"/>
<bean id="LogDao" class="lcsb.mapviewer.persist.dao.log.LogDao" parent="BaseDao"/>
<bean id="BigFileEntryDao" class="lcsb.mapviewer.persist.dao.cache.BigFileEntryDao" parent="BaseDao"/>
<bean id="UploadedFileEntryDao" class="lcsb.mapviewer.persist.dao.cache.UploadedFileEntryDao" parent="BaseDao"/>
<bean id="ConfigurationDao" class="lcsb.mapviewer.persist.dao.ConfigurationDao" parent="BaseDao"/>
......@@ -200,8 +186,6 @@
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<!--<prop key="hibernate.show_sql">true</prop>-->
<!--<prop key="hibernate.current_session_context_class">thread</prop>-->
<!--<prop key="hibernate.hbm2ddl.auto">create</prop> -->
</props>
</property>
</bean>
......@@ -220,27 +204,4 @@
<bean id="PasswordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/>
<!-- These beans are responsible for statistics (used for debuging) -->
<!--
<bean id="hibernateStatisticsMBean" class="org.hibernate.jmx.StatisticsService">
<property name="statisticsEnabled" value="true" />
<property name="sessionFactory" value="#{SessionFactory}" />
</bean>
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="locateExistingServerIfPossible" value="true" />
</bean>
<bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter"
lazy-init="false">
<property name="server" ref="mbeanServer" />
<property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING"/>
<property name="beans">
<map>
<entry key="yourkey:name=hibernateStatistics" value-ref="hibernateStatisticsMBean" />
</map>
</property>
</bean>
-->
</beans>
<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: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="100" />
<property name="maxStatements" value="5" />
<property name="minPoolSize" value="5" />
</bean>
</beans>
database.uri=jdbc:postgresql://localhost:5432/map_viewer
database.username=map_viewer
database.password=123qweasdzxc
\ No newline at end of file
......@@ -56,7 +56,10 @@ import lcsb.mapviewer.persist.dao.user.UserDao;
@Transactional(value = "txManager")
@Rollback(true)
@ContextConfiguration(locations = { "/applicationContext-persist.xml", "/test-applicationContext.xml" })
@ContextConfiguration(locations = { "/applicationContext-persist.xml", //
"/test-applicationContext.xml", //
"/dataSource.xml" //
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class PersistTestFunctions {
private Logger logger = Logger.getLogger(PersistTestFunctions.class);
......
......@@ -55,6 +55,7 @@ import org.xml.sax.SAXException;
"/applicationContext-reactome.xml", //
"/applicationContext-persist.xml", //
"/test-applicationContext.xml", //
"/dataSource.xml", //
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class ReactomeTestFunctions {
......
......@@ -63,8 +63,12 @@ import lcsb.mapviewer.services.view.AuthenticationToken;
@Transactional(value = "txManager")
@Rollback(true)
@ContextConfiguration(
locations = { "/applicationContext-persist.xml", "/applicationContext-annotation.xml", "/applicationContext-service.xml", "/applicationContext-rest.xml" })
@ContextConfiguration(locations = { "/applicationContext-persist.xml", //
"/applicationContext-annotation.xml", //
"/applicationContext-service.xml", //
"/applicationContext-rest.xml", //
"/dataSource.xml", //
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class RestTestFunctions {
private Logger logger = Logger.getLogger(RestTestFunctions.class);
......@@ -200,9 +204,9 @@ public abstract class RestTestFunctions {
complexParams.entry(entry4);
complexParams.entry(entry5);
Model model =parser.createModel(complexParams);
Model model = parser.createModel(complexParams);
model.setTileSize(256);
for (ModelSubmodelConnection connection: model.getSubmodelConnections()) {
for (ModelSubmodelConnection connection : model.getSubmodelConnections()) {
connection.getSubmodel().setTileSize(256);
}
model.setProject(new Project());
......
......@@ -83,7 +83,11 @@ import lcsb.mapviewer.services.search.db.drug.IDrugService;
@Transactional(value = "txManager")
@Rollback(false)
@ContextConfiguration(locations = { "/applicationContext-annotation.xml", "/applicationContext-persist.xml", "/applicationContext-service.xml" })
@ContextConfiguration(locations = { "/applicationContext-annotation.xml", //
"/applicationContext-persist.xml", //
"/applicationContext-service.xml", //
"/dataSource.xml", //
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class ServiceTestFunctions {
private Logger logger = Logger.getLogger(ServiceTestFunctions.class);
......
......@@ -18,6 +18,7 @@
classpath:applicationContext-persist.xml
classpath:applicationContext-rest.xml
classpath:applicationContext-service.xml
classpath:dataSource.xml
</param-value>
</context-param>
<context-param>
......
......@@ -86,7 +86,11 @@ import lcsb.mapviewer.services.view.ModelViewFactory;
@Transactional(value = "txManager")
@Rollback(true)
@ContextConfiguration(locations = { "/applicationContext-persist.xml", "/applicationContext-annotation.xml", "/applicationContext-service.xml" })
@ContextConfiguration(locations = { "/applicationContext-persist.xml", //
"/applicationContext-annotation.xml", //
"/applicationContext-service.xml", //
"/dataSource.xml", //
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class WebTestFunctions {
private Logger logger = Logger.getLogger(WebTestFunctions.class);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment