diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs index a5ee549..a40adf3 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs | |||
@@ -43,51 +43,6 @@ namespace OpenSim.Framework.Communications.Tests | |||
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class AssetCacheTests | 44 | public class AssetCacheTests |
45 | { | 45 | { |
46 | protected UUID m_assetIdReceived; | ||
47 | protected AssetBase m_assetReceived; | ||
48 | |||
49 | /// <summary> | ||
50 | /// Test the 'asynchronous' get asset mechanism (though this won't be done asynchronously within this test) | ||
51 | /// </summary> | ||
52 | [Test] | ||
53 | public void TestGetAsset() | ||
54 | { | ||
55 | UUID assetId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
56 | byte[] assetData = new byte[] { 3, 2, 1 }; | ||
57 | |||
58 | AssetBase asset = new AssetBase(); | ||
59 | asset.FullID = assetId; | ||
60 | asset.Data = assetData; | ||
61 | |||
62 | TestAssetDataPlugin assetPlugin = new TestAssetDataPlugin(); | ||
63 | assetPlugin.CreateAsset(asset); | ||
64 | |||
65 | SQLAssetServer assetServer = new SQLAssetServer(assetPlugin); | ||
66 | IAssetCache assetCache = new AssetCache(assetServer); | ||
67 | |||
68 | assetCache.GetAsset(assetId, AssetRequestCallback, false); | ||
69 | |||
70 | // Manually pump the asset server | ||
71 | while (assetServer.HasWaitingRequests()) | ||
72 | assetServer.ProcessNextRequest(); | ||
73 | |||
74 | Assert.That( | ||
75 | assetId, Is.EqualTo(m_assetIdReceived), "Asset id stored differs from asset id received"); | ||
76 | Assert.That( | ||
77 | assetData, Is.EqualTo(m_assetReceived.Data), "Asset data stored differs from asset data received"); | ||
78 | } | ||
79 | |||
80 | private void AssetRequestCallback(UUID assetId, AssetBase asset) | ||
81 | { | ||
82 | m_assetIdReceived = assetId; | ||
83 | m_assetReceived = asset; | ||
84 | |||
85 | lock (this) | ||
86 | { | ||
87 | Monitor.PulseAll(this); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | private class FakeUserService : IUserService | 46 | private class FakeUserService : IUserService |
92 | { | 47 | { |
93 | public void AddTemporaryUserProfile(UserProfileData userProfile) | 48 | public void AddTemporaryUserProfile(UserProfileData userProfile) |
@@ -109,7 +64,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
109 | { | 64 | { |
110 | UserProfileData userProfile = new UserProfileData(); | 65 | UserProfileData userProfile = new UserProfileData(); |
111 | 66 | ||
112 | userProfile.ID = new UUID( Util.GetHashGuid( uri.ToString(), AssetCache.AssetInfo.Secret )); | 67 | // userProfile.ID = new UUID( Util.GetHashGuid( uri.ToString(), AssetCache.AssetInfo.Secret )); |
113 | 68 | ||
114 | return userProfile; | 69 | return userProfile; |
115 | } | 70 | } |
@@ -189,19 +144,5 @@ namespace OpenSim.Framework.Communications.Tests | |||
189 | return true; | 144 | return true; |
190 | } | 145 | } |
191 | } | 146 | } |
192 | |||
193 | [Test] | ||
194 | public void TestProcessAssetData() | ||
195 | { | ||
196 | string url = "http://host/dir/"; | ||
197 | string creatorData = " creator_url " + url + " "; | ||
198 | string ownerData = " owner_url " + url + " "; | ||
199 | |||
200 | AssetCache assetCache = new AssetCache(); | ||
201 | FakeUserService fakeUserService = new FakeUserService(); | ||
202 | |||
203 | Assert.AreEqual(" creator_id " + Util.GetHashGuid(url, AssetCache.AssetInfo.Secret) + " ", assetCache.ProcessAssetDataString(creatorData, fakeUserService)); | ||
204 | Assert.AreEqual(" owner_id " + Util.GetHashGuid(url, AssetCache.AssetInfo.Secret) + " ", assetCache.ProcessAssetDataString(ownerData, fakeUserService)); | ||
205 | } | ||
206 | } | 147 | } |
207 | } | 148 | } |