Program: 34545
Project: 34545
Buggy source:
/** 
 * Verify the following: <OL> <LI> An ear file that contains two war files. One war file contains two servlets, the other one contains one servlet. Each war files has one jar file. In this test case the following configuration will be used. 1. WAR 1 will be configured to use Database. 2. WAR 2 will use the LDAP Identity Store. 3. Test cases will run using the RunAsServlet. 4. To test this out, we will be using the local ldap user: User 2. However, in the server.xml the blue3 is configured as the run-as manager. but that user doesn't exist in the database. For that reason it is expected that user 2 will appear in the servlet response. </OL> <P> The user we are sending exist on the LDAP but the RunAs exist on the DB. 200 is expected. <OL> <LI> </OL>
 */
@Mode(TestMode.LITE) @Test public void testEJBRunAsAnnotatedLdapOnWar1AndDBOnWAR2() throws Exception {
  String response;
  String queryString;
  Log.info(logClass,getCurrentTestName(),"String_Node_Str" + getCurrentTestName());
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  WCApplicationHelper.createWar(myServer,TEMP_DIR,EJB_WAR_NAME,true,EJB_BEAN_JAR_NAME,true,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  WCApplicationHelper.createWar(myServer,TEMP_DIR,EJB_WAR_NAME2,true,EJB_BEAN_JAR_NAME,true,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  WCApplicationHelper.packageWarsToEar(myServer,TEMP_DIR,EJB_EAR_NAME,true,EJB_WAR_NAME,EJB_WAR_NAME2);
  WCApplicationHelper.addEarToServerApps(myServer,TEMP_DIR,EJB_EAR_NAME);
  WCApplicationHelper.addWarToServerApps(myServer,"String_Node_Str",true,JAR_NAME,false,"String_Node_Str","String_Node_Str");
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  startServer(XML_NAME,EJB_APP_NAME);
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  queryString=EJB_WAR_PATH + RUNAS_SERVLET + "String_Node_Str";
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  response=executeGetRequestBasicAuthCreds(httpclient,urlBase + queryString,LocalLdapServer.USER2,LocalLdapServer.PASSWORD,HttpServletResponse.SC_OK);
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  verifyEjbRunAsUserResponse(response,Constants.ejb01Bean,Constants.getEjbBeanMethodName + Constants.ejbBeanMethodRunAsSpecified,Constants.getEjbCallerPrincipal + Constants.DB_USER3,Constants.DB_USER2);
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  httpclient.getConnectionManager().shutdown();
  setupConnection();
  myServer.removeInstalledAppForValidation(EJB_APP_NAME);
  myServer.stopServer();
  Log.info(logClass,getCurrentTestName(),"String_Node_Str" + getCurrentTestName());
}

Fixed version (ground truth):
/** 
 * Verify the following: <OL> <LI> An ear file that contains two war files. One war file contains two servlets, the other one contains one servlet. Each war files has one jar file. In this test case the following configuration will be used. 1. WAR 1 will be configured to use Database. 2. WAR 2 will use the LDAP Identity Store. 3. Test cases will run using the RunAsServlet. 4. To test this out, we will be using the local ldap user: User 2. However, in the server.xml the blue3 is configured as the run-as manager. but that user doesn't exist in the database. For that reason it is expected that user 2 will appear in the servlet response. </OL> <P> The user we are sending exist on the LDAP but the RunAs exist on the DB. 200 is expected. <OL> <LI> </OL>
 */
@Mode(TestMode.LITE) public void testEJBRunAsAnnotatedLdapOnWar1AndDBOnWAR2() throws Exception {
  String response;
  String queryString;
  Log.info(logClass,getCurrentTestName(),"String_Node_Str" + getCurrentTestName());
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  WCApplicationHelper.createWar(myServer,TEMP_DIR,EJB_WAR_NAME,true,EJB_BEAN_JAR_NAME,true,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  WCApplicationHelper.createWar(myServer,TEMP_DIR,EJB_WAR_NAME2,true,EJB_BEAN_JAR_NAME,true,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  WCApplicationHelper.packageWarsToEar(myServer,TEMP_DIR,EJB_EAR_NAME,true,EJB_WAR_NAME,EJB_WAR_NAME2);
  WCApplicationHelper.addEarToServerApps(myServer,TEMP_DIR,EJB_EAR_NAME);
  WCApplicationHelper.addWarToServerApps(myServer,"String_Node_Str",true,JAR_NAME,false,"String_Node_Str","String_Node_Str");
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  startServer(XML_NAME,EJB_APP_NAME);
  assertNotNull("String_Node_Str",myServer.waitForStringInLog("String_Node_Str"));
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  queryString=EJB_WAR_PATH + RUNAS_SERVLET + "String_Node_Str";
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  response=executeGetRequestBasicAuthCreds(httpclient,urlBase + queryString,LocalLdapServer.USER2,LocalLdapServer.PASSWORD,HttpServletResponse.SC_OK);
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  verifyEjbRunAsUserResponse(response,Constants.ejb01Bean,Constants.getEjbBeanMethodName + Constants.ejbBeanMethodRunAsSpecified,Constants.getEjbCallerPrincipal + Constants.DB_USER3,Constants.DB_USER2);
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  Log.info(logClass,getCurrentTestName(),"String_Node_Str");
  httpclient.getConnectionManager().shutdown();
  setupConnection();
  myServer.removeInstalledAppForValidation(EJB_APP_NAME);
  myServer.stopServer();
  Log.info(logClass,getCurrentTestName(),"String_Node_Str" + getCurrentTestName());
}