cas1.getIndexRepository().addFS(anAnnot2);
AnnotationFS anAnnot3 = cas1.createAnnotation(cas1.getAnnotationType(), 8, 13);
cas1.getIndexRepository().addFS(anAnnot3);
AnnotationFS anAnnot4 = cas1.createAnnotation(cas1.getAnnotationType(), 15, 30);
cas1.getIndexRepository().addFS(anAnnot4);
FSIndex tIndex = cas1.getAnnotationIndex();
assertTrue(tIndex.size() == 5); //doc annot plus 4 annots
FeatureStructure entityFS = cas1.createFS(entityType);
cas1.getIndexRepository().addFS(entityFS);
StringArrayFS strArrayFS = cas1.createStringArrayFS(5);
strArrayFS.set(0, "class1");
entityFS.setFeatureValue(classesFeat, strArrayFS);
//create listFS and set the link feature
FeatureStructure emptyNode = cas1.createFS(emptyFsListType);
FeatureStructure secondNode = cas1.createFS(nonEmptyFsListType);
secondNode.setFeatureValue(headFeat, anAnnot2);
secondNode.setFeatureValue(tailFeat, emptyNode);
FeatureStructure firstNode = cas1.createFS(nonEmptyFsListType);
firstNode.setFeatureValue(headFeat, anAnnot1);
firstNode.setFeatureValue(tailFeat, secondNode);
entityFS.setFeatureValue(linksFeat, firstNode);
// create a view w/o setting document text
CAS view1 = cas1.createView("View1");
//serialize complete
XmiSerializationSharedData sharedData = new XmiSerializationSharedData();
String xml = serialize(cas1, sharedData);
int maxOutgoingXmiId = sharedData.getMaxXmiId();
//System.out.println("CAS1 " + xml);
//System.out.println("MaxOutgoingXmiId " + maxOutgoingXmiId);
//deserialize into cas2
XmiSerializationSharedData sharedData2 = new XmiSerializationSharedData();
this.deserialize(xml, cas2, sharedData2, true, -1);
CasComparer.assertEquals(cas1, cas2);
//=======================================================================
//create Marker, add/modify fs and serialize in delta xmi format.
Marker marker = cas2.createMarker();
FSIndex cas2tIndex = cas2.getAnnotationIndex();
// create an annotation and add to index
AnnotationFS cas2anAnnot5 = cas2.createAnnotation(cas2.getAnnotationType(), 6, 8);
cas2.getIndexRepository().addFS(cas2anAnnot5);
assertTrue(cas2tIndex.size() == 6); // prev annots and this new one
// create an annotation and add to index
AnnotationFS cas2anAnnot6 = cas2.createAnnotation(cas2.getAnnotationType(), 6, 8);
cas2.getIndexRepository().addFS(cas2anAnnot6);
assertTrue(cas2tIndex.size() == 7); // prev annots and twonew one
//add to FSList
Iterator<FeatureStructure> iter = cas2.getIndexRepository().getIndex("testEntityIndex").iterator();
FeatureStructure cas2EntityFS = iter.next();
FeatureStructure cas2linksFS = cas2EntityFS.getFeatureValue(linksFeat);