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