aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs')
-rw-r--r--OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs51
1 files changed, 46 insertions, 5 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
index ccbdf81..2b272e6 100644
--- a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
@@ -35,7 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Data; 35using OpenSim.Data;
36using OpenSim.Data.Null; 36using OpenSim.Data.Null;
37 37
38namespace OpenSim.Tests.Common.Mock 38namespace OpenSim.Tests.Common
39{ 39{
40 public class TestXInventoryDataPlugin : NullGenericDataHandler, IXInventoryData 40 public class TestXInventoryDataPlugin : NullGenericDataHandler, IXInventoryData
41 { 41 {
@@ -46,17 +46,33 @@ namespace OpenSim.Tests.Common.Mock
46 46
47 public XInventoryItem[] GetItems(string[] fields, string[] vals) 47 public XInventoryItem[] GetItems(string[] fields, string[] vals)
48 { 48 {
49// Console.WriteLine(
50// "Requesting items, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
51
49 List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList()); 52 List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList());
50 53
51 return origItems.Select(i => i.Clone()).ToArray(); 54 XInventoryItem[] items = origItems.Select(i => i.Clone()).ToArray();
55
56// Console.WriteLine("Found {0} items", items.Length);
57// Array.ForEach(items, i => Console.WriteLine("Found item {0} {1}", i.inventoryName, i.inventoryID));
58
59 return items;
52 } 60 }
53 61
54 public XInventoryFolder[] GetFolders(string[] fields, string[] vals) 62 public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
55 { 63 {
64// Console.WriteLine(
65// "Requesting folders, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
66
56 List<XInventoryFolder> origFolders 67 List<XInventoryFolder> origFolders
57 = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList()); 68 = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList());
58 69
59 return origFolders.Select(f => f.Clone()).ToArray(); 70 XInventoryFolder[] folders = origFolders.Select(f => f.Clone()).ToArray();
71
72// Console.WriteLine("Found {0} folders", folders.Length);
73// Array.ForEach(folders, f => Console.WriteLine("Found folder {0} {1}", f.folderName, f.folderID));
74
75 return folders;
60 } 76 }
61 77
62 public bool StoreFolder(XInventoryFolder folder) 78 public bool StoreFolder(XInventoryFolder folder)
@@ -72,7 +88,9 @@ namespace OpenSim.Tests.Common.Mock
72 { 88 {
73 m_allItems[item.inventoryID] = item.Clone(); 89 m_allItems[item.inventoryID] = item.Clone();
74 90
75// Console.WriteLine("Added item {0} {1}, creator {2}, owner {3}", item.inventoryName, item.inventoryID, item.creatorID, item.avatarID); 91// Console.WriteLine(
92// "Added item {0} {1}, folder {2}, creator {3}, owner {4}",
93// item.inventoryName, item.inventoryID, item.parentFolderID, item.creatorID, item.avatarID);
76 94
77 return true; 95 return true;
78 } 96 }
@@ -104,7 +122,30 @@ namespace OpenSim.Tests.Common.Mock
104 } 122 }
105 123
106 public bool MoveItem(string id, string newParent) { throw new NotImplementedException(); } 124 public bool MoveItem(string id, string newParent) { throw new NotImplementedException(); }
107 public bool MoveFolder(string id, string newParent) { throw new NotImplementedException(); } 125
126 public bool MoveFolder(string id, string newParent)
127 {
128 // Don't use GetFolders() here - it takes a clone!
129 XInventoryFolder folder = m_allFolders[new UUID(id)];
130
131 if (folder == null)
132 return false;
133
134 folder.parentFolderID = new UUID(newParent);
135
136// XInventoryFolder[] newParentFolders
137// = GetFolders(new string[] { "folderID" }, new string[] { folder.parentFolderID.ToString() });
138
139// Console.WriteLine(
140// "Moved folder {0} {1}, to {2} {3}",
141// folder.folderName, folder.folderID, newParentFolders[0].folderName, folder.parentFolderID);
142
143 // TODO: Really need to implement folder version incrementing, though this should be common code anyway,
144 // not reimplemented in each db plugin.
145
146 return true;
147 }
148
108 public XInventoryItem[] GetActiveGestures(UUID principalID) { throw new NotImplementedException(); } 149 public XInventoryItem[] GetActiveGestures(UUID principalID) { throw new NotImplementedException(); }
109 public int GetAssetPermissions(UUID principalID, UUID assetID) { throw new NotImplementedException(); } 150 public int GetAssetPermissions(UUID principalID, UUID assetID) { throw new NotImplementedException(); }
110 } 151 }