Program: 179590
Project: 179590
Buggy source:
/** 
 * Tests that the new mechanism for configuring a launcher from a  servlet context works, with multi-node configurations
 * @throws NamingException a problem with the test
 */
public void testConfiguredMultiNodeContext() throws NamingException {
  JdbcMigrationLauncherFactory launcherFactory=new JdbcMigrationLauncherFactory();
  MockServletContext sc=new MockServletContext();
  String dbType1="String_Node_Str";
  String dbType2="String_Node_Str";
  String sysName="String_Node_Str";
  sc.setInitParameter("String_Node_Str",sysName);
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  sc.setInitParameter("String_Node_Str",dbType1);
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  sc.setInitParameter("String_Node_Str",dbType2);
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  MockDataSource ds=new MockDataSource();
  MockContextFactory.setAsInitial();
  InitialContext context=new InitialContext();
  context.createSubcontext("String_Node_Str");
  context.bind("String_Node_Str",ds);
  ServletContextEvent sce=new ServletContextEvent(sc);
  JdbcMigrationLauncher launcher=null;
  try {
    launcher=launcherFactory.createMigrationLauncher(sce);
  }
 catch (  MigrationException e) {
    e.printStackTrace();
    fail("String_Node_Str");
  }
  Iterator contextIter=launcher.getContexts().keySet().iterator();
  JdbcMigrationContext jdbcContext1=(JdbcMigrationContext)contextIter.next();
  JdbcMigrationContext jdbcContext2=(JdbcMigrationContext)contextIter.next();
  assertEquals(dbType1,jdbcContext1.getDatabaseType().getDatabaseType());
  assertEquals(sysName,jdbcContext1.getSystemName());
  assertEquals(dbType2,jdbcContext2.getDatabaseType().getDatabaseType());
  assertEquals(sysName,jdbcContext2.getSystemName());
  assertEquals(true,launcher.isReadOnly());
}

Fixed version (ground truth):
/** 
 * Tests that the new mechanism for configuring a launcher from a  servlet context works, with multi-node configurations
 * @throws NamingException a problem with the test
 */
public void testConfiguredMultiNodeContext() throws NamingException {
  JdbcMigrationLauncherFactory launcherFactory=new JdbcMigrationLauncherFactory();
  MockServletContext sc=new MockServletContext();
  String dbType1="String_Node_Str";
  String dbType2="String_Node_Str";
  String sysName="String_Node_Str";
  sc.setInitParameter("String_Node_Str",sysName);
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  sc.setInitParameter("String_Node_Str",dbType1);
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  sc.setInitParameter("String_Node_Str",dbType2);
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  sc.setInitParameter("String_Node_Str","String_Node_Str");
  MockDataSource ds=new MockDataSource();
  MockContextFactory.setAsInitial();
  InitialContext context=new InitialContext();
  context.bind("String_Node_Str",ds);
  context.bind("String_Node_Str",ds);
  ServletContextEvent sce=new ServletContextEvent(sc);
  JdbcMigrationLauncher launcher=null;
  try {
    launcher=launcherFactory.createMigrationLauncher(sce);
  }
 catch (  MigrationException e) {
    e.printStackTrace();
    fail("String_Node_Str");
  }
  Iterator contextIter=launcher.getContexts().keySet().iterator();
  JdbcMigrationContext jdbcContext1=(JdbcMigrationContext)contextIter.next();
  JdbcMigrationContext jdbcContext2=(JdbcMigrationContext)contextIter.next();
  assertEquals(dbType1,jdbcContext1.getDatabaseType().getDatabaseType());
  assertEquals(sysName,jdbcContext1.getSystemName());
  assertEquals(dbType2,jdbcContext2.getDatabaseType().getDatabaseType());
  assertEquals(sysName,jdbcContext2.getSystemName());
  assertEquals(true,launcher.isReadOnly());
}