RED-8702: Explore document databases to store entityLog
* refactoring
This commit is contained in:
parent
6ba00325d3
commit
14a219df75
@ -31,6 +31,7 @@ dependencies {
|
||||
|
||||
implementation(project(":redaction-service-api-v1")) { exclude(group = "com.iqser.red.service", module = "persistence-service-internal-api-v1") }
|
||||
implementation("com.iqser.red.service:persistence-service-internal-api-v1:${persistenceServiceVersion}") { exclude(group = "org.springframework.boot") }
|
||||
implementation("com.iqser.red.service:persistence-service-processor-v1:${persistenceServiceVersion}")
|
||||
implementation("com.knecon.fforesight:layoutparser-service-internal-api:${layoutParserVersion}")
|
||||
|
||||
implementation("com.iqser.red.commons:spring-commons:6.2.0")
|
||||
|
||||
@ -71,7 +71,7 @@ public class MigrationMessageReceiver {
|
||||
|
||||
log.info("Storing migrated entityLog and ids to migrate in DB for file {}", migrationRequest.getFileId());
|
||||
//todo
|
||||
redactionStorageService.storeObject(migrationRequest.getDossierId(), migrationRequest.getFileId(), FileType.ENTITY_LOG, migratedEntityLog.getEntityLog());
|
||||
redactionStorageService.saveEntityLog(migrationRequest.getDossierId(), migrationRequest.getFileId(), migratedEntityLog.getEntityLog());
|
||||
redactionStorageService.storeObject(migrationRequest.getDossierId(), migrationRequest.getFileId(), FileType.MIGRATED_IDS, migratedEntityLog.getMigratedIds());
|
||||
|
||||
sendFinished(MigrationResponse.builder().dossierId(migrationRequest.getDossierId()).fileId(migrationRequest.getFileId()).build());
|
||||
|
||||
@ -179,7 +179,7 @@ public class MigrationIntegrationTest extends BuildDocumentIntegrationTest {
|
||||
manualRedactions,
|
||||
TEST_FILE_ID);
|
||||
|
||||
redactionStorageService.storeObject(TEST_DOSSIER_ID, TEST_FILE_ID, FileType.ENTITY_LOG, migratedEntityLog.getEntityLog());
|
||||
redactionStorageService.saveEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID, migratedEntityLog.getEntityLog());
|
||||
assertEquals(mergedRedactionLog.getRedactionLogEntry().size(), migratedEntityLog.getEntityLog().getEntityLogEntry().size());
|
||||
EntityLog entityLog = migratedEntityLog.getEntityLog();
|
||||
assertEquals(mergedRedactionLog.getAnalysisNumber(), entityLog.getAnalysisNumber());
|
||||
|
||||
@ -19,6 +19,8 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
@ -29,20 +31,18 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Change;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogEntry;
|
||||
import com.iqser.red.service.redaction.v1.server.client.DictionaryClient;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogDocument;
|
||||
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogDocumentRepository;
|
||||
import com.iqser.red.service.redaction.v1.server.mongodeprecated.EntityLogDocumentService;
|
||||
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogMongoService;
|
||||
import com.iqser.red.service.redaction.v1.server.mongodeprecated._EntityLogDocumentRepository;
|
||||
import com.iqser.red.service.redaction.v1.server.storage.RedactionStorageService;
|
||||
import com.iqser.red.storage.commons.service.StorageServiceImpl;
|
||||
import com.knecon.fforesight.mongo.database.commons.config.MongoDbConfiguration;
|
||||
import com.knecon.fforesight.mongo.database.commons.config.MultiTenantMongoDBFactory;
|
||||
@ -92,18 +92,9 @@ public class MyOtherMongoTest {
|
||||
|
||||
private static final String CONNECTION_STRING = String.format("mongodb://%s:%s@%s:%s/", USERNAME, PASSWORD, HOSTNAME, PORT);
|
||||
|
||||
@Autowired
|
||||
private EntityLogDocumentRepository entityLogDocumentRepository;
|
||||
|
||||
@Autowired
|
||||
private EntityLogDocumentService entityLogDocumentService;
|
||||
|
||||
@Autowired
|
||||
private StorageServiceImpl storageService;
|
||||
|
||||
@Autowired
|
||||
private _EntityLogDocumentRepository _entityLogDocumentRepository;
|
||||
|
||||
@Autowired
|
||||
private EntityLogMongoService entityLogMongoService;
|
||||
|
||||
@ -125,6 +116,7 @@ public class MyOtherMongoTest {
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SneakyThrows
|
||||
public void testUpdateBigEntityLogDocumentByAddingOne() {
|
||||
@ -141,6 +133,7 @@ public class MyOtherMongoTest {
|
||||
assertEquals(found.get().getEntityLogEntry().size(), 1707);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SneakyThrows
|
||||
public void testUpdateBigEntityLogDocumentByNewLog() {
|
||||
@ -150,7 +143,7 @@ public class MyOtherMongoTest {
|
||||
objectMapper.registerModule(new JavaTimeModule());
|
||||
|
||||
EntityLog entityLog = objectMapper.readValue(file.getInputStream(), EntityLog.class);
|
||||
entityLog.setAnalysisNumber(entityLog.getAnalysisNumber()+1);
|
||||
entityLog.setAnalysisNumber(entityLog.getAnalysisNumber() + 1);
|
||||
|
||||
entityLogMongoService.saveEntityLog(TEST_DOSSIER_2_ID, TEST_FILE_2_ID, entityLog);
|
||||
|
||||
@ -160,6 +153,7 @@ public class MyOtherMongoTest {
|
||||
assertEquals(found.get().getEntityLogEntry().size(), 1707);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SneakyThrows
|
||||
public void testUpdateBigEntityLogDocumentAnalysisNumber() {
|
||||
@ -169,7 +163,7 @@ public class MyOtherMongoTest {
|
||||
objectMapper.registerModule(new JavaTimeModule());
|
||||
|
||||
EntityLog entityLog = objectMapper.readValue(file.getInputStream(), EntityLog.class);
|
||||
entityLog.setAnalysisNumber(entityLog.getAnalysisNumber()+1);
|
||||
entityLog.setAnalysisNumber(entityLog.getAnalysisNumber() + 1);
|
||||
|
||||
entityLogMongoService.saveEntityLog(TEST_DOSSIER_2_ID, TEST_FILE_2_ID, entityLog);
|
||||
|
||||
@ -178,6 +172,7 @@ public class MyOtherMongoTest {
|
||||
assertEquals(found.get().getAnalysisNumber(), entityLog.getAnalysisNumber());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SneakyThrows
|
||||
public void testFindEntries() {
|
||||
@ -295,7 +290,7 @@ public class MyOtherMongoTest {
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(exclude = {RabbitAutoConfiguration.class})
|
||||
@EnableAutoConfiguration(exclude = {RabbitAutoConfiguration.class, LiquibaseAutoConfiguration.class, DataSourceAutoConfiguration.class})
|
||||
@Import({MongoDbConfiguration.class, MultiTenantMongoDBFactory.class, MongoClientCache.class, MongoDataSources.class, MongoConnectionProviderImpl.class})
|
||||
@ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE)})
|
||||
public static class MongoTestConfiguration {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user