diff options
author | Justin Clark-Casey (justincc) | 2011-04-15 01:10:26 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-04-15 01:10:26 +0100 |
commit | 79bd430e08b9e8612194d9b02504f8f4acd889f6 (patch) | |
tree | c74dce75de623385d7de52b63621b9f486037127 | |
parent | extend TestLoadCoalesecedItem() to check loaded object ids and positions (diff) | |
download | opensim-SC-79bd430e08b9e8612194d9b02504f8f4acd889f6.zip opensim-SC-79bd430e08b9e8612194d9b02504f8f4acd889f6.tar.gz opensim-SC-79bd430e08b9e8612194d9b02504f8f4acd889f6.tar.bz2 opensim-SC-79bd430e08b9e8612194d9b02504f8f4acd889f6.tar.xz |
Remove the mock inventory service for tests and just use the real one all the time with an in-memory data plugin
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockInventoryService.cs | 186 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 19 |
2 files changed, 6 insertions, 199 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs deleted file mode 100644 index 4ac1078..0000000 --- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs +++ /dev/null | |||
@@ -1,186 +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 OpenSim.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using Nini.Config; | ||
35 | |||
36 | namespace OpenSim.Tests.Common.Mock | ||
37 | { | ||
38 | public class MockInventoryService : IInventoryService | ||
39 | { | ||
40 | public MockInventoryService() {} | ||
41 | |||
42 | public MockInventoryService(IConfigSource config) {} | ||
43 | |||
44 | /// <summary> | ||
45 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
46 | /// </summary> | ||
47 | /// <param name="userId"></param> | ||
48 | /// <returns></returns> | ||
49 | public bool CreateUserInventory(UUID userId) | ||
50 | { | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | /// <summary> | ||
55 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
56 | /// </summary> | ||
57 | /// <param name="userId"></param> | ||
58 | /// <returns></returns> | ||
59 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
60 | { | ||
61 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
62 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
63 | folder.ID = UUID.Random(); | ||
64 | folder.Owner = userId; | ||
65 | folders.Add(folder); | ||
66 | return folders; | ||
67 | } | ||
68 | |||
69 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
70 | { | ||
71 | return new InventoryFolderBase(); | ||
72 | } | ||
73 | |||
74 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
75 | { | ||
76 | return null; | ||
77 | } | ||
78 | |||
79 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
80 | { | ||
81 | return null; | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// Returns a list of all the active gestures in a user's inventory. | ||
86 | /// </summary> | ||
87 | /// <param name="userId"> | ||
88 | /// The <see cref="UUID"/> of the user | ||
89 | /// </param> | ||
90 | /// <returns> | ||
91 | /// A flat list of the gesture items. | ||
92 | /// </returns> | ||
93 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
94 | { | ||
95 | return null; | ||
96 | } | ||
97 | |||
98 | public InventoryCollection GetUserInventory(UUID userID) | ||
99 | { | ||
100 | return null; | ||
101 | } | ||
102 | |||
103 | public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) | ||
104 | { | ||
105 | } | ||
106 | |||
107 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
108 | { | ||
109 | return null; | ||
110 | } | ||
111 | |||
112 | public bool AddFolder(InventoryFolderBase folder) | ||
113 | { | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | public bool UpdateFolder(InventoryFolderBase folder) | ||
118 | { | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | public bool MoveFolder(InventoryFolderBase folder) | ||
123 | { | ||
124 | return false; | ||
125 | } | ||
126 | |||
127 | public bool DeleteFolders(UUID ownerID, List<UUID> ids) | ||
128 | { | ||
129 | return false; | ||
130 | } | ||
131 | |||
132 | public bool PurgeFolder(InventoryFolderBase folder) | ||
133 | { | ||
134 | return false; | ||
135 | } | ||
136 | |||
137 | public bool AddItem(InventoryItemBase item) | ||
138 | { | ||
139 | return true; | ||
140 | } | ||
141 | |||
142 | public bool UpdateItem(InventoryItemBase item) | ||
143 | { | ||
144 | return false; | ||
145 | } | ||
146 | |||
147 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
148 | { | ||
149 | return false; | ||
150 | } | ||
151 | |||
152 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
153 | { | ||
154 | return false; | ||
155 | } | ||
156 | |||
157 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
158 | { | ||
159 | return null; | ||
160 | } | ||
161 | |||
162 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
163 | { | ||
164 | return null; | ||
165 | } | ||
166 | |||
167 | public bool HasInventoryForUser(UUID userID) | ||
168 | { | ||
169 | return false; | ||
170 | } | ||
171 | |||
172 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
173 | { | ||
174 | InventoryFolderBase root = new InventoryFolderBase(); | ||
175 | root.ID = UUID.Random(); | ||
176 | root.Owner = userID; | ||
177 | root.ParentID = UUID.Zero; | ||
178 | return root; | ||
179 | } | ||
180 | |||
181 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
182 | { | ||
183 | return 1; | ||
184 | } | ||
185 | } | ||
186 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 837f4e2..97d4ace 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -137,7 +137,7 @@ namespace OpenSim.Tests.Common.Setup | |||
137 | // For now, always started a 'real' authentication service | 137 | // For now, always started a 'real' authentication service |
138 | StartAuthenticationService(testScene, true); | 138 | StartAuthenticationService(testScene, true); |
139 | 139 | ||
140 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory")); | 140 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); |
141 | StartGridService(testScene, true); | 141 | StartGridService(testScene, true); |
142 | LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); | 142 | LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); |
143 | LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); | 143 | LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); |
@@ -208,24 +208,17 @@ namespace OpenSim.Tests.Common.Setup | |||
208 | //m_authenticationService = service; | 208 | //m_authenticationService = service; |
209 | } | 209 | } |
210 | 210 | ||
211 | private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real) | 211 | private static LocalInventoryServicesConnector StartInventoryService(Scene testScene) |
212 | { | 212 | { |
213 | LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); | 213 | LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); |
214 | IConfigSource config = new IniConfigSource(); | 214 | |
215 | IConfigSource config = new IniConfigSource(); | ||
215 | config.AddConfig("Modules"); | 216 | config.AddConfig("Modules"); |
216 | config.AddConfig("InventoryService"); | 217 | config.AddConfig("InventoryService"); |
217 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); | 218 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); |
218 | 219 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | |
219 | if (real) | ||
220 | { | ||
221 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | ||
222 | } | ||
223 | else | ||
224 | { | ||
225 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); | ||
226 | } | ||
227 | |||
228 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 220 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
221 | |||
229 | inventoryService.Initialise(config); | 222 | inventoryService.Initialise(config); |
230 | inventoryService.AddRegion(testScene); | 223 | inventoryService.AddRegion(testScene); |
231 | inventoryService.RegionLoaded(testScene); | 224 | inventoryService.RegionLoaded(testScene); |