Program: 76915
Project: 76915
Buggy source:
/** 
 * Converts ODA data set parameters to ROM data set parameters. <ul> <li>no the latest design session reponse, update ROM values. Default value is not copied to data set parameter since it has linked report parameter. <li>if the latest design session reponse changed, update ROM values. <li>if the latest design session reponse didn't change and ROM values changed, don't update ROM values. <li>update native type and default value on data set parameter <li>update the data set handle in the reportParameter.dataSet value </ul>
 * @throws Exception
 */
public void testToROMDataSetParamWithReportParam() throws Exception {
  openDesign("String_Node_Str");
  OdaDataSetHandle setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  DataSetDesign setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  DataSetParameters params=setDesign.getParameters();
  ParameterDefinition param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition1(param);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  saveAs("String_Node_Str");
  compareTextFile("String_Node_Str","String_Node_Str");
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  params=setDesign.getParameters();
  param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition1(param);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  saveAs("String_Node_Str");
  compareTextFile("String_Node_Str","String_Node_Str");
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  params=setDesign.getParameters();
  param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition2(param);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  saveAs("String_Node_Str");
  compareTextFile("String_Node_Str","String_Node_Str");
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  Iterator paramHandles=setHandle.parametersIterator();
  OdaDataSetParameterHandle paramHandle=(OdaDataSetParameterHandle)paramHandles.next();
  paramHandle.setIsOutput(true);
  paramHandle.setIsInput(false);
  paramHandle.setDefaultValue("String_Node_Str");
  String reportParamName=paramHandle.getParamName();
  ScalarParameterHandle reportParam=(ScalarParameterHandle)designHandle.findParameter(reportParamName);
  reportParam.setPromptText("String_Node_Str");
  reportParam.setDefaultValue("String_Node_Str");
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  saveAs("String_Node_Str");
  compareTextFile("String_Node_Str","String_Node_Str");
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  params=setDesign.getParameters();
  param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition3(param);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  checkUpdateParameterDefinition3(param);
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  params=setDesign.getParameters();
  param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition3(param);
  DataSetHandle dataSetToDelete=designHandle.findDataSet("String_Node_Str");
  dataSetToDelete.drop();
  dataSetToDelete=designHandle.findDataSet("String_Node_Str");
  assertNull(dataSetToDelete);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  checkUpdateParameterDefinition3(param);
  dataSetToDelete=designHandle.findDataSet("String_Node_Str");
  assertNotNull(dataSetToDelete);
}

Fixed version (ground truth):
/** 
 * Converts ODA data set parameters to ROM data set parameters. <ul> <li>no the latest design session reponse, update ROM values. Default value is not copied to data set parameter since it has linked report parameter. <li>if the latest design session reponse changed, update ROM values. <li>if the latest design session reponse didn't change and ROM values changed, don't update ROM values. <li>update native type and default value on data set parameter <li>update the data set handle in the reportParameter.dataSet value </ul>
 * @throws Exception
 */
public void testToROMDataSetParamWithReportParam() throws Exception {
  openDesign("String_Node_Str");
  OdaDataSetHandle setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  DataSetDesign setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  DataSetParameters params=setDesign.getParameters();
  ParameterDefinition param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition1(param);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  saveAs("String_Node_Str");
  compareTextFile("String_Node_Str","String_Node_Str");
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  DesignUtil.validateObject(setDesign);
  params=setDesign.getParameters();
  param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition1(param);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  saveAs("String_Node_Str");
  compareTextFile("String_Node_Str","String_Node_Str");
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  params=setDesign.getParameters();
  param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition2(param);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  saveAs("String_Node_Str");
  compareTextFile("String_Node_Str","String_Node_Str");
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  Iterator paramHandles=setHandle.parametersIterator();
  OdaDataSetParameterHandle paramHandle=(OdaDataSetParameterHandle)paramHandles.next();
  paramHandle.setIsOutput(true);
  paramHandle.setIsInput(false);
  paramHandle.setDefaultValue("String_Node_Str");
  String reportParamName=paramHandle.getParamName();
  ScalarParameterHandle reportParam=(ScalarParameterHandle)designHandle.findParameter(reportParamName);
  reportParam.setPromptText("String_Node_Str");
  reportParam.setDefaultValue("String_Node_Str");
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  saveAs("String_Node_Str");
  compareTextFile("String_Node_Str","String_Node_Str");
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  params=setDesign.getParameters();
  param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition3(param);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  checkUpdateParameterDefinition3(param);
  openDesign("String_Node_Str");
  setHandle=(OdaDataSetHandle)designHandle.findDataSet("String_Node_Str");
  setDesign=new ModelOdaAdapter().createDataSetDesign(setHandle);
  params=setDesign.getParameters();
  param=(ParameterDefinition)params.getParameterDefinitions().get(0);
  updateParameterDefinition3(param);
  DataSetHandle dataSetToDelete=designHandle.findDataSet("String_Node_Str");
  dataSetToDelete.drop();
  dataSetToDelete=designHandle.findDataSet("String_Node_Str");
  assertNull(dataSetToDelete);
  new ModelOdaAdapter().updateDataSetHandle(setDesign,setHandle,false);
  checkUpdateParameterDefinition3(param);
  dataSetToDelete=designHandle.findDataSet("String_Node_Str");
  assertNotNull(dataSetToDelete);
}