1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.teststeps;
14
15 import java.lang.ref.SoftReference;
16
17 import com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcResponse;
18 import com.eviware.soapui.impl.wsdl.support.assertions.AssertedXPathsContainer;
19 import com.eviware.soapui.impl.wsdl.teststeps.actions.ShowMessageExchangeAction;
20 import com.eviware.soapui.model.ModelItem;
21 import com.eviware.soapui.model.iface.Attachment;
22 import com.eviware.soapui.model.iface.MessageExchange;
23 import com.eviware.soapui.model.iface.Operation;
24 import com.eviware.soapui.model.testsuite.AssertedXPath;
25 import com.eviware.soapui.support.action.swing.ActionList;
26 import com.eviware.soapui.support.types.StringToStringMap;
27 import com.eviware.soapui.support.types.StringToStringsMap;
28
29 public class JdbcTestStepResult extends WsdlTestStepResult implements AssertedXPathsContainer, MessageExchange
30 {
31 private JdbcResponse response;
32 private SoftReference<JdbcResponse> softResponse;
33 private String requestContent;
34 private boolean addedAction;
35
36 public JdbcTestStepResult( WsdlTestStep testStep )
37 {
38 super( testStep );
39 }
40
41 public void setResponse( JdbcResponse response, boolean useSoftReference )
42 {
43 if( useSoftReference )
44 this.softResponse = new SoftReference<JdbcResponse>( response );
45 else
46 this.response = response;
47 }
48
49 public void setRequestContent( String requestContent )
50 {
51 this.requestContent = requestContent;
52 }
53
54 public void addAssertedXPath( AssertedXPath assertedXPath )
55 {
56 }
57
58 @Override
59 public ActionList getActions()
60 {
61 if( !addedAction )
62 {
63 addAction( new ShowMessageExchangeAction( this, "TestStep" ), true );
64 addedAction = true;
65 }
66
67 return super.getActions();
68 }
69
70 public ModelItem getModelItem()
71 {
72 return getTestStep();
73 }
74
75 public Operation getOperation()
76 {
77 return null;
78 }
79
80 public StringToStringMap getProperties()
81 {
82 return new StringToStringMap();
83 }
84
85 public String getProperty( String name )
86 {
87 return null;
88 }
89
90 public byte[] getRawRequestData()
91 {
92 return hasResponse() ? getResponse().getRawRequestData() : null;
93 }
94
95 public byte[] getRawResponseData()
96 {
97 return getResponseContent().getBytes();
98 }
99
100 public Attachment[] getRequestAttachments()
101 {
102 return new Attachment[0];
103 }
104
105 public Attachment[] getRequestAttachmentsForPart( String partName )
106 {
107 return new Attachment[0];
108 }
109
110 public String getRequestContent()
111 {
112 return requestContent != null ? requestContent : hasResponse() ? getResponse().getRequestContent() : null;
113 }
114
115 public JdbcResponse getResponse()
116 {
117 return softResponse != null ? softResponse.get() : response;
118 }
119
120 public String getRequestContentAsXml()
121 {
122 return null;
123 }
124
125 public StringToStringsMap getRequestHeaders()
126 {
127 return new StringToStringsMap();
128 }
129
130 public Attachment[] getResponseAttachments()
131 {
132 return new Attachment[0];
133 }
134
135 public Attachment[] getResponseAttachmentsForPart( String partName )
136 {
137 return new Attachment[0];
138 }
139
140 public String getResponseContent()
141 {
142 return hasResponse() ? getResponse().getContentAsString() : null;
143 }
144
145 public String getResponseContentAsXml()
146 {
147 return getResponseContent();
148 }
149
150 public StringToStringsMap getResponseHeaders()
151 {
152 return new StringToStringsMap();
153 }
154
155 public long getTimestamp()
156 {
157 return hasResponse() ? getResponse().getTimestamp() : -1;
158 }
159
160 public boolean hasRawData()
161 {
162 return true;
163 }
164
165 public boolean hasRequest( boolean ignoreEmpty )
166 {
167 return hasResponse();
168 }
169
170 public boolean hasResponse()
171 {
172 return getResponse() != null;
173 }
174
175 public String getEndpoint()
176 {
177
178 return null;
179 }
180
181 }