diff options
Diffstat (limited to 'OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs')
-rw-r--r-- | OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs index 091a944..51dd79d 100644 --- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs +++ b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs | |||
@@ -1,10 +1,14 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Net; | ||
3 | using System.Text; | 4 | using System.Text; |
5 | using HttpServer; | ||
4 | using NUnit.Framework; | 6 | using NUnit.Framework; |
5 | using OpenSim.Data; | 7 | using OpenSim.Data; |
6 | using OpenSim.Framework.Servers.HttpServer; | 8 | using OpenSim.Framework.Servers.HttpServer; |
7 | using OpenSim.Tests.Common; | 9 | using OpenSim.Tests.Common; |
10 | using OpenSim.Tests.Common.Mock; | ||
11 | using OpenSim.Tests.Common.Setup; | ||
8 | 12 | ||
9 | namespace OpenSim.Framework.Servers.Tests | 13 | namespace OpenSim.Framework.Servers.Tests |
10 | { | 14 | { |
@@ -59,13 +63,44 @@ namespace OpenSim.Framework.Servers.Tests | |||
59 | BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH); | 63 | BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH); |
60 | } | 64 | } |
61 | 65 | ||
62 | //[Test] | 66 | [Test] |
63 | //public void TestHandleFetchMissingAsset() | 67 | public void TestHandleFetchMissingAsset() |
64 | //{ | 68 | { |
65 | // byte[] emptyResult = new byte[] { }; | 69 | IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin(); |
66 | // GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | 70 | GetAssetStreamHandler handler = new GetAssetStreamHandler(assetDataPlugin); |
71 | |||
72 | GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler); | ||
73 | } | ||
74 | |||
75 | [Test] | ||
76 | public void TestHandleFetchExistingAssetData() | ||
77 | { | ||
78 | GetAssetStreamHandler handler; | ||
79 | OSHttpResponse response; | ||
80 | AssetBase asset = CreateTestEnvironment(out handler, out response); | ||
81 | |||
82 | GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response); | ||
83 | } | ||
67 | 84 | ||
68 | // Assert.AreEqual(new string[] { }, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid."); | 85 | [Test] |
69 | //} | 86 | public void TestHandleFetchExistingAssetXml() |
87 | { | ||
88 | GetAssetStreamHandler handler; | ||
89 | OSHttpResponse response; | ||
90 | AssetBase asset = CreateTestEnvironment(out handler, out response); | ||
91 | |||
92 | GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetXmlTest(asset, handler, response); | ||
93 | } | ||
94 | |||
95 | private static AssetBase CreateTestEnvironment(out GetAssetStreamHandler handler, out OSHttpResponse response) | ||
96 | { | ||
97 | AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response); | ||
98 | |||
99 | IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin(); | ||
100 | handler = new GetAssetStreamHandler(assetDataPlugin); | ||
101 | |||
102 | assetDataPlugin.CreateAsset(asset); | ||
103 | return asset; | ||
104 | } | ||
70 | } | 105 | } |
71 | } | 106 | } |