Program: 6697
Project: 6697
Buggy source:
@Test(timeout=60000) public void testHA() throws Exception {
  HBaseTestingUtility hBaseTestingUtility=new HBaseTestingUtility();
  hBaseTestingUtility.startMiniDFSCluster(1);
  Configuration hConf=hBaseTestingUtility.getConfiguration();
  hConf.setBoolean("String_Node_Str",true);
  InMemoryZKServer zkServer=InMemoryZKServer.builder().build();
  zkServer.startAndWait();
  try {
    CConfiguration cConf=CConfiguration.create();
    cConf.set(Constants.CFG_HDFS_USER,System.getProperty("String_Node_Str"));
    cConf.set(Constants.Zookeeper.QUORUM,zkServer.getConnectionStr());
    cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder().getAbsolutePath());
    Injector injector=Guice.createInjector(new ConfigModule(cConf),new ZKClientModule(),new LocationRuntimeModule().getInMemoryModules(),new DiscoveryRuntimeModule().getDistributedModules(),new TransactionMetricsModule(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules(false));
    ZKClientService zkClient=injector.getInstance(ZKClientService.class);
    zkClient.startAndWait();
    final Table table=createTable("String_Node_Str");
    try {
      TransactionSystemClient txClient=injector.getInstance(TransactionSystemClient.class);
      TransactionExecutor txExecutor=new DefaultTransactionExecutor(txClient,ImmutableList.of((TransactionAware)table));
      TransactionService first=createTxService(zkServer.getConnectionStr(),Networks.getRandomPort(),hConf,tmpFolder.newFolder());
      first.startAndWait();
      Assert.assertNotNull(txClient.startShort());
      verifyGetAndPut(table,txExecutor,null,"String_Node_Str");
      TransactionService second=createTxService(zkServer.getConnectionStr(),Networks.getRandomPort(),hConf,tmpFolder.newFolder());
      second.startAndWait();
      TimeUnit.SECONDS.sleep(1);
      Assert.assertNotNull(txClient.startShort());
      verifyGetAndPut(table,txExecutor,"String_Node_Str","String_Node_Str");
      first.stopAndWait();
      Assert.assertNotNull(txClient.startShort());
      verifyGetAndPut(table,txExecutor,"String_Node_Str","String_Node_Str");
      TransactionService third=createTxService(zkServer.getConnectionStr(),Networks.getRandomPort(),hConf,tmpFolder.newFolder());
      third.start();
      second.stopAndWait();
      Assert.assertNotNull(txClient.startShort());
      verifyGetAndPut(table,txExecutor,"String_Node_Str","String_Node_Str");
      third.stop();
    }
  finally {
      dropTable("String_Node_Str",cConf);
      zkClient.stopAndWait();
    }
  }
  finally {
    zkServer.stop();
  }
}

Fixed version (ground truth):
@Test(timeout=60000) public void testHA() throws Exception {
  HBaseTestingUtility hBaseTestingUtility=new HBaseTestingUtility();
  hBaseTestingUtility.startMiniDFSCluster(1);
  Configuration hConf=hBaseTestingUtility.getConfiguration();
  hConf.setBoolean("String_Node_Str",true);
  InMemoryZKServer zkServer=InMemoryZKServer.builder().build();
  zkServer.startAndWait();
  try {
    CConfiguration cConf=CConfiguration.create();
    cConf.set(Constants.CFG_HDFS_USER,System.getProperty("String_Node_Str"));
    cConf.set(Constants.Zookeeper.QUORUM,zkServer.getConnectionStr());
    cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder().getAbsolutePath());
    Injector injector=Guice.createInjector(new ConfigModule(cConf),new ZKClientModule(),new LocationRuntimeModule().getInMemoryModules(),new DiscoveryRuntimeModule().getDistributedModules(),new TransactionMetricsModule(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules());
    ZKClientService zkClient=injector.getInstance(ZKClientService.class);
    zkClient.startAndWait();
    final Table table=createTable("String_Node_Str");
    try {
      TransactionSystemClient txClient=injector.getInstance(TransactionSystemClient.class);
      TransactionExecutor txExecutor=new DefaultTransactionExecutor(txClient,ImmutableList.of((TransactionAware)table));
      TransactionService first=createTxService(zkServer.getConnectionStr(),Networks.getRandomPort(),hConf,tmpFolder.newFolder());
      first.startAndWait();
      Assert.assertNotNull(txClient.startShort());
      verifyGetAndPut(table,txExecutor,null,"String_Node_Str");
      TransactionService second=createTxService(zkServer.getConnectionStr(),Networks.getRandomPort(),hConf,tmpFolder.newFolder());
      second.startAndWait();
      TimeUnit.SECONDS.sleep(1);
      Assert.assertNotNull(txClient.startShort());
      verifyGetAndPut(table,txExecutor,"String_Node_Str","String_Node_Str");
      first.stopAndWait();
      Assert.assertNotNull(txClient.startShort());
      verifyGetAndPut(table,txExecutor,"String_Node_Str","String_Node_Str");
      TransactionService third=createTxService(zkServer.getConnectionStr(),Networks.getRandomPort(),hConf,tmpFolder.newFolder());
      third.start();
      second.stopAndWait();
      Assert.assertNotNull(txClient.startShort());
      verifyGetAndPut(table,txExecutor,"String_Node_Str","String_Node_Str");
      third.stop();
    }
  finally {
      dropTable("String_Node_Str",cConf);
      zkClient.stopAndWait();
    }
  }
  finally {
    zkServer.stop();
  }
}