diff options
author | Justin Clark-Casey (justincc) | 2011-12-05 20:44:20 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-12-05 20:44:20 +0000 |
commit | 4567555c49cb560dd6f109bbfec42086af3de56f (patch) | |
tree | bfb0a6fd21d2070940399c0e36dc7d0de1e7eb0d /OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs | |
parent | For the GetTexture capability, if a data range is requested that covers the w... (diff) | |
download | opensim-SC-4567555c49cb560dd6f109bbfec42086af3de56f.zip opensim-SC-4567555c49cb560dd6f109bbfec42086af3de56f.tar.gz opensim-SC-4567555c49cb560dd6f109bbfec42086af3de56f.tar.bz2 opensim-SC-4567555c49cb560dd6f109bbfec42086af3de56f.tar.xz |
Implement IOSHttpRequest and IOSHttpResponse http interfaces and use instead of OSHttpRequest/OSHttpResponse.
This is required for the substitution of different HTTP servers or the newer HttpServer.dll without having to commit to a particular implementation.
This is also required to write regression tests that involve the HTTP layer.
If you need to recompile, all you need to do is replace OSHttpRequest/OSHttpResponse references with IOSHttpRequest/IOSHttpResponse.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs | 112 |
1 files changed, 97 insertions, 15 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs b/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs index 581985a..e10fe82 100644 --- a/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs +++ b/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs | |||
@@ -27,25 +27,107 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
30 | using System.Text; | 31 | using System.Text; |
32 | using System.Web; | ||
31 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
32 | 34 | ||
33 | namespace OpenSim.Tests.Common.Mock | 35 | namespace OpenSim.Tests.Common.Mock |
34 | { | 36 | { |
35 | public class TestOSHttpResponse : OSHttpResponse | 37 | public class TestOSHttpResponse : IOSHttpResponse |
36 | { | 38 | { |
37 | private int m_statusCode; | 39 | /// <summary> |
38 | public override int StatusCode | 40 | /// Content type property. |
39 | { | 41 | /// </summary> |
40 | get { return m_statusCode; } | 42 | /// <remarks> |
41 | set { m_statusCode = value; } | 43 | /// Setting this property will also set IsContentTypeSet to |
42 | } | 44 | /// true. |
43 | 45 | /// </remarks> | |
44 | private string m_contentType; | 46 | public string ContentType { get; set; } |
45 | public override string ContentType | 47 | |
46 | { | 48 | /// <summary> |
47 | get { return m_contentType; } | 49 | /// Boolean property indicating whether the content type |
48 | set { m_contentType = value; } | 50 | /// property actively has been set. |
49 | } | 51 | /// </summary> |
52 | /// <remarks> | ||
53 | /// IsContentTypeSet will go away together with .NET base. | ||
54 | /// </remarks> | ||
55 | // public bool IsContentTypeSet | ||
56 | // { | ||
57 | // get { return _contentTypeSet; } | ||
58 | // } | ||
59 | // private bool _contentTypeSet; | ||
60 | |||
61 | /// <summary> | ||
62 | /// Length of the body content; 0 if there is no body. | ||
63 | /// </summary> | ||
64 | public long ContentLength { get; set; } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Alias for ContentLength. | ||
68 | /// </summary> | ||
69 | public long ContentLength64 { get; set; } | ||
70 | |||
71 | /// <summary> | ||
72 | /// Encoding of the body content. | ||
73 | /// </summary> | ||
74 | public Encoding ContentEncoding { get; set; } | ||
75 | |||
76 | public bool KeepAlive { get; set; } | ||
77 | |||
78 | /// <summary> | ||
79 | /// Get or set the keep alive timeout property (default is | ||
80 | /// 20). Setting this to 0 also disables KeepAlive. Setting | ||
81 | /// this to something else but 0 also enable KeepAlive. | ||
82 | /// </summary> | ||
83 | public int KeepAliveTimeout { get; set; } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Return the output stream feeding the body. | ||
87 | /// </summary> | ||
88 | /// <remarks> | ||
89 | /// On its way out... | ||
90 | /// </remarks> | ||
91 | public Stream OutputStream { get; private set; } | ||
92 | |||
93 | public string ProtocolVersion { get; set; } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Return the output stream feeding the body. | ||
97 | /// </summary> | ||
98 | public Stream Body { get; private set; } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Set a redirct location. | ||
102 | /// </summary> | ||
103 | public string RedirectLocation { private get; set; } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Chunk transfers. | ||
107 | /// </summary> | ||
108 | public bool SendChunked { get; set; } | ||
109 | |||
110 | /// <summary> | ||
111 | /// HTTP status code. | ||
112 | /// </summary> | ||
113 | public int StatusCode { get; set; } | ||
114 | |||
115 | /// <summary> | ||
116 | /// HTTP status description. | ||
117 | /// </summary> | ||
118 | public string StatusDescription { get; set; } | ||
119 | |||
120 | public bool ReuseContext { get; set; } | ||
121 | |||
122 | /// <summary> | ||
123 | /// Add a header field and content to the response. | ||
124 | /// </summary> | ||
125 | /// <param name="key">string containing the header field | ||
126 | /// name</param> | ||
127 | /// <param name="value">string containing the header field | ||
128 | /// value</param> | ||
129 | public void AddHeader(string key, string value) { throw new NotImplementedException(); } | ||
130 | |||
131 | public void Send() { } | ||
50 | } | 132 | } |
51 | } | 133 | } \ No newline at end of file |