View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2008 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.model.propertyexpansion.resolvers;
14  
15  import com.eviware.soapui.model.propertyexpansion.PropertyExpansionContext;
16  
17  public class TestRunPropertyResolver implements PropertyResolver
18  {
19  	public String resolveProperty( PropertyExpansionContext context, String propertyName, boolean globalOverride )
20  	{
21  //		if( !(context instanceof TestRunContext ))
22  //			return null;
23  //		
24  //		TestRunContext trc = ( TestRunContext ) context;
25  //		
26  //		TestCase testCase = trc.getTestCase();
27  //		if( testCase == null )
28  //			return null;
29  //		TestSuite testSuite = testCase.getTestSuite();
30  //		
31  //		if( propertyName.charAt( 0 ) == PropertyExpansion.SCOPE_PREFIX )
32  //		{
33  //			// explicit item reference?
34  //			String value = ResolverUtils.checkForExplicitReference( propertyName, PropertyExpansion.PROJECT_REFERENCE, testSuite.getProject(), trc, globalOverride );
35  //			if( value != null )
36  //				return value;
37  //			
38  //			value = ResolverUtils.checkForExplicitReference( propertyName, PropertyExpansion.TESTSUITE_REFERENCE, testSuite, trc, globalOverride );
39  //			if( value != null )
40  //				return value;
41  //			
42  //			value = ResolverUtils.checkForExplicitReference( propertyName, PropertyExpansion.TESTCASE_REFERENCE, testCase, trc, globalOverride );
43  //			if( value != null )
44  //				return value;
45  //		}
46  //		
47  //		int sepIx = propertyName.indexOf( PropertyExpansion.PROPERTY_SEPARATOR );
48  //		Object property = null;
49  //
50  //		if( sepIx > 0 )
51  //		{
52  //			String step = propertyName.substring( 0, sepIx );
53  //			String name = propertyName.substring( sepIx+1 );
54  //			
55  //			sepIx = name.indexOf( PropertyExpansion.PROPERTY_SEPARATOR );
56  //			if( sepIx != -1 )
57  //			{
58  //				String xpath = name.substring( sepIx+1 );
59  //				name = name.substring( 0, sepIx );
60  //				
61  //				if( step.length() == 0 )
62  //					property = trc.getProperty( name);
63  //				else
64  //					property = trc.getProperty( step, name);
65  //				
66  //				if( property != null )
67  //				{
68  //					property = ResolverUtils.extractXPathPropertyValue( property, PropertyExpansionUtils.expandProperties( trc, xpath ) );
69  //				}
70  //			}
71  //			else
72  //			{
73  //				if( step.length() == 0 )
74  //					property = trc.getProperty( name);
75  //				else
76  //					property = trc.getProperty( step, name);
77  //			}
78  //		}
79  //		
80  //		return property == null ? null : property.toString();
81  		
82  		return null;
83  	}
84  }