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.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  	public String getRequestContent()
44  	{
45  		WsdlMockResult mockResult = getModelItem().getMockResult();
46  		WsdlMockRequest mockRequest = mockResult.getMockRequest();
47  		return mockRequest.getRequestContent();
48  	}
49  
50  	public StringToStringMap getRequestHeaders()
51  	{
52  		return null;
53  	}
54  
55  	public Attachment[] getResponseAttachments()
56  	{
57  		return getModelItem().getAttachments();
58  	}
59  
60  	public String getResponseContent()
61  	{
62  		return getModelItem().getResponseContent();
63  	}
64  
65  	public StringToStringMap getResponseHeaders()
66  	{
67  		return getModelItem().getResponseHeaders();
68  	}
69  
70  	@Override
71  	public WsdlOperation getOperation()
72  	{
73  		return getModelItem().getMockOperation().getOperation();
74  	}
75  
76  	public long getTimeTaken()
77  	{
78  		return 0;
79  	}
80  
81  	public long getTimestamp()
82  	{
83  		return 0;
84  	}
85  
86  	public boolean isDiscarded()
87  	{
88  		return false;
89  	}
90  
91  	public Vector<?> getRequestWssResult()
92  	{
93  		return getModelItem().getMockResult().getRequestWssResult();
94  	}
95  
96  	public Vector<?> getResponseWssResult()
97  	{
98  		return null;
99  	}
100 
101 	public int getResponseStatusCode()
102 	{
103 		return getModelItem().getMockResult().getResponseStatus();
104 	}
105 
106 	public String getResponseContentType()
107 	{
108 		return getModelItem().getMockResult().getResponseContentType();
109 	}
110 }