ImportExportServiceImpl implements ImportExportService { @Override public File exportCasToFile(CAS aCas, SourceDocument aDocument, String aFileName, FormatSupport aFormat, boolean aStripExtension) throws IOException, UIMAException { return exportCasToFile(aCas, aDocument, aFileName, aFormat, aStripExtension, null); } ImportExportServiceImpl(
            @Autowired RepositoryProperties aRepositoryProperties, 
            @Lazy @Autowired(required = false) List<FormatSupport> aFormats,
            @Autowired CasStorageService aCasStorageService,
            @Autowired AnnotationSchemaService aAnnotationService); @EventListener(ContextRefreshedEvent.class) void onContextRefreshedEvent(); @Override List<FormatSupport> getFormats(); @Override @Transactional File exportAnnotationDocument(SourceDocument aDocument, String aUser,
            FormatSupport aFormat, String aFileName, Mode aMode); @Override @Transactional File exportAnnotationDocument(SourceDocument aDocument, String aUser,
            FormatSupport aFormat, String aFileName, Mode aMode, boolean aStripExtension); @Override @Transactional File exportAnnotationDocument(SourceDocument aDocument, String aUser,
            FormatSupport aFormat, String aFileName, Mode aMode, boolean aStripExtension,
            Map<Pair<Project, String>, Object> aBulkOperationContext); @Override CAS importCasFromFile(File aFile, Project aProject, String aFormatId); @Override CAS importCasFromFile(File aFile, Project aProject, String aFormatId,
            TypeSystemDescription aFullProjectTypeSystem); static void splitSentences(CAS aCas); static void tokenize(CAS aCas); static void trim(String aText, int[] aSpan); static boolean isEmpty(int aBegin, int aEnd); static boolean trimChar(final char aChar); @Override File exportCasToFile(CAS aCas, SourceDocument aDocument, String aFileName,
            FormatSupport aFormat, boolean aStripExtension); @Override File exportCasToFile(CAS aCas, SourceDocument aDocument, String aFileName,
            FormatSupport aFormat, boolean aStripExtension,
            Map<Pair<Project, String>, Object> aBulkOperationContext);  }
@Test public void thatExportContainsNoCasMetadata() throws Exception { SourceDocument sd = makeSourceDocument(1l, 1l); List<TypeSystemDescription> typeSystems = new ArrayList<>(); typeSystems.add(createTypeSystemDescription()); typeSystems.add(CasMetadataUtils.getInternalTypeSystem()); TypeSystemDescription ts = mergeTypeSystems(typeSystems); JCas jcas = JCasFactory.createJCas(ts); casStorageSession.add("jcas", EXCLUSIVE_WRITE_ACCESS, jcas.getCas()); jcas.setDocumentText("This is a test ."); DocumentMetaData.create(jcas); CASMetadata cmd = new CASMetadata(jcas); cmd.addToIndexes(jcas); File exportedXmi = sut.exportCasToFile(jcas.getCas(), sd, "testfile", sut.getFormatById(XmiFormatSupport.ID).get(), true); JCas jcas2 = JCasFactory.createJCas(ts); casStorageSession.add("jcas2", EXCLUSIVE_WRITE_ACCESS, jcas.getCas()); try (ZipArchiveInputStream zipInput = new ZipArchiveInputStream( new FileInputStream(exportedXmi))) { ZipArchiveEntry entry; while ((entry = zipInput.getNextZipEntry()) != null) { if (entry.getName().endsWith(".xmi")) { XmiCasDeserializer.deserialize(zipInput, jcas2.getCas()); break; } } } finally { exportedXmi.delete(); } List<CASMetadata> result = new ArrayList<>(select(jcas2, CASMetadata.class)); assertThat(result).hasSize(0); }