diff options
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r-- | OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs | 70 | ||||
-rw-r--r-- | OpenSim/Tests/Inventory/TestInventory.cs | 2016 |
2 files changed, 1043 insertions, 1043 deletions
diff --git a/OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs b/OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs index dd537a5..cb89a71 100644 --- a/OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs +++ b/OpenSim/Tests/Inventory/Properties/AssemblyInfo.cs | |||
@@ -1,35 +1,35 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | 2 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | 4 | ||
5 | // General Information about an assembly is controlled through the following | 5 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 6 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 7 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("Inventory")] | 8 | [assembly: AssemblyTitle("Inventory")] |
9 | [assembly: AssemblyDescription("")] | 9 | [assembly: AssemblyDescription("")] |
10 | [assembly: AssemblyConfiguration("")] | 10 | [assembly: AssemblyConfiguration("")] |
11 | [assembly: AssemblyCompany("Lauridsen")] | 11 | [assembly: AssemblyCompany("Lauridsen")] |
12 | [assembly: AssemblyProduct("Inventory")] | 12 | [assembly: AssemblyProduct("Inventory")] |
13 | [assembly: AssemblyCopyright("Copyright © Lauridsen 2007")] | 13 | [assembly: AssemblyCopyright("Copyright © Lauridsen 2007")] |
14 | [assembly: AssemblyTrademark("")] | 14 | [assembly: AssemblyTrademark("")] |
15 | [assembly: AssemblyCulture("")] | 15 | [assembly: AssemblyCulture("")] |
16 | 16 | ||
17 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
18 | // to COM components. If you need to access a type in this assembly from | 18 | // to COM components. If you need to access a type in this assembly from |
19 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
20 | [assembly: ComVisible(false)] | 20 | [assembly: ComVisible(false)] |
21 | 21 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("2330add7-08a2-4f33-9ab8-74894fe7e3dd")] | 23 | [assembly: Guid("2330add7-08a2-4f33-9ab8-74894fe7e3dd")] |
24 | 24 | ||
25 | // Version information for an assembly consists of the following four values: | 25 | // Version information for an assembly consists of the following four values: |
26 | // | 26 | // |
27 | // Major Version | 27 | // Major Version |
28 | // Minor Version | 28 | // Minor Version |
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | // You can specify all the values or you can default the Revision and Build Numbers | 32 | // You can specify all the values or you can default the Revision and Build Numbers |
33 | // by using the '*' as shown below: | 33 | // by using the '*' as shown below: |
34 | [assembly: AssemblyVersion("1.0.0.0")] | 34 | [assembly: AssemblyVersion("1.0.0.0")] |
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | 35 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Tests/Inventory/TestInventory.cs b/OpenSim/Tests/Inventory/TestInventory.cs index 7f1ded8..f9a791f 100644 --- a/OpenSim/Tests/Inventory/TestInventory.cs +++ b/OpenSim/Tests/Inventory/TestInventory.cs | |||
@@ -1,1008 +1,1008 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using NUnit.Framework; | 32 | using NUnit.Framework; |
33 | 33 | ||
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Data; | 36 | using OpenSim.Framework.Data; |
37 | using OpenSim.Framework.Data.SQLite; | 37 | using OpenSim.Framework.Data.SQLite; |
38 | using OpenSim.Framework.Data.MySQL; | 38 | using OpenSim.Framework.Data.MySQL; |
39 | using OpenSim.Framework.Console; | 39 | using OpenSim.Framework.Console; |
40 | 40 | ||
41 | namespace OpenSim.Test.Inventory | 41 | namespace OpenSim.Test.Inventory |
42 | { | 42 | { |
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class TestInventory | 44 | public class TestInventory |
45 | { | 45 | { |
46 | IInventoryData _dbPlugin; | 46 | IInventoryData _dbPlugin; |
47 | LLUUID _agent_1_id; | 47 | LLUUID _agent_1_id; |
48 | public static LLUUID LibraryFolderRootUuid = new LLUUID("5926de2a-c2d7-4c11-ac4e-74512ffeb6d1"); | 48 | public static LLUUID LibraryFolderRootUuid = new LLUUID("5926de2a-c2d7-4c11-ac4e-74512ffeb6d1"); |
49 | 49 | ||
50 | Random _rnd = new Random((int)DateTime.Now.Ticks); | 50 | Random _rnd = new Random((int)DateTime.Now.Ticks); |
51 | 51 | ||
52 | [TestFixtureSetUp] | 52 | [TestFixtureSetUp] |
53 | public void SetupInventoryTest() | 53 | public void SetupInventoryTest() |
54 | { | 54 | { |
55 | 55 | ||
56 | _agent_1_id = LLUUID.Random(); | 56 | _agent_1_id = LLUUID.Random(); |
57 | 57 | ||
58 | MainLog.Instance = new LogBase("UnitTest.log", "TEST", null, true); | 58 | MainLog.Instance = new LogBase("UnitTest.log", "TEST", null, true); |
59 | // _dbPlugin = new SQLiteInventoryStore(); | 59 | // _dbPlugin = new SQLiteInventoryStore(); |
60 | _dbPlugin = new MySQLInventoryData(); | 60 | _dbPlugin = new MySQLInventoryData(); |
61 | _dbPlugin.Initialise(); | 61 | _dbPlugin.Initialise(); |
62 | } | 62 | } |
63 | 63 | ||
64 | [TestFixtureTearDown] | 64 | [TestFixtureTearDown] |
65 | public void TeardownInventoryTest() | 65 | public void TeardownInventoryTest() |
66 | { | 66 | { |
67 | _dbPlugin.Close(); | 67 | _dbPlugin.Close(); |
68 | } | 68 | } |
69 | 69 | ||
70 | private bool AreFoldersIdentical(InventoryFolderBase a, InventoryFolderBase b) | 70 | private bool AreFoldersIdentical(InventoryFolderBase a, InventoryFolderBase b) |
71 | { | 71 | { |
72 | if (a.agentID != b.agentID) return false; | 72 | if (a.agentID != b.agentID) return false; |
73 | if (a.folderID != b.folderID) return false; | 73 | if (a.folderID != b.folderID) return false; |
74 | if (a.name != b.name) return false; | 74 | if (a.name != b.name) return false; |
75 | if (a.parentID != b.parentID) return false; | 75 | if (a.parentID != b.parentID) return false; |
76 | if (a.type != b.type) return false; | 76 | if (a.type != b.type) return false; |
77 | if (a.version != b.version) return false; | 77 | if (a.version != b.version) return false; |
78 | return true; | 78 | return true; |
79 | } | 79 | } |
80 | 80 | ||
81 | private bool AreItemsIdentical(InventoryItemBase a, InventoryItemBase b) | 81 | private bool AreItemsIdentical(InventoryItemBase a, InventoryItemBase b) |
82 | { | 82 | { |
83 | if (a.assetID != b.assetID) return false; | 83 | if (a.assetID != b.assetID) return false; |
84 | if (a.assetType != b.assetType) return false; | 84 | if (a.assetType != b.assetType) return false; |
85 | if (a.avatarID != b.avatarID) return false; | 85 | if (a.avatarID != b.avatarID) return false; |
86 | if (a.creatorsID != b.creatorsID) return false; | 86 | if (a.creatorsID != b.creatorsID) return false; |
87 | if (a.inventoryBasePermissions != b.inventoryBasePermissions) return false; | 87 | if (a.inventoryBasePermissions != b.inventoryBasePermissions) return false; |
88 | if (a.inventoryCurrentPermissions != b.inventoryCurrentPermissions) return false; | 88 | if (a.inventoryCurrentPermissions != b.inventoryCurrentPermissions) return false; |
89 | if (a.inventoryEveryOnePermissions != b.inventoryEveryOnePermissions) return false; | 89 | if (a.inventoryEveryOnePermissions != b.inventoryEveryOnePermissions) return false; |
90 | if (a.inventoryNextPermissions != b.inventoryNextPermissions) return false; | 90 | if (a.inventoryNextPermissions != b.inventoryNextPermissions) return false; |
91 | if (a.inventoryID != b.inventoryID) return false; | 91 | if (a.inventoryID != b.inventoryID) return false; |
92 | if (a.inventoryDescription != b.inventoryDescription) return false; | 92 | if (a.inventoryDescription != b.inventoryDescription) return false; |
93 | if (a.inventoryName != b.inventoryName) return false; | 93 | if (a.inventoryName != b.inventoryName) return false; |
94 | if (a.invType != b.invType) return false; | 94 | if (a.invType != b.invType) return false; |
95 | if (a.parentFolderID != b.parentFolderID) return false; | 95 | if (a.parentFolderID != b.parentFolderID) return false; |
96 | return true; | 96 | return true; |
97 | } | 97 | } |
98 | 98 | ||
99 | /// <summary> | 99 | /// <summary> |
100 | /// Test that we can insert a root folder | 100 | /// Test that we can insert a root folder |
101 | /// </summary> | 101 | /// </summary> |
102 | [Test] | 102 | [Test] |
103 | public void T01_SetupRootFolder() | 103 | public void T01_SetupRootFolder() |
104 | { | 104 | { |
105 | InventoryFolderBase root = new InventoryFolderBase(); | 105 | InventoryFolderBase root = new InventoryFolderBase(); |
106 | root.agentID = _agent_1_id; | 106 | root.agentID = _agent_1_id; |
107 | root.folderID = _agent_1_id; | 107 | root.folderID = _agent_1_id; |
108 | root.name = "Root folder"; | 108 | root.name = "Root folder"; |
109 | root.parentID = LLUUID.Zero; | 109 | root.parentID = LLUUID.Zero; |
110 | root.type = 2; | 110 | root.type = 2; |
111 | root.version = 2; | 111 | root.version = 2; |
112 | _dbPlugin.addInventoryFolder(root); | 112 | _dbPlugin.addInventoryFolder(root); |
113 | 113 | ||
114 | InventoryFolderBase f = _dbPlugin.getInventoryFolder(root.folderID); | 114 | InventoryFolderBase f = _dbPlugin.getInventoryFolder(root.folderID); |
115 | Assert.IsNotNull(f, "Failed to get existing folder"); | 115 | Assert.IsNotNull(f, "Failed to get existing folder"); |
116 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 116 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
117 | 117 | ||
118 | // Test that we only get the root folder, based on it's id, i.e. any other gui will not find the folder | 118 | // Test that we only get the root folder, based on it's id, i.e. any other gui will not find the folder |
119 | f = _dbPlugin.getInventoryFolder(LLUUID.Zero); | 119 | f = _dbPlugin.getInventoryFolder(LLUUID.Zero); |
120 | Assert.IsNull(f, "get folder returned a folder, but shouldn't find one"); | 120 | Assert.IsNull(f, "get folder returned a folder, but shouldn't find one"); |
121 | 121 | ||
122 | f = _dbPlugin.getInventoryFolder(LLUUID.Random()); | 122 | f = _dbPlugin.getInventoryFolder(LLUUID.Random()); |
123 | Assert.IsNull(f, "get folder returned a folder, but shouldn't find one"); | 123 | Assert.IsNull(f, "get folder returned a folder, but shouldn't find one"); |
124 | 124 | ||
125 | // test that we can delete the folder | 125 | // test that we can delete the folder |
126 | 126 | ||
127 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 127 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
128 | f = _dbPlugin.getInventoryFolder(root.folderID); | 128 | f = _dbPlugin.getInventoryFolder(root.folderID); |
129 | Assert.IsNull(f, "get folder returned a folder, but it should have been deleted"); | 129 | Assert.IsNull(f, "get folder returned a folder, but it should have been deleted"); |
130 | } | 130 | } |
131 | 131 | ||
132 | /// <summary> | 132 | /// <summary> |
133 | /// Make sure that all folders reported as root folders are root folders | 133 | /// Make sure that all folders reported as root folders are root folders |
134 | /// </summary> | 134 | /// </summary> |
135 | [Test] | 135 | [Test] |
136 | public void T02_TestRootFolder() | 136 | public void T02_TestRootFolder() |
137 | { | 137 | { |
138 | InventoryFolderBase root = new InventoryFolderBase(); | 138 | InventoryFolderBase root = new InventoryFolderBase(); |
139 | root.agentID = _agent_1_id; | 139 | root.agentID = _agent_1_id; |
140 | root.folderID = _agent_1_id; | 140 | root.folderID = _agent_1_id; |
141 | root.name = "Root folder"; | 141 | root.name = "Root folder"; |
142 | root.parentID = LLUUID.Zero; | 142 | root.parentID = LLUUID.Zero; |
143 | root.type = 2; | 143 | root.type = 2; |
144 | root.version = 2; | 144 | root.version = 2; |
145 | _dbPlugin.addInventoryFolder(root); | 145 | _dbPlugin.addInventoryFolder(root); |
146 | 146 | ||
147 | List<InventoryFolderBase> folders = _dbPlugin.getUserRootFolders(_agent_1_id); | 147 | List<InventoryFolderBase> folders = _dbPlugin.getUserRootFolders(_agent_1_id); |
148 | Assert.IsNotNull(folders, "Failed to get rootfolders for user"); | 148 | Assert.IsNotNull(folders, "Failed to get rootfolders for user"); |
149 | 149 | ||
150 | bool foundRoot = false; | 150 | bool foundRoot = false; |
151 | foreach(InventoryFolderBase f in folders) { | 151 | foreach(InventoryFolderBase f in folders) { |
152 | 152 | ||
153 | // a root folder has a zero valued LLUUID | 153 | // a root folder has a zero valued LLUUID |
154 | Assert.AreEqual(f.parentID, LLUUID.Zero, "non root folder returned"); | 154 | Assert.AreEqual(f.parentID, LLUUID.Zero, "non root folder returned"); |
155 | 155 | ||
156 | 156 | ||
157 | if(f.agentID == root.agentID) | 157 | if(f.agentID == root.agentID) |
158 | { | 158 | { |
159 | // we cannot have two different user specific root folders | 159 | // we cannot have two different user specific root folders |
160 | Assert.IsFalse(foundRoot, "Two different user specific root folders returned"); | 160 | Assert.IsFalse(foundRoot, "Two different user specific root folders returned"); |
161 | 161 | ||
162 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 162 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
163 | foundRoot = false; | 163 | foundRoot = false; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 166 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
167 | } | 167 | } |
168 | 168 | ||
169 | /// <summary> | 169 | /// <summary> |
170 | /// Test of folder hierarchy | 170 | /// Test of folder hierarchy |
171 | /// </summary> | 171 | /// </summary> |
172 | [Test] | 172 | [Test] |
173 | public void T03_TestRootFolder() | 173 | public void T03_TestRootFolder() |
174 | { | 174 | { |
175 | InventoryFolderBase root = new InventoryFolderBase(); | 175 | InventoryFolderBase root = new InventoryFolderBase(); |
176 | root.agentID = _agent_1_id; | 176 | root.agentID = _agent_1_id; |
177 | root.folderID = _agent_1_id; | 177 | root.folderID = _agent_1_id; |
178 | root.name = "Root folder"; | 178 | root.name = "Root folder"; |
179 | root.parentID = LLUUID.Zero; | 179 | root.parentID = LLUUID.Zero; |
180 | root.type = 2; | 180 | root.type = 2; |
181 | root.version = 2; | 181 | root.version = 2; |
182 | _dbPlugin.addInventoryFolder(root); | 182 | _dbPlugin.addInventoryFolder(root); |
183 | 183 | ||
184 | List<InventoryFolderBase> folders = _dbPlugin.getInventoryFolders(_agent_1_id); | 184 | List<InventoryFolderBase> folders = _dbPlugin.getInventoryFolders(_agent_1_id); |
185 | Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); | 185 | Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); |
186 | Assert.IsEmpty(folders, "non empty collection was returned, even though the list of sub-folders should be empty"); | 186 | Assert.IsEmpty(folders, "non empty collection was returned, even though the list of sub-folders should be empty"); |
187 | 187 | ||
188 | InventoryFolderBase child1 = new InventoryFolderBase(); | 188 | InventoryFolderBase child1 = new InventoryFolderBase(); |
189 | child1.agentID = _agent_1_id; | 189 | child1.agentID = _agent_1_id; |
190 | child1.folderID = LLUUID.Random(); | 190 | child1.folderID = LLUUID.Random(); |
191 | child1.name = "Child 1"; | 191 | child1.name = "Child 1"; |
192 | child1.parentID = root.folderID; | 192 | child1.parentID = root.folderID; |
193 | child1.type = 3; | 193 | child1.type = 3; |
194 | child1.version = 3; | 194 | child1.version = 3; |
195 | _dbPlugin.addInventoryFolder(child1); | 195 | _dbPlugin.addInventoryFolder(child1); |
196 | 196 | ||
197 | InventoryFolderBase child2 = new InventoryFolderBase(); | 197 | InventoryFolderBase child2 = new InventoryFolderBase(); |
198 | child2.agentID = _agent_1_id; | 198 | child2.agentID = _agent_1_id; |
199 | child2.folderID = LLUUID.Random(); | 199 | child2.folderID = LLUUID.Random(); |
200 | child2.name = "Child 2"; | 200 | child2.name = "Child 2"; |
201 | child2.parentID = root.folderID; | 201 | child2.parentID = root.folderID; |
202 | child2.type = 4; | 202 | child2.type = 4; |
203 | child2.version = 4; | 203 | child2.version = 4; |
204 | _dbPlugin.addInventoryFolder(child2); | 204 | _dbPlugin.addInventoryFolder(child2); |
205 | 205 | ||
206 | folders = _dbPlugin.getInventoryFolders(_agent_1_id); | 206 | folders = _dbPlugin.getInventoryFolders(_agent_1_id); |
207 | Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); | 207 | Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); |
208 | Assert.AreEqual(folders.Count, 2, "two children were reported as inserted into the root folder"); | 208 | Assert.AreEqual(folders.Count, 2, "two children were reported as inserted into the root folder"); |
209 | 209 | ||
210 | bool foundChild1 = false; | 210 | bool foundChild1 = false; |
211 | bool foundChild2 = false; | 211 | bool foundChild2 = false; |
212 | 212 | ||
213 | foreach (InventoryFolderBase f in folders) | 213 | foreach (InventoryFolderBase f in folders) |
214 | { | 214 | { |
215 | if (f.folderID == child1.folderID) | 215 | if (f.folderID == child1.folderID) |
216 | { | 216 | { |
217 | Assert.IsTrue(AreFoldersIdentical(child1, f), "Difference between stored and retrieved folder data"); | 217 | Assert.IsTrue(AreFoldersIdentical(child1, f), "Difference between stored and retrieved folder data"); |
218 | foundChild1 = true; | 218 | foundChild1 = true; |
219 | } | 219 | } |
220 | else if (f.folderID == child2.folderID) | 220 | else if (f.folderID == child2.folderID) |
221 | { | 221 | { |
222 | Assert.IsTrue(AreFoldersIdentical(child2, f), "Difference between stored and retrieved folder data"); | 222 | Assert.IsTrue(AreFoldersIdentical(child2, f), "Difference between stored and retrieved folder data"); |
223 | foundChild2 = true; | 223 | foundChild2 = true; |
224 | } | 224 | } |
225 | else | 225 | else |
226 | { | 226 | { |
227 | Assert.Fail("found unknown child folder"); | 227 | Assert.Fail("found unknown child folder"); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | if (foundChild1 == false || foundChild2 == false) | 231 | if (foundChild1 == false || foundChild2 == false) |
232 | { | 232 | { |
233 | Assert.Fail("one of the two child folders was not returned"); | 233 | Assert.Fail("one of the two child folders was not returned"); |
234 | } | 234 | } |
235 | 235 | ||
236 | _dbPlugin.deleteInventoryFolder(child2.folderID); | 236 | _dbPlugin.deleteInventoryFolder(child2.folderID); |
237 | _dbPlugin.deleteInventoryFolder(child1.folderID); | 237 | _dbPlugin.deleteInventoryFolder(child1.folderID); |
238 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 238 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
239 | } | 239 | } |
240 | 240 | ||
241 | /// <summary> | 241 | /// <summary> |
242 | /// Test of folder hierarchy, and deletion | 242 | /// Test of folder hierarchy, and deletion |
243 | /// </summary> | 243 | /// </summary> |
244 | [Test] | 244 | [Test] |
245 | public void T04_TestRootFolder() | 245 | public void T04_TestRootFolder() |
246 | { | 246 | { |
247 | InventoryFolderBase root = new InventoryFolderBase(); | 247 | InventoryFolderBase root = new InventoryFolderBase(); |
248 | root.agentID = _agent_1_id; | 248 | root.agentID = _agent_1_id; |
249 | root.folderID = _agent_1_id; | 249 | root.folderID = _agent_1_id; |
250 | root.name = "Root folder"; | 250 | root.name = "Root folder"; |
251 | root.parentID = LLUUID.Zero; | 251 | root.parentID = LLUUID.Zero; |
252 | root.type = 2; | 252 | root.type = 2; |
253 | root.version = 2; | 253 | root.version = 2; |
254 | _dbPlugin.addInventoryFolder(root); | 254 | _dbPlugin.addInventoryFolder(root); |
255 | 255 | ||
256 | InventoryFolderBase child1 = new InventoryFolderBase(); | 256 | InventoryFolderBase child1 = new InventoryFolderBase(); |
257 | child1.agentID = _agent_1_id; | 257 | child1.agentID = _agent_1_id; |
258 | child1.folderID = LLUUID.Random(); | 258 | child1.folderID = LLUUID.Random(); |
259 | child1.name = "Child 1"; | 259 | child1.name = "Child 1"; |
260 | child1.parentID = root.folderID; | 260 | child1.parentID = root.folderID; |
261 | child1.type = 3; | 261 | child1.type = 3; |
262 | child1.version = 3; | 262 | child1.version = 3; |
263 | _dbPlugin.addInventoryFolder(child1); | 263 | _dbPlugin.addInventoryFolder(child1); |
264 | 264 | ||
265 | InventoryFolderBase child2 = new InventoryFolderBase(); | 265 | InventoryFolderBase child2 = new InventoryFolderBase(); |
266 | child2.agentID = _agent_1_id; | 266 | child2.agentID = _agent_1_id; |
267 | child2.folderID = LLUUID.Random(); | 267 | child2.folderID = LLUUID.Random(); |
268 | child2.name = "Child 2"; | 268 | child2.name = "Child 2"; |
269 | child2.parentID = root.folderID; | 269 | child2.parentID = root.folderID; |
270 | child2.type = 4; | 270 | child2.type = 4; |
271 | child2.version = 4; | 271 | child2.version = 4; |
272 | _dbPlugin.addInventoryFolder(child2); | 272 | _dbPlugin.addInventoryFolder(child2); |
273 | 273 | ||
274 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 274 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
275 | 275 | ||
276 | List<InventoryFolderBase> folders = _dbPlugin.getInventoryFolders(_agent_1_id); | 276 | List<InventoryFolderBase> folders = _dbPlugin.getInventoryFolders(_agent_1_id); |
277 | Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); | 277 | Assert.IsNotNull(folders, "null was returned, but an empty list of subfolders were expected"); |
278 | Assert.IsEmpty(folders, "non empty collection was returned, even though the list of sub-folders should be empty"); | 278 | Assert.IsEmpty(folders, "non empty collection was returned, even though the list of sub-folders should be empty"); |
279 | 279 | ||
280 | InventoryFolderBase f = _dbPlugin.getInventoryFolder(_agent_1_id); | 280 | InventoryFolderBase f = _dbPlugin.getInventoryFolder(_agent_1_id); |
281 | Assert.IsNull(f, "Folder was returned, even though is has been deleted"); | 281 | Assert.IsNull(f, "Folder was returned, even though is has been deleted"); |
282 | 282 | ||
283 | f = _dbPlugin.getInventoryFolder(child1.folderID); | 283 | f = _dbPlugin.getInventoryFolder(child1.folderID); |
284 | Assert.IsNull(f, "Folder was returned, even though is has been deleted"); | 284 | Assert.IsNull(f, "Folder was returned, even though is has been deleted"); |
285 | 285 | ||
286 | f = _dbPlugin.getInventoryFolder(child2.folderID); | 286 | f = _dbPlugin.getInventoryFolder(child2.folderID); |
287 | Assert.IsNull(f, "Folder was returned, even though is has been deleted"); | 287 | Assert.IsNull(f, "Folder was returned, even though is has been deleted"); |
288 | } | 288 | } |
289 | 289 | ||
290 | /// <summary> | 290 | /// <summary> |
291 | /// Folder update | 291 | /// Folder update |
292 | /// </summary> | 292 | /// </summary> |
293 | [Test] | 293 | [Test] |
294 | public void T05_UpdateFolder() | 294 | public void T05_UpdateFolder() |
295 | { | 295 | { |
296 | InventoryFolderBase root = new InventoryFolderBase(); | 296 | InventoryFolderBase root = new InventoryFolderBase(); |
297 | root.agentID = _agent_1_id; | 297 | root.agentID = _agent_1_id; |
298 | root.folderID = _agent_1_id; | 298 | root.folderID = _agent_1_id; |
299 | root.name = "Root folder"; | 299 | root.name = "Root folder"; |
300 | root.parentID = LLUUID.Zero; | 300 | root.parentID = LLUUID.Zero; |
301 | root.type = 2; | 301 | root.type = 2; |
302 | root.version = 2; | 302 | root.version = 2; |
303 | _dbPlugin.addInventoryFolder(root); | 303 | _dbPlugin.addInventoryFolder(root); |
304 | 304 | ||
305 | InventoryFolderBase f = _dbPlugin.getInventoryFolder(_agent_1_id); | 305 | InventoryFolderBase f = _dbPlugin.getInventoryFolder(_agent_1_id); |
306 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 306 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
307 | 307 | ||
308 | root.agentID = LLUUID.Random(); | 308 | root.agentID = LLUUID.Random(); |
309 | _dbPlugin.updateInventoryFolder(root); | 309 | _dbPlugin.updateInventoryFolder(root); |
310 | f = _dbPlugin.getInventoryFolder(root.folderID); | 310 | f = _dbPlugin.getInventoryFolder(root.folderID); |
311 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 311 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
312 | 312 | ||
313 | root.folderID = LLUUID.Random(); | 313 | root.folderID = LLUUID.Random(); |
314 | _dbPlugin.updateInventoryFolder(root); | 314 | _dbPlugin.updateInventoryFolder(root); |
315 | f = _dbPlugin.getInventoryFolder(root.folderID); | 315 | f = _dbPlugin.getInventoryFolder(root.folderID); |
316 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 316 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
317 | 317 | ||
318 | root.name = "Root folder 2"; | 318 | root.name = "Root folder 2"; |
319 | _dbPlugin.updateInventoryFolder(root); | 319 | _dbPlugin.updateInventoryFolder(root); |
320 | f = _dbPlugin.getInventoryFolder(root.folderID); | 320 | f = _dbPlugin.getInventoryFolder(root.folderID); |
321 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 321 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
322 | 322 | ||
323 | root.parentID = LLUUID.Random(); | 323 | root.parentID = LLUUID.Random(); |
324 | _dbPlugin.updateInventoryFolder(root); | 324 | _dbPlugin.updateInventoryFolder(root); |
325 | f = _dbPlugin.getInventoryFolder(root.folderID); | 325 | f = _dbPlugin.getInventoryFolder(root.folderID); |
326 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 326 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
327 | 327 | ||
328 | root.type = (short)(root.type + 1); | 328 | root.type = (short)(root.type + 1); |
329 | _dbPlugin.updateInventoryFolder(root); | 329 | _dbPlugin.updateInventoryFolder(root); |
330 | f = _dbPlugin.getInventoryFolder(root.folderID); | 330 | f = _dbPlugin.getInventoryFolder(root.folderID); |
331 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 331 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
332 | 332 | ||
333 | root.version = (ushort)(root.version + 1); | 333 | root.version = (ushort)(root.version + 1); |
334 | _dbPlugin.updateInventoryFolder(root); | 334 | _dbPlugin.updateInventoryFolder(root); |
335 | f = _dbPlugin.getInventoryFolder(root.folderID); | 335 | f = _dbPlugin.getInventoryFolder(root.folderID); |
336 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); | 336 | Assert.IsTrue(AreFoldersIdentical(root, f), "Difference between stored and retrieved folder data"); |
337 | 337 | ||
338 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 338 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
339 | _dbPlugin.deleteInventoryFolder(root.folderID); | 339 | _dbPlugin.deleteInventoryFolder(root.folderID); |
340 | } | 340 | } |
341 | 341 | ||
342 | /// <summary> | 342 | /// <summary> |
343 | /// Test that we can insert a root folder | 343 | /// Test that we can insert a root folder |
344 | /// </summary> | 344 | /// </summary> |
345 | [Test] | 345 | [Test] |
346 | public void T06_SetupInventoryWithItems() | 346 | public void T06_SetupInventoryWithItems() |
347 | { | 347 | { |
348 | 348 | ||
349 | // Setup inventory | 349 | // Setup inventory |
350 | InventoryFolderBase root = new InventoryFolderBase(); | 350 | InventoryFolderBase root = new InventoryFolderBase(); |
351 | root.agentID = _agent_1_id; | 351 | root.agentID = _agent_1_id; |
352 | root.folderID = _agent_1_id; | 352 | root.folderID = _agent_1_id; |
353 | root.name = "Root folder"; | 353 | root.name = "Root folder"; |
354 | root.parentID = LLUUID.Zero; | 354 | root.parentID = LLUUID.Zero; |
355 | root.type = 2; | 355 | root.type = 2; |
356 | root.version = 2; | 356 | root.version = 2; |
357 | _dbPlugin.addInventoryFolder(root); | 357 | _dbPlugin.addInventoryFolder(root); |
358 | 358 | ||
359 | InventoryFolderBase child1 = new InventoryFolderBase(); | 359 | InventoryFolderBase child1 = new InventoryFolderBase(); |
360 | child1.agentID = _agent_1_id; | 360 | child1.agentID = _agent_1_id; |
361 | child1.folderID = LLUUID.Random(); | 361 | child1.folderID = LLUUID.Random(); |
362 | child1.name = "Child 1"; | 362 | child1.name = "Child 1"; |
363 | child1.parentID = root.folderID; | 363 | child1.parentID = root.folderID; |
364 | child1.type = 3; | 364 | child1.type = 3; |
365 | child1.version = 3; | 365 | child1.version = 3; |
366 | _dbPlugin.addInventoryFolder(child1); | 366 | _dbPlugin.addInventoryFolder(child1); |
367 | 367 | ||
368 | InventoryFolderBase child1Child = new InventoryFolderBase(); | 368 | InventoryFolderBase child1Child = new InventoryFolderBase(); |
369 | child1Child.agentID = _agent_1_id; | 369 | child1Child.agentID = _agent_1_id; |
370 | child1Child.folderID = LLUUID.Random(); | 370 | child1Child.folderID = LLUUID.Random(); |
371 | child1Child.name = "Child 1 child"; | 371 | child1Child.name = "Child 1 child"; |
372 | child1Child.parentID = child1.folderID; | 372 | child1Child.parentID = child1.folderID; |
373 | child1Child.type = 4; | 373 | child1Child.type = 4; |
374 | child1Child.version = 4; | 374 | child1Child.version = 4; |
375 | _dbPlugin.addInventoryFolder(child1Child); | 375 | _dbPlugin.addInventoryFolder(child1Child); |
376 | 376 | ||
377 | InventoryFolderBase child2 = new InventoryFolderBase(); | 377 | InventoryFolderBase child2 = new InventoryFolderBase(); |
378 | child2.agentID = _agent_1_id; | 378 | child2.agentID = _agent_1_id; |
379 | child2.folderID = LLUUID.Random(); | 379 | child2.folderID = LLUUID.Random(); |
380 | child2.name = "Child 2"; | 380 | child2.name = "Child 2"; |
381 | child2.parentID = root.folderID; | 381 | child2.parentID = root.folderID; |
382 | child2.type = 5; | 382 | child2.type = 5; |
383 | child2.version = 5; | 383 | child2.version = 5; |
384 | _dbPlugin.addInventoryFolder(child2); | 384 | _dbPlugin.addInventoryFolder(child2); |
385 | 385 | ||
386 | InventoryFolderBase child2Child = new InventoryFolderBase(); | 386 | InventoryFolderBase child2Child = new InventoryFolderBase(); |
387 | child2Child.agentID = _agent_1_id; | 387 | child2Child.agentID = _agent_1_id; |
388 | child2Child.folderID = LLUUID.Random(); | 388 | child2Child.folderID = LLUUID.Random(); |
389 | child2Child.name = "Child 2 child"; | 389 | child2Child.name = "Child 2 child"; |
390 | child2Child.parentID = child2.folderID; | 390 | child2Child.parentID = child2.folderID; |
391 | child2Child.type = 6; | 391 | child2Child.type = 6; |
392 | child2Child.version = 6; | 392 | child2Child.version = 6; |
393 | _dbPlugin.addInventoryFolder(child2Child); | 393 | _dbPlugin.addInventoryFolder(child2Child); |
394 | 394 | ||
395 | InventoryItemBase rootItem = new InventoryItemBase(); | 395 | InventoryItemBase rootItem = new InventoryItemBase(); |
396 | rootItem.assetID = LLUUID.Random(); | 396 | rootItem.assetID = LLUUID.Random(); |
397 | rootItem.assetType = _rnd.Next(1, 1000); | 397 | rootItem.assetType = _rnd.Next(1, 1000); |
398 | rootItem.avatarID = _agent_1_id; | 398 | rootItem.avatarID = _agent_1_id; |
399 | rootItem.creatorsID = LLUUID.Random(); | 399 | rootItem.creatorsID = LLUUID.Random(); |
400 | rootItem.inventoryBasePermissions = (uint)_rnd.Next(1,1000000); | 400 | rootItem.inventoryBasePermissions = (uint)_rnd.Next(1,1000000); |
401 | rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 401 | rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
402 | rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 402 | rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
403 | rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 403 | rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
404 | rootItem.inventoryID = LLUUID.Random(); | 404 | rootItem.inventoryID = LLUUID.Random(); |
405 | rootItem.inventoryDescription = "Root item, Description"; | 405 | rootItem.inventoryDescription = "Root item, Description"; |
406 | rootItem.inventoryName = "Root item"; | 406 | rootItem.inventoryName = "Root item"; |
407 | rootItem.invType = _rnd.Next(1, 1000); | 407 | rootItem.invType = _rnd.Next(1, 1000); |
408 | rootItem.parentFolderID = root.folderID; | 408 | rootItem.parentFolderID = root.folderID; |
409 | _dbPlugin.addInventoryItem(rootItem); | 409 | _dbPlugin.addInventoryItem(rootItem); |
410 | 410 | ||
411 | InventoryItemBase child1Item = new InventoryItemBase(); | 411 | InventoryItemBase child1Item = new InventoryItemBase(); |
412 | child1Item.assetID = LLUUID.Random(); | 412 | child1Item.assetID = LLUUID.Random(); |
413 | child1Item.assetType = _rnd.Next(1, 1000); | 413 | child1Item.assetType = _rnd.Next(1, 1000); |
414 | child1Item.avatarID = _agent_1_id; | 414 | child1Item.avatarID = _agent_1_id; |
415 | child1Item.creatorsID = LLUUID.Random(); | 415 | child1Item.creatorsID = LLUUID.Random(); |
416 | child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 416 | child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
417 | child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 417 | child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
418 | child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 418 | child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
419 | child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 419 | child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
420 | child1Item.inventoryID = LLUUID.Random(); | 420 | child1Item.inventoryID = LLUUID.Random(); |
421 | child1Item.inventoryDescription = "child1 item, Description"; | 421 | child1Item.inventoryDescription = "child1 item, Description"; |
422 | child1Item.inventoryName = "child1 item"; | 422 | child1Item.inventoryName = "child1 item"; |
423 | child1Item.invType = _rnd.Next(1, 1000); | 423 | child1Item.invType = _rnd.Next(1, 1000); |
424 | child1Item.parentFolderID = child1.folderID; | 424 | child1Item.parentFolderID = child1.folderID; |
425 | _dbPlugin.addInventoryItem(child1Item); | 425 | _dbPlugin.addInventoryItem(child1Item); |
426 | 426 | ||
427 | InventoryItemBase child1ChildItem = new InventoryItemBase(); | 427 | InventoryItemBase child1ChildItem = new InventoryItemBase(); |
428 | child1ChildItem.assetID = LLUUID.Random(); | 428 | child1ChildItem.assetID = LLUUID.Random(); |
429 | child1ChildItem.assetType = _rnd.Next(1, 1000); | 429 | child1ChildItem.assetType = _rnd.Next(1, 1000); |
430 | child1ChildItem.avatarID = _agent_1_id; | 430 | child1ChildItem.avatarID = _agent_1_id; |
431 | child1ChildItem.creatorsID = LLUUID.Random(); | 431 | child1ChildItem.creatorsID = LLUUID.Random(); |
432 | child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 432 | child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
433 | child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 433 | child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
434 | child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 434 | child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
435 | child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 435 | child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
436 | child1ChildItem.inventoryID = LLUUID.Random(); | 436 | child1ChildItem.inventoryID = LLUUID.Random(); |
437 | child1ChildItem.inventoryDescription = "child1Child item, Description"; | 437 | child1ChildItem.inventoryDescription = "child1Child item, Description"; |
438 | child1ChildItem.inventoryName = "child1Child item"; | 438 | child1ChildItem.inventoryName = "child1Child item"; |
439 | child1ChildItem.invType = _rnd.Next(1, 1000); | 439 | child1ChildItem.invType = _rnd.Next(1, 1000); |
440 | child1ChildItem.parentFolderID = child1Child.folderID; | 440 | child1ChildItem.parentFolderID = child1Child.folderID; |
441 | _dbPlugin.addInventoryItem(child1ChildItem); | 441 | _dbPlugin.addInventoryItem(child1ChildItem); |
442 | 442 | ||
443 | InventoryItemBase child2Item = new InventoryItemBase(); | 443 | InventoryItemBase child2Item = new InventoryItemBase(); |
444 | child2Item.assetID = LLUUID.Random(); | 444 | child2Item.assetID = LLUUID.Random(); |
445 | child2Item.assetType = _rnd.Next(1, 1000); | 445 | child2Item.assetType = _rnd.Next(1, 1000); |
446 | child2Item.avatarID = _agent_1_id; | 446 | child2Item.avatarID = _agent_1_id; |
447 | child2Item.creatorsID = LLUUID.Random(); | 447 | child2Item.creatorsID = LLUUID.Random(); |
448 | child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 448 | child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
449 | child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 449 | child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
450 | child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 450 | child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
451 | child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 451 | child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
452 | child2Item.inventoryID = LLUUID.Random(); | 452 | child2Item.inventoryID = LLUUID.Random(); |
453 | child2Item.inventoryDescription = "child2 item, Description"; | 453 | child2Item.inventoryDescription = "child2 item, Description"; |
454 | child2Item.inventoryName = "child2 item"; | 454 | child2Item.inventoryName = "child2 item"; |
455 | child2Item.invType = _rnd.Next(1, 1000); | 455 | child2Item.invType = _rnd.Next(1, 1000); |
456 | child2Item.parentFolderID = child2.folderID; | 456 | child2Item.parentFolderID = child2.folderID; |
457 | _dbPlugin.addInventoryItem(child2Item); | 457 | _dbPlugin.addInventoryItem(child2Item); |
458 | 458 | ||
459 | InventoryItemBase child2ChildItem = new InventoryItemBase(); | 459 | InventoryItemBase child2ChildItem = new InventoryItemBase(); |
460 | child2ChildItem.assetID = LLUUID.Random(); | 460 | child2ChildItem.assetID = LLUUID.Random(); |
461 | child2ChildItem.assetType = _rnd.Next(1, 1000); | 461 | child2ChildItem.assetType = _rnd.Next(1, 1000); |
462 | child2ChildItem.avatarID = _agent_1_id; | 462 | child2ChildItem.avatarID = _agent_1_id; |
463 | child2ChildItem.creatorsID = LLUUID.Random(); | 463 | child2ChildItem.creatorsID = LLUUID.Random(); |
464 | child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 464 | child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
465 | child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 465 | child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
466 | child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 466 | child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
467 | child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 467 | child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
468 | child2ChildItem.inventoryID = LLUUID.Random(); | 468 | child2ChildItem.inventoryID = LLUUID.Random(); |
469 | child2ChildItem.inventoryDescription = "child2Child item, Description"; | 469 | child2ChildItem.inventoryDescription = "child2Child item, Description"; |
470 | child2ChildItem.inventoryName = "child2Child item"; | 470 | child2ChildItem.inventoryName = "child2Child item"; |
471 | child2ChildItem.invType = _rnd.Next(1, 1000); | 471 | child2ChildItem.invType = _rnd.Next(1, 1000); |
472 | child2ChildItem.parentFolderID = child2Child.folderID; | 472 | child2ChildItem.parentFolderID = child2Child.folderID; |
473 | _dbPlugin.addInventoryItem(child2ChildItem); | 473 | _dbPlugin.addInventoryItem(child2ChildItem); |
474 | 474 | ||
475 | // test read of items | 475 | // test read of items |
476 | 476 | ||
477 | InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 477 | InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
478 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 478 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
479 | 479 | ||
480 | item = _dbPlugin.getInventoryItem(child1Item.inventoryID); | 480 | item = _dbPlugin.getInventoryItem(child1Item.inventoryID); |
481 | Assert.IsTrue(AreItemsIdentical(child1Item, item)); | 481 | Assert.IsTrue(AreItemsIdentical(child1Item, item)); |
482 | 482 | ||
483 | item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); | 483 | item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); |
484 | Assert.IsTrue(AreItemsIdentical(child1ChildItem, item)); | 484 | Assert.IsTrue(AreItemsIdentical(child1ChildItem, item)); |
485 | 485 | ||
486 | item = _dbPlugin.getInventoryItem(child2Item.inventoryID); | 486 | item = _dbPlugin.getInventoryItem(child2Item.inventoryID); |
487 | Assert.IsTrue(AreItemsIdentical(child2Item, item)); | 487 | Assert.IsTrue(AreItemsIdentical(child2Item, item)); |
488 | 488 | ||
489 | item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); | 489 | item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); |
490 | Assert.IsTrue(AreItemsIdentical(child2ChildItem, item)); | 490 | Assert.IsTrue(AreItemsIdentical(child2ChildItem, item)); |
491 | 491 | ||
492 | _dbPlugin.deleteInventoryItem(rootItem.inventoryID); | 492 | _dbPlugin.deleteInventoryItem(rootItem.inventoryID); |
493 | _dbPlugin.deleteInventoryItem(child1Item.inventoryID); | 493 | _dbPlugin.deleteInventoryItem(child1Item.inventoryID); |
494 | _dbPlugin.deleteInventoryItem(child1ChildItem.inventoryID); | 494 | _dbPlugin.deleteInventoryItem(child1ChildItem.inventoryID); |
495 | _dbPlugin.deleteInventoryItem(child2Item.inventoryID); | 495 | _dbPlugin.deleteInventoryItem(child2Item.inventoryID); |
496 | _dbPlugin.deleteInventoryItem(child2ChildItem.inventoryID); | 496 | _dbPlugin.deleteInventoryItem(child2ChildItem.inventoryID); |
497 | } | 497 | } |
498 | 498 | ||
499 | /// <summary> | 499 | /// <summary> |
500 | /// Test that we can insert a root folder | 500 | /// Test that we can insert a root folder |
501 | /// </summary> | 501 | /// </summary> |
502 | [Test] | 502 | [Test] |
503 | public void T07_DeleteInventoryWithItems() | 503 | public void T07_DeleteInventoryWithItems() |
504 | { | 504 | { |
505 | 505 | ||
506 | // Setup inventory | 506 | // Setup inventory |
507 | InventoryFolderBase root = new InventoryFolderBase(); | 507 | InventoryFolderBase root = new InventoryFolderBase(); |
508 | root.agentID = _agent_1_id; | 508 | root.agentID = _agent_1_id; |
509 | root.folderID = _agent_1_id; | 509 | root.folderID = _agent_1_id; |
510 | root.name = "Root folder"; | 510 | root.name = "Root folder"; |
511 | root.parentID = LLUUID.Zero; | 511 | root.parentID = LLUUID.Zero; |
512 | root.type = 2; | 512 | root.type = 2; |
513 | root.version = 2; | 513 | root.version = 2; |
514 | _dbPlugin.addInventoryFolder(root); | 514 | _dbPlugin.addInventoryFolder(root); |
515 | 515 | ||
516 | InventoryFolderBase child1 = new InventoryFolderBase(); | 516 | InventoryFolderBase child1 = new InventoryFolderBase(); |
517 | child1.agentID = _agent_1_id; | 517 | child1.agentID = _agent_1_id; |
518 | child1.folderID = LLUUID.Random(); | 518 | child1.folderID = LLUUID.Random(); |
519 | child1.name = "Child 1"; | 519 | child1.name = "Child 1"; |
520 | child1.parentID = root.folderID; | 520 | child1.parentID = root.folderID; |
521 | child1.type = 3; | 521 | child1.type = 3; |
522 | child1.version = 3; | 522 | child1.version = 3; |
523 | _dbPlugin.addInventoryFolder(child1); | 523 | _dbPlugin.addInventoryFolder(child1); |
524 | 524 | ||
525 | InventoryFolderBase child1Child = new InventoryFolderBase(); | 525 | InventoryFolderBase child1Child = new InventoryFolderBase(); |
526 | child1Child.agentID = _agent_1_id; | 526 | child1Child.agentID = _agent_1_id; |
527 | child1Child.folderID = LLUUID.Random(); | 527 | child1Child.folderID = LLUUID.Random(); |
528 | child1Child.name = "Child 1 child"; | 528 | child1Child.name = "Child 1 child"; |
529 | child1Child.parentID = child1.folderID; | 529 | child1Child.parentID = child1.folderID; |
530 | child1Child.type = 4; | 530 | child1Child.type = 4; |
531 | child1Child.version = 4; | 531 | child1Child.version = 4; |
532 | _dbPlugin.addInventoryFolder(child1Child); | 532 | _dbPlugin.addInventoryFolder(child1Child); |
533 | 533 | ||
534 | InventoryFolderBase child2 = new InventoryFolderBase(); | 534 | InventoryFolderBase child2 = new InventoryFolderBase(); |
535 | child2.agentID = _agent_1_id; | 535 | child2.agentID = _agent_1_id; |
536 | child2.folderID = LLUUID.Random(); | 536 | child2.folderID = LLUUID.Random(); |
537 | child2.name = "Child 2"; | 537 | child2.name = "Child 2"; |
538 | child2.parentID = root.folderID; | 538 | child2.parentID = root.folderID; |
539 | child2.type = 5; | 539 | child2.type = 5; |
540 | child2.version = 5; | 540 | child2.version = 5; |
541 | _dbPlugin.addInventoryFolder(child2); | 541 | _dbPlugin.addInventoryFolder(child2); |
542 | 542 | ||
543 | InventoryFolderBase child2Child = new InventoryFolderBase(); | 543 | InventoryFolderBase child2Child = new InventoryFolderBase(); |
544 | child2Child.agentID = _agent_1_id; | 544 | child2Child.agentID = _agent_1_id; |
545 | child2Child.folderID = LLUUID.Random(); | 545 | child2Child.folderID = LLUUID.Random(); |
546 | child2Child.name = "Child 2 child"; | 546 | child2Child.name = "Child 2 child"; |
547 | child2Child.parentID = child2.folderID; | 547 | child2Child.parentID = child2.folderID; |
548 | child2Child.type = 6; | 548 | child2Child.type = 6; |
549 | child2Child.version = 6; | 549 | child2Child.version = 6; |
550 | _dbPlugin.addInventoryFolder(child2Child); | 550 | _dbPlugin.addInventoryFolder(child2Child); |
551 | 551 | ||
552 | InventoryItemBase rootItem = new InventoryItemBase(); | 552 | InventoryItemBase rootItem = new InventoryItemBase(); |
553 | rootItem.assetID = LLUUID.Random(); | 553 | rootItem.assetID = LLUUID.Random(); |
554 | rootItem.assetType = _rnd.Next(1, 1000); | 554 | rootItem.assetType = _rnd.Next(1, 1000); |
555 | rootItem.avatarID = _agent_1_id; | 555 | rootItem.avatarID = _agent_1_id; |
556 | rootItem.creatorsID = LLUUID.Random(); | 556 | rootItem.creatorsID = LLUUID.Random(); |
557 | rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 557 | rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
558 | rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 558 | rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
559 | rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 559 | rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
560 | rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 560 | rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
561 | rootItem.inventoryID = LLUUID.Random(); | 561 | rootItem.inventoryID = LLUUID.Random(); |
562 | rootItem.inventoryDescription = "Root item, Description"; | 562 | rootItem.inventoryDescription = "Root item, Description"; |
563 | rootItem.inventoryName = "Root item"; | 563 | rootItem.inventoryName = "Root item"; |
564 | rootItem.invType = _rnd.Next(1, 1000); | 564 | rootItem.invType = _rnd.Next(1, 1000); |
565 | rootItem.parentFolderID = root.folderID; | 565 | rootItem.parentFolderID = root.folderID; |
566 | _dbPlugin.addInventoryItem(rootItem); | 566 | _dbPlugin.addInventoryItem(rootItem); |
567 | 567 | ||
568 | InventoryItemBase child1Item = new InventoryItemBase(); | 568 | InventoryItemBase child1Item = new InventoryItemBase(); |
569 | child1Item.assetID = LLUUID.Random(); | 569 | child1Item.assetID = LLUUID.Random(); |
570 | child1Item.assetType = _rnd.Next(1, 1000); | 570 | child1Item.assetType = _rnd.Next(1, 1000); |
571 | child1Item.avatarID = _agent_1_id; | 571 | child1Item.avatarID = _agent_1_id; |
572 | child1Item.creatorsID = LLUUID.Random(); | 572 | child1Item.creatorsID = LLUUID.Random(); |
573 | child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 573 | child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
574 | child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 574 | child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
575 | child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 575 | child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
576 | child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 576 | child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
577 | child1Item.inventoryID = LLUUID.Random(); | 577 | child1Item.inventoryID = LLUUID.Random(); |
578 | child1Item.inventoryDescription = "child1 item, Description"; | 578 | child1Item.inventoryDescription = "child1 item, Description"; |
579 | child1Item.inventoryName = "child1 item"; | 579 | child1Item.inventoryName = "child1 item"; |
580 | child1Item.invType = _rnd.Next(1, 1000); | 580 | child1Item.invType = _rnd.Next(1, 1000); |
581 | child1Item.parentFolderID = child1.folderID; | 581 | child1Item.parentFolderID = child1.folderID; |
582 | _dbPlugin.addInventoryItem(child1Item); | 582 | _dbPlugin.addInventoryItem(child1Item); |
583 | 583 | ||
584 | InventoryItemBase child1ChildItem = new InventoryItemBase(); | 584 | InventoryItemBase child1ChildItem = new InventoryItemBase(); |
585 | child1ChildItem.assetID = LLUUID.Random(); | 585 | child1ChildItem.assetID = LLUUID.Random(); |
586 | child1ChildItem.assetType = _rnd.Next(1, 1000); | 586 | child1ChildItem.assetType = _rnd.Next(1, 1000); |
587 | child1ChildItem.avatarID = _agent_1_id; | 587 | child1ChildItem.avatarID = _agent_1_id; |
588 | child1ChildItem.creatorsID = LLUUID.Random(); | 588 | child1ChildItem.creatorsID = LLUUID.Random(); |
589 | child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 589 | child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
590 | child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 590 | child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
591 | child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 591 | child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
592 | child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 592 | child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
593 | child1ChildItem.inventoryID = LLUUID.Random(); | 593 | child1ChildItem.inventoryID = LLUUID.Random(); |
594 | child1ChildItem.inventoryDescription = "child1Child item, Description"; | 594 | child1ChildItem.inventoryDescription = "child1Child item, Description"; |
595 | child1ChildItem.inventoryName = "child1Child item"; | 595 | child1ChildItem.inventoryName = "child1Child item"; |
596 | child1ChildItem.invType = _rnd.Next(1, 1000); | 596 | child1ChildItem.invType = _rnd.Next(1, 1000); |
597 | child1ChildItem.parentFolderID = child1Child.folderID; | 597 | child1ChildItem.parentFolderID = child1Child.folderID; |
598 | _dbPlugin.addInventoryItem(child1ChildItem); | 598 | _dbPlugin.addInventoryItem(child1ChildItem); |
599 | 599 | ||
600 | InventoryItemBase child2Item = new InventoryItemBase(); | 600 | InventoryItemBase child2Item = new InventoryItemBase(); |
601 | child2Item.assetID = LLUUID.Random(); | 601 | child2Item.assetID = LLUUID.Random(); |
602 | child2Item.assetType = _rnd.Next(1, 1000); | 602 | child2Item.assetType = _rnd.Next(1, 1000); |
603 | child2Item.avatarID = _agent_1_id; | 603 | child2Item.avatarID = _agent_1_id; |
604 | child2Item.creatorsID = LLUUID.Random(); | 604 | child2Item.creatorsID = LLUUID.Random(); |
605 | child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 605 | child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
606 | child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 606 | child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
607 | child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 607 | child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
608 | child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 608 | child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
609 | child2Item.inventoryID = LLUUID.Random(); | 609 | child2Item.inventoryID = LLUUID.Random(); |
610 | child2Item.inventoryDescription = "child2 item, Description"; | 610 | child2Item.inventoryDescription = "child2 item, Description"; |
611 | child2Item.inventoryName = "child2 item"; | 611 | child2Item.inventoryName = "child2 item"; |
612 | child2Item.invType = _rnd.Next(1, 1000); | 612 | child2Item.invType = _rnd.Next(1, 1000); |
613 | child2Item.parentFolderID = child2.folderID; | 613 | child2Item.parentFolderID = child2.folderID; |
614 | _dbPlugin.addInventoryItem(child2Item); | 614 | _dbPlugin.addInventoryItem(child2Item); |
615 | 615 | ||
616 | InventoryItemBase child2ChildItem = new InventoryItemBase(); | 616 | InventoryItemBase child2ChildItem = new InventoryItemBase(); |
617 | child2ChildItem.assetID = LLUUID.Random(); | 617 | child2ChildItem.assetID = LLUUID.Random(); |
618 | child2ChildItem.assetType = _rnd.Next(1, 1000); | 618 | child2ChildItem.assetType = _rnd.Next(1, 1000); |
619 | child2ChildItem.avatarID = _agent_1_id; | 619 | child2ChildItem.avatarID = _agent_1_id; |
620 | child2ChildItem.creatorsID = LLUUID.Random(); | 620 | child2ChildItem.creatorsID = LLUUID.Random(); |
621 | child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 621 | child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
622 | child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 622 | child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
623 | child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 623 | child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
624 | child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 624 | child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
625 | child2ChildItem.inventoryID = LLUUID.Random(); | 625 | child2ChildItem.inventoryID = LLUUID.Random(); |
626 | child2ChildItem.inventoryDescription = "child2Child item, Description"; | 626 | child2ChildItem.inventoryDescription = "child2Child item, Description"; |
627 | child2ChildItem.inventoryName = "child2Child item"; | 627 | child2ChildItem.inventoryName = "child2Child item"; |
628 | child2ChildItem.invType = _rnd.Next(1, 1000); | 628 | child2ChildItem.invType = _rnd.Next(1, 1000); |
629 | child2ChildItem.parentFolderID = child2Child.folderID; | 629 | child2ChildItem.parentFolderID = child2Child.folderID; |
630 | _dbPlugin.addInventoryItem(child2ChildItem); | 630 | _dbPlugin.addInventoryItem(child2ChildItem); |
631 | 631 | ||
632 | // test deletetion of items | 632 | // test deletetion of items |
633 | 633 | ||
634 | _dbPlugin.deleteInventoryItem(rootItem.inventoryID); | 634 | _dbPlugin.deleteInventoryItem(rootItem.inventoryID); |
635 | _dbPlugin.deleteInventoryItem(child1Item.inventoryID); | 635 | _dbPlugin.deleteInventoryItem(child1Item.inventoryID); |
636 | _dbPlugin.deleteInventoryItem(child1ChildItem.inventoryID); | 636 | _dbPlugin.deleteInventoryItem(child1ChildItem.inventoryID); |
637 | _dbPlugin.deleteInventoryItem(child2Item.inventoryID); | 637 | _dbPlugin.deleteInventoryItem(child2Item.inventoryID); |
638 | _dbPlugin.deleteInventoryItem(child2ChildItem.inventoryID); | 638 | _dbPlugin.deleteInventoryItem(child2ChildItem.inventoryID); |
639 | 639 | ||
640 | InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 640 | InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
641 | Assert.IsNull(item); | 641 | Assert.IsNull(item); |
642 | 642 | ||
643 | item = _dbPlugin.getInventoryItem(child1Item.inventoryID); | 643 | item = _dbPlugin.getInventoryItem(child1Item.inventoryID); |
644 | Assert.IsNull(item); | 644 | Assert.IsNull(item); |
645 | 645 | ||
646 | item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); | 646 | item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); |
647 | Assert.IsNull(item); | 647 | Assert.IsNull(item); |
648 | 648 | ||
649 | item = _dbPlugin.getInventoryItem(child2Item.inventoryID); | 649 | item = _dbPlugin.getInventoryItem(child2Item.inventoryID); |
650 | Assert.IsNull(item); | 650 | Assert.IsNull(item); |
651 | 651 | ||
652 | item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); | 652 | item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); |
653 | Assert.IsNull(item); | 653 | Assert.IsNull(item); |
654 | 654 | ||
655 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 655 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
656 | } | 656 | } |
657 | 657 | ||
658 | 658 | ||
659 | /// <summary> | 659 | /// <summary> |
660 | /// Test that we can insert a root folder | 660 | /// Test that we can insert a root folder |
661 | /// </summary> | 661 | /// </summary> |
662 | [Test] | 662 | [Test] |
663 | public void T08_DeleteInventoryWithItems() | 663 | public void T08_DeleteInventoryWithItems() |
664 | { | 664 | { |
665 | 665 | ||
666 | // Setup inventory | 666 | // Setup inventory |
667 | InventoryFolderBase root = new InventoryFolderBase(); | 667 | InventoryFolderBase root = new InventoryFolderBase(); |
668 | root.agentID = _agent_1_id; | 668 | root.agentID = _agent_1_id; |
669 | root.folderID = _agent_1_id; | 669 | root.folderID = _agent_1_id; |
670 | root.name = "Root folder"; | 670 | root.name = "Root folder"; |
671 | root.parentID = LLUUID.Zero; | 671 | root.parentID = LLUUID.Zero; |
672 | root.type = 2; | 672 | root.type = 2; |
673 | root.version = 2; | 673 | root.version = 2; |
674 | _dbPlugin.addInventoryFolder(root); | 674 | _dbPlugin.addInventoryFolder(root); |
675 | 675 | ||
676 | InventoryFolderBase child1 = new InventoryFolderBase(); | 676 | InventoryFolderBase child1 = new InventoryFolderBase(); |
677 | child1.agentID = _agent_1_id; | 677 | child1.agentID = _agent_1_id; |
678 | child1.folderID = LLUUID.Random(); | 678 | child1.folderID = LLUUID.Random(); |
679 | child1.name = "Child 1"; | 679 | child1.name = "Child 1"; |
680 | child1.parentID = root.folderID; | 680 | child1.parentID = root.folderID; |
681 | child1.type = 3; | 681 | child1.type = 3; |
682 | child1.version = 3; | 682 | child1.version = 3; |
683 | _dbPlugin.addInventoryFolder(child1); | 683 | _dbPlugin.addInventoryFolder(child1); |
684 | 684 | ||
685 | InventoryFolderBase child1Child = new InventoryFolderBase(); | 685 | InventoryFolderBase child1Child = new InventoryFolderBase(); |
686 | child1Child.agentID = _agent_1_id; | 686 | child1Child.agentID = _agent_1_id; |
687 | child1Child.folderID = LLUUID.Random(); | 687 | child1Child.folderID = LLUUID.Random(); |
688 | child1Child.name = "Child 1 child"; | 688 | child1Child.name = "Child 1 child"; |
689 | child1Child.parentID = child1.folderID; | 689 | child1Child.parentID = child1.folderID; |
690 | child1Child.type = 4; | 690 | child1Child.type = 4; |
691 | child1Child.version = 4; | 691 | child1Child.version = 4; |
692 | _dbPlugin.addInventoryFolder(child1Child); | 692 | _dbPlugin.addInventoryFolder(child1Child); |
693 | 693 | ||
694 | InventoryFolderBase child2 = new InventoryFolderBase(); | 694 | InventoryFolderBase child2 = new InventoryFolderBase(); |
695 | child2.agentID = _agent_1_id; | 695 | child2.agentID = _agent_1_id; |
696 | child2.folderID = LLUUID.Random(); | 696 | child2.folderID = LLUUID.Random(); |
697 | child2.name = "Child 2"; | 697 | child2.name = "Child 2"; |
698 | child2.parentID = root.folderID; | 698 | child2.parentID = root.folderID; |
699 | child2.type = 5; | 699 | child2.type = 5; |
700 | child2.version = 5; | 700 | child2.version = 5; |
701 | _dbPlugin.addInventoryFolder(child2); | 701 | _dbPlugin.addInventoryFolder(child2); |
702 | 702 | ||
703 | InventoryFolderBase child2Child = new InventoryFolderBase(); | 703 | InventoryFolderBase child2Child = new InventoryFolderBase(); |
704 | child2Child.agentID = _agent_1_id; | 704 | child2Child.agentID = _agent_1_id; |
705 | child2Child.folderID = LLUUID.Random(); | 705 | child2Child.folderID = LLUUID.Random(); |
706 | child2Child.name = "Child 2 child"; | 706 | child2Child.name = "Child 2 child"; |
707 | child2Child.parentID = child2.folderID; | 707 | child2Child.parentID = child2.folderID; |
708 | child2Child.type = 6; | 708 | child2Child.type = 6; |
709 | child2Child.version = 6; | 709 | child2Child.version = 6; |
710 | _dbPlugin.addInventoryFolder(child2Child); | 710 | _dbPlugin.addInventoryFolder(child2Child); |
711 | 711 | ||
712 | InventoryItemBase rootItem = new InventoryItemBase(); | 712 | InventoryItemBase rootItem = new InventoryItemBase(); |
713 | rootItem.assetID = LLUUID.Random(); | 713 | rootItem.assetID = LLUUID.Random(); |
714 | rootItem.assetType = _rnd.Next(1, 1000); | 714 | rootItem.assetType = _rnd.Next(1, 1000); |
715 | rootItem.avatarID = _agent_1_id; | 715 | rootItem.avatarID = _agent_1_id; |
716 | rootItem.creatorsID = LLUUID.Random(); | 716 | rootItem.creatorsID = LLUUID.Random(); |
717 | rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 717 | rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
718 | rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 718 | rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
719 | rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 719 | rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
720 | rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 720 | rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
721 | rootItem.inventoryID = LLUUID.Random(); | 721 | rootItem.inventoryID = LLUUID.Random(); |
722 | rootItem.inventoryDescription = "Root item, Description"; | 722 | rootItem.inventoryDescription = "Root item, Description"; |
723 | rootItem.inventoryName = "Root item"; | 723 | rootItem.inventoryName = "Root item"; |
724 | rootItem.invType = _rnd.Next(1, 1000); | 724 | rootItem.invType = _rnd.Next(1, 1000); |
725 | rootItem.parentFolderID = root.folderID; | 725 | rootItem.parentFolderID = root.folderID; |
726 | _dbPlugin.addInventoryItem(rootItem); | 726 | _dbPlugin.addInventoryItem(rootItem); |
727 | 727 | ||
728 | InventoryItemBase child1Item = new InventoryItemBase(); | 728 | InventoryItemBase child1Item = new InventoryItemBase(); |
729 | child1Item.assetID = LLUUID.Random(); | 729 | child1Item.assetID = LLUUID.Random(); |
730 | child1Item.assetType = _rnd.Next(1, 1000); | 730 | child1Item.assetType = _rnd.Next(1, 1000); |
731 | child1Item.avatarID = _agent_1_id; | 731 | child1Item.avatarID = _agent_1_id; |
732 | child1Item.creatorsID = LLUUID.Random(); | 732 | child1Item.creatorsID = LLUUID.Random(); |
733 | child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 733 | child1Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
734 | child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 734 | child1Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
735 | child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 735 | child1Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
736 | child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 736 | child1Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
737 | child1Item.inventoryID = LLUUID.Random(); | 737 | child1Item.inventoryID = LLUUID.Random(); |
738 | child1Item.inventoryDescription = "child1 item, Description"; | 738 | child1Item.inventoryDescription = "child1 item, Description"; |
739 | child1Item.inventoryName = "child1 item"; | 739 | child1Item.inventoryName = "child1 item"; |
740 | child1Item.invType = _rnd.Next(1, 1000); | 740 | child1Item.invType = _rnd.Next(1, 1000); |
741 | child1Item.parentFolderID = child1.folderID; | 741 | child1Item.parentFolderID = child1.folderID; |
742 | _dbPlugin.addInventoryItem(child1Item); | 742 | _dbPlugin.addInventoryItem(child1Item); |
743 | 743 | ||
744 | InventoryItemBase child1ChildItem = new InventoryItemBase(); | 744 | InventoryItemBase child1ChildItem = new InventoryItemBase(); |
745 | child1ChildItem.assetID = LLUUID.Random(); | 745 | child1ChildItem.assetID = LLUUID.Random(); |
746 | child1ChildItem.assetType = _rnd.Next(1, 1000); | 746 | child1ChildItem.assetType = _rnd.Next(1, 1000); |
747 | child1ChildItem.avatarID = _agent_1_id; | 747 | child1ChildItem.avatarID = _agent_1_id; |
748 | child1ChildItem.creatorsID = LLUUID.Random(); | 748 | child1ChildItem.creatorsID = LLUUID.Random(); |
749 | child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 749 | child1ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
750 | child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 750 | child1ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
751 | child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 751 | child1ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
752 | child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 752 | child1ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
753 | child1ChildItem.inventoryID = LLUUID.Random(); | 753 | child1ChildItem.inventoryID = LLUUID.Random(); |
754 | child1ChildItem.inventoryDescription = "child1Child item, Description"; | 754 | child1ChildItem.inventoryDescription = "child1Child item, Description"; |
755 | child1ChildItem.inventoryName = "child1Child item"; | 755 | child1ChildItem.inventoryName = "child1Child item"; |
756 | child1ChildItem.invType = _rnd.Next(1, 1000); | 756 | child1ChildItem.invType = _rnd.Next(1, 1000); |
757 | child1ChildItem.parentFolderID = child1Child.folderID; | 757 | child1ChildItem.parentFolderID = child1Child.folderID; |
758 | _dbPlugin.addInventoryItem(child1ChildItem); | 758 | _dbPlugin.addInventoryItem(child1ChildItem); |
759 | 759 | ||
760 | InventoryItemBase child2Item = new InventoryItemBase(); | 760 | InventoryItemBase child2Item = new InventoryItemBase(); |
761 | child2Item.assetID = LLUUID.Random(); | 761 | child2Item.assetID = LLUUID.Random(); |
762 | child2Item.assetType = _rnd.Next(1, 1000); | 762 | child2Item.assetType = _rnd.Next(1, 1000); |
763 | child2Item.avatarID = _agent_1_id; | 763 | child2Item.avatarID = _agent_1_id; |
764 | child2Item.creatorsID = LLUUID.Random(); | 764 | child2Item.creatorsID = LLUUID.Random(); |
765 | child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 765 | child2Item.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
766 | child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 766 | child2Item.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
767 | child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 767 | child2Item.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
768 | child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 768 | child2Item.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
769 | child2Item.inventoryID = LLUUID.Random(); | 769 | child2Item.inventoryID = LLUUID.Random(); |
770 | child2Item.inventoryDescription = "child2 item, Description"; | 770 | child2Item.inventoryDescription = "child2 item, Description"; |
771 | child2Item.inventoryName = "child2 item"; | 771 | child2Item.inventoryName = "child2 item"; |
772 | child2Item.invType = _rnd.Next(1, 1000); | 772 | child2Item.invType = _rnd.Next(1, 1000); |
773 | child2Item.parentFolderID = child2.folderID; | 773 | child2Item.parentFolderID = child2.folderID; |
774 | _dbPlugin.addInventoryItem(child2Item); | 774 | _dbPlugin.addInventoryItem(child2Item); |
775 | 775 | ||
776 | InventoryItemBase child2ChildItem = new InventoryItemBase(); | 776 | InventoryItemBase child2ChildItem = new InventoryItemBase(); |
777 | child2ChildItem.assetID = LLUUID.Random(); | 777 | child2ChildItem.assetID = LLUUID.Random(); |
778 | child2ChildItem.assetType = _rnd.Next(1, 1000); | 778 | child2ChildItem.assetType = _rnd.Next(1, 1000); |
779 | child2ChildItem.avatarID = _agent_1_id; | 779 | child2ChildItem.avatarID = _agent_1_id; |
780 | child2ChildItem.creatorsID = LLUUID.Random(); | 780 | child2ChildItem.creatorsID = LLUUID.Random(); |
781 | child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 781 | child2ChildItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
782 | child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 782 | child2ChildItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
783 | child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 783 | child2ChildItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
784 | child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 784 | child2ChildItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
785 | child2ChildItem.inventoryID = LLUUID.Random(); | 785 | child2ChildItem.inventoryID = LLUUID.Random(); |
786 | child2ChildItem.inventoryDescription = "child2Child item, Description"; | 786 | child2ChildItem.inventoryDescription = "child2Child item, Description"; |
787 | child2ChildItem.inventoryName = "child2Child item"; | 787 | child2ChildItem.inventoryName = "child2Child item"; |
788 | child2ChildItem.invType = _rnd.Next(1, 1000); | 788 | child2ChildItem.invType = _rnd.Next(1, 1000); |
789 | child2ChildItem.parentFolderID = child2Child.folderID; | 789 | child2ChildItem.parentFolderID = child2Child.folderID; |
790 | _dbPlugin.addInventoryItem(child2ChildItem); | 790 | _dbPlugin.addInventoryItem(child2ChildItem); |
791 | 791 | ||
792 | // test deletetion of items | 792 | // test deletetion of items |
793 | 793 | ||
794 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 794 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
795 | 795 | ||
796 | InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 796 | InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
797 | Assert.IsNull(item); | 797 | Assert.IsNull(item); |
798 | 798 | ||
799 | item = _dbPlugin.getInventoryItem(child1Item.inventoryID); | 799 | item = _dbPlugin.getInventoryItem(child1Item.inventoryID); |
800 | Assert.IsNull(item); | 800 | Assert.IsNull(item); |
801 | 801 | ||
802 | item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); | 802 | item = _dbPlugin.getInventoryItem(child1ChildItem.inventoryID); |
803 | Assert.IsNull(item); | 803 | Assert.IsNull(item); |
804 | 804 | ||
805 | item = _dbPlugin.getInventoryItem(child2Item.inventoryID); | 805 | item = _dbPlugin.getInventoryItem(child2Item.inventoryID); |
806 | Assert.IsNull(item); | 806 | Assert.IsNull(item); |
807 | 807 | ||
808 | item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); | 808 | item = _dbPlugin.getInventoryItem(child2ChildItem.inventoryID); |
809 | Assert.IsNull(item); | 809 | Assert.IsNull(item); |
810 | 810 | ||
811 | } | 811 | } |
812 | 812 | ||
813 | /// <summary> | 813 | /// <summary> |
814 | /// Test that we can update items | 814 | /// Test that we can update items |
815 | /// </summary> | 815 | /// </summary> |
816 | [Test] | 816 | [Test] |
817 | public void T09_UpdateItem() | 817 | public void T09_UpdateItem() |
818 | { | 818 | { |
819 | 819 | ||
820 | // Setup inventory | 820 | // Setup inventory |
821 | InventoryFolderBase root = new InventoryFolderBase(); | 821 | InventoryFolderBase root = new InventoryFolderBase(); |
822 | root.agentID = _agent_1_id; | 822 | root.agentID = _agent_1_id; |
823 | root.folderID = _agent_1_id; | 823 | root.folderID = _agent_1_id; |
824 | root.name = "Root folder"; | 824 | root.name = "Root folder"; |
825 | root.parentID = LLUUID.Zero; | 825 | root.parentID = LLUUID.Zero; |
826 | root.type = 2; | 826 | root.type = 2; |
827 | root.version = 2; | 827 | root.version = 2; |
828 | _dbPlugin.addInventoryFolder(root); | 828 | _dbPlugin.addInventoryFolder(root); |
829 | 829 | ||
830 | InventoryItemBase rootItem = new InventoryItemBase(); | 830 | InventoryItemBase rootItem = new InventoryItemBase(); |
831 | rootItem.assetID = LLUUID.Random(); | 831 | rootItem.assetID = LLUUID.Random(); |
832 | rootItem.assetType = _rnd.Next(1, 1000); | 832 | rootItem.assetType = _rnd.Next(1, 1000); |
833 | rootItem.avatarID = _agent_1_id; | 833 | rootItem.avatarID = _agent_1_id; |
834 | rootItem.creatorsID = LLUUID.Random(); | 834 | rootItem.creatorsID = LLUUID.Random(); |
835 | rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 835 | rootItem.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
836 | rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 836 | rootItem.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
837 | rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 837 | rootItem.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
838 | rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 838 | rootItem.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
839 | rootItem.inventoryID = LLUUID.Random(); | 839 | rootItem.inventoryID = LLUUID.Random(); |
840 | rootItem.inventoryDescription = "Root item, Description"; | 840 | rootItem.inventoryDescription = "Root item, Description"; |
841 | rootItem.inventoryName = "Root item"; | 841 | rootItem.inventoryName = "Root item"; |
842 | rootItem.invType = _rnd.Next(1, 1000); | 842 | rootItem.invType = _rnd.Next(1, 1000); |
843 | rootItem.parentFolderID = root.folderID; | 843 | rootItem.parentFolderID = root.folderID; |
844 | _dbPlugin.addInventoryItem(rootItem); | 844 | _dbPlugin.addInventoryItem(rootItem); |
845 | 845 | ||
846 | rootItem.assetID = LLUUID.Random(); | 846 | rootItem.assetID = LLUUID.Random(); |
847 | _dbPlugin.updateInventoryItem(rootItem); | 847 | _dbPlugin.updateInventoryItem(rootItem); |
848 | InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 848 | InventoryItemBase item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
849 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 849 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
850 | 850 | ||
851 | rootItem.assetType = rootItem.assetType+1; | 851 | rootItem.assetType = rootItem.assetType+1; |
852 | _dbPlugin.updateInventoryItem(rootItem); | 852 | _dbPlugin.updateInventoryItem(rootItem); |
853 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 853 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
854 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 854 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
855 | 855 | ||
856 | rootItem.avatarID = LLUUID.Random(); | 856 | rootItem.avatarID = LLUUID.Random(); |
857 | _dbPlugin.updateInventoryItem(rootItem); | 857 | _dbPlugin.updateInventoryItem(rootItem); |
858 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 858 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
859 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 859 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
860 | 860 | ||
861 | rootItem.creatorsID = LLUUID.Random(); | 861 | rootItem.creatorsID = LLUUID.Random(); |
862 | _dbPlugin.updateInventoryItem(rootItem); | 862 | _dbPlugin.updateInventoryItem(rootItem); |
863 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 863 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
864 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 864 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
865 | 865 | ||
866 | rootItem.inventoryBasePermissions = rootItem.inventoryBasePermissions+1; | 866 | rootItem.inventoryBasePermissions = rootItem.inventoryBasePermissions+1; |
867 | _dbPlugin.updateInventoryItem(rootItem); | 867 | _dbPlugin.updateInventoryItem(rootItem); |
868 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 868 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
869 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 869 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
870 | 870 | ||
871 | rootItem.inventoryCurrentPermissions = rootItem.inventoryCurrentPermissions+1; | 871 | rootItem.inventoryCurrentPermissions = rootItem.inventoryCurrentPermissions+1; |
872 | _dbPlugin.updateInventoryItem(rootItem); | 872 | _dbPlugin.updateInventoryItem(rootItem); |
873 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 873 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
874 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 874 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
875 | 875 | ||
876 | rootItem.inventoryDescription = "New description"; | 876 | rootItem.inventoryDescription = "New description"; |
877 | _dbPlugin.updateInventoryItem(rootItem); | 877 | _dbPlugin.updateInventoryItem(rootItem); |
878 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 878 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
879 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 879 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
880 | 880 | ||
881 | rootItem.inventoryEveryOnePermissions = rootItem.inventoryEveryOnePermissions+1; | 881 | rootItem.inventoryEveryOnePermissions = rootItem.inventoryEveryOnePermissions+1; |
882 | _dbPlugin.updateInventoryItem(rootItem); | 882 | _dbPlugin.updateInventoryItem(rootItem); |
883 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 883 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
884 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 884 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
885 | 885 | ||
886 | rootItem.inventoryName = "New name"; | 886 | rootItem.inventoryName = "New name"; |
887 | _dbPlugin.updateInventoryItem(rootItem); | 887 | _dbPlugin.updateInventoryItem(rootItem); |
888 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 888 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
889 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 889 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
890 | 890 | ||
891 | rootItem.inventoryNextPermissions = rootItem.inventoryNextPermissions+1; | 891 | rootItem.inventoryNextPermissions = rootItem.inventoryNextPermissions+1; |
892 | _dbPlugin.updateInventoryItem(rootItem); | 892 | _dbPlugin.updateInventoryItem(rootItem); |
893 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 893 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
894 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 894 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
895 | 895 | ||
896 | rootItem.invType = rootItem.invType+1; | 896 | rootItem.invType = rootItem.invType+1; |
897 | _dbPlugin.updateInventoryItem(rootItem); | 897 | _dbPlugin.updateInventoryItem(rootItem); |
898 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 898 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
899 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 899 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
900 | 900 | ||
901 | rootItem.parentFolderID = LLUUID.Zero; | 901 | rootItem.parentFolderID = LLUUID.Zero; |
902 | _dbPlugin.updateInventoryItem(rootItem); | 902 | _dbPlugin.updateInventoryItem(rootItem); |
903 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); | 903 | item = _dbPlugin.getInventoryItem(rootItem.inventoryID); |
904 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); | 904 | Assert.IsTrue(AreItemsIdentical(rootItem, item)); |
905 | 905 | ||
906 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 906 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
907 | _dbPlugin.deleteInventoryItem(rootItem.inventoryID); | 907 | _dbPlugin.deleteInventoryItem(rootItem.inventoryID); |
908 | } | 908 | } |
909 | 909 | ||
910 | 910 | ||
911 | /// <summary> | 911 | /// <summary> |
912 | /// Test that we can insert a root folder | 912 | /// Test that we can insert a root folder |
913 | /// </summary> | 913 | /// </summary> |
914 | [Test] | 914 | [Test] |
915 | public void T10_GetListOfItemsInFolder() | 915 | public void T10_GetListOfItemsInFolder() |
916 | { | 916 | { |
917 | 917 | ||
918 | // Setup inventory | 918 | // Setup inventory |
919 | InventoryFolderBase root = new InventoryFolderBase(); | 919 | InventoryFolderBase root = new InventoryFolderBase(); |
920 | root.agentID = _agent_1_id; | 920 | root.agentID = _agent_1_id; |
921 | root.folderID = _agent_1_id; | 921 | root.folderID = _agent_1_id; |
922 | root.name = "Root folder"; | 922 | root.name = "Root folder"; |
923 | root.parentID = LLUUID.Zero; | 923 | root.parentID = LLUUID.Zero; |
924 | root.type = 2; | 924 | root.type = 2; |
925 | root.version = 2; | 925 | root.version = 2; |
926 | _dbPlugin.addInventoryFolder(root); | 926 | _dbPlugin.addInventoryFolder(root); |
927 | 927 | ||
928 | InventoryFolderBase child1 = new InventoryFolderBase(); | 928 | InventoryFolderBase child1 = new InventoryFolderBase(); |
929 | child1.agentID = _agent_1_id; | 929 | child1.agentID = _agent_1_id; |
930 | child1.folderID = LLUUID.Random(); | 930 | child1.folderID = LLUUID.Random(); |
931 | child1.name = "Child 1"; | 931 | child1.name = "Child 1"; |
932 | child1.parentID = root.folderID; | 932 | child1.parentID = root.folderID; |
933 | child1.type = 3; | 933 | child1.type = 3; |
934 | child1.version = 3; | 934 | child1.version = 3; |
935 | _dbPlugin.addInventoryFolder(child1); | 935 | _dbPlugin.addInventoryFolder(child1); |
936 | 936 | ||
937 | InventoryFolderBase child1Child = new InventoryFolderBase(); | 937 | InventoryFolderBase child1Child = new InventoryFolderBase(); |
938 | child1Child.agentID = _agent_1_id; | 938 | child1Child.agentID = _agent_1_id; |
939 | child1Child.folderID = LLUUID.Random(); | 939 | child1Child.folderID = LLUUID.Random(); |
940 | child1Child.name = "Child 1 child"; | 940 | child1Child.name = "Child 1 child"; |
941 | child1Child.parentID = child1.folderID; | 941 | child1Child.parentID = child1.folderID; |
942 | child1Child.type = 4; | 942 | child1Child.type = 4; |
943 | child1Child.version = 4; | 943 | child1Child.version = 4; |
944 | _dbPlugin.addInventoryFolder(child1Child); | 944 | _dbPlugin.addInventoryFolder(child1Child); |
945 | 945 | ||
946 | 946 | ||
947 | InventoryItemBase item1 = new InventoryItemBase(); | 947 | InventoryItemBase item1 = new InventoryItemBase(); |
948 | item1.assetID = LLUUID.Random(); | 948 | item1.assetID = LLUUID.Random(); |
949 | item1.assetType = _rnd.Next(1, 1000); | 949 | item1.assetType = _rnd.Next(1, 1000); |
950 | item1.avatarID = _agent_1_id; | 950 | item1.avatarID = _agent_1_id; |
951 | item1.creatorsID = LLUUID.Random(); | 951 | item1.creatorsID = LLUUID.Random(); |
952 | item1.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 952 | item1.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
953 | item1.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 953 | item1.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
954 | item1.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 954 | item1.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
955 | item1.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 955 | item1.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
956 | item1.inventoryID = LLUUID.Random(); | 956 | item1.inventoryID = LLUUID.Random(); |
957 | item1.inventoryDescription = "Item 1, description"; | 957 | item1.inventoryDescription = "Item 1, description"; |
958 | item1.inventoryName = "Item 1"; | 958 | item1.inventoryName = "Item 1"; |
959 | item1.invType = _rnd.Next(1, 1000); | 959 | item1.invType = _rnd.Next(1, 1000); |
960 | item1.parentFolderID = child1Child.folderID; | 960 | item1.parentFolderID = child1Child.folderID; |
961 | _dbPlugin.addInventoryItem(item1); | 961 | _dbPlugin.addInventoryItem(item1); |
962 | 962 | ||
963 | InventoryItemBase item2 = new InventoryItemBase(); | 963 | InventoryItemBase item2 = new InventoryItemBase(); |
964 | item2.assetID = LLUUID.Random(); | 964 | item2.assetID = LLUUID.Random(); |
965 | item2.assetType = _rnd.Next(1, 1000); | 965 | item2.assetType = _rnd.Next(1, 1000); |
966 | item2.avatarID = _agent_1_id; | 966 | item2.avatarID = _agent_1_id; |
967 | item2.creatorsID = LLUUID.Random(); | 967 | item2.creatorsID = LLUUID.Random(); |
968 | item2.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); | 968 | item2.inventoryBasePermissions = (uint)_rnd.Next(1, 1000000); |
969 | item2.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); | 969 | item2.inventoryCurrentPermissions = (uint)_rnd.Next(1, 1000000); |
970 | item2.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); | 970 | item2.inventoryEveryOnePermissions = (uint)_rnd.Next(1, 1000000); |
971 | item2.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); | 971 | item2.inventoryNextPermissions = (uint)_rnd.Next(1, 1000000); |
972 | item2.inventoryID = LLUUID.Random(); | 972 | item2.inventoryID = LLUUID.Random(); |
973 | item2.inventoryDescription = "Item 1, description"; | 973 | item2.inventoryDescription = "Item 1, description"; |
974 | item2.inventoryName = "Item 1"; | 974 | item2.inventoryName = "Item 1"; |
975 | item2.invType = _rnd.Next(1, 1000); | 975 | item2.invType = _rnd.Next(1, 1000); |
976 | item2.parentFolderID = child1Child.folderID; | 976 | item2.parentFolderID = child1Child.folderID; |
977 | _dbPlugin.addInventoryItem(item2); | 977 | _dbPlugin.addInventoryItem(item2); |
978 | 978 | ||
979 | List<InventoryItemBase> items = _dbPlugin.getInventoryInFolder(child1Child.folderID); | 979 | List<InventoryItemBase> items = _dbPlugin.getInventoryInFolder(child1Child.folderID); |
980 | Assert.IsNotNull(items); | 980 | Assert.IsNotNull(items); |
981 | Assert.IsNotEmpty(items); | 981 | Assert.IsNotEmpty(items); |
982 | 982 | ||
983 | bool foundItem1 = false; | 983 | bool foundItem1 = false; |
984 | bool foundItem2 = false; | 984 | bool foundItem2 = false; |
985 | 985 | ||
986 | foreach (InventoryItemBase i in items) | 986 | foreach (InventoryItemBase i in items) |
987 | { | 987 | { |
988 | if (i.inventoryID == item1.inventoryID) | 988 | if (i.inventoryID == item1.inventoryID) |
989 | { | 989 | { |
990 | foundItem1 = true; | 990 | foundItem1 = true; |
991 | Assert.IsTrue(AreItemsIdentical(item1, i)); | 991 | Assert.IsTrue(AreItemsIdentical(item1, i)); |
992 | } | 992 | } |
993 | else if (i.inventoryID == item2.inventoryID) | 993 | else if (i.inventoryID == item2.inventoryID) |
994 | { | 994 | { |
995 | foundItem2 = true; | 995 | foundItem2 = true; |
996 | Assert.IsTrue(AreItemsIdentical(item2, i)); | 996 | Assert.IsTrue(AreItemsIdentical(item2, i)); |
997 | } | 997 | } |
998 | else | 998 | else |
999 | { | 999 | { |
1000 | Assert.Fail("Unknown inventory item found"); | 1000 | Assert.Fail("Unknown inventory item found"); |
1001 | } | 1001 | } |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | Assert.IsTrue(foundItem1 && foundItem2, "not all items were returned"); | 1004 | Assert.IsTrue(foundItem1 && foundItem2, "not all items were returned"); |
1005 | _dbPlugin.deleteInventoryFolder(_agent_1_id); | 1005 | _dbPlugin.deleteInventoryFolder(_agent_1_id); |
1006 | } | 1006 | } |
1007 | } | 1007 | } |
1008 | } | 1008 | } |