Search in sources :

Example 1 with PROJECT_TYPE_ANNOTATION

use of de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_ANNOTATION in project webanno by webanno.

the class CuratedDocumentsExporterTest method thatImportingAnnotationProjectWorks_3_6_1.

@Test
public void thatImportingAnnotationProjectWorks_3_6_1() throws Exception {
    project.setMode(PROJECT_TYPE_ANNOTATION);
    // Export the project and import it again
    List<Pair<SourceDocument, String>> imported = runImportAndFetchDocuments(new ZipFile("src/test/resources/exports/Export+Test+-+Curated+annotation+project_3_6_1.zip"));
    // Check that the curation for the document in the project is imported
    assertThat(imported).extracting(p -> p.getKey().getName()).containsExactlyInAnyOrder("example_sentence.txt");
    assertThat(imported).extracting(Pair::getValue).containsExactlyInAnyOrder(CURATION_USER);
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) MockitoAnnotations.initMocks(org.mockito.MockitoAnnotations.initMocks) CORRECTION_USER(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.CORRECTION_USER) Mock(org.mockito.Mock) ImportExportServiceImpl(de.tudarmstadt.ukp.clarin.webanno.api.dao.ImportExportServiceImpl) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) CasStorageService(de.tudarmstadt.ukp.clarin.webanno.api.CasStorageService) CURATION_USER(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.CURATION_USER) PROJECT_TYPE_ANNOTATION(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_ANNOTATION) Mockito.spy(org.mockito.Mockito.spy) XmiFormatSupport(de.tudarmstadt.ukp.clarin.webanno.xmi.XmiFormatSupport) ArrayList(java.util.ArrayList) AnnotationSchemaService(de.tudarmstadt.ukp.clarin.webanno.api.AnnotationSchemaService) RepositoryProperties(de.tudarmstadt.ukp.clarin.webanno.api.RepositoryProperties) ArgumentCaptor(org.mockito.ArgumentCaptor) Pair(org.apache.commons.lang3.tuple.Pair) Arrays.asList(java.util.Arrays.asList) ZipFile(java.util.zip.ZipFile) Project(de.tudarmstadt.ukp.clarin.webanno.model.Project) CasStorageServiceImpl(de.tudarmstadt.ukp.clarin.webanno.api.dao.CasStorageServiceImpl) Before(org.junit.Before) PROJECT_TYPE_CORRECTION(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_CORRECTION) DocumentService(de.tudarmstadt.ukp.clarin.webanno.api.DocumentService) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) ProjectExportServiceImpl(de.tudarmstadt.ukp.clarin.webanno.api.dao.export.ProjectExportServiceImpl) BackupProperties(de.tudarmstadt.ukp.clarin.webanno.api.dao.BackupProperties) File(java.io.File) ExportedProject(de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProject) Mockito.verify(org.mockito.Mockito.verify) List(java.util.List) Rule(org.junit.Rule) ProjectImportRequest(de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectImportRequest) SourceDocument(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument) ImportExportService(de.tudarmstadt.ukp.clarin.webanno.api.ImportExportService) TemporaryFolder(org.junit.rules.TemporaryFolder) ZipFile(java.util.zip.ZipFile) Pair(org.apache.commons.lang3.tuple.Pair) Test(org.junit.Test)

Example 2 with PROJECT_TYPE_ANNOTATION

use of de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_ANNOTATION in project webanno by webanno.

the class AnnotationDocumentsExporterTest method thatImportingAnnotationProjectWorks_3_6_1.

@Test
public void thatImportingAnnotationProjectWorks_3_6_1() throws Exception {
    project.setMode(PROJECT_TYPE_ANNOTATION);
    // Export the project and import it again
    List<Pair<SourceDocument, String>> imported = runImportAndFetchDocuments(new ZipFile("src/test/resources/exports/Export+Test+-+Curated+annotation+project_3_6_1.zip"));
    // Check that the curation for the document in the project is imported
    assertThat(imported).extracting(p -> p.getKey().getName()).containsExactlyInAnyOrder("example_sentence.txt", "example_sentence.txt");
    assertThat(imported).extracting(Pair::getValue).containsExactlyInAnyOrder(INITIAL_CAS_PSEUDO_USER, "admin");
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) MockitoAnnotations.initMocks(org.mockito.MockitoAnnotations.initMocks) CORRECTION_USER(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.CORRECTION_USER) Mock(org.mockito.Mock) ImportExportServiceImpl(de.tudarmstadt.ukp.clarin.webanno.api.dao.ImportExportServiceImpl) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) CasStorageService(de.tudarmstadt.ukp.clarin.webanno.api.CasStorageService) PROJECT_TYPE_ANNOTATION(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_ANNOTATION) XmiFormatSupport(de.tudarmstadt.ukp.clarin.webanno.xmi.XmiFormatSupport) ArrayList(java.util.ArrayList) AnnotationSchemaService(de.tudarmstadt.ukp.clarin.webanno.api.AnnotationSchemaService) RepositoryProperties(de.tudarmstadt.ukp.clarin.webanno.api.RepositoryProperties) Pair(org.apache.commons.lang3.tuple.Pair) Arrays.asList(java.util.Arrays.asList) ZipFile(java.util.zip.ZipFile) Project(de.tudarmstadt.ukp.clarin.webanno.model.Project) INITIAL_CAS_PSEUDO_USER(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.INITIAL_CAS_PSEUDO_USER) CasStorageServiceImpl(de.tudarmstadt.ukp.clarin.webanno.api.dao.CasStorageServiceImpl) Before(org.junit.Before) PROJECT_TYPE_CORRECTION(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_CORRECTION) DocumentService(de.tudarmstadt.ukp.clarin.webanno.api.DocumentService) Test(org.junit.Test) ExportedSourceDocument(de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedSourceDocument) Mockito.when(org.mockito.Mockito.when) ProjectExportServiceImpl(de.tudarmstadt.ukp.clarin.webanno.api.dao.export.ProjectExportServiceImpl) BackupProperties(de.tudarmstadt.ukp.clarin.webanno.api.dao.BackupProperties) File(java.io.File) ExportedProject(de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProject) FilenameUtils.removeExtension(org.apache.commons.io.FilenameUtils.removeExtension) List(java.util.List) Rule(org.junit.Rule) ProjectImportRequest(de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectImportRequest) SourceDocument(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument) ImportExportService(de.tudarmstadt.ukp.clarin.webanno.api.ImportExportService) TemporaryFolder(org.junit.rules.TemporaryFolder) ZipFile(java.util.zip.ZipFile) Pair(org.apache.commons.lang3.tuple.Pair) Test(org.junit.Test)

Aggregations

AnnotationSchemaService (de.tudarmstadt.ukp.clarin.webanno.api.AnnotationSchemaService)2 CasStorageService (de.tudarmstadt.ukp.clarin.webanno.api.CasStorageService)2 DocumentService (de.tudarmstadt.ukp.clarin.webanno.api.DocumentService)2 ImportExportService (de.tudarmstadt.ukp.clarin.webanno.api.ImportExportService)2 RepositoryProperties (de.tudarmstadt.ukp.clarin.webanno.api.RepositoryProperties)2 CORRECTION_USER (de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.CORRECTION_USER)2 PROJECT_TYPE_ANNOTATION (de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_ANNOTATION)2 PROJECT_TYPE_CORRECTION (de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_CORRECTION)2 BackupProperties (de.tudarmstadt.ukp.clarin.webanno.api.dao.BackupProperties)2 CasStorageServiceImpl (de.tudarmstadt.ukp.clarin.webanno.api.dao.CasStorageServiceImpl)2 ImportExportServiceImpl (de.tudarmstadt.ukp.clarin.webanno.api.dao.ImportExportServiceImpl)2 ProjectExportServiceImpl (de.tudarmstadt.ukp.clarin.webanno.api.dao.export.ProjectExportServiceImpl)2 ProjectImportRequest (de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectImportRequest)2 ExportedProject (de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProject)2 Project (de.tudarmstadt.ukp.clarin.webanno.model.Project)2 SourceDocument (de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument)2 XmiFormatSupport (de.tudarmstadt.ukp.clarin.webanno.xmi.XmiFormatSupport)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Arrays.asList (java.util.Arrays.asList)2