* Throw in tests of the byte, short and long heaps as well
*
*/
String testString = "testString";
cas.reset();
LowLevelCAS ll_cas = cas.getLowLevelCAS();
FSIndexRepository ir = cas.getIndexRepository();
int ll_strfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theStringFeature);
int ll_bytefeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theByteFeature);
int ll_shortfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theShortFeature);
int ll_bytearrayfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theByteArrayFeature);
int ll_shortarrayfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theShortArrayFeature);
int ll_longfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theLongFeature);
for (int cycle=0; cycle<10; cycle+=2) {
FeatureStructure newFS1 = cas.createFS(theTypeType);
ir.addFS(newFS1);
newFS1.setIntValue(startFeature, cycle);
newFS1.setIntValue(endFeature, cycle+1);
// set string using normal string feature create
newFS1.setStringValue(theStringFeature, testString);
newFS1.setByteValue(theByteFeature, (byte)cycle);
newFS1.setShortValue(theShortFeature, (short)cycle);
newFS1.setLongValue(theLongFeature, (long)cycle);
ByteArrayFS newBA1 = cas.createByteArrayFS(1);
ShortArrayFS newSA1 = cas.createShortArrayFS(1);
newBA1.set(0, (byte)cycle);
newSA1.set(0, (short)cycle);
newFS1.setFeatureValue(theByteArrayFeature, newBA1);
newFS1.setFeatureValue(theShortArrayFeature, newSA1);
FeatureStructure newFS2 = cas.createFS(theTypeType);
ByteArrayFS newBA2 = cas.createByteArrayFS(1);
ShortArrayFS newSA2 = cas.createShortArrayFS(1);
newFS2.setIntValue(startFeature, cycle+1);
newFS2.setIntValue(endFeature, cycle+2);
ir.addFS(newFS2);
// set string using lowlevel string create API
final int llfs2 = ll_cas.ll_getFSRef(newFS2);
final int llba2 = ll_cas.ll_getFSRef(newBA2);
final int llsa2 = ll_cas.ll_getFSRef(newSA2);
ll_cas.ll_setCharBufferValue(llfs2, ll_strfeatcode,
testString.toCharArray(), 0, testString.length());
ll_cas.ll_setByteValue(llfs2, ll_bytefeatcode, (byte)(cycle+1));
ll_cas.ll_setShortValue(llfs2, ll_shortfeatcode, (short)(cycle+1));
ll_cas.ll_setLongValue(llfs2, ll_longfeatcode, (long)(cycle+1));
ll_cas.ll_setByteArrayValue(llba2, 0, (byte)(cycle+1));
ll_cas.ll_setShortArrayValue(llsa2, 0, (short)(cycle+1));
newFS2.setFeatureValue(theByteArrayFeature, newBA2);
newFS2.setFeatureValue(theShortArrayFeature, newSA2);
ByteArrayOutputStream fos = new ByteArrayOutputStream();
Serialization.serializeCAS(cas, fos);