You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2017/09/28 01:57:14 UTC

svn commit: r1809932 - /uima/uv3/uimaj-v3/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java

Author: schor
Date: Thu Sep 28 01:57:14 2017
New Revision: 1809932

URL: http://svn.apache.org/viewvc?rev=1809932&view=rev
Log:
[UIMA-5588][UIMA-5593] add tests that fail for these Jiras

Modified:
    uima/uv3/uimaj-v3/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java

Modified: uima/uv3/uimaj-v3/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java?rev=1809932&r1=1809931&r2=1809932&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java Thu Sep 28 01:57:14 2017
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.IOException;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.cas.CAS;
@@ -42,6 +43,8 @@ import org.apache.uima.util.XMLInputSour
 
 public class DocumentAnnotationTest extends TestCase {
   JCas jcas;
+  private CAS source;
+  private CAS target;
   
   public void setUp() throws Exception {
     try {
@@ -75,10 +78,22 @@ public class DocumentAnnotationTest exte
     TypeSystemDescription typeSystem = UIMAFramework.getXMLParser().parseTypeSystemDescription(
             new XMLInputSource(typeSystemFile));
     
-    CAS source = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(), null);
-    CAS target = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(), null);
+    source = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(), null);
+    target = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(), null);
+    
+    jcas = source.getJCas();
+    
+    tstSerdesB4Sofa(SerialFormat.XMI);
+    tstSerdesB4Sofa(SerialFormat.XCAS);
+    tstSerdesB4Sofa(SerialFormat.BINARY);
+    tstSerdesB4Sofa(SerialFormat.COMPRESSED);
+    tstSerdesB4Sofa(SerialFormat.COMPRESSED_FILTERED);    
+  }
+  
+  private void tstSerdesB4Sofa(SerialFormat format) throws IOException {
+    source.reset();
+    target.reset();
     
-    JCas jcas = source.getJCas();
     new DocMeta(jcas).addToIndexes();
     
     jcas.setDocumentText("something");
@@ -86,16 +101,14 @@ public class DocumentAnnotationTest exte
     new Annotation(jcas);
     
     ByteArrayOutputStream bos = new ByteArrayOutputStream();
-    CasIOUtils.save(source, bos, SerialFormat.XMI);
+    CasIOUtils.save(source, bos, format);
     bos.close();
     
     CasIOUtils.load(new ByteArrayInputStream(bos.toByteArray()), target);
-
     AnnotationFS c = target.getDocumentAnnotation();
     System.out.println(c);
     System.out.println(target.<DocMeta>getDocumentAnnotation());
-//    System.out.println(target.getDocumentAnnotation());
-
+    assertTrue(CasCompare.compareCASes((CASImpl)source, (CASImpl)target));
   }
 
 }