View Javadoc

1   /*
2    *  soapUI Pro, copyright (C) 2007-2008 eviware software ab 
3    */
4   package com.eviware.soapui.impl.wsdl.actions.testcase;
5   
6   import java.io.File;
7   
8   import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
9   import com.eviware.soapui.support.UISupport;
10  import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
11  
12  public class ExportTestCaseAction extends AbstractSoapUIAction<WsdlTestCase>
13  {
14  
15  	public ExportTestCaseAction()
16  	{
17  		super("Export", "Exports the test case");
18  	}
19  
20  	public void perform(WsdlTestCase testCase, Object param)
21  	{
22  		testCase.beforeSave();
23  		String defaultFileName = System.getProperty("user.home") + File.separator + testCase.getName() + ".xml";
24  		File file = UISupport.getFileDialogs().saveAs(this, "Select test case file", "xml", "XML", new File(defaultFileName));
25  		
26  		if( file == null ) return;
27        
28        String fileName = file.getAbsolutePath();
29        if( fileName == null ) return;
30         
31        testCase.exportTestCase(file);
32  	}
33  }