}
String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
TestStep testStep = testCase.getTestStepByName( testStepName );
String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
testStep.getId(), AbstractSecurityScanWithProperties.class ) );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
}
else
{
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, new String[0] );
}
}
else
{
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
}
}
} );
dialog.getFormField( CloneParameterDialog.TARGET_TESTCASE ).addFormFieldListener( new XFormFieldListener()
{
public void valueChanged( XFormField sourceField, String newValue, String oldValue )
{
String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
TestCase testCase = testSuite.getTestCaseByName( newValue );
String[] testStepNames = new String[0];
String[] securityTestNames = ModelSupport.getNames( testCase.getSecurityTestList() );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames );
if( securityTestNames.length > 0 )
{
testStepNames = getSecurableTestStepsNames( testCase );
}
dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, testStepNames );
if( securityTestNames.length > 0 )
{
dialog.setValue( CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames[0] );
if( testStepNames.length > 0 )
{
dialog.setValue( CloneParameterDialog.TARGET_TESTSTEP, testStepNames[0] );
}
else
{
dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
}
String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
TestStep testStep = testCase.getTestStepByName( testStepName );
String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
testStep.getId(), AbstractSecurityScanWithProperties.class ) );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
}
else
{
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, new String[0] );
}
}
} );
dialog.getFormField( CloneParameterDialog.TARGET_TESTSTEP ).addFormFieldListener( new XFormFieldListener()
{
public void valueChanged( XFormField sourceField, String newValue, String oldValue )
{
String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
String testCaseName = dialog.getValue( CloneParameterDialog.TARGET_TESTCASE );
TestCase testCase = testSuite.getTestCaseByName( testCaseName );
String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
TestStep testStep = testCase.getTestStepByName( newValue );
String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
testStep.getId(), AbstractSecurityScanWithProperties.class ) );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
}
} );
dialog.getFormField( CloneParameterDialog.TARGET_SECURITYTEST ).addFormFieldListener( new XFormFieldListener()
{
public void valueChanged( XFormField sourceField, String newValue, String oldValue )
{
String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
String testCaseName = dialog.getValue( CloneParameterDialog.TARGET_TESTCASE );
TestCase testCase = testSuite.getTestCaseByName( testCaseName );
SecurityTest securityTest = testCase.getSecurityTestByName( newValue );
String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
TestStep testStep = testCase.getTestStepByName( testStepName );
String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
testStep.getId(), AbstractSecurityScanWithProperties.class ) );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
}
} );
WsdlTestCase wsdlTestCase = ( WsdlTestCase )securityScan.getTestStep().getTestCase();
dialog.setOptions( CloneParameterDialog.TARGET_TESTSUITE,
ModelSupport.getNames( wsdlTestCase.getTestSuite().getProject().getTestSuiteList() ) );
dialog.setValue( CloneParameterDialog.TARGET_TESTSUITE, wsdlTestCase.getTestSuite().getName() );
List<TestCase> wsdlTestCaseList = wsdlTestCase.getTestSuite().getTestCaseList();
dialog.setOptions( CloneParameterDialog.TARGET_TESTCASE, ModelSupport.getNames( wsdlTestCaseList ) );
dialog.setValue( CloneParameterDialog.TARGET_TESTCASE, wsdlTestCase.getName() );
dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, getSecurableTestStepsNames( wsdlTestCase ) );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST,
ModelSupport.getNames( wsdlTestCase.getSecurityTestList() ) );
String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
SecurityTest securityTest = wsdlTestCase.getSecurityTestByName( securityTestName );
String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
TestStep testStep = wsdlTestCase.getTestStepByName( testStepName );
String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType( testStep.getId(),
AbstractSecurityScanWithProperties.class ) );
dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
dialog.setOptions( CloneParameterDialog.PARAMETERS, securityScan.getParameterHolder().getParameterLabels() );