From 289c21099cf3ce0a2e3392436541b67d0961d8e8 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 24 Aug 2010 16:50:31 +0100
Subject: 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
---
OpenSim/Tests/Common/Mock/MockInventoryService.cs | 12 +++------
.../Tests/Common/Mock/TestInventoryDataPlugin.cs | 31 ++++++++++++++++++----
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 6 +++++
3 files changed, 36 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Tests')
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
{
public class MockInventoryService : IInventoryService
{
- public MockInventoryService()
- {
- }
+ public MockInventoryService() {}
- public MockInventoryService(IConfigSource config)
- {
- }
+ public MockInventoryService(IConfigSource config) {}
///
///
@@ -140,7 +136,7 @@ namespace OpenSim.Tests.Common.Mock
public bool AddItem(InventoryItemBase item)
{
- return false;
+ return true;
}
public bool UpdateItem(InventoryItemBase item)
@@ -187,4 +183,4 @@ namespace OpenSim.Tests.Common.Mock
return 1;
}
}
-}
+}
\ 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
///
public class TestInventoryDataPlugin : IInventoryDataPlugin
{
-// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
///
/// Inventory folders
@@ -84,14 +84,19 @@ namespace OpenSim.Tests.Common.Mock
public List getInventoryInFolder(UUID folderID)
{
-// m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0}", folderID);
+ InventoryFolderBase folder = m_folders[folderID];
+
+ m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0} {1}", folder.Name, folder.ID);
List items = new List();
foreach (InventoryItemBase item in m_items.Values)
{
if (item.Folder == folderID)
+ {
+ m_log.DebugFormat("[MOCK INV DB]: getInventoryInFolder() adding item {0}", item.Name);
items.Add(item);
+ }
}
return items;
@@ -101,7 +106,7 @@ namespace OpenSim.Tests.Common.Mock
public InventoryFolderBase getUserRootFolder(UUID user)
{
-// m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user);
+ m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user);
InventoryFolderBase folder = null;
m_rootFolders.TryGetValue(user, out folder);
@@ -111,12 +116,22 @@ namespace OpenSim.Tests.Common.Mock
public List getInventoryFolders(UUID parentID)
{
+ InventoryFolderBase parentFolder = m_folders[parentID];
+
+ m_log.DebugFormat("[MOCK INV DB]: Getting folders in folder {0} {1}", parentFolder.Name, parentFolder.ID);
+
List folders = new List();
foreach (InventoryFolderBase folder in m_folders.Values)
{
if (folder.ParentID == parentID)
+ {
+ m_log.DebugFormat(
+ "[MOCK INV DB]: Found folder {0} {1} in {2} {3}",
+ folder.Name, folder.ID, parentFolder.Name, parentFolder.ID);
+
folders.Add(folder);
+ }
}
return folders;
@@ -137,6 +152,10 @@ namespace OpenSim.Tests.Common.Mock
public void addInventoryFolder(InventoryFolderBase folder)
{
+ m_log.DebugFormat(
+ "[MOCK INV DB]: Adding inventory folder {0} {1} type {2}",
+ folder.Name, folder.ID, (AssetType)folder.Type);
+
m_folders[folder.ID] = folder;
if (folder.ParentID == UUID.Zero)
@@ -166,8 +185,10 @@ namespace OpenSim.Tests.Common.Mock
public void addInventoryItem(InventoryItemBase item)
{
-// m_log.DebugFormat(
-// "[MOCK INV DB]: Adding inventory item {0} {1} in {2}", item.Name, item.ID, item.Folder);
+ InventoryFolderBase folder = m_folders[item.Folder];
+
+ m_log.DebugFormat(
+ "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID);
m_items[item.ID] = item;
}
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
config.AddConfig("Modules");
config.AddConfig("InventoryService");
config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
+
if (real)
+ {
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
+ }
else
+ {
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService");
+ }
+
config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
inventoryService.Initialise(config);
inventoryService.AddRegion(testScene);
--
cgit v1.1