diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b8e211444..33f6a9563 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,8 +12,11 @@ variables:
test:
stage: test
image: maven:3.6.1-jdk-8-alpine
+ services:
+ - mongo:4.0.18
script:
- - mvn clean test --projects 'eva-lib,eva-server'
+ # Gitlab exposes services under their own hostnames. So test host should be "mongo" instead of "localhost".
+ - mvn clean test --projects 'eva-lib,eva-server' -Deva.mongo.host.test=mongo
only:
- master
- tags
diff --git a/.travis.yml b/.travis.yml
index 6e1bc4960..4533ba0f4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,16 +1,18 @@
sudo: false
-
-language: java
-
-jdk:
- - openjdk8
-
-env:
- - OPENCGA_HOME=$TRAVIS_BUILD_DIR/opencga/opencga-app/build
-
-install:
- - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -PTravis
-
-script:
- - mvn test -s .travis.settings.xml -PTravis
-
+matrix:
+ include:
+ - language: "java"
+ jdk: "openjdk8"
+ env:
+ - OPENCGA_HOME=$TRAVIS_BUILD_DIR/opencga/opencga-app/build
+ - MONGODB_VERSION=4.0.18
+ install:
+ - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGODB_VERSION.tgz
+ - tar xfz mongodb-linux-x86_64-$MONGODB_VERSION.tgz
+ - export PATH=`pwd`/mongodb-linux-x86_64-$MONGODB_VERSION/bin:$PATH
+ - mkdir -p data/db
+ - mongod --dbpath=data/db &
+ - mongod --version
+ - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -PTravis
+ script:
+ - mvn test -s .travis.settings.xml -PTravis
diff --git a/dbsnp-import/pom.xml b/dbsnp-import/pom.xml
index 28541e975..be0a2d4b2 100644
--- a/dbsnp-import/pom.xml
+++ b/dbsnp-import/pom.xml
@@ -64,12 +64,6 @@
hsqldb
-
- com.github.fakemongo
- fongo
- 2.0.12
- test
-
diff --git a/dbsnp-import/src/main/java/uk/ac/ebi/eva/server/Application.java b/dbsnp-import/src/main/java/uk/ac/ebi/eva/server/Application.java
index 944e04542..2c2621897 100644
--- a/dbsnp-import/src/main/java/uk/ac/ebi/eva/server/Application.java
+++ b/dbsnp-import/src/main/java/uk/ac/ebi/eva/server/Application.java
@@ -19,7 +19,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
diff --git a/dbsnp-import/src/main/resources/application.properties b/dbsnp-import/src/main/resources/application.properties
index 52fedc9da..e9b1fb8f9 100644
--- a/dbsnp-import/src/main/resources/application.properties
+++ b/dbsnp-import/src/main/resources/application.properties
@@ -1,10 +1,13 @@
spring.datasource.driver-class-name=org.postgresql.Driver
-spring.datasource.url=@eva.evapro.jdbc.url@?currentSchema=@eva.evapro.dbsnp-progress.schema@
-spring.datasource.username=@eva.evapro.user@
-spring.datasource.password=@eva.evapro.password@
+spring.datasource.url=|eva.evapro.jdbc.url|?currentSchema=|eva.evapro.dbsnp-progress.schema|
+spring.datasource.username=|eva.evapro.user|
+spring.datasource.password=|eva.evapro.password|
spring.jpa.generate-ddl=false
spring.data.rest.base-path=/v1/
management.endpoints.web.exposure.include=info,health
management.info.git.mode=full
+
+# See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#bean-overriding
+spring.main.allow-bean-definition-overriding=true
diff --git a/dbsnp-import/src/test/java/uk/ac/ebi/eva/server/repositories/ProgressReportRepositoryTest.java b/dbsnp-import/src/test/java/uk/ac/ebi/eva/server/repositories/ProgressReportRepositoryTest.java
index 881d73d78..412f203b5 100644
--- a/dbsnp-import/src/test/java/uk/ac/ebi/eva/server/repositories/ProgressReportRepositoryTest.java
+++ b/dbsnp-import/src/test/java/uk/ac/ebi/eva/server/repositories/ProgressReportRepositoryTest.java
@@ -28,10 +28,11 @@
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
+import java.util.Optional;
import java.util.Set;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
@RunWith(SpringRunner.class)
@DataJpaTest
@@ -47,13 +48,14 @@ public void testCountRecords() {
@Test
public void testFindById() {
- ProgressReport report = progressReportRepository.findOne(new ProgressReportPK("fruitfly_7227",
- "GCA_000001215.4"));
+ Optional report = progressReportRepository.findById(new ProgressReportPK("fruitfly_7227",
+ "GCA_000001215.4"));
+ assertTrue(report.isPresent());
ProgressReport expected = new ProgressReport("fruitfly_7227", 7227, "Drosophila melanogaster", "Fruit fly",
"GCA_000001215.4", 149, true, false, false, Status.pending,
Status.pending, Status.pending, null, null, null, 0L, 0L, 0L, 0L,
0L, 0L);
- assertEquals(expected, report);
+ assertEquals(expected, report.get());
}
@Test
@@ -70,24 +72,25 @@ public void testFindMultipleAssemblies() {
@Test
public void testVariantWithEvidenceImportFields() {
- ProgressReport report = progressReportRepository.findOne(new ProgressReportPK("arabidopsis_3702",
- "GCA_000001735.1"));
- assertEquals(Status.done, report.getVariantsWithEvidenceImported());
+ Optional report = progressReportRepository.findById(new ProgressReportPK("arabidopsis_3702",
+ "GCA_000001735.1"));
+ assertTrue(report.isPresent());
+ assertEquals(Status.done, report.get().getVariantsWithEvidenceImported());
Calendar cal = Calendar.getInstance();
cal.set(2018, Calendar.MAY, 30, 0, 0, 0);
cal.set(Calendar.MILLISECOND, 0);
Date date = cal.getTime();
- assertEquals(date.getTime(), report.getVariantsWithEvidenceImportedDate().getTime());
+ assertEquals(date.getTime(), report.get().getVariantsWithEvidenceImportedDate().getTime());
}
@Test
public void testVariantWithoutGenbankAccession() {
String databaseName = "orangutan_9600";
String genbankAssemblyAccession = "";
- ProgressReport report = progressReportRepository.findOne(new ProgressReportPK(databaseName,
- genbankAssemblyAccession));
- assertNotNull(report);
- assertEquals(genbankAssemblyAccession, report.getGenbankAssemblyAccession());
- assertEquals(databaseName, report.getDatabaseName());
+ Optional report = progressReportRepository.findById(new ProgressReportPK(databaseName,
+ genbankAssemblyAccession));
+ assertTrue(report.isPresent());
+ assertEquals(genbankAssemblyAccession, report.get().getGenbankAssemblyAccession());
+ assertEquals(databaseName, report.get().getDatabaseName());
}
}
\ No newline at end of file
diff --git a/dbsnp-import/src/test/resources/application.properties b/dbsnp-import/src/test/resources/application.properties
index 90469fede..3a9185f36 100644
--- a/dbsnp-import/src/test/resources/application.properties
+++ b/dbsnp-import/src/test/resources/application.properties
@@ -9,3 +9,6 @@ spring.datasource.generate-unique-name=true
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
+
+# See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#bean-overriding
+spring.main.allow-bean-definition-overriding=true
diff --git a/dgva-server/src/main/java/uk/ac/ebi/dgva/server/Application.java b/dgva-server/src/main/java/uk/ac/ebi/dgva/server/Application.java
index 236e80482..af21fb8b6 100644
--- a/dgva-server/src/main/java/uk/ac/ebi/dgva/server/Application.java
+++ b/dgva-server/src/main/java/uk/ac/ebi/dgva/server/Application.java
@@ -19,7 +19,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
diff --git a/dgva-server/src/main/resources/application.properties b/dgva-server/src/main/resources/application.properties
index aff823d8a..b9f1b0cde 100644
--- a/dgva-server/src/main/resources/application.properties
+++ b/dgva-server/src/main/resources/application.properties
@@ -15,3 +15,6 @@ springfox.documentation.swagger.v2.path=/webservices/api
management.endpoints.web.exposure.include=info,health
management.info.git.mode=full
+
+# See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#bean-overriding
+spring.main.allow-bean-definition-overriding=true
diff --git a/dgva-server/src/test/resources/application.properties b/dgva-server/src/test/resources/application.properties
index bd81c8bd6..804d48f92 100644
--- a/dgva-server/src/test/resources/application.properties
+++ b/dgva-server/src/test/resources/application.properties
@@ -11,3 +11,6 @@ spring.jpa.show-sql=true
logging.level.com.bytestree.restful=DEBUG
logging.level.org.springframework.web.client.RestTemplate=DEBUG
+
+# See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#bean-overriding
+spring.main.allow-bean-definition-overriding=true
diff --git a/eva-lib/pom.xml b/eva-lib/pom.xml
index 2dffcd425..f00b9deec 100644
--- a/eva-lib/pom.xml
+++ b/eva-lib/pom.xml
@@ -13,6 +13,7 @@
1.8
+ localhost
@@ -32,11 +33,6 @@
org.springframework.boot
spring-boot-starter-data-jpa
-
- com.github.fakemongo
- fongo
- test
-
com.lordofthejars
nosqlunit-core
@@ -44,12 +40,6 @@
com.lordofthejars
nosqlunit-mongodb
-
-
- com.github.fakemongo
- fongo
-
-
com.h2database
@@ -60,10 +50,6 @@
org.springframework.boot
spring-boot-starter-validation
-
- javax.validation
- validation-api
-
com.fasterxml.jackson.core
jackson-databind
@@ -77,6 +63,19 @@
${project.artifactId}-${project.version}-${git.commit.id.abbrev}
+
+
+ src/test/resources/properties
+ true
+
+
+ src/test/resources/
+ false
+
+ src/test/resources/properties/*
+
+
+
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/MongoConfiguration.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/MongoConfiguration.java
index cf5a84eff..3a29aa0ad 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/MongoConfiguration.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/MongoConfiguration.java
@@ -15,6 +15,13 @@
*/
package uk.ac.ebi.eva.lib;
+import com.mongodb.AuthenticationMechanism;
+import com.mongodb.MongoClient;
+import com.mongodb.MongoClientOptions;
+import com.mongodb.MongoCredential;
+import com.mongodb.ReadPreference;
+import com.mongodb.ServerAddress;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -29,8 +36,13 @@
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import uk.ac.ebi.eva.lib.configuration.DbCollectionsProperties;
+import uk.ac.ebi.eva.lib.configuration.SpringDataMongoDbProperties;
import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
@Configuration
@Import(DbCollectionsProperties.class)
@@ -47,6 +59,9 @@ public class MongoConfiguration {
@Autowired
private DbCollectionsProperties dbCollectionsProperties;
+ @Autowired
+ private SpringDataMongoDbProperties springDataMongoDbProperties;
+
@Bean
public String mongoCollectionsVariants() {
return dbCollectionsProperties.getVariants();
@@ -91,4 +106,57 @@ public MappingMongoConverter mappingMongoConverter() throws IOException {
return mongoConverter;
}
+ /**
+ * Get a MongoClient using the configuration (credentials) in a given Properties.
+ *
+ * @param springDataMongoDbProperties can have the next values:
+ * - eva.mongo.auth.db authentication database
+ * - eva.mongo.host comma-separated strings of colon-separated host and port strings: host_1:port_1,host_2:port_2
+ * - eva.mongo.user
+ * - eva.mongo.passwd
+ * - eva.mongo.read-preference string, "secondaryPreferred" if unspecified. one of:
+ * [primary, primaryPreferred, secondary, secondaryPreferred, nearest]
+ * @return MongoClient with given credentials
+ * @throws UnknownHostException
+ */
+ public static MongoClient getMongoClient(SpringDataMongoDbProperties springDataMongoDbProperties) throws UnknownHostException {
+
+ String[] hosts = springDataMongoDbProperties.getHost().split(",");
+ List servers = new ArrayList<>();
+
+ // Get the list of hosts (optionally including the port number)
+ for (String host : hosts) {
+ String[] params = host.split(":");
+ if (params.length > 1) {
+ servers.add(new ServerAddress(params[0], Integer.parseInt(params[1])));
+ } else {
+ servers.add(new ServerAddress(params[0], 27017));
+ }
+ }
+
+ String readPreference = springDataMongoDbProperties.getReadPreference();
+ readPreference = readPreference == null || readPreference.isEmpty()? "secondaryPreferred" : readPreference;
+
+ MongoClientOptions options = MongoClientOptions.builder()
+ .readPreference(ReadPreference.valueOf(readPreference))
+ .build();
+
+ List mongoCredentialList = new ArrayList<>();
+ String authenticationDb = springDataMongoDbProperties.getAuthenticationDatabase();
+ if (authenticationDb != null && !authenticationDb.isEmpty()) {
+ MongoCredential mongoCredential = MongoCredential.createCredential(
+ springDataMongoDbProperties.getUsername(),
+ authenticationDb,
+ springDataMongoDbProperties.getPassword().toCharArray());
+ String authenticationMechanism = springDataMongoDbProperties.getAuthenticationMechanism();
+ if (authenticationMechanism == null) {
+ return new MongoClient(servers, options);
+ }
+ mongoCredential = mongoCredential.withMechanism(
+ AuthenticationMechanism.fromMechanismName(authenticationMechanism));
+ mongoCredentialList = Collections.singletonList(mongoCredential);
+ }
+
+ return new MongoClient(servers, mongoCredentialList, options);
+ }
}
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/configuration/SpringDataMongoDbProperties.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/configuration/SpringDataMongoDbProperties.java
index 43ab3d4f5..04c2d0a21 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/configuration/SpringDataMongoDbProperties.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/configuration/SpringDataMongoDbProperties.java
@@ -24,21 +24,33 @@
@Component
public class SpringDataMongoDbProperties {
+ private String database;
+
@Size(min = 1)
private String host;
private String authenticationDatabase;
+ private String authenticationMechanism;
+
private String username;
private String password;
private String readPreference;
+ public String getDatabase() {
+ return database;
+ }
+
public String getHost() {
return host;
}
+ public void setDatabase(String database) {
+ this.database = database;
+ }
+
public void setHost(String host) {
this.host = host;
}
@@ -51,6 +63,14 @@ public void setAuthenticationDatabase(String authenticationDatabase) {
this.authenticationDatabase = authenticationDatabase;
}
+ public String getAuthenticationMechanism() {
+ return authenticationMechanism;
+ }
+
+ public void setAuthenticationMechanism(String authenticationMechanism) {
+ this.authenticationMechanism = authenticationMechanism;
+ }
+
public String getUsername() {
return username;
}
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/dgva_utils/DgvaDBUtils.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/dgva_utils/DgvaDBUtils.java
index bcf8ea959..08eab9a83 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/dgva_utils/DgvaDBUtils.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/dgva_utils/DgvaDBUtils.java
@@ -16,12 +16,11 @@
package uk.ac.ebi.eva.lib.dgva_utils;
import org.springframework.data.jpa.domain.Specification;
-import org.springframework.data.jpa.domain.Specifications;
import uk.ac.ebi.eva.lib.repositories.DgvaStudyBrowserRepository;
import uk.ac.ebi.eva.lib.utils.QueryOptions;
import uk.ac.ebi.eva.lib.utils.QueryOptionsConstants;
-import static org.springframework.data.jpa.domain.Specifications.where;
+import static org.springframework.data.jpa.domain.Specification.where;
import static uk.ac.ebi.eva.lib.extension.GenericSpecifications.ilike;
import static uk.ac.ebi.eva.lib.extension.GenericSpecifications.in;
@@ -32,7 +31,7 @@ public static Specification getSpeciesAndTypeFilters(QueryOptions queryOptions)
return null;
}
- Specifications speciesSpecifications = null;
+ Specification speciesSpecifications = null;
if (queryOptions.containsKey(QueryOptionsConstants.SPECIES)) {
String[] species = queryOptions.getAsStringList(QueryOptionsConstants.SPECIES).toArray(new String[]{});
speciesSpecifications = where(in(DgvaStudyBrowserRepository.COMMON_NAME, (Object[])species))
@@ -45,12 +44,13 @@ public static Specification getSpeciesAndTypeFilters(QueryOptions queryOptions)
}
}
- Specifications typeSpecifications = null;
+ Specification typeSpecifications = null;
if (queryOptions.containsKey(QueryOptionsConstants.TYPE)) {
String[] types = queryOptions.getAsStringList(QueryOptionsConstants.TYPE).toArray(new String[]{});
typeSpecifications = where(in(DgvaStudyBrowserRepository.STUDY_TYPE, (Object[])types));
for (String type : types) {
- typeSpecifications = typeSpecifications.or(ilike(DgvaStudyBrowserRepository.STUDY_TYPE, "%" + type + "%"));
+ typeSpecifications = typeSpecifications.or(
+ ilike(DgvaStudyBrowserRepository.STUDY_TYPE, "%" + type + "%"));
}
}
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/DBAdaptorConnector.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/DBAdaptorConnector.java
index 753bddd4c..0e3c68dc7 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/DBAdaptorConnector.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/DBAdaptorConnector.java
@@ -15,6 +15,7 @@
*/
package uk.ac.ebi.eva.lib.eva_utils;
+import com.mongodb.AuthenticationMechanism;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
@@ -67,15 +68,6 @@ public static MongoClient getMongoClient(SpringDataMongoDbProperties springDataM
}
}
- List mongoCredentialList = new ArrayList<>();
- String authenticationDb = springDataMongoDbProperties.getAuthenticationDatabase();
- if (authenticationDb != null && !authenticationDb.isEmpty()) {
- mongoCredentialList = Collections.singletonList(MongoCredential.createCredential(
- springDataMongoDbProperties.getUsername(),
- authenticationDb,
- springDataMongoDbProperties.getPassword().toCharArray()));
- }
-
String readPreference = springDataMongoDbProperties.getReadPreference();
readPreference = readPreference == null || readPreference.isEmpty()? "secondaryPreferred" : readPreference;
@@ -83,6 +75,22 @@ public static MongoClient getMongoClient(SpringDataMongoDbProperties springDataM
.readPreference(ReadPreference.valueOf(readPreference))
.build();
+ List mongoCredentialList = new ArrayList<>();
+ String authenticationDb = springDataMongoDbProperties.getAuthenticationDatabase();
+ if (authenticationDb != null && !authenticationDb.isEmpty()) {
+ MongoCredential mongoCredential = MongoCredential.createCredential(
+ springDataMongoDbProperties.getUsername(),
+ authenticationDb,
+ springDataMongoDbProperties.getPassword().toCharArray());
+ String authenticationMechanism = springDataMongoDbProperties.getAuthenticationMechanism();
+ if (authenticationMechanism == null) {
+ return new MongoClient(servers, options);
+ }
+ mongoCredential = mongoCredential.withMechanism(
+ AuthenticationMechanism.fromMechanismName(authenticationMechanism));
+ mongoCredentialList = Collections.singletonList(mongoCredential);
+ }
+
return new MongoClient(servers, mongoCredentialList, options);
}
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/EvaproDbUtils.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/EvaproDbUtils.java
index 6bb3d8217..c6a34ca27 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/EvaproDbUtils.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/EvaproDbUtils.java
@@ -16,7 +16,6 @@
package uk.ac.ebi.eva.lib.eva_utils;
import org.springframework.data.jpa.domain.Specification;
-import org.springframework.data.jpa.domain.Specifications;
import uk.ac.ebi.eva.commons.core.models.StudyType;
import uk.ac.ebi.eva.lib.extension.GenericSpecifications;
@@ -24,7 +23,7 @@
import uk.ac.ebi.eva.lib.utils.QueryOptions;
import uk.ac.ebi.eva.lib.utils.QueryOptionsConstants;
-import static org.springframework.data.jpa.domain.Specifications.where;
+import static org.springframework.data.jpa.domain.Specification.where;
public class EvaproDbUtils {
@@ -58,14 +57,14 @@ public static Specification getSpeciesAndTypeFilters(QueryOptions queryOptions)
return null;
}
- Specifications speciesSpecifications = null;
+ Specification speciesSpecifications = null;
if (queryOptions.containsKey(QueryOptionsConstants.SPECIES)) {
Object[] species = queryOptions.getAsStringList(QueryOptionsConstants.SPECIES).toArray(new Object[]{});
speciesSpecifications = where(GenericSpecifications.in(EvaStudyBrowserRepository.COMMON_NAME, species))
.or(GenericSpecifications.in(EvaStudyBrowserRepository.SCIENTIFIC_NAME, species));
}
- Specifications typeSpecifications = null;
+ Specification typeSpecifications = null;
if (queryOptions.containsKey(QueryOptionsConstants.TYPE)) {
Object[] types = queryOptions.getAsStringList(QueryOptionsConstants.TYPE).toArray(new Object[]{});
typeSpecifications = where(GenericSpecifications.in(EvaStudyBrowserRepository.EXPERIMENT_TYPE, types));
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/MultiMongoDbFactory.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/MultiMongoDbFactory.java
index 89a82ea11..60d44c74a 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/MultiMongoDbFactory.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/eva_utils/MultiMongoDbFactory.java
@@ -15,8 +15,8 @@
*/
package uk.ac.ebi.eva.lib.eva_utils;
-import com.mongodb.DB;
import com.mongodb.MongoClient;
+import com.mongodb.client.MongoDatabase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
@@ -64,7 +64,7 @@ public static void clearDatabaseNameForCurrentThread() {
}
@Override
- public DB getDb() {
+ public MongoDatabase getDb() {
final String tlName = dbName.get();
final String dbToUse = (tlName != null ? tlName : this.defaultName);
logger.debug("Acquiring database: " + dbToUse);
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/dgva/StudyDgvaDBAdaptor.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/dgva/StudyDgvaDBAdaptor.java
index da88b682c..4fc4132cc 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/dgva/StudyDgvaDBAdaptor.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/dgva/StudyDgvaDBAdaptor.java
@@ -28,6 +28,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
@Component
public class StudyDgvaDBAdaptor implements StudyDBAdaptor {
@@ -62,10 +63,10 @@ public QueryResult findStudyNameOrStudyId(String s, QueryOptions queryOptions) {
@Override
public QueryResult getStudyById(String studyId, QueryOptions queryOptions) {
long start = System.currentTimeMillis();
- DgvaStudyBrowser dgvaStudy = dgvaStudyBrowserRepository.findOne(studyId);
+ Optional dgvaStudy = dgvaStudyBrowserRepository.findById(studyId);
List variantStudy = new ArrayList<>();
- if (dgvaStudy != null) {
- variantStudy.add(dgvaStudy.generateVariantStudy());
+ if (dgvaStudy.isPresent()) {
+ variantStudy.add(dgvaStudy.get().generateVariantStudy());
}
long end = System.currentTimeMillis();
return new QueryResult(null, ((Long) (end - start)).intValue(), variantStudy.size(), variantStudy.size(), null, null, variantStudy);
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/eva/ArchiveEvaproDBAdaptor.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/eva/ArchiveEvaproDBAdaptor.java
index 8381a1239..dfc1b1764 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/eva/ArchiveEvaproDBAdaptor.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/eva/ArchiveEvaproDBAdaptor.java
@@ -17,7 +17,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
-import org.springframework.data.jpa.domain.Specifications;
import org.springframework.stereotype.Component;
import uk.ac.ebi.eva.lib.metadata.ArchiveDBAdaptor;
@@ -35,7 +34,7 @@
import java.util.*;
import java.util.stream.Collectors;
-import static org.springframework.data.jpa.domain.Specifications.where;
+import static org.springframework.data.jpa.domain.Specification.where;
@Component
public class ArchiveEvaproDBAdaptor implements ArchiveDBAdaptor {
@@ -133,14 +132,14 @@ private Specification getSpeciesAndTypeFilters(QueryOptions queryOptions) {
return null;
}
- Specifications speciesSpecifications = null;
+ Specification speciesSpecifications = null;
if (queryOptions.containsKey(QueryOptionsConstants.SPECIES)) {
Object[] species = queryOptions.getAsStringList(QueryOptionsConstants.SPECIES).toArray(new Object[]{});
speciesSpecifications = where(GenericSpecifications.in(EvaStudyBrowserRepository.COMMON_NAME, species))
.or(GenericSpecifications.in(EvaStudyBrowserRepository.SCIENTIFIC_NAME, species));
}
- Specifications typeSpecifications = null;
+ Specification typeSpecifications = null;
if (queryOptions.containsKey(QueryOptionsConstants.TYPE)) {
Object[] types = queryOptions.getAsStringList(QueryOptionsConstants.TYPE).toArray(new Object[]{});
typeSpecifications = where(GenericSpecifications.in(EvaStudyBrowserRepository.EXPERIMENT_TYPE, types));
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/eva/StudyEvaproDBAdaptor.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/eva/StudyEvaproDBAdaptor.java
index d55616512..4e7eca5a1 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/eva/StudyEvaproDBAdaptor.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/metadata/eva/StudyEvaproDBAdaptor.java
@@ -28,6 +28,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import static uk.ac.ebi.eva.lib.eva_utils.EvaproDbUtils.getSpeciesAndTypeFilters;
@@ -66,10 +67,10 @@ public QueryResult findStudyNameOrStudyId(String s, QueryOptions queryOptions) {
@Override
public QueryResult getStudyById(String s, QueryOptions queryOptions) {
long start = System.currentTimeMillis();
- EvaStudyBrowser study = evaStudyBrowserRepository.findOne(s);
+ Optional study = evaStudyBrowserRepository.findById(s);
List variantStudy = new ArrayList<>();
- if (study != null) {
- variantStudy.add(study.generateVariantStudy());
+ if (study.isPresent()) {
+ variantStudy.add(study.get().generateVariantStudy());
}
long end = System.currentTimeMillis();
return new QueryResult(null, ((Long) (end - start)).intValue(), variantStudy.size(), variantStudy.size(), null, null, variantStudy);
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/repositories/FileRepository.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/repositories/FileRepository.java
index a21af5e7b..86464bae6 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/repositories/FileRepository.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/repositories/FileRepository.java
@@ -16,6 +16,7 @@
package uk.ac.ebi.eva.lib.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import uk.ac.ebi.eva.lib.models.FileFtpReference;
import uk.ac.ebi.eva.lib.entities.File;
@@ -27,8 +28,10 @@ public interface FileRepository extends JpaRepository {
Long countByFileTypeIn(List strings);
//named query
+ @Query(nativeQuery = true)
FileFtpReference getFileFtpReferenceByFilename(@Param("filename") String filename);
//named query
+ @Query(nativeQuery = true)
List getFileFtpReferenceByNames(@Param("filenames") List filenames);
}
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/repositories/TaxonomyRepository.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/repositories/TaxonomyRepository.java
index e13bb3b3d..bb5f24549 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/repositories/TaxonomyRepository.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/repositories/TaxonomyRepository.java
@@ -16,6 +16,8 @@
package uk.ac.ebi.eva.lib.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
import uk.ac.ebi.eva.lib.models.Assembly;
import uk.ac.ebi.eva.lib.entities.Taxonomy;
@@ -23,7 +25,9 @@
public interface TaxonomyRepository extends JpaRepository {
+ @Query(nativeQuery = true)
List getBrowsableSpecies();
+ @Query(nativeQuery = true)
List getAccessionedSpecies();
}
diff --git a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/utils/ObjectMap.java b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/utils/ObjectMap.java
index 19fcaf776..ec1be3e22 100644
--- a/eva-lib/src/main/java/uk/ac/ebi/eva/lib/utils/ObjectMap.java
+++ b/eva-lib/src/main/java/uk/ac/ebi/eva/lib/utils/ObjectMap.java
@@ -295,7 +295,7 @@ public List
${maven.build.timestamp}
yyyyMMddHHmm
+ localhost
diff --git a/eva-server/src/main/java/uk/ac/ebi/eva/server/Application.java b/eva-server/src/main/java/uk/ac/ebi/eva/server/Application.java
index aa5df99c2..91c4429e5 100644
--- a/eva-server/src/main/java/uk/ac/ebi/eva/server/Application.java
+++ b/eva-server/src/main/java/uk/ac/ebi/eva/server/Application.java
@@ -22,7 +22,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
diff --git a/eva-server/src/main/resources/application.properties b/eva-server/src/main/resources/application.properties
index b3c22199d..f35571208 100644
--- a/eva-server/src/main/resources/application.properties
+++ b/eva-server/src/main/resources/application.properties
@@ -1,12 +1,12 @@
# Configure JDBC datasource OR JNDI datasource
# EVAPRO Datasource configuration
-#spring.datasource.url=@eva.evapro.jdbc.url@
-#spring.datasource.username=@eva.evapro.user@
-#spring.datasource.password=@eva.evapro.password@
+#spring.datasource.url=|eva.evapro.jdbc.url|
+#spring.datasource.username=|eva.evapro.user|
+#spring.datasource.password=|eva.evapro.password|
#spring.datasource.driver-class-name=org.postgresql.Driver
# EVAPRO JNDI configuration
-spring.datasource.jndi-name = java:/comp/env/jdbc/@eva.evapro.datasource@
+spring.datasource.jndi-name = java:/comp/env/jdbc/|eva.evapro.datasource|
#Avoid hibernate ddl schema generation/update or validation
spring.jpa.hibernate.ddl-auto = none
@@ -19,19 +19,22 @@ springfox.documentation.swagger.v2.path=/webservices/api
#spring.profiles.active=oauth2-security
#security.oauth2.resource.user-info-uri = ...
-spring.data.mongodb.host=@eva.mongo.host@
-spring.data.mongodb.authentication-database=@eva.mongo.auth.db@
-spring.data.mongodb.username=@eva.mongo.user@
-spring.data.mongodb.password=@eva.mongo.passwd@
-spring.data.mongodb.read-preference=@eva.mongo.read-preference@
+spring.data.mongodb.host=|eva.mongo.host|
+spring.data.mongodb.authentication-database=|eva.mongo.auth.db|
+spring.data.mongodb.username=|eva.mongo.user|
+spring.data.mongodb.password=|eva.mongo.passwd|
+spring.data.mongodb.read-preference=|eva.mongo.read-preference|
-db.collection-names.files=@eva.mongo.collections.files@
-db.collection-names.variants=@eva.mongo.collections.variants@
-db.collection-names.annotation-metadata=@eva.mongo.collections.annotation-metadata@
-db.collection-names.features=@eva.mongo.collections.features@
-db.collection-names.annotations=@eva.mongo.collections.annotations@
+db.collection-names.files=|eva.mongo.collections.files|
+db.collection-names.variants=|eva.mongo.collections.variants|
+db.collection-names.annotation-metadata=|eva.mongo.collections.annotation-metadata|
+db.collection-names.features=|eva.mongo.collections.features|
+db.collection-names.annotations=|eva.mongo.collections.annotations|
management.endpoints.web.exposure.include=info,health
management.info.git.mode=full
-spring.jmx.default-domain=eva.ebi.ac.uk.@timestamp@
+spring.jmx.default-domain=eva.ebi.ac.uk.|timestamp|
+
+# See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#bean-overriding
+spring.main.allow-bean-definition-overriding=true
diff --git a/eva-server/src/test/java/uk/ac/ebi/eva/server/configuration/MongoRepositoryTestConfiguration.java b/eva-server/src/test/java/uk/ac/ebi/eva/server/configuration/MongoRepositoryTestConfiguration.java
index 21143ec99..9aa5c6ee7 100644
--- a/eva-server/src/test/java/uk/ac/ebi/eva/server/configuration/MongoRepositoryTestConfiguration.java
+++ b/eva-server/src/test/java/uk/ac/ebi/eva/server/configuration/MongoRepositoryTestConfiguration.java
@@ -15,25 +15,29 @@
*/
package uk.ac.ebi.eva.server.configuration;
-import com.github.fakemongo.Fongo;
import com.mongodb.MongoClient;
+
+import org.springframework.boot.test.autoconfigure.data.mongo.AutoConfigureDataMongo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
-import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.mongodb.MongoDbFactory;
+import org.springframework.data.mongodb.config.EnableMongoAuditing;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
import uk.ac.ebi.eva.lib.MongoConfiguration;
import uk.ac.ebi.eva.lib.Profiles;
+import uk.ac.ebi.eva.lib.configuration.SpringDataMongoDbProperties;
@Configuration
@Import({MongoConfiguration.class})
@PropertySource({"classpath:application.properties"})
+@EnableMongoAuditing
+@AutoConfigureDataMongo
public class MongoRepositoryTestConfiguration {
@Bean
@@ -43,14 +47,14 @@ public MongoTemplate mongoTemplate(MongoDbFactory mongoDbFactory,
}
@Bean
- @Profile(Profiles.TEST_MONGO_FACTORY)
- public MongoDbFactory mongoDbFactory(MongoClient mongoClient) throws Exception {
- return new SimpleMongoDbFactory(mongoClient, this.getDatabaseName());
+ public MongoClient mongoClient(SpringDataMongoDbProperties properties) throws Exception {
+ return MongoConfiguration.getMongoClient(properties);
}
@Bean
- public MongoClient mongoClient() {
- return new Fongo("defaultInstance").getMongo();
+ @Profile(Profiles.TEST_MONGO_FACTORY)
+ public MongoDbFactory mongoDbFactory(MongoClient mongoClient) throws Exception {
+ return new SimpleMongoDbFactory(mongoClient, this.getDatabaseName());
}
private String getDatabaseName() {
diff --git a/eva-server/src/test/java/uk/ac/ebi/eva/server/test/rule/FixSpringMongoDbRule.java b/eva-server/src/test/java/uk/ac/ebi/eva/server/test/rule/FixSpringMongoDbRule.java
new file mode 100644
index 000000000..78571d620
--- /dev/null
+++ b/eva-server/src/test/java/uk/ac/ebi/eva/server/test/rule/FixSpringMongoDbRule.java
@@ -0,0 +1,24 @@
+package uk.ac.ebi.eva.server.test.rule;
+
+import com.lordofthejars.nosqlunit.mongodb.MongoDbConfiguration;
+import com.lordofthejars.nosqlunit.mongodb.SpringMongoDbRule;
+
+/**
+ * Temporary fix until nosql unit rc-6 or final is released
+ */
+public class FixSpringMongoDbRule extends SpringMongoDbRule {
+
+ public FixSpringMongoDbRule(MongoDbConfiguration mongoDbConfiguration) {
+ super(mongoDbConfiguration);
+ }
+
+ public FixSpringMongoDbRule(MongoDbConfiguration mongoDbConfiguration, Object object) {
+ super(mongoDbConfiguration, object);
+ }
+
+ @Override
+ public void close() {
+ // DO NOT CLOSE the connection (Spring will do it when destroying the context)
+ }
+
+}
diff --git a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerIntegrationTest.java b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerIntegrationTest.java
index b376be926..61fa3002c 100644
--- a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerIntegrationTest.java
+++ b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerIntegrationTest.java
@@ -16,6 +16,7 @@
package uk.ac.ebi.eva.server.ws;
import com.lordofthejars.nosqlunit.annotation.UsingDataSet;
+import com.lordofthejars.nosqlunit.mongodb.MongoDbConfigurationBuilder;
import com.lordofthejars.nosqlunit.mongodb.MongoDbRule;
import org.junit.Before;
import org.junit.Rule;
@@ -36,11 +37,11 @@
import uk.ac.ebi.eva.commons.mongodb.services.VariantWithSamplesAndAnnotationsService;
import uk.ac.ebi.eva.lib.Profiles;
import uk.ac.ebi.eva.server.configuration.MongoRepositoryTestConfiguration;
+import uk.ac.ebi.eva.server.test.rule.FixSpringMongoDbRule;
import java.net.URISyntaxException;
import java.util.List;
-import static com.lordofthejars.nosqlunit.mongodb.MongoDbRule.MongoDbRuleBuilder.newMongoDbRule;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -71,7 +72,8 @@ public class GeneWSServerIntegrationTest {
MongoDbFactory mongoDbFactory;
@Rule
- public MongoDbRule mongoDbRule = newMongoDbRule().defaultSpringMongoDb(TEST_DB);
+ public MongoDbRule mongoDbRule = new FixSpringMongoDbRule(
+ MongoDbConfigurationBuilder.mongoDb().databaseName(TEST_DB).build());
@Before
diff --git a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerIntegrationTest.java b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerIntegrationTest.java
index 2b7473a1b..a2c6e6d40 100644
--- a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerIntegrationTest.java
+++ b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerIntegrationTest.java
@@ -142,7 +142,7 @@ public void testVepVersionAndVepCacheVersionFilter() {
}
@Test
- public void testVariantSearchByList() {
+ public void testVariantSearchByList() throws Exception {
String testVariantIds = "rs370478,rs199692280";
String url = "/v1/variants/" + testVariantIds + "/?species=mmusculus_grcm38";
JSONObject jsonObject = WSTestHelpers.testRestTemplateHelperJsonObject(url, restTemplate);
@@ -169,7 +169,7 @@ public void testVariantSearchByList() {
}
@Test
- public void testProteinSubstitutionScoresModel() {
+ public void testProteinSubstitutionScoresModel() throws Exception {
String testVariantId = "rs370478";
String url = "/v1/variants/" + testVariantId + "/info?species=mmusculus_grcm38";
JSONObject jsonObject = WSTestHelpers.testRestTemplateHelperJsonObject(url, restTemplate);
diff --git a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerTest.java b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerTest.java
index ef577f308..1c24eb41c 100644
--- a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerTest.java
+++ b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerTest.java
@@ -44,10 +44,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.eq;
+
/**
* Tests for VariantWSServer
@@ -81,7 +82,7 @@ public void setUp() throws Exception {
List variantEntities = Collections.singletonList(VARIANT);
given(variantEntityRepository
- .findByChromosomeAndStartAndReferenceAndAlternate(eq(CHROMOSOME), anyInt(), any(), any(), any()))
+ .findByChromosomeAndStartAndReferenceAndAlternate(eq(CHROMOSOME), anyLong(), any(), any(), any()))
.willReturn(variantEntities);
given(variantEntityRepository.findByIdsAndComplexFilters(eq(Arrays.asList(VARIANT_ID)), any(), any(), any(), any()))
diff --git a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerV2Test.java b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerV2Test.java
index 46487c8b8..3f927adca 100644
--- a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerV2Test.java
+++ b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/VariantWSServerV2Test.java
@@ -38,13 +38,11 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
+
import uk.ac.ebi.eva.commons.core.models.Annotation;
-import uk.ac.ebi.eva.commons.core.models.pipeline.Variant;
import uk.ac.ebi.eva.commons.core.models.ws.VariantSourceEntryWithSampleNames;
import uk.ac.ebi.eva.commons.core.models.ws.VariantWithSamplesAndAnnotation;
import uk.ac.ebi.eva.commons.mongodb.services.VariantWithSamplesAndAnnotationsService;
-import uk.ac.ebi.eva.lib.utils.QueryResponse;
-import uk.ac.ebi.eva.lib.utils.QueryResult;
import java.net.URISyntaxException;
import java.util.Collections;
@@ -52,10 +50,11 @@
import static org.junit.Assert.*;
import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.eq;
+
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -86,7 +85,7 @@ public void setUp() throws Exception {
VARIANT.addSourceEntry(new VariantSourceEntryWithSampleNames("fid", "sid", null, null, null, null, null));
List variantEntities = Collections.singletonList(VARIANT);
- given(service.findByChromosomeAndStartAndReferenceAndAlternate(eq(CHROMOSOME), anyInt(), any(), any(), any()))
+ given(service.findByChromosomeAndStartAndReferenceAndAlternate(eq(CHROMOSOME), anyLong(), any(), any(), any()))
.willReturn(variantEntities);
}
diff --git a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/WSTestHelpers.java b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/WSTestHelpers.java
index 80d3e24fe..8089ca8bf 100644
--- a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/WSTestHelpers.java
+++ b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/WSTestHelpers.java
@@ -38,7 +38,8 @@
public class WSTestHelpers {
- public static JSONObject testRestTemplateHelperJsonObject(String url, TestRestTemplate restTemplate) {
+ public static JSONObject testRestTemplateHelperJsonObject(String url, TestRestTemplate restTemplate)
+ throws Exception {
ResponseEntity response = restTemplate.exchange(
url, HttpMethod.GET, null,
new ParameterizedTypeReference() {
diff --git a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/ga4gh/GA4GHBeaconWSServerTest.java b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/ga4gh/GA4GHBeaconWSServerTest.java
index 9a3280e93..39f89a1c2 100644
--- a/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/ga4gh/GA4GHBeaconWSServerTest.java
+++ b/eva-server/src/test/java/uk/ac/ebi/eva/server/ws/ga4gh/GA4GHBeaconWSServerTest.java
@@ -38,10 +38,10 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.eq;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -59,7 +59,7 @@ public void setUp() throws Exception {
"alternate", "rs1");
List variantEntities = Collections.singletonList(variant);
- given(service.findByChromosomeAndStartAndAltAndStudyIn(eq("1"), anyInt(), any(), any(), any()))
+ given(service.findByChromosomeAndStartAndAltAndStudyIn(eq("1"), anyLong(), any(), any(), any()))
.willReturn(variantEntities);
}
diff --git a/eva-server/src/test/resources/application.properties b/eva-server/src/test/resources/properties/application.properties
similarity index 55%
rename from eva-server/src/test/resources/application.properties
rename to eva-server/src/test/resources/properties/application.properties
index dcd8fce01..b18dcb118 100644
--- a/eva-server/src/test/resources/application.properties
+++ b/eva-server/src/test/resources/properties/application.properties
@@ -1,11 +1,14 @@
-spring.data.mongodb.host=localhost
+spring.data.mongodb.host=|eva.mongo.host.test|
spring.data.mongodb.authentication-database=
spring.data.mongodb.username=
spring.data.mongodb.password=
-spring.data.mongodb.read-preference=
+spring.data.mongodb.read-preference=secondaryPreferred
db.collection-names.files=testFiles
db.collection-names.variants=testVariants
db.collection-names.annotation-metadata=testMetadata
db.collection-names.annotations=testAnnotations
db.collection-names.features=testFeatures
+
+# See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#bean-overriding
+spring.main.allow-bean-definition-overriding=true
diff --git a/pom.xml b/pom.xml
index 14349f791..cbff59c77 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.2.RELEASE
+ 2.1.0.RELEASE
@@ -49,22 +49,22 @@
uk.ac.ebi.eva
variation-commons-core
- 0.7-SNAPSHOT
+ 0.7.4-SNAPSHOT
uk.ac.ebi.eva
variation-commons-jpa
- 0.7-SNAPSHOT
+ 0.7.4-SNAPSHOT
uk.ac.ebi.eva
variation-commons-mongodb
- 0.7-SNAPSHOT
+ 0.7.4-SNAPSHOT
uk.ac.ebi.eva
variation-commons-beacon
- 0.7-SNAPSHOT
+ 0.7.4-SNAPSHOT
org.postgresql
@@ -88,12 +88,6 @@
2.5.0
compile
-
- com.github.fakemongo
- fongo
- 2.0.12
- test
-
com.h2database
h2
@@ -108,29 +102,18 @@
com.lordofthejars
nosqlunit-mongodb
- 0.10.0
-
-
- com.github.fakemongo
- fongo
-
-
-
-
- javax.validation
- validation-api
- 1.1.0.Final
+ 0.14.0
org.springframework.boot
spring-boot-starter-tomcat
- 1.4.2.RELEASE
+ 2.1.0.RELEASE
provided
com.fasterxml.jackson.core
jackson-databind
- 2.8.11.3
+ 2.9.7
@@ -154,8 +137,13 @@
org.apache.maven.plugins
maven-resources-plugin
+ 2.6
UTF-8
+
+
+ |
+