diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Framework/Servers/Tests | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/Tests/OSHttpTests.cs | 315 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/Tests/VersionInfoTests.cs | 2 |
2 files changed, 3 insertions, 314 deletions
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index 3412e0f..5c0e0df 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs | |||
@@ -41,318 +41,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
41 | { | 41 | { |
42 | [TestFixture] | 42 | [TestFixture] |
43 | public class OSHttpTests : OpenSimTestCase | 43 | public class OSHttpTests : OpenSimTestCase |
44 | { | 44 | { |
45 | // we need an IHttpClientContext for our tests | ||
46 | public class TestHttpClientContext: IHttpClientContext | ||
47 | { | ||
48 | private bool _secured; | ||
49 | public bool IsSecured | ||
50 | { | ||
51 | get { return _secured; } | ||
52 | } | ||
53 | public bool Secured | ||
54 | { | ||
55 | get { return _secured; } | ||
56 | } | ||
57 | |||
58 | public TestHttpClientContext(bool secured) | ||
59 | { | ||
60 | _secured = secured; | ||
61 | } | ||
62 | |||
63 | public void Disconnect(SocketError error) {} | ||
64 | public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body) {} | ||
65 | public void Respond(string httpVersion, HttpStatusCode statusCode, string reason) {} | ||
66 | public void Respond(string body) {} | ||
67 | public void Send(byte[] buffer) {} | ||
68 | public void Send(byte[] buffer, int offset, int size) {} | ||
69 | public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body, string contentType) {} | ||
70 | public void Close() { } | ||
71 | public bool EndWhenDone { get { return false;} set { return;}} | ||
72 | |||
73 | public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { }; | ||
74 | /// <summary> | ||
75 | /// A request have been received in the context. | ||
76 | /// </summary> | ||
77 | public event EventHandler<RequestEventArgs> RequestReceived = delegate { }; | ||
78 | |||
79 | } | ||
80 | |||
81 | public class TestHttpRequest: IHttpRequest | ||
82 | { | ||
83 | private string _uriPath; | ||
84 | public bool BodyIsComplete | ||
85 | { | ||
86 | get { return true; } | ||
87 | } | ||
88 | public string[] AcceptTypes | ||
89 | { | ||
90 | get {return _acceptTypes; } | ||
91 | } | ||
92 | private string[] _acceptTypes; | ||
93 | public Stream Body | ||
94 | { | ||
95 | get { return _body; } | ||
96 | set { _body = value;} | ||
97 | } | ||
98 | private Stream _body; | ||
99 | public ConnectionType Connection | ||
100 | { | ||
101 | get { return _connection; } | ||
102 | set { _connection = value; } | ||
103 | } | ||
104 | private ConnectionType _connection; | ||
105 | public int ContentLength | ||
106 | { | ||
107 | get { return _contentLength; } | ||
108 | set { _contentLength = value; } | ||
109 | } | ||
110 | private int _contentLength; | ||
111 | public NameValueCollection Headers | ||
112 | { | ||
113 | get { return _headers; } | ||
114 | } | ||
115 | private NameValueCollection _headers = new NameValueCollection(); | ||
116 | public string HttpVersion | ||
117 | { | ||
118 | get { return _httpVersion; } | ||
119 | set { _httpVersion = value; } | ||
120 | } | ||
121 | private string _httpVersion = null; | ||
122 | public string Method | ||
123 | { | ||
124 | get { return _method; } | ||
125 | set { _method = value; } | ||
126 | } | ||
127 | private string _method = null; | ||
128 | public HttpInput QueryString | ||
129 | { | ||
130 | get { return _queryString; } | ||
131 | } | ||
132 | private HttpInput _queryString = null; | ||
133 | public Uri Uri | ||
134 | { | ||
135 | get { return _uri; } | ||
136 | set { _uri = value; } | ||
137 | } | ||
138 | private Uri _uri = null; | ||
139 | public string[] UriParts | ||
140 | { | ||
141 | get { return _uri.Segments; } | ||
142 | } | ||
143 | public HttpParam Param | ||
144 | { | ||
145 | get { return null; } | ||
146 | } | ||
147 | public HttpForm Form | ||
148 | { | ||
149 | get { return null; } | ||
150 | } | ||
151 | public bool IsAjax | ||
152 | { | ||
153 | get { return false; } | ||
154 | } | ||
155 | public RequestCookies Cookies | ||
156 | { | ||
157 | get { return null; } | ||
158 | } | ||
159 | |||
160 | public TestHttpRequest() {} | ||
161 | |||
162 | public TestHttpRequest(string contentEncoding, string contentType, string userAgent, | ||
163 | string remoteAddr, string remotePort, string[] acceptTypes, | ||
164 | ConnectionType connectionType, int contentLength, Uri uri) | ||
165 | { | ||
166 | _headers["content-encoding"] = contentEncoding; | ||
167 | _headers["content-type"] = contentType; | ||
168 | _headers["user-agent"] = userAgent; | ||
169 | _headers["remote_addr"] = remoteAddr; | ||
170 | _headers["remote_port"] = remotePort; | ||
171 | |||
172 | _acceptTypes = acceptTypes; | ||
173 | _connection = connectionType; | ||
174 | _contentLength = contentLength; | ||
175 | _uri = uri; | ||
176 | } | ||
177 | |||
178 | public void DecodeBody(FormDecoderProvider providers) {} | ||
179 | public void SetCookies(RequestCookies cookies) {} | ||
180 | public void AddHeader(string name, string value) | ||
181 | { | ||
182 | _headers.Add(name, value); | ||
183 | } | ||
184 | public int AddToBody(byte[] bytes, int offset, int length) | ||
185 | { | ||
186 | return 0; | ||
187 | } | ||
188 | public void Clear() {} | ||
189 | |||
190 | public object Clone() | ||
191 | { | ||
192 | TestHttpRequest clone = new TestHttpRequest(); | ||
193 | clone._acceptTypes = _acceptTypes; | ||
194 | clone._connection = _connection; | ||
195 | clone._contentLength = _contentLength; | ||
196 | clone._uri = _uri; | ||
197 | clone._headers = new NameValueCollection(_headers); | ||
198 | |||
199 | return clone; | ||
200 | } | ||
201 | public IHttpResponse CreateResponse(IHttpClientContext context) | ||
202 | { | ||
203 | return new HttpResponse(context, this); | ||
204 | } | ||
205 | /// <summary> | ||
206 | /// Path and query (will be merged with the host header) and put in Uri | ||
207 | /// </summary> | ||
208 | /// <see cref="Uri"/> | ||
209 | public string UriPath | ||
210 | { | ||
211 | get { return _uriPath; } | ||
212 | set | ||
213 | { | ||
214 | _uriPath = value; | ||
215 | |||
216 | } | ||
217 | } | ||
218 | |||
219 | } | ||
220 | |||
221 | public class TestHttpResponse: IHttpResponse | ||
222 | { | ||
223 | public Stream Body | ||
224 | { | ||
225 | get { return _body; } | ||
226 | |||
227 | set { _body = value; } | ||
228 | } | ||
229 | private Stream _body; | ||
230 | |||
231 | public string ProtocolVersion | ||
232 | { | ||
233 | get { return _protocolVersion; } | ||
234 | set { _protocolVersion = value; } | ||
235 | } | ||
236 | private string _protocolVersion; | ||
237 | |||
238 | public bool Chunked | ||
239 | { | ||
240 | get { return _chunked; } | ||
241 | |||
242 | set { _chunked = value; } | ||
243 | } | ||
244 | private bool _chunked; | ||
245 | |||
246 | public ConnectionType Connection | ||
247 | { | ||
248 | get { return _connection; } | ||
249 | |||
250 | set { _connection = value; } | ||
251 | } | ||
252 | private ConnectionType _connection; | ||
253 | |||
254 | public Encoding Encoding | ||
255 | { | ||
256 | get { return _encoding; } | ||
257 | |||
258 | set { _encoding = value; } | ||
259 | } | ||
260 | private Encoding _encoding; | ||
261 | |||
262 | public int KeepAlive | ||
263 | { | ||
264 | get { return _keepAlive; } | ||
265 | |||
266 | set { _keepAlive = value; } | ||
267 | } | ||
268 | private int _keepAlive; | ||
269 | |||
270 | public HttpStatusCode Status | ||
271 | { | ||
272 | get { return _status; } | ||
273 | |||
274 | set { _status = value; } | ||
275 | } | ||
276 | private HttpStatusCode _status; | ||
277 | |||
278 | public string Reason | ||
279 | { | ||
280 | get { return _reason; } | ||
281 | |||
282 | set { _reason = value; } | ||
283 | } | ||
284 | private string _reason; | ||
285 | |||
286 | public long ContentLength | ||
287 | { | ||
288 | get { return _contentLength; } | ||
289 | |||
290 | set { _contentLength = value; } | ||
291 | } | ||
292 | private long _contentLength; | ||
293 | |||
294 | public string ContentType | ||
295 | { | ||
296 | get { return _contentType; } | ||
297 | |||
298 | set { _contentType = value; } | ||
299 | } | ||
300 | private string _contentType; | ||
301 | |||
302 | public bool HeadersSent | ||
303 | { | ||
304 | get { return _headersSent; } | ||
305 | } | ||
306 | private bool _headersSent; | ||
307 | |||
308 | public bool Sent | ||
309 | { | ||
310 | get { return _sent; } | ||
311 | } | ||
312 | private bool _sent; | ||
313 | |||
314 | public ResponseCookies Cookies | ||
315 | { | ||
316 | get { return _cookies; } | ||
317 | } | ||
318 | private ResponseCookies _cookies = null; | ||
319 | |||
320 | public TestHttpResponse() | ||
321 | { | ||
322 | _headersSent = false; | ||
323 | _sent = false; | ||
324 | } | ||
325 | |||
326 | public void AddHeader(string name, string value) {} | ||
327 | public void Send() | ||
328 | { | ||
329 | if (!_headersSent) SendHeaders(); | ||
330 | if (_sent) throw new InvalidOperationException("stuff already sent"); | ||
331 | _sent = true; | ||
332 | } | ||
333 | |||
334 | public void SendBody(byte[] buffer, int offset, int count) | ||
335 | { | ||
336 | if (!_headersSent) SendHeaders(); | ||
337 | _sent = true; | ||
338 | } | ||
339 | public void SendBody(byte[] buffer) | ||
340 | { | ||
341 | if (!_headersSent) SendHeaders(); | ||
342 | _sent = true; | ||
343 | } | ||
344 | |||
345 | public void SendHeaders() | ||
346 | { | ||
347 | if (_headersSent) throw new InvalidOperationException("headers already sent"); | ||
348 | _headersSent = true; | ||
349 | } | ||
350 | |||
351 | public void Redirect(Uri uri) {} | ||
352 | public void Redirect(string url) {} | ||
353 | } | ||
354 | |||
355 | |||
356 | public OSHttpRequest req0; | 45 | public OSHttpRequest req0; |
357 | public OSHttpRequest req1; | 46 | public OSHttpRequest req1; |
358 | 47 | ||
@@ -424,4 +113,4 @@ namespace OpenSim.Framework.Servers.Tests | |||
424 | Assert.That(rsp0.ContentType, Is.EqualTo("text/xml")); | 113 | Assert.That(rsp0.ContentType, Is.EqualTo("text/xml")); |
425 | } | 114 | } |
426 | } | 115 | } |
427 | } | 116 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs b/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs index 2d72cb8..480f2bb 100644 --- a/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs +++ b/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
47 | { | 47 | { |
48 | foreach (VersionInfo.Flavour flavour in Enum.GetValues(typeof(VersionInfo.Flavour))) | 48 | foreach (VersionInfo.Flavour flavour in Enum.GetValues(typeof(VersionInfo.Flavour))) |
49 | { | 49 | { |
50 | Assert.AreEqual(VersionInfo.VERSIONINFO_VERSION_LENGTH, VersionInfo.GetVersionString("0.0.0", "0", flavour).Length, "0.0.0/" + flavour + " failed"); | 50 | Assert.AreEqual(VersionInfo.VERSIONINFO_VERSION_LENGTH, VersionInfo.GetVersionString("0.0.0", flavour).Length, "0.0.0/" + flavour + " failed"); |
51 | } | 51 | } |
52 | } | 52 | } |
53 | } | 53 | } |