Program: 98187
Project: 98187
Buggy source:
@Test public void testSchemaCountCommit(){
  String cName1="String_Node_Str";
  String cName2="String_Node_Str";
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  ZooClass stt=ZooSchema.defineClass(pm,TestClassTiny.class);
  ZooClass s1=ZooSchema.declareClass(pm,cName1,stt);
  ZooClass s2=ZooSchema.declareClass(pm,cName2,s1);
  ZooField f1=s1.declareField("String_Node_Str",Long.TYPE);
  f1.rename("String_Node_Str");
  ZooField f2=s2.declareField("String_Node_Str",Integer.TYPE);
  f2.rename("String_Node_Str");
  f2.remove();
  s2.remove();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,2);
  stt=ZooSchema.locateClass(pm,TestClassTiny.class);
  s1=ZooSchema.locateClass(pm,cName1);
  stt.declareField("String_Node_Str",Long.TYPE);
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,4);
  s1=ZooSchema.locateClass(pm,cName1);
  s1.declareField("String_Node_Str",Long.TYPE);
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,5);
  s1=ZooSchema.locateClass(pm,cName1);
  s1.locateField("String_Node_Str").rename("String_Node_Str");
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,6);
  s1=ZooSchema.locateClass(pm,cName1);
  s1.locateField("String_Node_Str").remove();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,7);
  s1=ZooSchema.locateClass(pm,cName1);
  f1=s1.declareField("String_Node_Str",Long.TYPE);
  f1.rename("String_Node_Str");
  f2=s1.declareField("String_Node_Str",Long.TYPE);
  f2.rename("String_Node_Str");
  f2.remove();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,8);
  TestTools.closePM();
}

Fixed version (ground truth):
@Test public void testSchemaCountCommit(){
  String cName1="String_Node_Str";
  String cName2="String_Node_Str";
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  ZooClass stt=ZooSchema.defineClass(pm,TestClassTiny.class);
  ZooClass s1=ZooSchema.declareClass(pm,cName1,stt);
  ZooClass s2=ZooSchema.declareClass(pm,cName2,s1);
  ZooField f1=s1.declareField("String_Node_Str",Long.TYPE);
  f1.rename("String_Node_Str");
  ZooField f2=s2.declareField("String_Node_Str",Integer.TYPE);
  f2.rename("String_Node_Str");
  f2.remove();
  s2.remove();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,2);
  stt=ZooSchema.locateClass(pm,TestClassTiny.class);
  s1=ZooSchema.locateClass(pm,cName1);
  stt.declareField("String_Node_Str",Long.TYPE);
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,4);
  s1=ZooSchema.locateClass(pm,cName1);
  s1.declareField("String_Node_Str",Long.TYPE);
  pm.currentTransaction().commit();
  TestTools.closePM();
  pm=TestTools.openPM();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,5);
  s1=ZooSchema.locateClass(pm,cName1);
  s1.locateField("String_Node_Str").rename("String_Node_Str");
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,6);
  s1=ZooSchema.locateClass(pm,cName1);
  s1.locateField("String_Node_Str").remove();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,7);
  s1=ZooSchema.locateClass(pm,cName1);
  f1=s1.declareField("String_Node_Str",Long.TYPE);
  f1.rename("String_Node_Str");
  f2=s1.declareField("String_Node_Str",Long.TYPE);
  f2.rename("String_Node_Str");
  f2.remove();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  checkSchemaCount(pm,8);
  TestTools.closePM();
}