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 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.WsdlMessageExchange;
22  import com.eviware.soapui.model.ModelItem;
23  import com.eviware.soapui.model.iface.Attachment;
24  import com.eviware.soapui.support.types.StringToStringMap;
25  
26  /***
27   * WsdlMessageExchange for a WsdlMockResponse, required for validations
28   * 
29   * @author ole.matzura
30   */
31  
32  public class WsdlMockResponseMessageExchange extends WsdlMessageExchange
33  {
34  	private final WsdlMockResponse mockResponse;
35  
36  	public WsdlMockResponseMessageExchange( WsdlMockResponse mockResponse )
37  	{
38  		this.mockResponse = mockResponse;
39  	}
40  	
41  	public Attachment[] getRequestAttachments()
42  	{
43  		return null;
44  	}
45  
46  	public ModelItem getModelItem()
47  	{
48  	   return mockResponse;
49  	}
50  	
51  	public String getRequestContent()
52  	{
53  		WsdlMockResult mockResult = mockResponse.getMockResult();
54        WsdlMockRequest mockRequest = mockResult.getMockRequest();
55        return mockRequest.getRequestContent();
56  	}
57  
58  	public StringToStringMap getRequestHeaders()
59  	{
60  		return null;
61  	}
62  
63  	public Attachment[] getResponseAttachments()
64  	{
65  		return mockResponse.getAttachments();
66  	}
67  
68  	public String getResponseContent()
69  	{
70  		return mockResponse.getResponseContent();
71  	}
72  
73  	public StringToStringMap getResponseHeaders()
74  	{
75  		return mockResponse.getResponseHeaders();
76  	}
77  
78  	@Override
79     public WsdlOperation getOperation()
80  	{
81  		return mockResponse.getMockOperation().getOperation();
82  	}
83  
84  	public long getTimeTaken()
85  	{
86  		return 0;
87  	}
88  
89  	public long getTimestamp()
90  	{
91  		return 0;
92  	}
93  
94  	public boolean isDiscarded()
95  	{
96  		return false;
97  	}
98  
99  	public Vector getRequestWssResult()
100 	{
101 		return mockResponse.getMockResult().getRequestWssResult();
102 	}
103 
104 	public Vector getResponseWssResult()
105 	{
106 		// TODO Auto-generated method stub
107 		return null;
108 	}
109 }