From ae759f2d060bc53cc0b372d5584fcd4ffdd963b4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 9 Mar 2009 19:40:32 +0000 Subject: * Add basic asset cache get test --- OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs | 37 +++++++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'OpenSim/Tests/Common/Mock') diff --git a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs index d6bce5b..80b9ae3 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs @@ -38,18 +38,39 @@ namespace OpenSim.Tests.Common.Mock /// tests are single threaded. /// public class TestAssetDataPlugin : IAssetDataPlugin - { + { public string Version { get { return "0"; } } public string Name { get { return "TestAssetDataPlugin"; } } + + protected Dictionary Assets = new Dictionary(); public void Initialise() {} + public void Initialise(string connect) {} public void Dispose() {} - public AssetBase FetchAsset(UUID uuid) { return null; } - public void CreateAsset(AssetBase asset) {} - public void UpdateAsset(AssetBase asset) {} - public bool ExistsAsset(UUID uuid) { return false; } - public List FetchAssetMetadataSet(int start, int count) { return new List(count); } - public void Initialise(string connect) {} + public AssetBase FetchAsset(UUID uuid) + { + if (ExistsAsset(uuid)) + return Assets[uuid]; + else + return null; + } + + public void CreateAsset(AssetBase asset) + { + Assets[asset.FullID] = asset; + } + + public void UpdateAsset(AssetBase asset) + { + CreateAsset(asset); + } + + public bool ExistsAsset(UUID uuid) + { + return Assets.ContainsKey(uuid); + } + + public List FetchAssetMetadataSet(int start, int count) { return new List(count); } } -} +} \ No newline at end of file -- cgit v1.1