View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2009 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;
14  
15  import java.beans.PropertyChangeEvent;
16  import java.beans.PropertyChangeListener;
17  import java.util.ArrayList;
18  import java.util.Collection;
19  import java.util.Collections;
20  import java.util.List;
21  import java.util.Map;
22  
23  import javax.swing.ImageIcon;
24  
25  import org.apache.log4j.Logger;
26  
27  import com.eviware.soapui.config.RequestStepConfig;
28  import com.eviware.soapui.config.TestStepConfig;
29  import com.eviware.soapui.impl.support.http.HttpRequestTestStep;
30  import com.eviware.soapui.impl.wsdl.AbstractWsdlModelItem;
31  import com.eviware.soapui.impl.wsdl.WsdlInterface;
32  import com.eviware.soapui.impl.wsdl.WsdlOperation;
33  import com.eviware.soapui.impl.wsdl.WsdlProject;
34  import com.eviware.soapui.impl.wsdl.WsdlRequest;
35  import com.eviware.soapui.impl.wsdl.WsdlSubmit;
36  import com.eviware.soapui.impl.wsdl.submit.transports.http.WsdlResponse;
37  import com.eviware.soapui.impl.wsdl.support.assertions.AssertedXPathsContainer;
38  import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
39  import com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext;
40  import com.eviware.soapui.impl.wsdl.teststeps.assertions.TestAssertionRegistry.AssertableType;
41  import com.eviware.soapui.model.ModelItem;
42  import com.eviware.soapui.model.iface.Interface;
43  import com.eviware.soapui.model.iface.Operation;
44  import com.eviware.soapui.model.iface.Submit;
45  import com.eviware.soapui.model.iface.Request.SubmitException;
46  import com.eviware.soapui.model.project.Project;
47  import com.eviware.soapui.model.propertyexpansion.PropertyExpander;
48  import com.eviware.soapui.model.propertyexpansion.PropertyExpansion;
49  import com.eviware.soapui.model.propertyexpansion.PropertyExpansionContainer;
50  import com.eviware.soapui.model.propertyexpansion.PropertyExpansionsResult;
51  import com.eviware.soapui.model.support.InterfaceListenerAdapter;
52  import com.eviware.soapui.model.support.ModelSupport;
53  import com.eviware.soapui.model.support.ProjectListenerAdapter;
54  import com.eviware.soapui.model.support.TestStepBeanProperty;
55  import com.eviware.soapui.model.testsuite.Assertable;
56  import com.eviware.soapui.model.testsuite.AssertionError;
57  import com.eviware.soapui.model.testsuite.AssertionsListener;
58  import com.eviware.soapui.model.testsuite.OperationTestStep;
59  import com.eviware.soapui.model.testsuite.TestAssertion;
60  import com.eviware.soapui.model.testsuite.TestCaseRunContext;
61  import com.eviware.soapui.model.testsuite.TestCaseRunner;
62  import com.eviware.soapui.model.testsuite.TestStep;
63  import com.eviware.soapui.model.testsuite.TestStepResult;
64  import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus;
65  import com.eviware.soapui.support.resolver.ChangeOperationResolver;
66  import com.eviware.soapui.support.resolver.ImportInterfaceResolver;
67  import com.eviware.soapui.support.resolver.RemoveTestStepResolver;
68  import com.eviware.soapui.support.resolver.ResolveContext;
69  import com.eviware.soapui.support.resolver.ResolveContext.PathToResolve;
70  import com.eviware.soapui.support.types.StringToStringMap;
71  
72  /***
73   * WsdlTestStep that executes a WsdlTestRequest
74   * 
75   * @author Ole.Matzura
76   */
77  
78  public class WsdlTestRequestStep extends WsdlTestStepWithProperties implements OperationTestStep,
79  		PropertyChangeListener, PropertyExpansionContainer, Assertable, HttpRequestTestStep
80  {
81  	private final static Logger log = Logger.getLogger( WsdlTestRequestStep.class );
82  	private RequestStepConfig requestStepConfig;
83  	private WsdlTestRequest testRequest;
84  	private WsdlOperation wsdlOperation;
85  	private final InternalProjectListener projectListener = new InternalProjectListener();
86  	private final InternalInterfaceListener interfaceListener = new InternalInterfaceListener();
87  	private WsdlSubmit<WsdlRequest> submit;
88  
89  	public WsdlTestRequestStep( WsdlTestCase testCase, TestStepConfig config, boolean forLoadTest )
90  	{
91  		super( testCase, config, true, forLoadTest );
92  
93  		if( getConfig().getConfig() != null )
94  		{
95  			requestStepConfig = ( RequestStepConfig )getConfig().getConfig().changeType( RequestStepConfig.type );
96  
97  			wsdlOperation = findWsdlOperation();
98  			if( wsdlOperation == null )
99  			{
100 				log.error( "Could not find operation [" + requestStepConfig.getOperation() + "] in interface ["
101 						+ requestStepConfig.getInterface() + "] for test request [" + getName() + "] in TestCase ["
102 						+ getTestCase().getTestSuite().getName() + "/" + getTestCase().getName() + "]" );
103 				// requestStepConfig.setRequest(null);
104 				setDisabled( true );
105 			}
106 			else
107 			{
108 				initTestRequest( config, forLoadTest );
109 			}
110 		}
111 		else
112 		{
113 			requestStepConfig = ( RequestStepConfig )getConfig().addNewConfig().changeType( RequestStepConfig.type );
114 		}
115 
116 		// init properties
117 		if( testRequest != null )
118 		{
119 			initRequestProperties();
120 		}
121 	}
122 
123 	private void initRequestProperties()
124 	{
125 		addProperty( new TestStepBeanProperty( "Endpoint", false, testRequest, "endpoint", this ) );
126 		addProperty( new TestStepBeanProperty( "Username", false, testRequest, "username", this ) );
127 		addProperty( new TestStepBeanProperty( "Password", false, testRequest, "password", this ) );
128 		addProperty( new TestStepBeanProperty( "Domain", false, testRequest, "domain", this ) );
129 		addProperty( new TestStepBeanProperty( "Request", false, testRequest, "requestContent", this )
130 		{
131 			@Override
132 			public String getDefaultValue()
133 			{
134 				return getOperation().createRequest( true );
135 			}
136 		} );
137 		addProperty( new TestStepBeanProperty( "Response", true, testRequest, "responseContent", this )
138 		{
139 			@Override
140 			public String getDefaultValue()
141 			{
142 				return getOperation().createResponse( true );
143 			}
144 		} );
145 	}
146 
147 	private void initTestRequest( TestStepConfig config, boolean forLoadTest )
148 	{
149 		if( !forLoadTest )
150 		{
151 			wsdlOperation.getInterface().getProject().addProjectListener( projectListener );
152 			wsdlOperation.getInterface().addInterfaceListener( interfaceListener );
153 
154 			// we need to listen for name changes which happen when
155 			// interfaces are updated..
156 			wsdlOperation.getInterface().addPropertyChangeListener( this );
157 			wsdlOperation.addPropertyChangeListener( this );
158 		}
159 
160 		testRequest = new WsdlTestRequest( wsdlOperation, requestStepConfig.getRequest(), this, forLoadTest );
161 		testRequest.addPropertyChangeListener( this );
162 
163 		if( config.isSetName() )
164 			testRequest.setName( config.getName() );
165 		else
166 			config.setName( testRequest.getName() );
167 	}
168 
169 	@Override
170 	public WsdlTestStep clone( WsdlTestCase targetTestCase, String name )
171 	{
172 		beforeSave();
173 
174 		TestStepConfig config = ( TestStepConfig )getConfig().copy();
175 		RequestStepConfig stepConfig = ( RequestStepConfig )config.getConfig().changeType( RequestStepConfig.type );
176 
177 		while( stepConfig.getRequest().sizeOfAttachmentArray() > 0 )
178 			stepConfig.getRequest().removeAttachment( 0 );
179 
180 		config.setName( name );
181 		stepConfig.getRequest().setName( name );
182 
183 		WsdlTestRequestStep result = ( WsdlTestRequestStep )targetTestCase.addTestStep( config );
184 		testRequest.copyAttachmentsTo( result.getTestRequest() );
185 
186 		return result;
187 	}
188 
189 	private WsdlOperation findWsdlOperation()
190 	{
191 		WsdlTestCase testCase = getTestCase();
192 		if( testCase == null || testCase.getTestSuite() == null )
193 			return null;
194 
195 		Project project = testCase.getTestSuite().getProject();
196 		WsdlOperation operation = null;
197 		for( int c = 0; c < project.getInterfaceCount(); c++ )
198 		{
199 			if( project.getInterfaceAt( c ).getName().equals( requestStepConfig.getInterface() ) )
200 			{
201 				WsdlInterface iface = ( WsdlInterface )project.getInterfaceAt( c );
202 				for( int i = 0; i < iface.getOperationCount(); i++ )
203 				{
204 					if( iface.getOperationAt( i ).getName().equals( requestStepConfig.getOperation() ) )
205 					{
206 						operation = iface.getOperationAt( i );
207 						break;
208 					}
209 				}
210 
211 				if( operation != null )
212 					break;
213 			}
214 		}
215 		return operation;
216 	}
217 
218 	public String getInterfaceName()
219 	{
220 		return requestStepConfig.getInterface();
221 	}
222 
223 	public String getOperationName()
224 	{
225 		return requestStepConfig.getOperation();
226 	}
227 
228 	@Override
229 	public void release()
230 	{
231 		super.release();
232 
233 		if( wsdlOperation == null )
234 			wsdlOperation = findWsdlOperation();
235 
236 		if( wsdlOperation != null )
237 		{
238 			wsdlOperation.removePropertyChangeListener( this );
239 			wsdlOperation.getInterface().getProject().removeProjectListener( projectListener );
240 			wsdlOperation.getInterface().removeInterfaceListener( interfaceListener );
241 			wsdlOperation.getInterface().removePropertyChangeListener( this );
242 		}
243 
244 		// could be null if initialization failed..
245 		if( testRequest != null )
246 		{
247 			testRequest.removePropertyChangeListener( this );
248 			testRequest.release();
249 		}
250 	}
251 
252 	@Override
253 	public void resetConfigOnMove( TestStepConfig config )
254 	{
255 		super.resetConfigOnMove( config );
256 
257 		requestStepConfig = ( RequestStepConfig )config.getConfig().changeType( RequestStepConfig.type );
258 		testRequest.updateConfig( requestStepConfig.getRequest() );
259 	}
260 
261 	@Override
262 	public ImageIcon getIcon()
263 	{
264 		return testRequest == null ? null : testRequest.getIcon();
265 	}
266 
267 	public WsdlTestRequest getTestRequest()
268 	{
269 		return testRequest;
270 	}
271 
272 	@Override
273 	public void setName( String name )
274 	{
275 		super.setName( name );
276 		testRequest.setName( name );
277 	}
278 
279 	public void propertyChange( PropertyChangeEvent arg0 )
280 	{
281 		if( arg0.getSource() == wsdlOperation )
282 		{
283 			if( arg0.getPropertyName().equals( Operation.NAME_PROPERTY ) )
284 			{
285 				requestStepConfig.setOperation( ( String )arg0.getNewValue() );
286 			}
287 		}
288 		else if( arg0.getSource() == wsdlOperation.getInterface() )
289 		{
290 			if( arg0.getPropertyName().equals( Interface.NAME_PROPERTY ) )
291 			{
292 				requestStepConfig.setInterface( ( String )arg0.getNewValue() );
293 			}
294 		}
295 		else if( arg0.getPropertyName().equals( TestAssertion.CONFIGURATION_PROPERTY )
296 				|| arg0.getPropertyName().equals( TestAssertion.DISABLED_PROPERTY ) )
297 		{
298 			if( getTestRequest().getResponse() != null )
299 			{
300 				getTestRequest().assertResponse( new WsdlTestRunContext( this ) );
301 			}
302 		}
303 		else
304 		{
305 			if( arg0.getSource() == testRequest && arg0.getPropertyName().equals( WsdlTestRequest.NAME_PROPERTY ) )
306 			{
307 				if( !super.getName().equals( ( String )arg0.getNewValue() ) )
308 					super.setName( ( String )arg0.getNewValue() );
309 			}
310 
311 			notifyPropertyChanged( arg0.getPropertyName(), arg0.getOldValue(), arg0.getNewValue() );
312 		}
313 	}
314 
315 	public TestStepResult run( TestCaseRunner runner, TestCaseRunContext runContext )
316 	{
317 		WsdlTestRequestStepResult testStepResult = new WsdlTestRequestStepResult( this );
318 		testStepResult.startTimer();
319 		runContext.setProperty( AssertedXPathsContainer.ASSERTEDXPATHSCONTAINER_PROPERTY, testStepResult );
320 
321 		try
322 		{
323 			submit = testRequest.submit( runContext, false );
324 			WsdlResponse response = ( WsdlResponse )submit.getResponse();
325 
326 			if( submit.getStatus() != Submit.Status.CANCELED )
327 			{
328 				if( submit.getStatus() == Submit.Status.ERROR )
329 				{
330 					testStepResult.setStatus( TestStepStatus.FAILED );
331 					testStepResult.addMessage( submit.getError().toString() );
332 					
333 
334 					testRequest.setResponse( null, runContext );
335 				}
336 				else if( response == null )
337 				{
338 					testStepResult.setStatus( TestStepStatus.FAILED );
339 					testStepResult.addMessage( "Request is missing response" );
340 
341 					testRequest.setResponse( null, runContext );
342 				}
343 				else
344 				{
345 					runContext.setProperty( AssertedXPathsContainer.ASSERTEDXPATHSCONTAINER_PROPERTY, testStepResult );
346 					testRequest.setResponse( response, runContext );
347 
348 					testStepResult.setTimeTaken( response.getTimeTaken() );
349 					testStepResult.setSize( response.getContentLength() );
350 
351 					switch( testRequest.getAssertionStatus() )
352 					{
353 					case FAILED :
354 						testStepResult.setStatus( TestStepStatus.FAILED );
355 						break;
356 					case VALID :
357 						testStepResult.setStatus( TestStepStatus.OK );
358 						break;
359 					case UNKNOWN :
360 						testStepResult.setStatus( TestStepStatus.UNKNOWN );
361 						break;
362 					}
363 
364 					testStepResult.setResponse( response, testStepResult.getStatus() != TestStepStatus.FAILED );
365 				}
366 			}
367 			else
368 			{
369 				testStepResult.setStatus( TestStepStatus.CANCELED );
370 				testStepResult.addMessage( "Request was canceled" );
371 			}
372 
373 			if( response != null )
374 				testStepResult.setRequestContent( response.getRequestContent(), testStepResult.getStatus() != TestStepStatus.FAILED );
375 			else
376 				testStepResult.setRequestContent( testRequest.getRequestContent(), testStepResult.getStatus() != TestStepStatus.FAILED );
377 			testStepResult.stopTimer();
378 		}
379 		catch( SubmitException e )
380 		{
381 			testStepResult.setStatus( TestStepStatus.FAILED );
382 			testStepResult.addMessage( "SubmitException: " + e );
383 			testStepResult.stopTimer();
384 		}
385 		finally
386 		{
387 			submit = null;
388 		}
389 
390 		testStepResult.setDomain( PropertyExpander.expandProperties( runContext, testRequest.getDomain() ) );
391 		testStepResult.setUsername( PropertyExpander.expandProperties( runContext, testRequest.getUsername() ) );
392 		testStepResult.setPassword( PropertyExpander.expandProperties( runContext, testRequest.getPassword() ) );
393 		testStepResult.setEndpoint( PropertyExpander.expandProperties( runContext, testRequest.getEndpoint() ) );
394 		testStepResult.setEncoding( PropertyExpander.expandProperties( runContext, testRequest.getEncoding() ) );
395 
396 		if( testStepResult.getStatus() != TestStepStatus.CANCELED )
397 		{
398 			AssertionStatus assertionStatus = testRequest.getAssertionStatus();
399 			switch( assertionStatus )
400 			{
401 			case FAILED :
402 			{
403 				testStepResult.setStatus( TestStepStatus.FAILED );
404 				if( getAssertionCount() == 0 )
405 				{
406 					testStepResult.addMessage( "Invalid/empty response" );
407 				}
408 				else
409 					for( int c = 0; c < getAssertionCount(); c++ )
410 					{
411 						WsdlMessageAssertion assertion = getAssertionAt( c );
412 						AssertionError[] errors = assertion.getErrors();
413 						if( errors != null )
414 						{
415 							for( AssertionError error : errors )
416 							{
417 								testStepResult.addMessage( "[" + assertion.getName() + "] " + error.getMessage() );
418 							}
419 						}
420 					}
421 
422 				break;
423 			}
424 				// default : testStepResult.setStatus( TestStepStatus.OK ); break;
425 			}
426 		}
427 
428 //		if( !runContext.hasProperty( TestRunContext.INTERACTIVE ) )
429 //			testRequest.setResponse( null, runContext );
430 
431 		return testStepResult;
432 	}
433 
434 	public WsdlMessageAssertion getAssertionAt( int index )
435 	{
436 		return testRequest.getAssertionAt( index );
437 	}
438 
439 	public int getAssertionCount()
440 	{
441 		return testRequest == null ? 0 : testRequest.getAssertionCount();
442 	}
443 
444 	public WsdlTestRequest getHttpRequest()
445 	{
446 		return testRequest;
447 	}
448 
449 	public class InternalProjectListener extends ProjectListenerAdapter
450 	{
451 		@Override
452 		public void interfaceRemoved( Interface iface )
453 		{
454 			if( wsdlOperation != null && wsdlOperation.getInterface().equals( iface ) )
455 			{
456 				log.debug( "Removing test step due to removed interface" );
457 				( getTestCase() ).removeTestStep( WsdlTestRequestStep.this );
458 			}
459 		}
460 	}
461 
462 	public class InternalInterfaceListener extends InterfaceListenerAdapter
463 	{
464 		@Override
465 		public void operationRemoved( Operation operation )
466 		{
467 			if( operation == wsdlOperation )
468 			{
469 				log.debug( "Removing test step due to removed operation" );
470 				( getTestCase() ).removeTestStep( WsdlTestRequestStep.this );
471 			}
472 		}
473 
474 		@Override
475 		public void operationUpdated( Operation operation )
476 		{
477 			if( operation == wsdlOperation )
478 			{
479 				requestStepConfig.setOperation( operation.getName() );
480 			}
481 		}
482 	}
483 
484 	@Override
485 	public boolean cancel()
486 	{
487 		if( submit == null )
488 			return false;
489 
490 		submit.cancel();
491 
492 		return true;
493 	}
494 
495 	@Override
496 	public Collection<Interface> getRequiredInterfaces()
497 	{
498 		ArrayList<Interface> result = new ArrayList<Interface>();
499 		result.add( findWsdlOperation().getInterface() );
500 		return result;
501 	}
502 
503 	public String getDefaultSourcePropertyName()
504 	{
505 		return "Response";
506 	}
507 
508 	public String getDefaultTargetPropertyName()
509 	{
510 		return "Request";
511 	}
512 
513 	@Override
514 	public boolean dependsOn( AbstractWsdlModelItem<?> modelItem )
515 	{
516 		if( modelItem instanceof Interface && testRequest.getOperation().getInterface() == modelItem )
517 		{
518 			return true;
519 		}
520 		else if( modelItem instanceof Operation && testRequest.getOperation() == modelItem )
521 		{
522 			return true;
523 		}
524 
525 		return false;
526 	}
527 
528 	@Override
529 	public void beforeSave()
530 	{
531 		super.beforeSave();
532 
533 		if( testRequest != null )
534 			testRequest.beforeSave();
535 	}
536 
537 	@Override
538 	public String getDescription()
539 	{
540 		return testRequest == null ? "<missing>" : testRequest.getDescription();
541 	}
542 
543 	@Override
544 	public void setDescription( String description )
545 	{
546 		if( testRequest != null )
547 			testRequest.setDescription( description );
548 	}
549 
550 	public void setOperation( WsdlOperation operation )
551 	{
552 		if( wsdlOperation == operation )
553 			return;
554 
555 		WsdlOperation oldOperation = wsdlOperation;
556 		wsdlOperation = operation;
557 		requestStepConfig.setInterface( operation.getInterface().getName() );
558 		requestStepConfig.setOperation( operation.getName() );
559 
560 		if( oldOperation != null )
561 			oldOperation.removePropertyChangeListener( this );
562 
563 		wsdlOperation.addPropertyChangeListener( this );
564 
565 		initTestRequest( this.getConfig(), false );
566 		testRequest.setOperation( wsdlOperation );
567 	}
568 
569 	@SuppressWarnings( "unchecked" )
570 	@Override
571 	public List<? extends ModelItem> getChildren()
572 	{
573 		return testRequest == null ? Collections.EMPTY_LIST : testRequest.getAssertionList();
574 	}
575 
576 	public PropertyExpansion[] getPropertyExpansions()
577 	{
578 		if( testRequest == null )
579 			return new PropertyExpansion[0];
580 
581 		PropertyExpansionsResult result = new PropertyExpansionsResult( this, testRequest );
582 
583 		result.extractAndAddAll( "requestContent" );
584 		result.extractAndAddAll( "endpoint" );
585 		result.extractAndAddAll( "username" );
586 		result.extractAndAddAll( "password" );
587 		result.extractAndAddAll( "domain" );
588 
589 		StringToStringMap requestHeaders = testRequest.getRequestHeaders();
590 		for( String key : requestHeaders.keySet() )
591 		{
592 			result.extractAndAddAll( new RequestHeaderHolder( requestHeaders, key ), "value" );
593 		}
594 
595 		testRequest.addWsaPropertyExpansions( result, testRequest.getWsaConfig(), this );
596 		return result.toArray( new PropertyExpansion[result.size()] );
597 	}
598 
599 	public class RequestHeaderHolder
600 	{
601 		private final StringToStringMap valueMap;
602 		private final String key;
603 
604 		public RequestHeaderHolder( StringToStringMap valueMap, String key )
605 		{
606 			this.valueMap = valueMap;
607 			this.key = key;
608 		}
609 
610 		public String getValue()
611 		{
612 			return valueMap.get( key );
613 		}
614 
615 		public void setValue( String value )
616 		{
617 			valueMap.put( key, value );
618 			testRequest.setRequestHeaders( valueMap );
619 		}
620 	}
621 
622 	public TestAssertion addAssertion( String type )
623 	{
624 		WsdlMessageAssertion result = testRequest.addAssertion( type );
625 		return result;
626 	}
627 
628 	public void addAssertionsListener( AssertionsListener listener )
629 	{
630 		testRequest.addAssertionsListener( listener );
631 	}
632 
633 	public TestAssertion cloneAssertion( TestAssertion source, String name )
634 	{
635 		return testRequest.cloneAssertion( source, name );
636 	}
637 
638 	public String getAssertableContent()
639 	{
640 		return testRequest.getAssertableContent();
641 	}
642 
643 	public AssertableType getAssertableType()
644 	{
645 		return testRequest.getAssertableType();
646 	}
647 
648 	public TestAssertion getAssertionByName( String name )
649 	{
650 		return testRequest.getAssertionByName( name );
651 	}
652 
653 	public List<TestAssertion> getAssertionList()
654 	{
655 		return testRequest.getAssertionList();
656 	}
657 
658 	public AssertionStatus getAssertionStatus()
659 	{
660 		return testRequest.getAssertionStatus();
661 	}
662 
663 	public Interface getInterface()
664 	{
665 		return getOperation().getInterface();
666 	}
667 
668 	public WsdlOperation getOperation()
669 	{
670 		return wsdlOperation;
671 	}
672 
673 	public TestStep getTestStep()
674 	{
675 		return this;
676 	}
677 
678 	public void removeAssertion( TestAssertion assertion )
679 	{
680 		testRequest.removeAssertion( assertion );
681 	}
682 
683 	public TestAssertion moveAssertion( int ix, int whereTo )
684 	{
685 		return testRequest.moveAssertion( ix, whereTo );
686 	}
687 
688 	public void removeAssertionsListener( AssertionsListener listener )
689 	{
690 		testRequest.removeAssertionsListener( listener );
691 	}
692 
693 	public Map<String, TestAssertion> getAssertions()
694 	{
695 		return testRequest.getAssertions();
696 	}
697 
698 	@Override
699 	public void prepare( TestCaseRunner testRunner, TestCaseRunContext testRunContext ) throws Exception
700 	{
701 		super.prepare( testRunner, testRunContext );
702 
703 		testRequest.setResponse( null, testRunContext );
704 
705 		for( TestAssertion assertion : testRequest.getAssertionList() )
706 		{
707 			assertion.prepare( testRunner, testRunContext );
708 		}
709 	}
710 
711 	public String getDefaultAssertableContent()
712 	{
713 		return testRequest.getDefaultAssertableContent();
714 	}
715 
716 	@SuppressWarnings( "unchecked" )
717 	public void resolve( ResolveContext<?> context )
718 	{
719 		super.resolve( context );
720 
721 		if( wsdlOperation == null )
722 		{
723 			// not solved and we have it in list do not add it.
724 			if( context.hasThisModelItem( this, "Missing SOAP Operation in Project", requestStepConfig.getInterface()
725 					+ "/" + requestStepConfig.getOperation() ) )
726 				return;
727 
728 			context.addPathToResolve( this, "Missing SOAP Operation in Project",
729 					requestStepConfig.getInterface() + "/" + requestStepConfig.getOperation() ).addResolvers(
730 					new RemoveTestStepResolver( this ), new ImportInterfaceResolver( this )
731 					{
732 
733 						@Override
734 						protected boolean update()
735 						{
736 							wsdlOperation = findWsdlOperation();
737 							if( wsdlOperation == null )
738 								return false;
739 
740 							initTestRequest( getConfig(), false );
741 							initRequestProperties();
742 							setDisabled( false );
743 							return true;
744 						}
745 					}, new ChangeOperationResolver( this, "Operation" )
746 					{
747 
748 						@Override
749 						public boolean update()
750 						{
751 							WsdlOperation wsdlOperation = ( WsdlOperation )getSelectedOperation();
752 							if( wsdlOperation == null )
753 								return false;
754 
755 							setOperation( wsdlOperation );
756 							initTestRequest( getConfig(), false );
757 							initRequestProperties();
758 							setDisabled( false );
759 							return true;
760 						}
761 
762 						protected Interface[] getInterfaces( WsdlProject project )
763 						{
764 							List<WsdlInterface> interfaces = ModelSupport.getChildren( project, WsdlInterface.class );
765 							return interfaces.toArray( new Interface[interfaces.size()] );
766 
767 						}
768 
769 					} );
770 		}
771 		else
772 		{
773 			testRequest.resolve( context );
774 			if( context.hasThisModelItem( this, "Missing SOAP Operation in Project", requestStepConfig.getInterface()
775 					+ "/" + requestStepConfig.getOperation() ) )
776 			{
777 				PathToResolve path = context.getPath( this, "Missing SOAP Operation in Project", requestStepConfig
778 						.getInterface()
779 						+ "/" + requestStepConfig.getOperation() );
780 				path.setSolved( true );
781 			}
782 		}
783 	}
784 
785 }