RED-7669: improve OCR performance
This commit is contained in:
parent
f600ffd118
commit
cc45d21586
@ -1,81 +0,0 @@
|
||||
package com.iqser.red.service.peristence.v1.server.integration.tests;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import com.iqser.red.persistence.service.v1.external.api.impl.controller.DossierTemplateController;
|
||||
import com.iqser.red.persistence.service.v1.external.api.impl.controller.StatusController;
|
||||
import com.iqser.red.persistence.service.v2.external.api.impl.controller.ComponentControllerV2;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.utils.AbstractPersistenceServerServiceTest;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.ComponentLogService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileManagementStorageService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileStatusService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLog;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLogEntry;
|
||||
|
||||
public class ComponentLogSortingTest extends AbstractPersistenceServerServiceTest {
|
||||
|
||||
@Autowired
|
||||
private ComponentLogService componentLogService;
|
||||
|
||||
@Autowired
|
||||
private ComponentControllerV2 componentControllerV2;
|
||||
|
||||
@MockBean
|
||||
private FileManagementStorageService fileManagementStorageService;
|
||||
|
||||
@MockBean
|
||||
private DossierTemplateController dossierTemplateController;
|
||||
|
||||
@MockBean
|
||||
private StatusController statusController;
|
||||
|
||||
@MockBean
|
||||
private FileStatusService fileStatusService;
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void stubMethods() {
|
||||
|
||||
MockitoAnnotations.openMocks(this);
|
||||
ComponentLog componentLog = new ComponentLog();
|
||||
List<ComponentLogEntry> entries = List.of(new ComponentLogEntry("Sex", Collections.emptyList()), new ComponentLogEntry("Study_Title", Collections.emptyList()));
|
||||
componentLog.setComponentLogEntries(entries);
|
||||
when(fileManagementStorageService.getComponentLog(any(), any())).thenReturn(componentLog);
|
||||
when(fileStatusService.getFileName(any())).thenReturn("file");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testComponentLogIsSorted() {
|
||||
|
||||
var componentLog = componentLogService.getComponentLog("123", "123");
|
||||
assertEquals(2, componentLog.getComponentLogEntries().size());
|
||||
assertEquals("Study_Title", componentLog.getComponentLogEntries().get(0).getName());
|
||||
assertEquals("Sex", componentLog.getComponentLogEntries().get(1).getName());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testComponentLogIsSortedInController() {
|
||||
|
||||
var result = componentControllerV2.getComponents("123", "123", "123", true);
|
||||
List<String> components = new LinkedList<>();
|
||||
result.getComponents().forEach((key, value) -> components.add(key));
|
||||
assertEquals(2, result.getComponents().size());
|
||||
assertEquals("Study_Title", components.get(0));
|
||||
assertEquals("Sex", components.get(1));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user