aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-04-15 01:23:26 +0100
committerJustin Clark-Casey (justincc)2011-04-15 01:23:26 +0100
commit54e885581989ddfaf525753ede12c4d4d797cba0 (patch)
tree93ebf52a5eed5d0ce12a7a804b4f4a07d0ee4d77 /OpenSim/Tests/Common/Mock
parentRemove the mock inventory service for tests and just use the real one all the... (diff)
downloadopensim-SC_OLD-54e885581989ddfaf525753ede12c4d4d797cba0.zip
opensim-SC_OLD-54e885581989ddfaf525753ede12c4d4d797cba0.tar.gz
opensim-SC_OLD-54e885581989ddfaf525753ede12c4d4d797cba0.tar.bz2
opensim-SC_OLD-54e885581989ddfaf525753ede12c4d4d797cba0.tar.xz
remove mock asset service for tests in favour of always using the real one
Diffstat (limited to 'OpenSim/Tests/Common/Mock')
-rw-r--r--OpenSim/Tests/Common/Mock/MockAssetService.cs123
1 files changed, 0 insertions, 123 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockAssetService.cs b/OpenSim/Tests/Common/Mock/MockAssetService.cs
deleted file mode 100644
index 9d7c5e2..0000000
--- a/OpenSim/Tests/Common/Mock/MockAssetService.cs
+++ /dev/null
@@ -1,123 +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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Data;
35using OpenSim.Services.Interfaces;
36using Nini.Config;
37
38namespace OpenSim.Tests.Common.Mock
39{
40 public class MockAssetService : IAssetService
41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>();
45
46 public MockAssetService() {}
47
48 /// <summary>
49 /// This constructor is required if the asset service is being created reflectively (which is the case in some
50 /// tests).
51 /// </summary>
52 /// <param name="config"></param>
53 public MockAssetService(IConfigSource config) {}
54
55 public AssetBase Get(string id)
56 {
57// m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id);
58
59 AssetBase asset;
60 if (Assets.ContainsKey(id))
61 {
62 asset = Assets[id];
63// m_log.DebugFormat(
64// "[MOCK ASSET SERVICE]: Got asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length);
65 }
66 else
67 {
68 asset = null;
69 }
70
71 return asset;
72 }
73
74 public AssetBase GetCached(string id)
75 {
76 return Get(id);
77 }
78
79 public AssetMetadata GetMetadata(string id)
80 {
81 throw new System.NotImplementedException();
82 }
83
84 public byte[] GetData(string id)
85 {
86// m_log.DebugFormat("[MOCK ASSET SERVICE]: Requesting data for asset {0}", id);
87
88 AssetBase asset = Get(id);
89
90 if (asset == null)
91 return null;
92 else
93 return asset.Data;
94 }
95
96 public bool Get(string id, object sender, AssetRetrieved handler)
97 {
98 handler(id, sender, Get(id));
99
100 return true;
101 }
102
103 public string Store(AssetBase asset)
104 {
105// m_log.DebugFormat(
106// "[MOCK ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length);
107
108 Assets[asset.ID] = asset;
109
110 return asset.ID;
111 }
112
113 public bool UpdateContent(string id, byte[] data)
114 {
115 throw new System.NotImplementedException();
116 }
117
118 public bool Delete(string id)
119 {
120 throw new System.NotImplementedException();
121 }
122 }
123} \ No newline at end of file