diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/AnnotationTestFunctions.java b/annotation/src/test/java/lcsb/mapviewer/annotation/AnnotationTestFunctions.java index a155631f38d2cfc47a562f3909b1dab0208bd79c..cad5977a4cb5118f7eaceff87cd6e50f04042bd3 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/AnnotationTestFunctions.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/AnnotationTestFunctions.java @@ -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 { diff --git a/converter-SBGNML/src/test/java/lcsb/mapviewer/converter/model/sbgnml/DbSerializationTest.java b/converter-SBGNML/src/test/java/lcsb/mapviewer/converter/model/sbgnml/DbSerializationTest.java index 66b52bba704f5b30c80582230cc5bf9f1e0124a7..c98a7c7b0094e0509ea67d57e6b168a4ac2b8c87 100644 --- a/converter-SBGNML/src/test/java/lcsb/mapviewer/converter/model/sbgnml/DbSerializationTest.java +++ b/converter-SBGNML/src/test/java/lcsb/mapviewer/converter/model/sbgnml/DbSerializationTest.java @@ -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 { diff --git a/persist/.classpath b/persist/.classpath index 62d4b8e4723486982a42cd5dd2b44363281a0bd8..08d7a50f5bdeedd3895bec12935a95bb700fbf77 100644 --- a/persist/.classpath +++ b/persist/.classpath @@ -1,37 +1,37 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" output="target/classes" path="src/main/java"> - <attributes> - <attribute name="optional" value="true"/> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="src" output="target/test-classes" path="src/test/java"> - <attributes> - <attribute name="optional" value="true"/> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - <attribute name="org.eclipse.jst.component.nondependency" value=""/> - </attributes> - </classpathentry> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="output" path="target/classes"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="org.eclipse.jst.component.nondependency" value=""/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/persist/src/main/resources/applicationContext-persist.xml b/persist/src/main/resources/applicationContext-persist.xml index 896e204ca1ca0b1a64eb6b4ba1dc01905591c689..b459702a7a5076281cd6cd5ca476dbb3d2bcc3cf 100644 --- a/persist/src/main/resources/applicationContext-persist.xml +++ b/persist/src/main/resources/applicationContext-persist.xml @@ -8,28 +8,14 @@ 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"> - -<!-- 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> diff --git a/persist/src/main/resources/dataSource.xml b/persist/src/main/resources/dataSource.xml new file mode 100644 index 0000000000000000000000000000000000000000..e6551f4fb1e63988a4faaceb069c69fe2fb7de07 --- /dev/null +++ b/persist/src/main/resources/dataSource.xml @@ -0,0 +1,25 @@ +<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> diff --git a/persist/src/main/resources/db.properties b/persist/src/main/resources/db.properties new file mode 100644 index 0000000000000000000000000000000000000000..e1edfb39acf73ef0ad8d928ba01941bb4d87ac72 --- /dev/null +++ b/persist/src/main/resources/db.properties @@ -0,0 +1,3 @@ +database.uri=jdbc:postgresql://localhost:5432/map_viewer +database.username=map_viewer +database.password=123qweasdzxc \ No newline at end of file diff --git a/persist/src/test/java/lcsb/mapviewer/persist/PersistTestFunctions.java b/persist/src/test/java/lcsb/mapviewer/persist/PersistTestFunctions.java index 494cdbda1c133287c00a6db01947ff660f73a1d8..03b6cad1942c420382e0e165f6ef8e59029c6a58 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/PersistTestFunctions.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/PersistTestFunctions.java @@ -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); diff --git a/reactome/src/test/java/lcsb/mapviewer/reactome/ReactomeTestFunctions.java b/reactome/src/test/java/lcsb/mapviewer/reactome/ReactomeTestFunctions.java index 48dbbe2bf51456dbfe18a2bf280d36fc84bfc1c3..8ac8e12415f3623e38d4afc572f873e731e805c5 100644 --- a/reactome/src/test/java/lcsb/mapviewer/reactome/ReactomeTestFunctions.java +++ b/reactome/src/test/java/lcsb/mapviewer/reactome/ReactomeTestFunctions.java @@ -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 { diff --git a/rest-api/src/test/java/lcsb/mapviewer/api/RestTestFunctions.java b/rest-api/src/test/java/lcsb/mapviewer/api/RestTestFunctions.java index af2f8dcf6120fddefb942ed728c8a84d9e044e8e..504d6a7f6f4d5e20ff32c7197d8f423b86d742a5 100644 --- a/rest-api/src/test/java/lcsb/mapviewer/api/RestTestFunctions.java +++ b/rest-api/src/test/java/lcsb/mapviewer/api/RestTestFunctions.java @@ -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()); diff --git a/service/src/test/java/lcsb/mapviewer/services/ServiceTestFunctions.java b/service/src/test/java/lcsb/mapviewer/services/ServiceTestFunctions.java index 869300e0881027ad3223efc0090c1256d688873c..be7a28143ec317cd966efc6bbf931ad7c175a5d5 100644 --- a/service/src/test/java/lcsb/mapviewer/services/ServiceTestFunctions.java +++ b/service/src/test/java/lcsb/mapviewer/services/ServiceTestFunctions.java @@ -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); @@ -178,7 +182,7 @@ public abstract class ServiceTestFunctions { protected ReactionDao reactionDao; @Autowired - protected ElementDao aliasDao; + protected ElementDao aliasDao; protected User user; protected User user2 = null; diff --git a/web/src/main/webapp/WEB-INF/web.xml b/web/src/main/webapp/WEB-INF/web.xml index d794ecf3da612eb4bcb4fb069329c11f3abdf88e..9b6aa5e3e08a46dd5469cc0163928c9c677034eb 100644 --- a/web/src/main/webapp/WEB-INF/web.xml +++ b/web/src/main/webapp/WEB-INF/web.xml @@ -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> diff --git a/web/src/test/java/lcsb/mapviewer/bean/WebTestFunctions.java b/web/src/test/java/lcsb/mapviewer/bean/WebTestFunctions.java index 35be8824267f92a04303aa84a0d2cfc5bb5d4968..fccf8ea97ff33d35499ff9af035184565b46f1f5 100644 --- a/web/src/test/java/lcsb/mapviewer/bean/WebTestFunctions.java +++ b/web/src/test/java/lcsb/mapviewer/bean/WebTestFunctions.java @@ -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); @@ -184,7 +188,7 @@ public abstract class WebTestFunctions { protected ReactionDao reactionDao; @Autowired - protected ElementDao aliasDao; + protected ElementDao aliasDao; @Autowired protected ModelViewFactory modelViewFactory;