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.panels.mockoperation;
14  
15  import com.eviware.soapui.impl.wsdl.WsdlOperation;
16  import com.eviware.soapui.impl.wsdl.mock.WsdlMockResult;
17  import com.eviware.soapui.impl.wsdl.submit.WsdlMessageExchange;
18  import com.eviware.soapui.model.iface.Attachment;
19  import com.eviware.soapui.support.types.StringToStringMap;
20  
21  /***
22   * WsdlMessageExchange for a WsdlMockResult, required for validations
23   * 
24   * @author ole.matzura
25   */
26  
27  public class WsdlMockResultMessageExchange extends WsdlMessageExchange
28  {
29  	private final WsdlMockResult mockResult;
30  
31  	public WsdlMockResultMessageExchange( WsdlMockResult mockResult )
32  	{
33  		this.mockResult = mockResult;
34  	}
35  	
36  	public Attachment[] getRequestAttachments()
37  	{
38  		return mockResult.getMockRequest().getRequestAttachments();
39  	}
40  
41  	public String getRequestContent()
42  	{
43  		if( mockResult == null || mockResult.getMockRequest() == null )
44  			return null;
45  		
46  		return  mockResult.getMockRequest().getRequestContent();
47  	}
48  
49  	public StringToStringMap getRequestHeaders()
50  	{
51  		return mockResult.getMockRequest().getRequestHeaders();
52  	}
53  
54  	public Attachment[] getResponseAttachments()
55  	{
56  		return mockResult.getMockResponse().getAttachments();
57  	}
58  
59  	public String getResponseContent()
60  	{
61  		return mockResult.getResponseContent();
62  	}
63  
64  	public StringToStringMap getResponseHeaders()
65  	{
66  		return mockResult.getResponseHeaders();
67  	}
68  
69  	public WsdlOperation getOperation()
70  	{
71  		return mockResult.getMockResponse().getMockOperation().getOperation();
72  	}
73  
74  	public long getTimeTaken()
75  	{
76  		return mockResult.getTimeTaken();
77  	}
78  
79  	public long getTimestamp()
80  	{
81  		return mockResult.getTimestamp();
82  	}
83  }