private JCas readCas(Reader reader) throws UIMAException, IOException, SAXException { JCas jcas = JCasFactory .createJCas(annotationSchemaService.getFullProjectTypeSystem(project)); String xmi = IOUtils.toString(reader); // Get the annotations from the XMI are back in the CAS. XmiCasDeserializer.deserialize(new ByteArrayInputStream(xmi.getBytes()), jcas.getCas()); return jcas; }
TypeSystemDescription allTypes = annotationService.getFullProjectTypeSystem(aProject); CAS cas = JCasFactory.createJCas(allTypes).getCas();
TypeSystemDescription allTypes = annotationService.getFullProjectTypeSystem(aProject); CAS cas = JCasFactory.createJCas(allTypes).getCas();
@Before public void setup() throws Exception { initMocks(this); schemaService = mock(AnnotationSchemaServiceImpl.class); backupProperties = new BackupProperties(); repositoryProperties = new RepositoryProperties(); repositoryProperties.setPath(testFolder.newFolder()); storageService = new CasStorageServiceImpl(null, repositoryProperties, backupProperties); sut = new ImportExportServiceImpl(repositoryProperties, asList(new XmiFormatSupport()), storageService, schemaService); sut.onContextRefreshedEvent(); when(schemaService.listAnnotationLayer(any(Project.class))).thenReturn(emptyList()); // We don't want to re-write the prepareCasForExport method - call the original when(schemaService.prepareCasForExport(any(), any())).thenCallRealMethod(); // The prepareCasForExport method internally calls getFullProjectTypeSystem, so we need to // ensure this is actually callable and doesn't run into a mocked version which simply // returns null. when(schemaService.getFullProjectTypeSystem(any(), anyBoolean())).thenCallRealMethod(); }