{
UISupport.showErrorMessage( "Error loading test case " );
return;
}
TestSuiteDocumentConfig newTestSuiteConfig = null;
try
{
newTestSuiteConfig = TestSuiteDocumentConfig.Factory.parse( file );
}
catch( Exception e )
{
SoapUI.logError( e );
}
if( newTestSuiteConfig == null )
{
UISupport.showErrorMessage( "Not valild test case xml" );
}
else
{
TestSuiteConfig config = ( TestSuiteConfig )projectDocument.getSoapuiProject().addNewTestSuite()
.set( newTestSuiteConfig.getTestSuite() );
WsdlTestSuite testSuite = buildTestSuite( config );
ModelSupport.unsetIds( testSuite );
testSuite.afterLoad();
/*
* security test keeps reference to test step by id, which gets changed
* during importing, so old values needs to be rewritten to new ones.
*
* Create tarnsition table ( old id , new id ) and use it to replace
* all old ids in new imported test case.
*
* Here needs to be done for all test cases separatly.
*/
for( int cnt2 = 0; cnt2 < config.getTestCaseList().size(); cnt2++ )
{
TestCaseConfig newTestCase = config.getTestCaseList().get( cnt2 );
TestCaseConfig importTestCaseConfig = newTestSuiteConfig.getTestSuite().getTestCaseList().get( cnt2 );
LinkedHashMap<String, String> oldNewIds = new LinkedHashMap<String, String>();
for( int cnt = 0; cnt < importTestCaseConfig.getTestStepList().size(); cnt++ )
oldNewIds.put( importTestCaseConfig.getTestStepList().get( cnt ).getId(), newTestCase.getTestStepList()
.get( cnt ).getId() );