aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorlbsa712009-05-08 15:44:35 +0000
committerlbsa712009-05-08 15:44:35 +0000
commit54b5346f16ace21bad12c58500bbaa6e1739608e (patch)
tree353f94d07a7061c35f175247e2d3350e060d309b /OpenSim/Framework/Servers
parentanother possible cause of some of the inventory wierdness is the 1/2 implemented (diff)
downloadopensim-SC_OLD-54b5346f16ace21bad12c58500bbaa6e1739608e.zip
opensim-SC_OLD-54b5346f16ace21bad12c58500bbaa6e1739608e.tar.gz
opensim-SC_OLD-54b5346f16ace21bad12c58500bbaa6e1739608e.tar.bz2
opensim-SC_OLD-54b5346f16ace21bad12c58500bbaa6e1739608e.tar.xz
* Extracted common superclass for GetAssetStreamHandler and CachedGetAssetStreamHandler
* Added some more tests
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs196
-rw-r--r--OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs173
-rw-r--r--OpenSim/Framework/Servers/GetAssetStreamHandler.cs159
-rw-r--r--OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs72
-rw-r--r--OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs7
5 files changed, 276 insertions, 331 deletions
diff --git a/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs b/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs
new file mode 100644
index 0000000..6e03ea8
--- /dev/null
+++ b/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs
@@ -0,0 +1,196 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Net;
32using System.Reflection;
33using System.Text;
34using System.Text.RegularExpressions;
35using System.Xml;
36using System.Xml.Serialization;
37using log4net;
38using OpenMetaverse;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Framework.Statistics;
41
42namespace OpenSim.Framework.Servers
43{
44 public abstract class BaseGetAssetStreamHandler : BaseStreamHandler
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 protected BaseGetAssetStreamHandler(string httpMethod, string path) : base(httpMethod, path)
49 {
50 }
51
52 protected abstract AssetBase GetAsset(UUID assetID);
53
54 public override byte[] Handle(string path, Stream request,
55 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
56 {
57 byte[] result = new byte[] { };
58
59 string[] p = SplitParams(path);
60
61 if (p.Length > 0)
62 {
63 UUID assetID = UUID.Zero;
64
65 if (!UUID.TryParse(p[0], out assetID))
66 {
67 m_log.InfoFormat(
68 "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]);
69 return result;
70 }
71
72 if (StatsManager.AssetStats != null)
73 StatsManager.AssetStats.AddRequest();
74
75 AssetBase asset = GetAsset(assetID);
76
77 if (asset != null)
78 {
79// if (asset.ContainsReferences)
80// {
81// asset.Data = ProcessOutgoingAssetData(asset.Data);
82// }
83 if (p.Length > 1 && p[1] == "data")
84 {
85 httpResponse.StatusCode = (int)HttpStatusCode.OK;
86 httpResponse.ContentType = SLAssetTypeToContentType(asset.Type);
87 result = asset.Data;
88 }
89 else
90 {
91 XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
92 MemoryStream ms = new MemoryStream();
93 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
94 xw.Formatting = Formatting.Indented;
95 xs.Serialize(xw, asset);
96 xw.Flush();
97
98 ms.Seek(0, SeekOrigin.Begin);
99 //StreamReader sr = new StreamReader(ms);
100
101 result = ms.GetBuffer();
102
103 Array.Resize<byte>(ref result, (int)ms.Length);
104 }
105 }
106 else
107 {
108 if (StatsManager.AssetStats != null)
109 StatsManager.AssetStats.AddNotFoundRequest();
110
111 m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID);
112 }
113 }
114
115 return result;
116 }
117
118 public string ProcessAssetDataString(string data)
119 {
120 Regex regex = new Regex("(creator_id|owner_id)\\s+(\\S+)");
121
122 // IUserService userService = null;
123
124 data = regex.Replace(data, delegate(Match m)
125 {
126 string result = String.Empty;
127
128// string key = m.Groups[1].Captures[0].Value;
129//
130// string value = m.Groups[2].Captures[0].Value;
131//
132// Guid userUri;
133//
134// switch (key)
135// {
136// case "creator_id":
137// userUri = new Guid(value);
138// // result = "creator_url " + userService(userService, userUri);
139// break;
140//
141// case "owner_id":
142// userUri = new Guid(value);
143// // result = "owner_url " + ResolveUserUri(userService, userUri);
144// break;
145// }
146
147 return result;
148 });
149
150 return data;
151 }
152
153 private string SLAssetTypeToContentType(int assetType)
154 {
155 switch (assetType)
156 {
157 case 0:
158 return "image/jp2";
159 case 1:
160 return "application/ogg";
161 case 2:
162 return "application/x-metaverse-callingcard";
163 case 3:
164 return "application/x-metaverse-landmark";
165 case 5:
166 return "application/x-metaverse-clothing";
167 case 6:
168 return "application/x-metaverse-primitive";
169 case 7:
170 return "application/x-metaverse-notecard";
171 case 8:
172 return "application/x-metaverse-folder";
173 case 10:
174 return "application/x-metaverse-lsl";
175 case 11:
176 return "application/x-metaverse-lso";
177 case 12:
178 return "image/tga";
179 case 13:
180 return "application/x-metaverse-bodypart";
181 case 17:
182 return "audio/x-wav";
183 case 19:
184 return "image/jpeg";
185 case 20:
186 return "application/x-metaverse-animation";
187 case 21:
188 return "application/x-metaverse-gesture";
189 case 22:
190 return "application/x-metaverse-simstate";
191 default:
192 return "application/octet-stream";
193 }
194 }
195 }
196}
diff --git a/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs b/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs
index fb217d1..ef637c5 100644
--- a/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs
+++ b/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs
@@ -25,194 +25,27 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.IO;
30using System.Reflection; 28using System.Reflection;
31using System.Text;
32using System.Text.RegularExpressions;
33using System.Xml;
34using System.Xml.Serialization;
35using log4net; 29using log4net;
36using OpenMetaverse; 30using OpenMetaverse;
37using OpenSim.Data;
38using OpenSim.Framework;
39using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Framework.Statistics;
42using System.Net;
43 31
44namespace OpenSim.Framework.Servers 32namespace OpenSim.Framework.Servers
45{ 33{
46 public class CachedGetAssetStreamHandler : BaseStreamHandler 34 public class CachedGetAssetStreamHandler : BaseGetAssetStreamHandler
47 { 35 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 36 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 37
50 // private OpenAsset_Main m_assetManager;
51 private readonly IAssetCache m_assetProvider; 38 private readonly IAssetCache m_assetProvider;
52 39
53 /// <summary>
54 /// Constructor.
55 /// </summary>
56 /// <param name="assetManager"></param>
57 /// <param name="assetProvider"></param>
58 public CachedGetAssetStreamHandler(IAssetCache assetProvider) 40 public CachedGetAssetStreamHandler(IAssetCache assetProvider)
59 : base("GET", "/assets") 41 : base("GET", "/assets")
60 { 42 {
61 // m_log.Info("[REST]: In Get Request");
62 // m_assetManager = assetManager;
63 m_assetProvider = assetProvider; 43 m_assetProvider = assetProvider;
64 } 44 }
65 45
66 public override byte[] Handle(string path, Stream request, 46 protected override AssetBase GetAsset(UUID assetID)
67 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
68 { 47 {
69 string param = GetParam(path); 48 return m_assetProvider.GetAsset(assetID, true); // TODO IsTexture should be deduced from loaded asset. It is not used in this case.
70 byte[] result = new byte[] { };
71
72 string[] p = param.Split(new char[] { '/', '?', '&' }, StringSplitOptions.RemoveEmptyEntries);
73
74 if (p.Length > 0)
75 {
76 UUID assetID = UUID.Zero;
77
78 if (!UUID.TryParse(p[0], out assetID))
79 {
80 m_log.InfoFormat(
81 "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]);
82 return result;
83 }
84
85 if (StatsManager.AssetStats != null)
86 StatsManager.AssetStats.AddRequest();
87
88 AssetBase asset = m_assetProvider.GetAsset(assetID,true); // TODO IsTexture should be deduced from loaded asset. It is not used in this case.
89
90 if (asset != null)
91 {
92// if (asset.ContainsReferences)
93// {
94// asset.Data = ProcessOutgoingAssetData(asset.Data);
95// }
96 if (p.Length > 1 && p[1] == "data")
97 {
98 httpResponse.StatusCode = (int)HttpStatusCode.OK;
99 httpResponse.ContentType = SLAssetTypeToContentType(asset.Type);
100 result = asset.Data;
101 }
102 else
103 {
104 XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
105 MemoryStream ms = new MemoryStream();
106 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
107 xw.Formatting = Formatting.Indented;
108 xs.Serialize(xw, asset);
109 xw.Flush();
110
111 ms.Seek(0, SeekOrigin.Begin);
112 //StreamReader sr = new StreamReader(ms);
113
114 result = ms.GetBuffer();
115
116 Array.Resize<byte>(ref result, (int)ms.Length);
117 }
118 }
119 else
120 {
121 if (StatsManager.AssetStats != null)
122 StatsManager.AssetStats.AddNotFoundRequest();
123
124 m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID);
125 }
126 }
127
128 return result;
129 }
130
131 // private byte[] ProcessOutgoingAssetData(byte[] assetData)
132 // {
133 // string data = Encoding.ASCII.GetString(assetData);
134
135 // data = ProcessAssetDataString(data);
136
137 // return Encoding.ASCII.GetBytes(data);
138 // }
139
140 public string ProcessAssetDataString(string data)
141 {
142 Regex regex = new Regex("(creator_id|owner_id)\\s+(\\S+)");
143
144 // IUserService userService = null;
145
146 data = regex.Replace(data, delegate(Match m)
147 {
148 string result = String.Empty;
149
150// string key = m.Groups[1].Captures[0].Value;
151//
152// string value = m.Groups[2].Captures[0].Value;
153//
154// Guid userUri;
155//
156// switch (key)
157// {
158// case "creator_id":
159// userUri = new Guid(value);
160// // result = "creator_url " + userService(userService, userUri);
161// break;
162//
163// case "owner_id":
164// userUri = new Guid(value);
165// // result = "owner_url " + ResolveUserUri(userService, userUri);
166// break;
167// }
168
169 return result;
170 });
171
172 return data;
173 }
174
175 private string SLAssetTypeToContentType(int assetType)
176 {
177 switch (assetType)
178 {
179 case 0:
180 return "image/jp2";
181 case 1:
182 return "application/ogg";
183 case 2:
184 return "application/x-metaverse-callingcard";
185 case 3:
186 return "application/x-metaverse-landmark";
187 case 5:
188 return "application/x-metaverse-clothing";
189 case 6:
190 return "application/x-metaverse-primitive";
191 case 7:
192 return "application/x-metaverse-notecard";
193 case 8:
194 return "application/x-metaverse-folder";
195 case 10:
196 return "application/x-metaverse-lsl";
197 case 11:
198 return "application/x-metaverse-lso";
199 case 12:
200 return "image/tga";
201 case 13:
202 return "application/x-metaverse-bodypart";
203 case 17:
204 return "audio/x-wav";
205 case 19:
206 return "image/jpeg";
207 case 20:
208 return "application/x-metaverse-animation";
209 case 21:
210 return "application/x-metaverse-gesture";
211 case 22:
212 return "application/x-metaverse-simstate";
213 default:
214 return "application/octet-stream";
215 }
216 } 49 }
217 } 50 }
218} 51}
diff --git a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs b/OpenSim/Framework/Servers/GetAssetStreamHandler.cs
index ba0355c..a262e97 100644
--- a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs
+++ b/OpenSim/Framework/Servers/GetAssetStreamHandler.cs
@@ -43,174 +43,21 @@ using System.Net;
43 43
44namespace OpenSim.Framework.Servers 44namespace OpenSim.Framework.Servers
45{ 45{
46 public class GetAssetStreamHandler : BaseStreamHandler 46 public class GetAssetStreamHandler : BaseGetAssetStreamHandler
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 // private OpenAsset_Main m_assetManager;
51 private readonly IAssetDataPlugin m_assetProvider; 50 private readonly IAssetDataPlugin m_assetProvider;
52 51
53 /// <summary>
54 /// Constructor.
55 /// </summary>
56 /// <param name="assetManager"></param>
57 /// <param name="assetProvider"></param>
58 public GetAssetStreamHandler(IAssetDataPlugin assetProvider) 52 public GetAssetStreamHandler(IAssetDataPlugin assetProvider)
59 : base("GET", "/assets") 53 : base("GET", "/assets")
60 { 54 {
61 // m_log.Info("[REST]: In Get Request");
62 // m_assetManager = assetManager;
63 m_assetProvider = assetProvider; 55 m_assetProvider = assetProvider;
64 } 56 }
65 57
66 public override byte[] Handle(string path, Stream request, 58 protected override AssetBase GetAsset(UUID assetID)
67 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
68 { 59 {
69 byte[] result = new byte[] { }; 60 return m_assetProvider.FetchAsset(assetID);
70
71 string[] p = SplitParams(path);
72
73 if (p.Length > 0)
74 {
75 UUID assetID = UUID.Zero;
76
77 if (!UUID.TryParse(p[0], out assetID))
78 {
79 m_log.InfoFormat(
80 "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]);
81 return result;
82 }
83
84 if (StatsManager.AssetStats != null)
85 StatsManager.AssetStats.AddRequest();
86
87 AssetBase asset = m_assetProvider.FetchAsset(assetID);
88 if (asset != null)
89 {
90// if (asset.ContainsReferences)
91// {
92// asset.Data = ProcessOutgoingAssetData(asset.Data);
93// }
94 if (p.Length > 1 && p[1] == "data")
95 {
96 httpResponse.StatusCode = (int)HttpStatusCode.OK;
97 httpResponse.ContentType = SLAssetTypeToContentType(asset.Type);
98 result = asset.Data;
99 }
100 else
101 {
102 XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
103 MemoryStream ms = new MemoryStream();
104 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
105 xw.Formatting = Formatting.Indented;
106 xs.Serialize(xw, asset);
107 xw.Flush();
108
109 ms.Seek(0, SeekOrigin.Begin);
110 //StreamReader sr = new StreamReader(ms);
111
112 result = ms.GetBuffer();
113
114 Array.Resize<byte>(ref result, (int)ms.Length);
115 }
116 }
117 else
118 {
119 if (StatsManager.AssetStats != null)
120 StatsManager.AssetStats.AddNotFoundRequest();
121
122 m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID);
123 }
124 }
125
126 return result;
127 }
128
129 // private byte[] ProcessOutgoingAssetData(byte[] assetData)
130 // {
131 // string data = Encoding.ASCII.GetString(assetData);
132
133 // data = ProcessAssetDataString(data);
134
135 // return Encoding.ASCII.GetBytes(data);
136 // }
137
138 public string ProcessAssetDataString(string data)
139 {
140 Regex regex = new Regex("(creator_id|owner_id)\\s+(\\S+)");
141
142 // IUserService userService = null;
143
144 data = regex.Replace(data, delegate(Match m)
145 {
146 string result = String.Empty;
147
148// string key = m.Groups[1].Captures[0].Value;
149//
150// string value = m.Groups[2].Captures[0].Value;
151//
152// Guid userUri;
153//
154// switch (key)
155// {
156// case "creator_id":
157// userUri = new Guid(value);
158// // result = "creator_url " + userService(userService, userUri);
159// break;
160//
161// case "owner_id":
162// userUri = new Guid(value);
163// // result = "owner_url " + ResolveUserUri(userService, userUri);
164// break;
165// }
166
167 return result;
168 });
169
170 return data;
171 }
172
173 private string SLAssetTypeToContentType(int assetType)
174 {
175 switch (assetType)
176 {
177 case 0:
178 return "image/jp2";
179 case 1:
180 return "application/ogg";
181 case 2:
182 return "application/x-metaverse-callingcard";
183 case 3:
184 return "application/x-metaverse-landmark";
185 case 5:
186 return "application/x-metaverse-clothing";
187 case 6:
188 return "application/x-metaverse-primitive";
189 case 7:
190 return "application/x-metaverse-notecard";
191 case 8:
192 return "application/x-metaverse-folder";
193 case 10:
194 return "application/x-metaverse-lsl";
195 case 11:
196 return "application/x-metaverse-lso";
197 case 12:
198 return "image/tga";
199 case 13:
200 return "application/x-metaverse-bodypart";
201 case 17:
202 return "audio/x-wav";
203 case 19:
204 return "image/jpeg";
205 case 20:
206 return "application/x-metaverse-animation";
207 case 21:
208 return "application/x-metaverse-gesture";
209 case 22:
210 return "application/x-metaverse-simstate";
211 default:
212 return "application/octet-stream";
213 }
214 } 61 }
215 } 62 }
216} 63}
diff --git a/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs
new file mode 100644
index 0000000..aa97f62
--- /dev/null
+++ b/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs
@@ -0,0 +1,72 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using NUnit.Framework;
5using OpenSim.Data;
6using OpenSim.Framework.Servers.HttpServer;
7using OpenSim.Tests.Common;
8
9namespace OpenSim.Framework.Servers.Tests
10{
11 [TestFixture]
12 public class CachedGetAssetStreamHandlerTests
13 {
14 private const string ASSETS_PATH = "/assets";
15
16 [Test]
17 public void TestConstructor()
18 {
19 TestHelper.InMethod();
20
21 CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null);
22 }
23
24 [Test]
25 public void TestGetParams()
26 {
27 TestHelper.InMethod();
28
29 CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null);
30 BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH);
31 }
32
33 [Test]
34 public void TestSplitParams()
35 {
36 TestHelper.InMethod();
37
38 CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null);
39 BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH);
40 }
41
42 [Test]
43 public void TestHandleNoParams()
44 {
45 TestHelper.InMethod();
46
47 CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null);
48
49 BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH);
50 }
51
52 [Test]
53 public void TestHandleMalformedGuid()
54 {
55 TestHelper.InMethod();
56
57 CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null);
58
59 BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH);
60 }
61
62 //[Test]
63 //public void TestHandleFetchMissingAsset()
64 //{
65
66 // byte[] emptyResult = new byte[] { };
67 // CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null);
68
69 // Assert.AreEqual(new string[] { }, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid.");
70 //}
71 }
72}
diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
index 157a883..091a944 100644
--- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
+++ b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
@@ -11,7 +11,6 @@ namespace OpenSim.Framework.Servers.Tests
11 [TestFixture] 11 [TestFixture]
12 public class GetAssetStreamHandlerTests 12 public class GetAssetStreamHandlerTests
13 { 13 {
14 private static byte[] EmptyByteArray = new byte[] {};
15 private const string ASSETS_PATH = "/assets"; 14 private const string ASSETS_PATH = "/assets";
16 15
17 [Test] 16 [Test]
@@ -47,8 +46,7 @@ namespace OpenSim.Framework.Servers.Tests
47 46
48 GetAssetStreamHandler handler = new GetAssetStreamHandler(null); 47 GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
49 48
50 Assert.AreEqual(EmptyByteArray, handler.Handle(ASSETS_PATH, null, null, null), "Failed on empty params."); 49 BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH);
51 Assert.AreEqual(EmptyByteArray, handler.Handle(ASSETS_PATH + "/", null, null, null), "Failed on single slash.");
52 } 50 }
53 51
54 [Test] 52 [Test]
@@ -58,13 +56,12 @@ namespace OpenSim.Framework.Servers.Tests
58 56
59 GetAssetStreamHandler handler = new GetAssetStreamHandler(null); 57 GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
60 58
61 Assert.AreEqual(EmptyByteArray, handler.Handle(ASSETS_PATH + "/badGuid", null, null, null), "Failed on bad guid."); 59 BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH);
62 } 60 }
63 61
64 //[Test] 62 //[Test]
65 //public void TestHandleFetchMissingAsset() 63 //public void TestHandleFetchMissingAsset()
66 //{ 64 //{
67
68 // byte[] emptyResult = new byte[] { }; 65 // byte[] emptyResult = new byte[] { };
69 // GetAssetStreamHandler handler = new GetAssetStreamHandler(null); 66 // GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
70 67