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  public class WsdlMockResultMessageExchange extends WsdlMessageExchange
22  {
23  	private final WsdlMockResult mockResult;
24  
25  	public WsdlMockResultMessageExchange( WsdlMockResult mockResult )
26  	{
27  		this.mockResult = mockResult;
28  	}
29  	
30  	public Attachment[] getRequestAttachments()
31  	{
32  		return mockResult.getMockRequest().getRequestAttachments();
33  	}
34  
35  	public String getRequestContent()
36  	{
37  		if( mockResult == null || mockResult.getMockRequest() == null )
38  			return null;
39  		
40  		return  mockResult.getMockRequest().getRequestContent();
41  	}
42  
43  	public StringToStringMap getRequestHeaders()
44  	{
45  		return mockResult.getMockRequest().getRequestHeaders();
46  	}
47  
48  	public Attachment[] getResponseAttachments()
49  	{
50  		return mockResult.getMockResponse().getAttachments();
51  	}
52  
53  	public String getResponseContent()
54  	{
55  		return mockResult.getResponseContent();
56  	}
57  
58  	public StringToStringMap getResponseHeaders()
59  	{
60  		return mockResult.getResponseHeaders();
61  	}
62  
63  	public WsdlOperation getOperation()
64  	{
65  		return mockResult.getMockResponse().getMockOperation().getOperation();
66  	}
67  
68  	public long getTimeTaken()
69  	{
70  		return mockResult.getTimeTaken();
71  	}
72  
73  	public long getTimestamp()
74  	{
75  		return mockResult.getTimestamp();
76  	}
77  }