123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- using System;
- using System.Collections.Generic;
- using System.Reflection;
- using log4net;
- using OpenMetaverse;
- using OpenSim.Framework;
- using OpenSim.Data;
- namespace OpenSim.Tests.Common.Mock
- {
-
-
-
-
-
- public class TestInventoryDataPlugin : IInventoryDataPlugin
- {
-
-
-
-
- private Dictionary<UUID, InventoryFolderBase> m_folders = new Dictionary<UUID, InventoryFolderBase>();
-
-
-
- private Dictionary<UUID, InventoryItemBase> m_items = new Dictionary<UUID, InventoryItemBase>();
-
-
-
- private Dictionary<UUID, InventoryFolderBase> m_rootFolders = new Dictionary<UUID, InventoryFolderBase>();
- public string Version { get { return "0"; } }
- public string Name { get { return "TestInventoryDataPlugin"; } }
- public void Initialise() {}
- public void Initialise(string connect) {}
- public void Dispose() {}
- public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
- {
- List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
- foreach (InventoryFolderBase folder in m_folders.Values)
- {
- if (folder.ParentID == parentID)
- {
- folders.AddRange(getFolderHierarchy(folder.ID));
- folders.Add(folder);
- }
- }
- return folders;
- }
- public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
- {
-
-
- List<InventoryItemBase> items = new List<InventoryItemBase>();
- foreach (InventoryItemBase item in m_items.Values)
- {
- if (item.Folder == folderID)
- {
- items.Add(item);
- }
- }
-
- return items;
- }
- public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; }
- public InventoryFolderBase getUserRootFolder(UUID user)
- {
-
- InventoryFolderBase folder = null;
- m_rootFolders.TryGetValue(user, out folder);
- return folder;
- }
- public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
- {
-
-
- List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
- foreach (InventoryFolderBase folder in m_folders.Values)
- {
- if (folder.ParentID == parentID)
- {
-
- folders.Add(folder);
- }
- }
- return folders;
- }
- public InventoryFolderBase getInventoryFolder(UUID folderId)
- {
- InventoryFolderBase folder = null;
- m_folders.TryGetValue(folderId, out folder);
- return folder;
- }
- public InventoryFolderBase queryInventoryFolder(UUID folderID)
- {
- return getInventoryFolder(folderID);
- }
- public void addInventoryFolder(InventoryFolderBase folder)
- {
-
- m_folders[folder.ID] = folder;
- if (folder.ParentID == UUID.Zero)
- {
- m_rootFolders[folder.Owner] = folder;
- }
- }
- public void updateInventoryFolder(InventoryFolderBase folder)
- {
- m_folders[folder.ID] = folder;
- }
- public void moveInventoryFolder(InventoryFolderBase folder)
- {
-
- updateInventoryFolder(folder);
- }
- public void deleteInventoryFolder(UUID folderId)
- {
- if (m_folders.ContainsKey(folderId))
- m_folders.Remove(folderId);
- }
- public void addInventoryItem(InventoryItemBase item)
- {
-
-
- m_items[item.ID] = item;
- }
-
- public void updateInventoryItem(InventoryItemBase item) { addInventoryItem(item); }
-
- public void deleteInventoryItem(UUID itemId)
- {
- if (m_items.ContainsKey(itemId))
- m_items.Remove(itemId);
- }
-
- public InventoryItemBase getInventoryItem(UUID itemId)
- {
- if (m_items.ContainsKey(itemId))
- return m_items[itemId];
- else
- return null;
- }
- public InventoryItemBase queryInventoryItem(UUID item)
- {
- return null;
- }
- public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) { return null; }
- }
- }
|