PrimitiveAnalysisEngine_impl ae = new PrimitiveAnalysisEngine_impl();
ae.initialize(desc, null); // this calls createAnalysisProcessData
// check results in CAS
// type system
CAS cas = ae.newCAS();
TypeSystem ts = cas.getTypeSystem();
Type t1 = ts.getType("Type1");
Assert.assertEquals("Type1", t1.getName());
Feature f1 = t1.getFeatureByBaseName("Feature1");
Feature f1a = ts.getFeatureByFullName("Type1:Feature1");
Assert.assertEquals(f1, f1a);
Assert.assertEquals("Feature1", f1.getShortName());
Assert.assertEquals(t1, f1.getDomain());
Type t2 = ts.getType("Type2");
Assert.assertEquals("Type2", t2.getName());
Feature f2 = t2.getFeatureByBaseName("Feature2");
Feature f2a = ts.getFeatureByFullName("Type2:Feature2");
Assert.assertEquals(f2, f2a);
Assert.assertEquals("Feature2", f2.getShortName());
Assert.assertEquals(t2, f2.getDomain());
Type et = ts.getType("EnumType");
Assert.assertEquals("EnumType", et.getName());
Assert.assertEquals(et, f2.getRange());
// indexes
FSIndexRepository irep = cas.getIndexRepository();
FSIndex ind = irep.getIndex("Index1");
Assert.assertNotNull(ind);
Assert.assertEquals("Type1", ind.getType().getName());
Assert.assertEquals(FSIndex.SORTED_INDEX, ind.getIndexingStrategy());
FeatureStructure fs1 = cas.createFS(t1);
fs1.setIntValue(f1, 0);
FeatureStructure fs2 = cas.createFS(t1);
fs2.setIntValue(f1, 1);
Assert.assertTrue(ind.compare(fs1, fs2) < 0);
FSIndex ind2 = irep.getIndex("Index2");
Assert.assertNotNull(ind2);
Assert.assertEquals("Type2", ind2.getType().getName());
Assert.assertEquals(FSIndex.SET_INDEX, ind2.getIndexingStrategy());
FeatureStructure fs3 = cas.createFS(t2);
fs3.setStringValue(f2, "One");
FeatureStructure fs4 = cas.createFS(t2);
fs4.setStringValue(f2, "Two");
Assert.assertTrue(ind2.compare(fs3, fs4) > 0);
FSIndex ind3 = irep.getIndex("Index3");
Assert.assertNotNull(ind3);
Assert.assertEquals("uima.tcas.Annotation", ind3.getType().getName());
Assert.assertEquals(FSIndex.SORTED_INDEX, ind3.getIndexingStrategy());
AnnotationFS fs5 = cas.createAnnotation(t1, 0, 0);
AnnotationFS fs6 = cas.createAnnotation(t2, 0, 0);
AnnotationFS fs7 = cas.createAnnotation(t1, 0, 0);
Assert.assertTrue(ind3.compare(fs5, fs6) < 0);
Assert.assertTrue(ind3.compare(fs6, fs7) > 0);
// only way to check if allowed values is correct is to try to set an
// invalid value?