Commit 44f17a62 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1016-refactor-test-framework' into 'master'

Resolve "refactor test framework"

Closes #1016

See merge request !1021
parents db94fed8 55e262d0
Pipeline #31664 passed with stage
in 21 minutes and 19 seconds
......@@ -15,6 +15,11 @@ variables:
POSTGRES_PASSWORD: "123qweasdzxc"
MAVEN_OPTS: "-Dmaven.repo.local=maven.repository"
before_script:
#by default we configure postgres database
- mkdir /etc/minerva/
- cp test-postgres-db-ci.properties /etc/minerva/db.properties
test:frontend:
stage: test
coverage: '/Statements[:\ ]+(\d+.\d+)\%/'
......@@ -41,6 +46,16 @@ test:frontend:
before_script:
- mvn dependency:purge-local-repository -DmanualInclude="lcsb.mapviewer"
.hsql_template: &hsql_definition
image: maven:3.6.0-jdk-11
stage: test
coverage: '/(\d+.\d+) \% covered/'
before_script:
#by default we configure postgres database
- rm -rf /etc/minerva/
- mkdir /etc/minerva/
- cp test-hsql-db-ci.properties /etc/minerva/db.properties
.test_backend_commons_template:
script: &test_backend_commons_definition
#xvfb is for X11 connection used by some parts of the java code: https://stackoverflow.com/a/47575851/1127920
......@@ -55,9 +70,6 @@ test:frontend:
.test_backend_annotation_template:
script: &test_backend_annotation_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl annotation -am
- mvn test -pl annotation
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' annotation/target/site/jacoco/jacoco.csv
......@@ -95,8 +107,6 @@ test:frontend:
.test_backend_converter_SBGNML_template:
script: &test_backend_converter_SBGNML_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl converter-SBGNML -am
- mvn test -pl converter-SBGNML
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-SBGNML/target/site/jacoco/jacoco.csv
......@@ -127,16 +137,12 @@ test:frontend:
.test_backend_persist_template:
script: &test_backend_persist_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl persist -am
- mvn test -pl persist
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' persist/target/site/jacoco/jacoco.csv
.test_backend_rest_template:
script: &test_backend_rest_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl rest-api -am
- mvn test -pl rest-api
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' rest-api/target/site/jacoco/jacoco.csv
......@@ -147,16 +153,12 @@ test:frontend:
- DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant
- curl -sL https://deb.nodesource.com/setup_9.x | bash -
- DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl web -am
- mvn test -pl web
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' web/target/site/jacoco/jacoco.csv
.test_backend_service_template:
script: &test_backend_service_definition
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl service -am
- mvn test -pl service
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' service/target/site/jacoco/jacoco.csv
......@@ -178,6 +180,10 @@ test:backend:annotation:jdk-11:
<<: *jdk_11_definition
script: *test_backend_annotation_definition
test:backend:annotation:jdk-11-hsql:
<<: *hsql_definition
script: *test_backend_annotation_definition
test:backend:CellDesigner_plugin:jdk-8:
<<: *jdk_8_definition
script: *test_backend_CellDesigner_plugin_definition
......@@ -211,6 +217,10 @@ test:backend:converter_SBGNML:jdk-11:
<<: *jdk_11_definition
script: *test_backend_converter_SBGNML_definition
test:backend:converter_SBGNML:jdk-11-hsql:
<<: *hsql_definition
script: *test_backend_converter_SBGNML_definition
test:backend:converter_SBML:jdk-8:
<<: *jdk_8_definition
script: *test_backend_converter_SBML_definition
......@@ -251,6 +261,10 @@ test:backend:persist:jdk-11:
<<: *jdk_11_definition
script: *test_backend_persist_definition
test:backend:persist:hsql:
<<: *hsql_definition
script: *test_backend_persist_definition
test:backend:rest:jdk-8:
<<: *jdk_8_definition
script: *test_backend_rest_definition
......@@ -259,6 +273,10 @@ test:backend:rest:jdk-11:
<<: *jdk_11_definition
script: *test_backend_rest_definition
test:backend:rest:hsql:
<<: *hsql_definition
script: *test_backend_rest_definition
test:backend:service:jdk-8:
<<: *jdk_8_definition
script: *test_backend_service_definition
......@@ -267,6 +285,10 @@ test:backend:service:jdk-11:
<<: *jdk_11_definition
script: *test_backend_service_definition
test:backend:service:hsql:
<<: *hsql_definition
script: *test_backend_service_definition
test:backend:web:jdk-8:
<<: *jdk_8_definition
script: *test_backend_web_definition
......@@ -275,6 +297,10 @@ test:backend:web:jdk-11:
<<: *jdk_11_definition
script: *test_backend_web_definition
test:backend:web:hsql:
<<: *jdk_11_definition
script: *test_backend_web_definition
build_war:
image: maven:3.6.0-jdk-8
stage: build
......@@ -291,7 +317,7 @@ build_war:
- DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant
- curl -sL https://deb.nodesource.com/setup_9.x | bash -
- DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
- ant maven-build
- ant maven-build-with-doc
- cp web/target/web-1.0.war minerva.war
test:dependency_conflict:
......@@ -312,6 +338,19 @@ test:dependency_conflict:
- cat conflicts.txt
- test 0 = $conflicts
test:mvn_changelog_version_check:
image: debian
stage: test
script:
- set +e
- mvn_version=`cat pom.xml |grep "<version>" |head -1 |cut -f2 -d'>' | cut -f1 -d'<'`
- changelog_version=`cat CHANGELOG |grep minerva |head -1 | cut -f2 -d'(' | cut -f1 -d')'`
- echo "Maven version:" $mvn_version
- echo "Changelog version:" $changelog_version
- set -e
- test $mvn_version = $changelog_version
build_debian_package:
image: debian
stage: packaging
......@@ -492,8 +531,6 @@ test_deploy_with_db_without_superadmin_rights:
image: maven:3.6.0-jdk-8
stage: test
script:
- mkdir /etc/minerva/
- cp test-db-ci.properties /etc/minerva/db.properties
- mvn -DskipTests=true clean install -pl persist -am
- mvn test -pl persist
......
minerva (16.0.0~alpha.0) stable; urgency=medium
* Improvement: automatically generated API documentation available in the
package (#1016)
* Bug fix: md5 hash function of plugin was not computed properly
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 27 Aug 2020 13:00:00 +0200
minerva (15.1.0~beta.1) unstable; urgency=medium
* Small improvement: "Human Disease Ontology", "IUPHAR ligand" and "Protein
Modification Ontology" annotation types are handled (#1359)
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</parent>
<artifactId>CellDesigner-plugin</artifactId>
<!-- dependency from the MapViewer model -->
......@@ -50,19 +50,19 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>commons</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</parent>
<artifactId>annotation</artifactId>
<name>Annotation module</name>
......@@ -18,7 +18,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<!-- dependency from the MapViewer dao -->
......@@ -26,7 +26,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>persist</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<!-- dependency from the MapViewer cell designer parser (we need access
......@@ -34,13 +34,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -226,7 +226,9 @@ public class BigFileCache {
localPath = entry.getLocalPath() + "/" + entry.getId() + "/";
File dirFile = new File(Configuration.getWebAppDir() + localPath);
if (!dirFile.mkdirs()) {
if (dirFile.exists() && dirFile.isDirectory()) {
logger.warn("Directory for the file already exists: " + dirFile.getAbsolutePath());
} else if (!dirFile.mkdirs()) {
throw new IOException("Cannot create directory: " + dirFile.getAbsolutePath());
}
......
......@@ -220,7 +220,6 @@ public class DapiConnectorImpl extends CachableInterface implements DapiConnecto
List<String> result = new ArrayList<>();
String url = DAPI_BASE_URL + "database/";
String content = getWebPageDownloader().getFromNetwork(url);
logger.debug(content);
JsonArray array = new JsonParser()
.parse(content)
.getAsJsonObject()
......
......@@ -78,7 +78,7 @@ public interface ReferenceGenomeConnector {
* @param version
* version of reference genome
* @param updater
* callback funtion that will be called to update information about
* callback function that will be called to update information about
* progress
* @param async
* should the download be performed asynchronously
......@@ -100,7 +100,7 @@ public interface ReferenceGenomeConnector {
* @param referenceGenome
* reference genome for which gene mapping is downloaded
* @param updater
* callback funtion that will be called to update information about
* callback function that will be called to update information about
* progress
* @param async
* should the download be performed asynchronously
......
......@@ -26,7 +26,7 @@ import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.layout.*;
/**
* Implementeation of reference genome connector accessing
* Implementation of reference genome connector accessing
* {@link ReferenceGenomeType#UCSC} database.
*
* @author Piotr Gawron
......
database.driver=org.hsqldb.jdbcDriver
database.dialect=org.hibernate.dialect.HSQLDialect
database.uri=jdbc:hsqldb:mem:dapi
database.username=sa
database.password=
database.connectionQuery=SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS
<?xml version="1.0" encoding="UTF-8"?>
<project name="minerva" default="main" basedir=".">
<property environment="env"/>
<property environment="env" />
<property name="build.dir" value="web/target"/>
<property name="war.file" value="web-1.0.war"/>
<property name="tomcat.home" value="${env.CATALINA_HOME}"/>
<property name="tomcat.deploy.dir" value="${tomcat.home}/webapps"/>
<property name="build.dir" value="web/target" />
<property name="war.file" value="*.war" />
<property name="tomcat.home" value="${env.CATALINA_HOME}" />
<property name="tomcat.deploy.dir" value="${tomcat.home}/webapps" />
<condition property="isWindows">
<os family="windows"/>
<os family="windows" />
</condition>
<condition property="isUnix">
<os family="unix"/>
<os family="unix" />
</condition>
<target name="war-exists">
<available file="${tomcat.deploy.dir}/${ant.project.name}.war" property="war.exists"/>
<available file="${tomcat.deploy.dir}/${ant.project.name}.war" property="war.exists" />
</target>
<target name="remove-war" depends="war-exists" if="war.exists">
<delete file="${tomcat.deploy.dir}/${ant.project.name}.war"/>
<delete file="${tomcat.deploy.dir}/${ant.project.name}.war" />
</target>
<target name="war-dir-exists">
<available file="${tomcat.deploy.dir}/${ant.project.name}" property="war-dir.exists" type="dir"/>
<available file="${tomcat.deploy.dir}/${ant.project.name}" property="war-dir.exists" type="dir" />
</target>
<target name="remove-war-dir" depends="war-dir-exists" if="war-dir.exists">
<delete dir="${tomcat.deploy.dir}/${ant.project.name}"/>
<delete dir="${tomcat.deploy.dir}/${ant.project.name}" />
</target>
<target name="deploy" depends="remove-war,remove-war-dir">
<copy file="${build.dir}/${war.file}" todir="${tomcat.deploy.dir}"/>
<move file="${tomcat.deploy.dir}/${war.file}" tofile="${tomcat.deploy.dir}/${ant.project.name}.war"/>
<copy todir="${tomcat.deploy.dir}">
<fileset dir="${build.dir}">
<include name="${war.file}" />
</fileset>
<globmapper from="*.war" to="${ant.project.name}.war"/>
</copy>
</target>
......@@ -43,69 +47,82 @@
<target name="all" depends="main">
</target>
<target name="tomcat-start" depends="tomcat-start-windows, tomcat-start-unix"/>
<target name="tomcat-start" depends="tomcat-start-windows, tomcat-start-unix" />
<target name="tomcat-start-windows" if="isWindows">
<exec executable="${tomcat.home}/bin/startup.bat"/>
<exec executable="${tomcat.home}/bin/startup.bat" />
</target>
<target name="tomcat-start-unix" if="isUnix">
<exec executable="${tomcat.home}/bin/startup.sh"/>
<exec executable="${tomcat.home}/bin/startup.sh" />
</target>
<target name="tomcat-stop" depends="tomcat-stop-windows, tomcat-stop-unix"/>
<target name="tomcat-stop" depends="tomcat-stop-windows, tomcat-stop-unix" />
<target name="tomcat-stop-windows" if="isWindows">
<exec executable="${tomcat.home}/bin/shutdown.bat"/>
<exec executable="${tomcat.home}/bin/shutdown.bat" />
</target>
<target name="tomcat-stop-unix" if="isUnix">
<exec executable="${tomcat.home}/bin/shutdown.sh"/>
<exec executable="${tomcat.home}/bin/shutdown.sh" />
</target>
<target name="maven-build" depends="gitversion, maven-build-windows, maven-build-unix"/>
<target name="maven-build" depends="gitversion, maven-build-windows, maven-build-unix" />
<target name="maven-build-windows" if="isWindows">
<exec dir="." executable="cmd">
<arg line="/c mvn -Dmaven.test.skip=true clean install -pl web -am"/>
<arg line="/c mvn -Dmaven.test.skip=true clean install -pl web -am" />
</exec>
</target>
<target name="maven-build-unix" if="isUnix">
<exec dir="." executable="sh">
<arg line="-c 'mvn -Dmaven.test.skip=true clean install -pl web -am'"/>
<arg line="-c 'mvn -Dmaven.test.skip=true clean install -pl web -am'" />
</exec>
</target>
<target name="maven-build-with-doc" depends="gitversion, maven-build-with-doc-windows, maven-build-with-doc-unix" />
<target name="maven-build-with-doc-windows" if="isWindows">
<exec dir="." executable="cmd">
<arg line="/c mvn -DfailIfNoTests=false -Dtest=lcsb.mapviewer.web.** clean install -pl web -am" />
</exec>
</target>
<target name="maven-build-with-doc-unix" if="isUnix">
<exec dir="." executable="sh">
<arg line="-c 'mvn -DfailIfNoTests=false -Dtest=lcsb.mapviewer.web.** clean install -pl web -am'" />
</exec>
</target>
<target name="maven-test" depends="maven-test-windows, maven-test-unix"/>
<target name="maven-test" depends="maven-test-windows, maven-test-unix" />
<target name="maven-test-windows" depends="maven-build" if="isWindows">
<exec dir="." executable="cmd">
<arg line="/c mvn test -fn"/>
<arg line="/c mvn test -fn" />
<!-- <arg line="/c mvn surefire-report:report" /> -->
</exec>
</target>
<target name="maven-test-unix" depends="maven-build" if="isUnix">
<exec dir="." executable="sh">
<arg line="-c 'mvn test -fn'"/>
<arg line="-c 'mvn test -fn'" />
<!-- <arg line="-c 'mvn surefire-report:report'" /> -->
</exec>
</target>
<target name="deployMapFiles">
<copy todir="${tomcat.deploy.dir}/map_images">
<fileset dir="map_images"/>
<fileset dir="map_images" />
</copy>
</target>
<target name="gitversion">
<exec executable="git" outputproperty="gitversion">
<arg value="rev-parse"/>
<arg value="HEAD"/>
<arg value="rev-parse" />
<arg value="HEAD" />
</exec>
<tstamp>
<format property="build.time" pattern="dd/MM/yyyy HH:mm"
unit="hour"/>
<format property="build.time" pattern="dd/MM/yyyy HH:mm" unit="hour" />
</tstamp>
<echo>GIT Version: ${gitversion}
Build timestamp: ${build.time}
......@@ -114,10 +131,10 @@
<echo file="web/src/main/webapp/version.txt">${gitversion}
${build.time}
</echo>
<copy file="CHANGELOG" tofile="web/src/main/webapp/CHANGELOG" overwrite="true"/>
<copy file="CHANGELOG" tofile="web/src/main/webapp/CHANGELOG" overwrite="true" />
</target>
<target name="debian-pkg" depends="maven-build">
<exec executable="debian/create-debian-pkg.sh"/>
<exec executable="debian/create-debian-pkg.sh" />
</target>
</project>
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</parent>
<artifactId>commons</artifactId>
<name>Mapviewer commons</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</parent>
<artifactId>converter-CellDesigner</artifactId>
<name>CellDesigner converter</name>
......@@ -17,13 +17,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</parent>
<artifactId>converter-SBGNML</artifactId>
......@@ -20,26 +20,26 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>persist</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
......
database.driver=org.hsqldb.jdbcDriver
database.dialect=org.hibernate.dialect.HSQLDialect
database.uri=jdbc:hsqldb:mem:dapi
database.username=sa
database.password=
database.connectionQuery=SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</parent>
<artifactId>converter-graphics</artifactId>
<name>MapViewer graphics converter</name>
......@@ -18,13 +18,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model-command</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<!-- Log4J2-->
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</parent>
<artifactId>converter-sbml</artifactId>
<name>converter-sbml</name>
......@@ -40,22 +40,22 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model-command</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>1.0</version>
<version>16.0.0~alpha.0</version>
</dependency>