View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.impl.wsdl.teststeps.registry;
14  
15  import com.eviware.soapui.config.TestStepConfig;
16  import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
17  import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
18  import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStepResult;
19  import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStepWithProperties;
20  import com.eviware.soapui.model.testsuite.TestCaseRunContext;
21  import com.eviware.soapui.model.testsuite.TestCaseRunner;
22  import com.eviware.soapui.model.testsuite.TestStepResult;
23  import com.eviware.soapui.support.UISupport;
24  
25  /***
26   * Factory for creation of placeholder steps
27   * 
28   * @author Ole.Matzura
29   */
30  
31  public class ProPlaceholderStepFactory extends WsdlTestStepFactory
32  {
33  	public ProPlaceholderStepFactory( String type, String name, String image )
34  	{
35  		super( type, name, "Placeholder for soapUI Pro " + name + " TestStep", image );
36  	}
37  
38  	public WsdlTestStep buildTestStep( WsdlTestCase testCase, TestStepConfig config, boolean forLoadTest )
39  	{
40  		return new WsdlProPlaceholderTestStep( testCase, config, forLoadTest, getTestStepIconPath(), getTestStepDescription() );
41  	}
42  
43  	public TestStepConfig createNewTestStep( WsdlTestCase testCase, String name )
44  	{
45  		return null;
46  	}
47  
48  	public boolean canCreate()
49  	{
50  		return false;
51  	}
52  	
53  	public static class WsdlProPlaceholderTestStep extends WsdlTestStepWithProperties
54  	{
55  		private final String description;
56  
57  		protected WsdlProPlaceholderTestStep( WsdlTestCase testCase, TestStepConfig config,	boolean forLoadTest, String iconPath, String description )
58  		{
59  			super( testCase, config, false, forLoadTest );
60  			this.description = description;
61  			
62  			if( !forLoadTest )
63  			{
64  				setIcon( UISupport.createImageIcon( iconPath ) );
65  			}
66  		}
67  
68  		public TestStepResult run( TestCaseRunner testRunner, TestCaseRunContext testRunContext )
69  		{
70  			return new WsdlTestStepResult( this );
71  		}
72  
73  		@Override
74  		public String getDescription()
75  		{
76  			return description;
77  		}
78  	}
79  }