Search in sources :

Example 1 with PROJECT_TYPE_CORRECTION

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

the class CuratedDocumentsExporterTest method thatImportingCorrectionProjectWorks_3_6_1.

@Test
public void thatImportingCorrectionProjectWorks_3_6_1() throws Exception {
    project.setMode(PROJECT_TYPE_CORRECTION);
    // Export the project and import it again
    List<Pair<SourceDocument, String>> imported = runImportAndFetchDocuments(new ZipFile("src/test/resources/exports/Export+Test+-+Curated+correction+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");
    // Since WebAnno 3.5.x, the CORRECTION_USER CAS is stored with the annotations
    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_CORRECTION

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

the class CuratedDocumentsExporterTest method thatImportingCorrectionProjectWorks_3_4_x.

@Test
public void thatImportingCorrectionProjectWorks_3_4_x() throws Exception {
    project.setMode(PROJECT_TYPE_CORRECTION);
    // Export the project and import it again
    List<Pair<SourceDocument, String>> imported = runImportAndFetchDocuments(new ZipFile("src/test/resources/exports/Export+Test+-+Curated+correction+project_3_4_8.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");
    // Before WebAnno 3.5.x, the CORRECTION_USER CAS was stored with the curations
    assertThat(imported).extracting(Pair::getValue).containsExactlyInAnyOrder(CURATION_USER, CORRECTION_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 3 with PROJECT_TYPE_CORRECTION

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

the class AnnotationDocumentsExporterTest method thatImportingCorrectionProjectWorks_3_6_1.

@Test
public void thatImportingCorrectionProjectWorks_3_6_1() throws Exception {
    project.setMode(PROJECT_TYPE_CORRECTION);
    // Export the project and import it again
    List<Pair<SourceDocument, String>> imported = runImportAndFetchDocuments(new ZipFile("src/test/resources/exports/Export+Test+-+Curated+correction+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", "example_sentence.txt");
    // Since WebAnno 3.5.x, the CORRECTION_USER CAS is stored with the annotations
    assertThat(imported).extracting(Pair::getValue).containsExactlyInAnyOrder(INITIAL_CAS_PSEUDO_USER, "admin", CORRECTION_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) 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)

Example 4 with PROJECT_TYPE_CORRECTION

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

the class AnnotationDocumentsExporterTest method thatImportingCorrectionProjectWorks_3_4_x.

@Test
public void thatImportingCorrectionProjectWorks_3_4_x() throws Exception {
    project.setMode(PROJECT_TYPE_CORRECTION);
    // Export the project and import it again
    List<Pair<SourceDocument, String>> imported = runImportAndFetchDocuments(new ZipFile("src/test/resources/exports/Export+Test+-+Curated+correction+project_3_4_8.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");
    // Before WebAnno 3.5.x, the CORRECTION_USER CAS was stored with the curations
    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)4 CasStorageService (de.tudarmstadt.ukp.clarin.webanno.api.CasStorageService)4 DocumentService (de.tudarmstadt.ukp.clarin.webanno.api.DocumentService)4 ImportExportService (de.tudarmstadt.ukp.clarin.webanno.api.ImportExportService)4 RepositoryProperties (de.tudarmstadt.ukp.clarin.webanno.api.RepositoryProperties)4 CORRECTION_USER (de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.CORRECTION_USER)4 PROJECT_TYPE_ANNOTATION (de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_ANNOTATION)4 PROJECT_TYPE_CORRECTION (de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PROJECT_TYPE_CORRECTION)4 BackupProperties (de.tudarmstadt.ukp.clarin.webanno.api.dao.BackupProperties)4 CasStorageServiceImpl (de.tudarmstadt.ukp.clarin.webanno.api.dao.CasStorageServiceImpl)4 ImportExportServiceImpl (de.tudarmstadt.ukp.clarin.webanno.api.dao.ImportExportServiceImpl)4 ProjectExportServiceImpl (de.tudarmstadt.ukp.clarin.webanno.api.dao.export.ProjectExportServiceImpl)4 ProjectImportRequest (de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectImportRequest)4 ExportedProject (de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProject)4 Project (de.tudarmstadt.ukp.clarin.webanno.model.Project)4 SourceDocument (de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument)4 XmiFormatSupport (de.tudarmstadt.ukp.clarin.webanno.xmi.XmiFormatSupport)4 File (java.io.File)4 ArrayList (java.util.ArrayList)4 Arrays.asList (java.util.Arrays.asList)4