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.panels.mockoperation;
14  
15  import java.util.Vector;
16  
17  import com.eviware.soapui.impl.wsdl.WsdlOperation;
18  import com.eviware.soapui.impl.wsdl.mock.WsdlMockRequest;
19  import com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse;
20  import com.eviware.soapui.impl.wsdl.mock.WsdlMockResult;
21  import com.eviware.soapui.impl.wsdl.submit.AbstractWsdlMessageExchange;
22  import com.eviware.soapui.model.iface.Attachment;
23  import com.eviware.soapui.support.types.StringToStringMap;
24  
25  /***
26   * WsdlMessageExchange for a WsdlMockResponse, required for validations
27   * 
28   * @author ole.matzura
29   */
30  
31  public class WsdlMockResponseMessageExchange extends AbstractWsdlMessageExchange<WsdlMockResponse>
32  {
33  	public WsdlMockResponseMessageExchange( WsdlMockResponse mockResponse )
34  	{
35  		super( mockResponse );
36  	}
37  
38  	public Attachment[] getRequestAttachments()
39  	{
40  		return null;
41  	}
42  
43  
44  	public String getEndpoint()
45  	{
46  		return getModelItem().getMockResult().getMockRequest().getHttpRequest().getRequestURI();
47  	}
48  
49  	public String getRequestContent()
50  	{
51  		WsdlMockResult mockResult = getModelItem().getMockResult();
52  		WsdlMockRequest mockRequest = mockResult.getMockRequest();
53  		return mockRequest.getRequestContent();
54  	}
55  
56  	public StringToStringMap getRequestHeaders()
57  	{
58  		return null;
59  	}
60  
61  	public Attachment[] getResponseAttachments()
62  	{
63  		return getModelItem().getAttachments();
64  	}
65  
66  	public String getResponseContent()
67  	{
68  		return getModelItem().getResponseContent();
69  	}
70  
71  	public StringToStringMap getResponseHeaders()
72  	{
73  		return getModelItem().getResponseHeaders();
74  	}
75  
76  	@Override
77  	public WsdlOperation getOperation()
78  	{
79  		return getModelItem().getMockOperation().getOperation();
80  	}
81  
82  	public long getTimeTaken()
83  	{
84  		return 0;
85  	}
86  
87  	public long getTimestamp()
88  	{
89  		return 0;
90  	}
91  
92  	public boolean isDiscarded()
93  	{
94  		return false;
95  	}
96  
97  	public Vector<?> getRequestWssResult()
98  	{
99  		return getModelItem().getMockResult().getRequestWssResult();
100 	}
101 
102 	public Vector<?> getResponseWssResult()
103 	{
104 		return null;
105 	}
106 
107 	public int getResponseStatusCode()
108 	{
109 		return getModelItem().getMockResult().getResponseStatus();
110 	}
111 
112 	public String getResponseContentType()
113 	{
114 		return getModelItem().getMockResult().getResponseContentType();
115 	}
116 }