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;
14  
15  import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
16  import com.eviware.soapui.model.ModelItem;
17  import com.eviware.soapui.model.propertyexpansion.PropertyExpander;
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  		if( "settings".equals( key ) )
45  			return getSettings();
46  
47  		return getProperty( key.toString() );
48  	}
49  
50  	@Override
51  	public Object put( String key, Object value )
52  	{
53  		Object oldValue = get( key );
54  		setProperty( key, value );
55  		return oldValue;
56  	}
57  
58  	public Settings getSettings()
59  	{
60  		return step == null ? step.getSettings() : null;
61  	}
62  
63  	public String expand( String content )
64  	{
65  		return PropertyExpander.expandProperties( this, content );
66  	}
67  }