diff options
author | Justin Clark-Casey (justincc) | 2010-08-24 16:50:31 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-24 16:50:31 +0100 |
commit | 289c21099cf3ce0a2e3392436541b67d0961d8e8 (patch) | |
tree | c6f94eeb0c4f1fc98c2ddef7c855a97dc408c908 /OpenSim/Tests/Common | |
parent | Add system lookup folder fix to the RemoveXInventoryServiceConnector as well ... (diff) | |
download | opensim-SC_OLD-289c21099cf3ce0a2e3392436541b67d0961d8e8.zip opensim-SC_OLD-289c21099cf3ce0a2e3392436541b67d0961d8e8.tar.gz opensim-SC_OLD-289c21099cf3ce0a2e3392436541b67d0961d8e8.tar.bz2 opensim-SC_OLD-289c21099cf3ce0a2e3392436541b67d0961d8e8.tar.xz |
Add automated test at the opensim 'api' level to check that a given item goes to the correct directory
Also removes some mono compiler warnings
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockInventoryService.cs | 12 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs | 31 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 6 |
3 files changed, 36 insertions, 13 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs index 1ea4bc1..4ac1078 100644 --- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs +++ b/OpenSim/Tests/Common/Mock/MockInventoryService.cs | |||
@@ -37,13 +37,9 @@ namespace OpenSim.Tests.Common.Mock | |||
37 | { | 37 | { |
38 | public class MockInventoryService : IInventoryService | 38 | public class MockInventoryService : IInventoryService |
39 | { | 39 | { |
40 | public MockInventoryService() | 40 | public MockInventoryService() {} |
41 | { | ||
42 | } | ||
43 | 41 | ||
44 | public MockInventoryService(IConfigSource config) | 42 | public MockInventoryService(IConfigSource config) {} |
45 | { | ||
46 | } | ||
47 | 43 | ||
48 | /// <summary> | 44 | /// <summary> |
49 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | 45 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> |
@@ -140,7 +136,7 @@ namespace OpenSim.Tests.Common.Mock | |||
140 | 136 | ||
141 | public bool AddItem(InventoryItemBase item) | 137 | public bool AddItem(InventoryItemBase item) |
142 | { | 138 | { |
143 | return false; | 139 | return true; |
144 | } | 140 | } |
145 | 141 | ||
146 | public bool UpdateItem(InventoryItemBase item) | 142 | public bool UpdateItem(InventoryItemBase item) |
@@ -187,4 +183,4 @@ namespace OpenSim.Tests.Common.Mock | |||
187 | return 1; | 183 | return 1; |
188 | } | 184 | } |
189 | } | 185 | } |
190 | } | 186 | } \ No newline at end of file |
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs index 7c4f689..ed0b1a6 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common.Mock | |||
42 | /// </summary> | 42 | /// </summary> |
43 | public class TestInventoryDataPlugin : IInventoryDataPlugin | 43 | public class TestInventoryDataPlugin : IInventoryDataPlugin |
44 | { | 44 | { |
45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | /// <value> | 47 | /// <value> |
48 | /// Inventory folders | 48 | /// Inventory folders |
@@ -84,14 +84,19 @@ namespace OpenSim.Tests.Common.Mock | |||
84 | 84 | ||
85 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) | 85 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) |
86 | { | 86 | { |
87 | // m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0}", folderID); | 87 | InventoryFolderBase folder = m_folders[folderID]; |
88 | |||
89 | m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0} {1}", folder.Name, folder.ID); | ||
88 | 90 | ||
89 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 91 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
90 | 92 | ||
91 | foreach (InventoryItemBase item in m_items.Values) | 93 | foreach (InventoryItemBase item in m_items.Values) |
92 | { | 94 | { |
93 | if (item.Folder == folderID) | 95 | if (item.Folder == folderID) |
96 | { | ||
97 | m_log.DebugFormat("[MOCK INV DB]: getInventoryInFolder() adding item {0}", item.Name); | ||
94 | items.Add(item); | 98 | items.Add(item); |
99 | } | ||
95 | } | 100 | } |
96 | 101 | ||
97 | return items; | 102 | return items; |
@@ -101,7 +106,7 @@ namespace OpenSim.Tests.Common.Mock | |||
101 | 106 | ||
102 | public InventoryFolderBase getUserRootFolder(UUID user) | 107 | public InventoryFolderBase getUserRootFolder(UUID user) |
103 | { | 108 | { |
104 | // m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user); | 109 | m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user); |
105 | 110 | ||
106 | InventoryFolderBase folder = null; | 111 | InventoryFolderBase folder = null; |
107 | m_rootFolders.TryGetValue(user, out folder); | 112 | m_rootFolders.TryGetValue(user, out folder); |
@@ -111,12 +116,22 @@ namespace OpenSim.Tests.Common.Mock | |||
111 | 116 | ||
112 | public List<InventoryFolderBase> getInventoryFolders(UUID parentID) | 117 | public List<InventoryFolderBase> getInventoryFolders(UUID parentID) |
113 | { | 118 | { |
119 | InventoryFolderBase parentFolder = m_folders[parentID]; | ||
120 | |||
121 | m_log.DebugFormat("[MOCK INV DB]: Getting folders in folder {0} {1}", parentFolder.Name, parentFolder.ID); | ||
122 | |||
114 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 123 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
115 | 124 | ||
116 | foreach (InventoryFolderBase folder in m_folders.Values) | 125 | foreach (InventoryFolderBase folder in m_folders.Values) |
117 | { | 126 | { |
118 | if (folder.ParentID == parentID) | 127 | if (folder.ParentID == parentID) |
128 | { | ||
129 | m_log.DebugFormat( | ||
130 | "[MOCK INV DB]: Found folder {0} {1} in {2} {3}", | ||
131 | folder.Name, folder.ID, parentFolder.Name, parentFolder.ID); | ||
132 | |||
119 | folders.Add(folder); | 133 | folders.Add(folder); |
134 | } | ||
120 | } | 135 | } |
121 | 136 | ||
122 | return folders; | 137 | return folders; |
@@ -137,6 +152,10 @@ namespace OpenSim.Tests.Common.Mock | |||
137 | 152 | ||
138 | public void addInventoryFolder(InventoryFolderBase folder) | 153 | public void addInventoryFolder(InventoryFolderBase folder) |
139 | { | 154 | { |
155 | m_log.DebugFormat( | ||
156 | "[MOCK INV DB]: Adding inventory folder {0} {1} type {2}", | ||
157 | folder.Name, folder.ID, (AssetType)folder.Type); | ||
158 | |||
140 | m_folders[folder.ID] = folder; | 159 | m_folders[folder.ID] = folder; |
141 | 160 | ||
142 | if (folder.ParentID == UUID.Zero) | 161 | if (folder.ParentID == UUID.Zero) |
@@ -166,8 +185,10 @@ namespace OpenSim.Tests.Common.Mock | |||
166 | 185 | ||
167 | public void addInventoryItem(InventoryItemBase item) | 186 | public void addInventoryItem(InventoryItemBase item) |
168 | { | 187 | { |
169 | // m_log.DebugFormat( | 188 | InventoryFolderBase folder = m_folders[item.Folder]; |
170 | // "[MOCK INV DB]: Adding inventory item {0} {1} in {2}", item.Name, item.ID, item.Folder); | 189 | |
190 | m_log.DebugFormat( | ||
191 | "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID); | ||
171 | 192 | ||
172 | m_items[item.ID] = item; | 193 | m_items[item.ID] = item; |
173 | } | 194 | } |
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index eaa0d33..d9ded2d 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -285,10 +285,16 @@ namespace OpenSim.Tests.Common.Setup | |||
285 | config.AddConfig("Modules"); | 285 | config.AddConfig("Modules"); |
286 | config.AddConfig("InventoryService"); | 286 | config.AddConfig("InventoryService"); |
287 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); | 287 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); |
288 | |||
288 | if (real) | 289 | if (real) |
290 | { | ||
289 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | 291 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); |
292 | } | ||
290 | else | 293 | else |
294 | { | ||
291 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); | 295 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); |
296 | } | ||
297 | |||
292 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 298 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
293 | inventoryService.Initialise(config); | 299 | inventoryService.Initialise(config); |
294 | inventoryService.AddRegion(testScene); | 300 | inventoryService.AddRegion(testScene); |