Skip to content

Commit

Permalink
Merge pull request #321 from europeana/EA-3647-upgrade-to-mongo6
Browse files Browse the repository at this point in the history
update to mongo6, morphia version and mongo driver #EA-3647
  • Loading branch information
gsergiu authored Apr 19, 2024
2 parents 146fd69 + e498af9 commit caf6a7a
Show file tree
Hide file tree
Showing 20 changed files with 263 additions and 174 deletions.
135 changes: 71 additions & 64 deletions entity-management-definitions/pom.xml
Original file line number Diff line number Diff line change
@@ -1,76 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>entity-management</artifactId>
<groupId>eu.europeana.api</groupId>
<version>1.6.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>entity-management-definitions</artifactId>
<packaging>jar</packaging>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>entity-management</artifactId>
<groupId>eu.europeana.api</groupId>
<version>1.6.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>entity-management-definitions</artifactId>
<packaging>jar</packaging>

<properties>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../${aggregate.report.xml}
<properties>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/../${aggregate.report.xml}
</sonar.coverage.jacoco.xmlReportPaths>
</properties>
</properties>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>

<dependency>
<groupId>eu.europeana.api.commons</groupId>
<artifactId>commons-definitions</artifactId>
<version>${api.commons.version}</version>
<exclusions>
<exclusion>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>eu.europeana.api.commons</groupId>
<artifactId>commons-definitions</artifactId>
<version>${api.commons.version}</version>
<exclusions>
<exclusion>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>dev.morphia.morphia</groupId>
<artifactId>morphia-core</artifactId>
<version>${morphia.version}</version>
</dependency>
<dependency>
<groupId>dev.morphia.morphia</groupId>
<artifactId>morphia-core</artifactId>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>

<!-- Only used for Email validation in EntityFieldsCompleteValidator -->
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${apache.commons.validator.version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>eu.europeana.corelib</groupId>
<artifactId>corelib-schemaorg</artifactId>
<version>${corelib.version}</version>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Only used for Email validation in EntityFieldsCompleteValidator -->
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${apache.commons.validator.version}</version>
</dependency>

<dependency>
<groupId>eu.europeana.corelib</groupId>
<artifactId>corelib-schemaorg</artifactId>
<version>${corelib.version}</version>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
105 changes: 63 additions & 42 deletions entity-management-mongo/pom.xml
Original file line number Diff line number Diff line change
@@ -1,52 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>entity-management</artifactId>
<groupId>eu.europeana.api</groupId>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>entity-management</artifactId>
<groupId>eu.europeana.api</groupId>
<version>1.6.4-SNAPSHOT</version>
</parent>
</parent>

<artifactId>entity-management-mongo</artifactId>

<artifactId>entity-management-mongo</artifactId>

<name>entity-management-mongo</name>
<name>entity-management-mongo</name>

<properties>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../${aggregate.report.xml}</sonar.coverage.jacoco.xmlReportPaths>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/../${aggregate.report.xml}</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<dependencies>

<dependency>
<groupId>eu.europeana.api</groupId>
<artifactId>entity-management-definitions</artifactId>
<version>1.6.4-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>eu.europeana.api</groupId>
<artifactId>entity-management-common</artifactId>
<version>1.6.4-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>eu.europeana.api.commons</groupId>
<version>${api.commons.version}</version>
<artifactId>commons-nosql</artifactId>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
</exclusion>

</exclusions>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependencies>

<dependency>
<groupId>eu.europeana.api</groupId>
<artifactId>entity-management-definitions</artifactId>
<version>1.6.4-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>eu.europeana.api</groupId>
<artifactId>entity-management-common</artifactId>
<version>1.6.4-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>eu.europeana.api.commons</groupId>
<version>${api.commons.version}</version>
<artifactId>commons-nosql</artifactId>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
</exclusion>

<exclusion>
<groupId>dev.morphia.morphia</groupId>
<artifactId>core</artifactId>
</exclusion>
<exclusion>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-legacy</artifactId>
</exclusion>
<exclusion>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- upgrade monhia verion for monngo 6-->
<dependency>
<groupId>dev.morphia.morphia</groupId>
<artifactId>morphia-core</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>eu.europeana.api</groupId>
<artifactId>spring-batch-mongo</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package eu.europeana.entitymanagement.mongo.repository;

import static dev.morphia.query.experimental.filters.Filters.eq;
import static dev.morphia.query.filters.Filters.eq;
import static eu.europeana.entitymanagement.mongo.utils.MorphiaUtils.MAJORITY_WRITE_MODIFY_OPTS;

import dev.morphia.Datastore;
import dev.morphia.query.experimental.updates.UpdateOperators;
import dev.morphia.query.updates.UpdateOperators;
import eu.europeana.entitymanagement.common.vocabulary.AppConfigConstants;
import eu.europeana.entitymanagement.definitions.model.EntityIdGenerator;
import javax.annotation.Resource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package eu.europeana.entitymanagement.mongo.repository;

import static dev.morphia.query.experimental.filters.Filters.eq;
import static dev.morphia.query.filters.Filters.eq;

import eu.europeana.entitymanagement.common.vocabulary.AppConfigConstants;
import eu.europeana.entitymanagement.definitions.ConceptSchemeFields;
Expand Down Expand Up @@ -32,7 +32,7 @@ public long deleteForGood(long identifier) {

/** Drops the ConceptScheme collection. */
public void dropCollection() {
getDataStore().getMapper().getCollection(ConceptScheme.class).drop();
getDataStore().getCollection(ConceptScheme.class).drop();
}

public ConceptScheme findConceptScheme(long identifier) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package eu.europeana.entitymanagement.mongo.repository;

import static dev.morphia.query.Sort.ascending;
import static dev.morphia.query.experimental.filters.Filters.eq;
import static dev.morphia.query.experimental.filters.Filters.in;
import static dev.morphia.query.experimental.filters.Filters.ne;
import static dev.morphia.query.experimental.filters.Filters.or;
import static dev.morphia.query.filters.Filters.eq;
import static dev.morphia.query.filters.Filters.in;
import static dev.morphia.query.filters.Filters.ne;
import static dev.morphia.query.filters.Filters.or;
import static eu.europeana.entitymanagement.definitions.EntityRecordFields.DISABLED;
import static eu.europeana.entitymanagement.definitions.EntityRecordFields.ENTITY_AGGREGATED_VIA;
import static eu.europeana.entitymanagement.definitions.EntityRecordFields.ENTITY_EXACT_MATCH;
Expand All @@ -22,8 +22,8 @@
import com.mongodb.client.result.UpdateResult;
import dev.morphia.query.FindOptions;
import dev.morphia.query.Query;
import dev.morphia.query.experimental.filters.Filter;
import dev.morphia.query.experimental.updates.UpdateOperators;
import dev.morphia.query.filters.Filter;
import dev.morphia.query.updates.UpdateOperators;
import eu.europeana.entitymanagement.common.vocabulary.AppConfigConstants;
import eu.europeana.entitymanagement.definitions.model.EntityIdGenerator;
import eu.europeana.entitymanagement.definitions.model.EntityRecord;
Expand Down Expand Up @@ -163,8 +163,8 @@ public EntityRecord save(EntityRecord entityRecord) {

/** Drops the EntityRecord and Entity ID generator collections. */
public void dropCollection() {
getDataStore().getMapper().getCollection(EntityRecord.class).drop();
getDataStore().getMapper().getCollection(EntityIdGenerator.class).drop();
getDataStore().getCollection(EntityRecord.class).drop();
getDataStore().getCollection(EntityIdGenerator.class).drop();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package eu.europeana.entitymanagement.mongo.repository;

import static dev.morphia.query.experimental.filters.Filters.in;
import static dev.morphia.query.filters.Filters.in;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import dev.morphia.Datastore;
import dev.morphia.query.experimental.filters.Filter;
import dev.morphia.query.filters.Filter;
import eu.europeana.entitymanagement.common.vocabulary.AppConfigConstants;
import eu.europeana.entitymanagement.definitions.model.Vocabulary;

Expand Down Expand Up @@ -55,7 +55,7 @@ public List<Vocabulary> saveBulk(List<Vocabulary> vocabs) {
* clear database collection
*/
public void dropCollection() {
datastore.getMapper().getCollection(Vocabulary.class).drop();
datastore.getCollection(Vocabulary.class).drop();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import com.mongodb.assertions.Assertions;
import dev.morphia.query.experimental.filters.Filter;
import dev.morphia.query.experimental.filters.Filters;
import dev.morphia.query.filters.Filter;
import dev.morphia.query.filters.Filters;
import eu.europeana.entitymanagement.AbstractIntegrationTest;
import eu.europeana.entitymanagement.batch.config.EntityUpdateJobConfig;
import eu.europeana.entitymanagement.batch.repository.FailedTaskRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ mongo.truststore=
# Whether a "NoHandlerFoundException" should be thrown if no Handler was found to process a request.
spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=false

# SG: should fix cyclic dependencies
#The dependencies of some of the beans in the application context form a cycle:
# entityManagementApp (field private eu.europeana.entitymanagement.batch.service.BatchEntityUpdateExecutor eu.europeana.entitymanagement.EntityManagementApp.batchUpdateExecutor)
# batchEntityUpdateExecutor defined in file [C:\java\git\europeana\entity-management\entity-management-web\target\classes\eu\europeana\entitymanagement\batch\service\BatchEntityUpdateExecutor.class]
#| jobLauncherConfig
spring.main.allow-circular-references=true
8 changes: 8 additions & 0 deletions entity-management-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
<exclusion>
<groupId>dev.morphia.morphia</groupId>
<artifactId>core</artifactId>
</exclusion>
<exclusion>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-legacy</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down
Loading

0 comments on commit caf6a7a

Please sign in to comment.