Program: 17377
Project: 17377
Buggy source:
@Test public void testUpdateProcessorWithNonNullData() throws Exception {
  logger.debug("String_Node_Str");
  ConnectionManager cm=getConnectionManager();
  String json=TestHelpers.readFileToString(this.getClass(),"String_Node_Str");
  CKeyspaceDefinition definition=CKeyspaceDefinition.fromJsonString(json);
  String keyspace=definition.getName();
  assertNotNull(definition);
  cm.buildKeyspace(definition,true);
  cm.setDefaultKeyspace(definition);
  ObjectMapper om=cm.getObjectMapper();
  om.truncateTables();
  CDefinition def1=om.getKeyspaceDefinition_ONLY_FOR_TESTING().getDefinitions().get("String_Node_Str");
  Map<String,Object> testObject=Maps.newTreeMap();
  testObject.put("String_Node_Str",Long.valueOf(100));
  testObject.put("String_Node_Str",Integer.valueOf(101));
  testObject.put("String_Node_Str",Long.valueOf(102));
  testObject.put("String_Node_Str",Integer.valueOf(103));
  testObject.put("String_Node_Str","String_Node_Str");
  testObject.put("String_Node_Str","String_Node_Str");
  testObject.put("String_Node_Str","String_Node_Str");
  UUID key=(UUID)om.insert("String_Node_Str",testObject);
  testObject.put("String_Node_Str",Long.valueOf(200));
  testObject.put("String_Node_Str",Integer.valueOf(201));
  testObject.put("String_Node_Str",Long.valueOf(202));
  testObject.put("String_Node_Str",Integer.valueOf(203));
  List<CQLStatement> insertStatements=Lists.newArrayList();
  for (  CIndex i : def1.getIndexes().values()) {
    om.getCqlGenerator_ONLY_FOR_TESTING().addCQLStatmentsForIndexInsert(keyspace,true,insertStatements,def1,testObject,i,key,om.getCqlGenerator_ONLY_FOR_TESTING().makeFieldAndValueList(def1,testObject),null,null);
  }
  for (  CQLStatement s : insertStatements) {
    om.getCqlExecutor().executeSync(s);
  }
  CQLStatement cql=om.getCqlGenerator_ONLY_FOR_TESTING().makeInsertUpdateIndexStatement(keyspace,def1,key,def1.makeIndexValues(testObject));
  om.getCqlExecutor().executeSync(cql);
  Map<String,Object> testObjectOriginal=Maps.newTreeMap();
  testObjectOriginal.put("String_Node_Str",Long.valueOf(100));
  testObjectOriginal.put("String_Node_Str",Integer.valueOf(101));
  testObjectOriginal.put("String_Node_Str",Long.valueOf(102));
  testObjectOriginal.put("String_Node_Str",Integer.valueOf(103));
  testObjectOriginal.put("String_Node_Str","String_Node_Str");
  testObjectOriginal.put("String_Node_Str","String_Node_Str");
  testObjectOriginal.put("String_Node_Str","String_Node_Str");
  cql=om.getCqlGenerator_ONLY_FOR_TESTING().makeInsertUpdateIndexStatement(definition.getName(),def1,key,def1.makeIndexValues(testObjectOriginal));
  om.getCqlExecutor().executeSync(cql);
  Map<String,Object> staticTableObject=om.getByKey("String_Node_Str",key);
  assertEquals(100L,staticTableObject.get("String_Node_Str"));
  assertEquals(101,staticTableObject.get("String_Node_Str"));
  assertEquals(103,staticTableObject.get("String_Node_Str"));
  assertEquals("String_Node_Str",staticTableObject.get("String_Node_Str"));
  Criteria criteria=new Criteria();
  SortedMap<String,Object> values=Maps.newTreeMap();
  values.put("String_Node_Str",Long.valueOf(200L));
  criteria.setIndexKeys(values);
  criteria.setLimit(0L);
  List<Map<String,Object>> indexObjects=om.list("String_Node_Str",criteria);
  assertEquals(1,indexObjects.size());
  assertEquals(staticTableObject.get("String_Node_Str"),indexObjects.get(0).get("String_Node_Str"));
  assertEquals(200L,indexObjects.get(0).get("String_Node_Str"));
  assertEquals(201,indexObjects.get(0).get("String_Node_Str"));
  assertEquals(203,indexObjects.get(0).get("String_Node_Str"));
  Thread.sleep(3000);
  UpdateProcessor up=new UpdateProcessor(om);
  up.process();
  criteria=new Criteria();
  values=Maps.newTreeMap();
  values.put("String_Node_Str",Long.valueOf(200));
  criteria.setIndexKeys(values);
  criteria.setLimit(0L);
  indexObjects=om.list("String_Node_Str",criteria);
  assertEquals(0,indexObjects.size());
  criteria=new Criteria();
  values=Maps.newTreeMap();
  values.put("String_Node_Str",Long.valueOf(100));
  criteria.setIndexKeys(values);
  indexObjects=om.list("String_Node_Str",criteria);
  assertEquals(1,indexObjects.size());
  assertEquals(staticTableObject.get("String_Node_Str"),indexObjects.get(0).get("String_Node_Str"));
  assertEquals(100L,indexObjects.get(0).get("String_Node_Str"));
  assertEquals(101,indexObjects.get(0).get("String_Node_Str"));
  assertEquals(103,indexObjects.get(0).get("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testUpdateProcessorWithNonNullData() throws Exception {
  logger.debug("String_Node_Str");
  ConnectionManager cm=getConnectionManager();
  String json=TestHelpers.readFileToString(this.getClass(),"String_Node_Str");
  CKeyspaceDefinition definition=CKeyspaceDefinition.fromJsonString(json);
  String keyspace=definition.getName();
  assertNotNull(definition);
  cm.buildKeyspace(definition,true);
  cm.setDefaultKeyspace(definition);
  ObjectMapper om=cm.getObjectMapper();
  om.truncateTables();
  CDefinition def1=om.getKeyspaceDefinition_ONLY_FOR_TESTING().getDefinitions().get("String_Node_Str");
  Map<String,Object> testObject=Maps.newTreeMap();
  testObject.put("String_Node_Str",Long.valueOf(100));
  testObject.put("String_Node_Str",Integer.valueOf(101));
  testObject.put("String_Node_Str",Long.valueOf(102));
  testObject.put("String_Node_Str",Integer.valueOf(103));
  testObject.put("String_Node_Str","String_Node_Str");
  testObject.put("String_Node_Str","String_Node_Str");
  testObject.put("String_Node_Str","String_Node_Str");
  UUID key=(UUID)om.insert("String_Node_Str",testObject);
  testObject.put("String_Node_Str",Long.valueOf(200));
  testObject.put("String_Node_Str",Integer.valueOf(201));
  testObject.put("String_Node_Str",Long.valueOf(202));
  testObject.put("String_Node_Str",Integer.valueOf(203));
  List<CQLStatement> insertStatements=Lists.newArrayList();
  for (  CIndex i : def1.getIndexes().values()) {
    om.getCqlGenerator_ONLY_FOR_TESTING().addCQLStatmentsForIndexInsert(keyspace,true,insertStatements,def1,testObject,i,key,om.getCqlGenerator_ONLY_FOR_TESTING().makeFieldAndValueList(def1,testObject),null,null);
  }
  for (  CQLStatement s : insertStatements) {
    om.getCqlExecutor().executeSync(s);
  }
  CQLStatement cql=om.getCqlGenerator_ONLY_FOR_TESTING().makeInsertUpdateIndexStatement(keyspace,def1,key,def1.makeIndexValues(testObject));
  om.getCqlExecutor().executeSync(cql);
  Map<String,Object> testObjectOriginal=Maps.newTreeMap();
  testObjectOriginal.put("String_Node_Str",Long.valueOf(100));
  testObjectOriginal.put("String_Node_Str",Integer.valueOf(101));
  testObjectOriginal.put("String_Node_Str",Long.valueOf(102));
  testObjectOriginal.put("String_Node_Str",Integer.valueOf(103));
  testObjectOriginal.put("String_Node_Str","String_Node_Str");
  testObjectOriginal.put("String_Node_Str","String_Node_Str");
  testObjectOriginal.put("String_Node_Str","String_Node_Str");
  cql=om.getCqlGenerator_ONLY_FOR_TESTING().makeInsertUpdateIndexStatement(definition.getName(),def1,key,def1.makeIndexValues(testObjectOriginal));
  om.getCqlExecutor().executeSync(cql);
  Map<String,Object> staticTableObject=om.getByKey("String_Node_Str",key);
  assertEquals(100L,staticTableObject.get("String_Node_Str"));
  assertEquals(101,staticTableObject.get("String_Node_Str"));
  assertEquals(103,staticTableObject.get("String_Node_Str"));
  assertEquals("String_Node_Str",staticTableObject.get("String_Node_Str"));
  Criteria criteria=new Criteria();
  SortedMap<String,Object> values=Maps.newTreeMap();
  values.put("String_Node_Str",Long.valueOf(200L));
  criteria.setIndexKeys(values);
  criteria.setLimit(0L);
  List<Map<String,Object>> indexObjects=om.list("String_Node_Str",criteria);
  assertEquals(1,indexObjects.size());
  assertEquals(staticTableObject.get("String_Node_Str"),indexObjects.get(0).get("String_Node_Str"));
  assertEquals(200L,indexObjects.get(0).get("String_Node_Str"));
  assertEquals(201,indexObjects.get(0).get("String_Node_Str"));
  assertEquals(203,indexObjects.get(0).get("String_Node_Str"));
  Thread.sleep(3000);
  UpdateProcessor up=new UpdateProcessor(om);
  up.process(9999L);
  criteria=new Criteria();
  values=Maps.newTreeMap();
  values.put("String_Node_Str",Long.valueOf(200));
  criteria.setIndexKeys(values);
  criteria.setLimit(0L);
  indexObjects=om.list("String_Node_Str",criteria);
  assertEquals(0,indexObjects.size());
  criteria=new Criteria();
  values=Maps.newTreeMap();
  values.put("String_Node_Str",Long.valueOf(100));
  criteria.setIndexKeys(values);
  indexObjects=om.list("String_Node_Str",criteria);
  assertEquals(1,indexObjects.size());
  assertEquals(staticTableObject.get("String_Node_Str"),indexObjects.get(0).get("String_Node_Str"));
  assertEquals(100L,indexObjects.get(0).get("String_Node_Str"));
  assertEquals(101,indexObjects.get(0).get("String_Node_Str"));
  assertEquals(103,indexObjects.get(0).get("String_Node_Str"));
}