View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2007 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;
14  
15  import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
16  import com.eviware.soapui.model.ModelItem;
17  import com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils;
18  import com.eviware.soapui.model.settings.Settings;
19  import com.eviware.soapui.model.support.AbstractSubmitContext;
20  import com.eviware.soapui.model.testsuite.TestStep;
21  
22  /***
23   * Default implementation
24   */
25  
26  public class WsdlSubmitContext extends AbstractSubmitContext
27  {
28  	private final TestStep step;
29  	
30  	public WsdlSubmitContext( ModelItem context )
31  	{
32  		super( context );
33  		step = context instanceof TestStep ? ( TestStep ) context : null;
34  	}
35  	
36  	public Object getProperty(String name)
37  	{
38  		return getProperty( name, step, (WsdlTestCase) (step == null ? null : step.getTestCase()) );
39  	}
40  	
41  	@Override
42  	public Object get( Object key )
43  	{
44  		return getProperty( key.toString() );
45  	}
46  	
47  	@Override
48  	public Object put( String key, Object value )
49  	{
50  		Object oldValue = get( key );
51  		setProperty( key, value );
52  		return oldValue;
53  	}
54  
55  	public Settings getSettings()
56  	{
57  		return step == null ? step.getSettings() : null;
58  	}
59  
60  	public String expand( String content )
61  	{
62  		return PropertyExpansionUtils.expandProperties( this, content );
63  	}
64  }