diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs | 51 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs | 134 |
2 files changed, 0 insertions, 185 deletions
diff --git a/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs b/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs deleted file mode 100644 index adddf27..0000000 --- a/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
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 | |||
28 | using System.Reflection; | ||
29 | using log4net; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Framework.Servers | ||
33 | { | ||
34 | public class CachedGetAssetStreamHandler : BaseGetAssetStreamHandler | ||
35 | { | ||
36 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
37 | |||
38 | private readonly IAssetCache m_assetProvider; | ||
39 | |||
40 | public CachedGetAssetStreamHandler(IAssetCache assetProvider) | ||
41 | : base("GET", "/assets") | ||
42 | { | ||
43 | m_assetProvider = assetProvider; | ||
44 | } | ||
45 | |||
46 | protected override AssetBase GetAsset(UUID assetID) | ||
47 | { | ||
48 | return m_assetProvider.GetAsset(assetID, true); // TODO IsTexture should be deduced from loaded asset. It is not used in this case. | ||
49 | } | ||
50 | } | ||
51 | } | ||
diff --git a/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs deleted file mode 100644 index 1026248..0000000 --- a/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using NUnit.Framework; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Framework.Servers.HttpServer; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | using OpenSim.Tests.Common; | ||
36 | using OpenSim.Tests.Common.Mock; | ||
37 | using OpenSim.Tests.Common.Setup; | ||
38 | |||
39 | namespace OpenSim.Framework.Servers.Tests | ||
40 | { | ||
41 | [TestFixture] | ||
42 | public class CachedGetAssetStreamHandlerTests | ||
43 | { | ||
44 | private const string ASSETS_PATH = "/assets"; | ||
45 | |||
46 | [Test] | ||
47 | public void TestConstructor() | ||
48 | { | ||
49 | TestHelper.InMethod(); | ||
50 | |||
51 | // CachedGetAssetStreamHandler handler = | ||
52 | new CachedGetAssetStreamHandler(null); | ||
53 | } | ||
54 | |||
55 | [Test] | ||
56 | public void TestGetParams() | ||
57 | { | ||
58 | TestHelper.InMethod(); | ||
59 | |||
60 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
61 | BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH); | ||
62 | } | ||
63 | |||
64 | [Test] | ||
65 | public void TestSplitParams() | ||
66 | { | ||
67 | TestHelper.InMethod(); | ||
68 | |||
69 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
70 | BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH); | ||
71 | } | ||
72 | |||
73 | [Test] | ||
74 | public void TestHandleNoParams() | ||
75 | { | ||
76 | TestHelper.InMethod(); | ||
77 | |||
78 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
79 | |||
80 | BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH); | ||
81 | } | ||
82 | |||
83 | [Test] | ||
84 | public void TestHandleMalformedGuid() | ||
85 | { | ||
86 | TestHelper.InMethod(); | ||
87 | |||
88 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
89 | |||
90 | BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH); | ||
91 | } | ||
92 | |||
93 | [Test] | ||
94 | public void TestHandleFetchMissingAsset() | ||
95 | { | ||
96 | CachedGetAssetStreamHandler handler; | ||
97 | OSHttpResponse response; | ||
98 | CreateTestEnvironment(out handler, out response); | ||
99 | |||
100 | GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler, response); | ||
101 | } | ||
102 | |||
103 | [Test] | ||
104 | public void TestHandleFetchExistingAssetData() | ||
105 | { | ||
106 | CachedGetAssetStreamHandler handler; | ||
107 | OSHttpResponse response; | ||
108 | AssetBase asset = CreateTestEnvironment(out handler, out response); | ||
109 | |||
110 | GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response); | ||
111 | } | ||
112 | |||
113 | //[Test] | ||
114 | //public void TestHandleFetchExistingAssetMetaData() | ||
115 | //{ | ||
116 | // CachedGetAssetStreamHandler handler; | ||
117 | // OSHttpResponse response; | ||
118 | // AssetBase asset = CreateTestEnvironment(out handler, out response); | ||
119 | |||
120 | // GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetMetaDataTest(asset, handler, response); | ||
121 | //} | ||
122 | |||
123 | private static AssetBase CreateTestEnvironment(out CachedGetAssetStreamHandler handler, out OSHttpResponse response) | ||
124 | { | ||
125 | AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response); | ||
126 | |||
127 | IAssetCache assetDataPlugin = new TestAssetCache(); | ||
128 | handler = new CachedGetAssetStreamHandler(assetDataPlugin); | ||
129 | |||
130 | assetDataPlugin.AddAsset(asset); | ||
131 | return asset; | ||
132 | } | ||
133 | } | ||
134 | } | ||