aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs8
-rw-r--r--OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs103
2 files changed, 106 insertions, 5 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index d827b86..c0749e3 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -32,6 +32,7 @@ using System.Xml;
32using System.Xml.Serialization; 32using System.Xml.Serialization;
33using System.Text; 33using System.Text;
34using log4net; 34using log4net;
35using OpenSim.Framework;
35 36
36namespace OpenSim.Server.Base 37namespace OpenSim.Server.Base
37{ 38{
@@ -92,7 +93,7 @@ namespace OpenSim.Server.Base
92 93
93 ms.Seek(0, SeekOrigin.Begin); 94 ms.Seek(0, SeekOrigin.Begin);
94 byte[] ret = ms.GetBuffer(); 95 byte[] ret = ms.GetBuffer();
95 Array.Resize<byte>(ref ret, (int)ms.Length); 96 Array.Resize(ref ret, (int)ms.Length);
96 97
97 return ret; 98 return ret;
98 } 99 }
@@ -117,9 +118,6 @@ namespace OpenSim.Server.Base
117 118
118 try 119 try
119 { 120 {
120 //m_log.DebugFormat("[PLUGINS]: Loading plugins from {0}", System.IO.Directory.GetCurrentDirectory());
121 //m_log.DebugFormat("[PLUGINS]: Trying to load {0}", dllName);
122
123 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 121 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
124 122
125 foreach (Type pluginType in pluginAssembly.GetTypes()) 123 foreach (Type pluginType in pluginAssembly.GetTypes())
@@ -152,4 +150,4 @@ namespace OpenSim.Server.Base
152 } 150 }
153 } 151 }
154 } 152 }
155} 153} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs b/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs
new file mode 100644
index 0000000..3636972
--- /dev/null
+++ b/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs
@@ -0,0 +1,103 @@
1using NUnit.Framework;
2using OpenSim.Framework;
3using OpenSim.Framework.Servers.HttpServer;
4using OpenSim.Server.Handlers.Asset;
5using OpenSim.Services.Interfaces;
6using OpenSim.Tests.Common;
7using OpenSim.Tests.Common.Mock;
8using OpenSim.Tests.Common.Setup;
9
10namespace OpenSim.Server.Handlers.Tests.Asset
11{
12 [TestFixture]
13 public class AssetServerGetHandlerTests
14 {
15 private const string ASSETS_PATH = "/assets";
16
17 [Test]
18 public void TestConstructor()
19 {
20 TestHelper.InMethod();
21
22 AssetServerGetHandler handler = new AssetServerGetHandler( null );
23 }
24
25 [Test]
26 public void TestGetParams()
27 {
28 TestHelper.InMethod();
29
30 AssetServerGetHandler handler = new AssetServerGetHandler(null);
31 BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH);
32 }
33
34 [Test]
35 public void TestSplitParams()
36 {
37 TestHelper.InMethod();
38
39 AssetServerGetHandler handler = new AssetServerGetHandler(null);
40 BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH);
41 }
42
43 //[Test]
44 //public void TestHandleNoParams()
45 //{
46 // TestHelper.InMethod();
47
48 // AssetServerGetHandler handler = new AssetServerGetHandler(null);
49
50 // BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH);
51 //}
52
53 //[Test]
54 //public void TestHandleMalformedGuid()
55 //{
56 // TestHelper.InMethod();
57
58 // AssetServerGetHandler handler = new AssetServerGetHandler(null);
59
60 // BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH);
61 //}
62
63 //[Test]
64 //public void TestHandleFetchMissingAsset()
65 //{
66 // IAssetService assetDataPlugin = new TestAssetDataPlugin();
67 // AssetServerGetHandler handler = new AssetServerGetHandler(assetDataPlugin);
68
69 // GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler);
70 //}
71
72 //[Test]
73 //public void TestHandleFetchExistingAssetData()
74 //{
75 // AssetServerGetHandler handler;
76 // OSHttpResponse response;
77 // AssetBase asset = CreateTestEnvironment(out handler, out response);
78
79 // GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response);
80 //}
81
82 //[Test]
83 //public void TestHandleFetchExistingAssetXml()
84 //{
85 // AssetServerGetHandler handler;
86 // OSHttpResponse response;
87 // AssetBase asset = CreateTestEnvironment(out handler, out response);
88
89 // GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetXmlTest(asset, handler, response);
90 //}
91
92 private static AssetBase CreateTestEnvironment(out AssetServerGetHandler handler, out OSHttpResponse response)
93 {
94 AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response);
95
96 IAssetService assetDataPlugin = new TestAssetService();
97 handler = new AssetServerGetHandler(assetDataPlugin);
98
99 assetDataPlugin.Store(asset);
100 return asset;
101 }
102 }
103} \ No newline at end of file