use of de.tudarmstadt.ukp.clarin.webanno.api.dao.BackupProperties in project webanno by webanno.
the class AnnotationDocumentsExporterTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
workFolder = tempFolder.newFolder();
project = new Project();
project.setId(1l);
project.setName("Test Project");
backupProperties = new BackupProperties();
repositoryProperties = new RepositoryProperties();
repositoryProperties.setPath(workFolder);
casStorageService = new CasStorageServiceImpl(null, schemaService, repositoryProperties, backupProperties);
importExportSerivce = new ImportExportServiceImpl(repositoryProperties, asList(new XmiFormatSupport()), casStorageService, schemaService);
sut = new AnnotationDocumentExporter(documentService, null, importExportSerivce, repositoryProperties);
}
use of de.tudarmstadt.ukp.clarin.webanno.api.dao.BackupProperties in project webanno by webanno.
the class CuratedDocumentsExporterTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
workFolder = tempFolder.newFolder();
project = new Project();
project.setId(1l);
project.setName("Test Project");
backupProperties = new BackupProperties();
repositoryProperties = new RepositoryProperties();
repositoryProperties.setPath(workFolder);
casStorageService = spy(new CasStorageServiceImpl(null, schemaService, repositoryProperties, backupProperties));
importExportSerivce = new ImportExportServiceImpl(repositoryProperties, asList(new XmiFormatSupport()), casStorageService, schemaService);
// documentService.getCasFile() is just a stupid wrapper around storageService.getCasFile()
// and it is easiest we emulate it here
when(documentService.getCasFile(any(), any())).thenAnswer(invocation -> {
return casStorageService.getCasFile(invocation.getArgument(0, SourceDocument.class), invocation.getArgument(1, String.class));
});
// Dynamically generate a SourceDocument with an incrementing ID when asked for one
when(documentService.getSourceDocument(any(), any())).then(invocation -> {
SourceDocument doc = new SourceDocument();
doc.setId(nextDocId++);
doc.setProject(invocation.getArgument(0, Project.class));
doc.setName(invocation.getArgument(1, String.class));
return doc;
});
sut = new CuratedDocumentsExporter(documentService, importExportSerivce);
}
Aggregations