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; ...@@ -60,6 +60,8 @@ import lcsb.mapviewer.persist.dao.cache.CacheTypeDao;
"/applicationContext-annotation.xml", // "/applicationContext-annotation.xml", //
"/applicationContext-persist.xml", // "/applicationContext-persist.xml", //
"/test-applicationContext.xml", // "/test-applicationContext.xml", //
"/test-applicationContext.xml", //
"/dataSource.xml", //
}) })
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
public abstract class AnnotationTestFunctions extends AbstractTransactionalJUnit4SpringContextTests { public abstract class AnnotationTestFunctions extends AbstractTransactionalJUnit4SpringContextTests {
......
...@@ -22,6 +22,8 @@ import lcsb.mapviewer.persist.dao.map.ModelDao; ...@@ -22,6 +22,8 @@ import lcsb.mapviewer.persist.dao.map.ModelDao;
@Transactional(value = "txManager") @Transactional(value = "txManager")
@ContextConfiguration(locations = { "/applicationContext-persist.xml", // @ContextConfiguration(locations = { "/applicationContext-persist.xml", //
"/test-applicationContext.xml",// "/test-applicationContext.xml",//
"/dataSource.xml", //
}) })
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
public class DbSerializationTest { public class DbSerializationTest {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"> <classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/> <attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>
...@@ -8,28 +8,14 @@ ...@@ -8,28 +8,14 @@
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd"> http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<!-- Data Source Declaration --> <bean id="BaseDao" class="lcsb.mapviewer.persist.dao.BaseDao" abstract="true"/>
<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="UserDao" class="lcsb.mapviewer.persist.dao.user.UserDao" parent="BaseDao"/> <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="PrivilegeDao" class="lcsb.mapviewer.persist.dao.user.PrivilegeDao" parent="BaseDao"/>
<bean id="LogDao" class="lcsb.mapviewer.persist.dao.log.LogDao" 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="BigFileEntryDao" class="lcsb.mapviewer.persist.dao.cache.BigFileEntryDao" parent="BaseDao"/>
<bean id="UploadedFileEntryDao" class="lcsb.mapviewer.persist.dao.cache.UploadedFileEntryDao" 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"/> <bean id="ConfigurationDao" class="lcsb.mapviewer.persist.dao.ConfigurationDao" parent="BaseDao"/>
...@@ -200,8 +186,6 @@ ...@@ -200,8 +186,6 @@
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<!--<prop key="hibernate.show_sql">true</prop>--> <!--<prop key="hibernate.show_sql">true</prop>-->
<!--<prop key="hibernate.current_session_context_class">thread</prop>--> <!--<prop key="hibernate.current_session_context_class">thread</prop>-->
<!--<prop key="hibernate.hbm2ddl.auto">create</prop> -->
</props> </props>
</property> </property>
</bean> </bean>
...@@ -220,27 +204,4 @@ ...@@ -220,27 +204,4 @@
<bean id="PasswordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/> <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>
<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; ...@@ -56,7 +56,10 @@ import lcsb.mapviewer.persist.dao.user.UserDao;
@Transactional(value = "txManager") @Transactional(value = "txManager")
@Rollback(true) @Rollback(true)
@ContextConfiguration(locations = { "/applicationContext-persist.xml", "/test-applicationContext.xml" }) @ContextConfiguration(locations = { "/applicationContext-persist.xml", //
"/test-applicationContext.xml", //
"/dataSource.xml" //
})
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
public abstract class PersistTestFunctions { public abstract class PersistTestFunctions {
private Logger logger = Logger.getLogger(PersistTestFunctions.class); private Logger logger = Logger.getLogger(PersistTestFunctions.class);
......
...@@ -55,6 +55,7 @@ import org.xml.sax.SAXException; ...@@ -55,6 +55,7 @@ import org.xml.sax.SAXException;
"/applicationContext-reactome.xml", // "/applicationContext-reactome.xml", //
"/applicationContext-persist.xml", // "/applicationContext-persist.xml", //
"/test-applicationContext.xml", // "/test-applicationContext.xml", //
"/dataSource.xml", //
}) })
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
public abstract class ReactomeTestFunctions { public abstract class ReactomeTestFunctions {
......
...@@ -63,8 +63,12 @@ import lcsb.mapviewer.services.view.AuthenticationToken; ...@@ -63,8 +63,12 @@ import lcsb.mapviewer.services.view.AuthenticationToken;
@Transactional(value = "txManager") @Transactional(value = "txManager")
@Rollback(true) @Rollback(true)
@ContextConfiguration( @ContextConfiguration(locations = { "/applicationContext-persist.xml", //
locations = { "/applicationContext-persist.xml", "/applicationContext-annotation.xml", "/applicationContext-service.xml", "/applicationContext-rest.xml" }) "/applicationContext-annotation.xml", //
"/applicationContext-service.xml", //
"/applicationContext-rest.xml", //
"/dataSource.xml", //
})
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
public abstract class RestTestFunctions { public abstract class RestTestFunctions {
private Logger logger = Logger.getLogger(RestTestFunctions.class); private Logger logger = Logger.getLogger(RestTestFunctions.class);
...@@ -200,9 +204,9 @@ public abstract class RestTestFunctions { ...@@ -200,9 +204,9 @@ public abstract class RestTestFunctions {
complexParams.entry(entry4); complexParams.entry(entry4);
complexParams.entry(entry5); complexParams.entry(entry5);
Model model =parser.createModel(complexParams); Model model = parser.createModel(complexParams);
model.setTileSize(256); model.setTileSize(256);
for (ModelSubmodelConnection connection: model.getSubmodelConnections()) { for (ModelSubmodelConnection connection : model.getSubmodelConnections()) {
connection.getSubmodel().setTileSize(256); connection.getSubmodel().setTileSize(256);
} }
model.setProject(new Project()); model.setProject(new Project());
......
...@@ -83,7 +83,11 @@ import lcsb.mapviewer.services.search.db.drug.IDrugService; ...@@ -83,7 +83,11 @@ import lcsb.mapviewer.services.search.db.drug.IDrugService;
@Transactional(value = "txManager") @Transactional(value = "txManager")
@Rollback(false) @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) @RunWith(SpringJUnit4ClassRunner.class)
public abstract class ServiceTestFunctions { public abstract class ServiceTestFunctions {
private Logger logger = Logger.getLogger(ServiceTestFunctions.class); private Logger logger = Logger.getLogger(ServiceTestFunctions.class);
...@@ -178,7 +182,7 @@ public abstract class ServiceTestFunctions { ...@@ -178,7 +182,7 @@ public abstract class ServiceTestFunctions {
protected ReactionDao reactionDao; protected ReactionDao reactionDao;
@Autowired @Autowired
protected ElementDao aliasDao; protected ElementDao aliasDao;
protected User user; protected User user;
protected User user2 = null; protected User user2 = null;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
classpath:applicationContext-persist.xml classpath:applicationContext-persist.xml
classpath:applicationContext-rest.xml classpath:applicationContext-rest.xml
classpath:applicationContext-service.xml classpath:applicationContext-service.xml
classpath:dataSource.xml
</param-value> </param-value>
</context-param> </context-param>
<context-param> <context-param>
......
...@@ -86,7 +86,11 @@ import lcsb.mapviewer.services.view.ModelViewFactory; ...@@ -86,7 +86,11 @@ import lcsb.mapviewer.services.view.ModelViewFactory;
@Transactional(value = "txManager") @Transactional(value = "txManager")
@Rollback(true) @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) @RunWith(SpringJUnit4ClassRunner.class)
public abstract class WebTestFunctions { public abstract class WebTestFunctions {
private Logger logger = Logger.getLogger(WebTestFunctions.class); private Logger logger = Logger.getLogger(WebTestFunctions.class);
...@@ -184,7 +188,7 @@ public abstract class WebTestFunctions { ...@@ -184,7 +188,7 @@ public abstract class WebTestFunctions {
protected ReactionDao reactionDao; protected ReactionDao reactionDao;
@Autowired @Autowired
protected ElementDao aliasDao; protected ElementDao aliasDao;
@Autowired @Autowired
protected ModelViewFactory modelViewFactory; protected ModelViewFactory modelViewFactory;
......
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