diff options
Diffstat (limited to 'OpenSim')
46 files changed, 438 insertions, 159 deletions
diff --git a/OpenSim/Data/IXInventoryData.cs b/OpenSim/Data/IXInventoryData.cs index d85a7ef..85a5c08 100644 --- a/OpenSim/Data/IXInventoryData.cs +++ b/OpenSim/Data/IXInventoryData.cs | |||
@@ -74,9 +74,38 @@ namespace OpenSim.Data | |||
74 | bool StoreFolder(XInventoryFolder folder); | 74 | bool StoreFolder(XInventoryFolder folder); |
75 | bool StoreItem(XInventoryItem item); | 75 | bool StoreItem(XInventoryItem item); |
76 | 76 | ||
77 | /// <summary> | ||
78 | /// Delete folders where field == val | ||
79 | /// </summary> | ||
80 | /// <param name="field"></param> | ||
81 | /// <param name="val"></param> | ||
82 | /// <returns>true if the delete was successful, false if it was not</returns> | ||
77 | bool DeleteFolders(string field, string val); | 83 | bool DeleteFolders(string field, string val); |
84 | |||
85 | /// <summary> | ||
86 | /// Delete folders where field1 == val1, field2 == val2... | ||
87 | /// </summary> | ||
88 | /// <param name="fields"></param> | ||
89 | /// <param name="vals"></param> | ||
90 | /// <returns>true if the delete was successful, false if it was not</returns> | ||
91 | bool DeleteFolders(string[] fields, string[] vals); | ||
92 | |||
93 | /// <summary> | ||
94 | /// Delete items where field == val | ||
95 | /// </summary> | ||
96 | /// <param name="field"></param> | ||
97 | /// <param name="val"></param> | ||
98 | /// <returns>true if the delete was successful, false if it was not</returns> | ||
78 | bool DeleteItems(string field, string val); | 99 | bool DeleteItems(string field, string val); |
79 | 100 | ||
101 | /// <summary> | ||
102 | /// Delete items where field1 == val1, field2 == val2... | ||
103 | /// </summary> | ||
104 | /// <param name="fields"></param> | ||
105 | /// <param name="vals"></param> | ||
106 | /// <returns>true if the delete was successful, false if it was not</returns> | ||
107 | bool DeleteItems(string[] fields, string[] vals); | ||
108 | |||
80 | bool MoveItem(string id, string newParent); | 109 | bool MoveItem(string id, string newParent); |
81 | XInventoryItem[] GetActiveGestures(UUID principalID); | 110 | XInventoryItem[] GetActiveGestures(UUID principalID); |
82 | int GetAssetPermissions(UUID principalID, UUID assetID); | 111 | int GetAssetPermissions(UUID principalID, UUID assetID); |
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs index f5492b3..317afac 100644 --- a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs +++ b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs | |||
@@ -335,24 +335,35 @@ namespace OpenSim.Data.MSSQL | |||
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||
338 | public virtual bool Delete(string field, string val) | 338 | public virtual bool Delete(string field, string key) |
339 | { | 339 | { |
340 | return Delete(new string[] { field }, new string[] { key }); | ||
341 | } | ||
342 | |||
343 | public virtual bool Delete(string[] fields, string[] keys) | ||
344 | { | ||
345 | if (fields.Length != keys.Length) | ||
346 | return false; | ||
347 | |||
348 | List<string> terms = new List<string>(); | ||
349 | |||
340 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | 350 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) |
341 | using (SqlCommand cmd = new SqlCommand()) | 351 | using (SqlCommand cmd = new SqlCommand()) |
342 | { | 352 | { |
343 | string deleteCommand = String.Format("DELETE FROM {0} WHERE [{1}] = @{1}", m_Realm, field); | 353 | for (int i = 0; i < fields.Length; i++) |
344 | cmd.CommandText = deleteCommand; | ||
345 | |||
346 | cmd.Parameters.Add(m_database.CreateParameter(field, val)); | ||
347 | cmd.Connection = conn; | ||
348 | conn.Open(); | ||
349 | |||
350 | if (cmd.ExecuteNonQuery() > 0) | ||
351 | { | 354 | { |
352 | //m_log.Warn("[MSSQLGenericTable]: " + deleteCommand); | 355 | cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i])); |
353 | return true; | 356 | terms.Add("[" + fields[i] + "] = @" + fields[i]); |
354 | } | 357 | } |
355 | return false; | 358 | |
359 | string where = String.Join(" AND ", terms.ToArray()); | ||
360 | |||
361 | string query = String.Format("DELETE * FROM {0} WHERE {1}", m_Realm, where); | ||
362 | |||
363 | cmd.Connection = conn; | ||
364 | cmd.CommandText = query; | ||
365 | conn.Open(); | ||
366 | return cmd.ExecuteNonQuery() > 0; | ||
356 | } | 367 | } |
357 | } | 368 | } |
358 | } | 369 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs index 5bc4fe4..01689a4 100644 --- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs | |||
@@ -79,11 +79,21 @@ namespace OpenSim.Data.MSSQL | |||
79 | return m_Folders.Delete(field, val); | 79 | return m_Folders.Delete(field, val); |
80 | } | 80 | } |
81 | 81 | ||
82 | public bool DeleteFolders(string[] fields, string[] vals) | ||
83 | { | ||
84 | return m_Folders.Delete(fields, vals); | ||
85 | } | ||
86 | |||
82 | public bool DeleteItems(string field, string val) | 87 | public bool DeleteItems(string field, string val) |
83 | { | 88 | { |
84 | return m_Items.Delete(field, val); | 89 | return m_Items.Delete(field, val); |
85 | } | 90 | } |
86 | 91 | ||
92 | public bool DeleteItems(string[] fields, string[] vals) | ||
93 | { | ||
94 | return m_Items.Delete(fields, vals); | ||
95 | } | ||
96 | |||
87 | public bool MoveItem(string id, string newParent) | 97 | public bool MoveItem(string id, string newParent) |
88 | { | 98 | { |
89 | return m_Items.MoveItem(id, newParent); | 99 | return m_Items.MoveItem(id, newParent); |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index cfffbd8..754cf72 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -264,18 +264,33 @@ namespace OpenSim.Data.MySQL | |||
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | public virtual bool Delete(string field, string val) | 267 | public virtual bool Delete(string field, string key) |
268 | { | 268 | { |
269 | return Delete(new string[] { field }, new string[] { key }); | ||
270 | } | ||
271 | |||
272 | public virtual bool Delete(string[] fields, string[] keys) | ||
273 | { | ||
274 | if (fields.Length != keys.Length) | ||
275 | return false; | ||
276 | |||
277 | List<string> terms = new List<string>(); | ||
278 | |||
269 | using (MySqlCommand cmd = new MySqlCommand()) | 279 | using (MySqlCommand cmd = new MySqlCommand()) |
270 | { | 280 | { |
281 | for (int i = 0 ; i < fields.Length ; i++) | ||
282 | { | ||
283 | cmd.Parameters.AddWithValue(fields[i], keys[i]); | ||
284 | terms.Add("`" + fields[i] + "` = ?" + fields[i]); | ||
285 | } | ||
271 | 286 | ||
272 | cmd.CommandText = String.Format("delete from {0} where `{1}` = ?{1}", m_Realm, field); | 287 | string where = String.Join(" and ", terms.ToArray()); |
273 | cmd.Parameters.AddWithValue(field, val); | ||
274 | 288 | ||
275 | if (ExecuteNonQuery(cmd) > 0) | 289 | string query = String.Format("delete from {0} where {1}", m_Realm, where); |
276 | return true; | ||
277 | 290 | ||
278 | return false; | 291 | cmd.CommandText = query; |
292 | |||
293 | return ExecuteNonQuery(cmd) > 0; | ||
279 | } | 294 | } |
280 | } | 295 | } |
281 | } | 296 | } |
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 481da49..caf18a4 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs | |||
@@ -85,11 +85,21 @@ namespace OpenSim.Data.MySQL | |||
85 | return m_Folders.Delete(field, val); | 85 | return m_Folders.Delete(field, val); |
86 | } | 86 | } |
87 | 87 | ||
88 | public bool DeleteFolders(string[] fields, string[] vals) | ||
89 | { | ||
90 | return m_Folders.Delete(fields, vals); | ||
91 | } | ||
92 | |||
88 | public bool DeleteItems(string field, string val) | 93 | public bool DeleteItems(string field, string val) |
89 | { | 94 | { |
90 | return m_Items.Delete(field, val); | 95 | return m_Items.Delete(field, val); |
91 | } | 96 | } |
92 | 97 | ||
98 | public bool DeleteItems(string[] fields, string[] vals) | ||
99 | { | ||
100 | return m_Items.Delete(fields, vals); | ||
101 | } | ||
102 | |||
93 | public bool MoveItem(string id, string newParent) | 103 | public bool MoveItem(string id, string newParent) |
94 | { | 104 | { |
95 | return m_Items.MoveItem(id, newParent); | 105 | return m_Items.MoveItem(id, newParent); |
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs index 0d7b001..3fb2d3f 100644 --- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs +++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | |||
@@ -258,17 +258,33 @@ namespace OpenSim.Data.SQLite | |||
258 | return false; | 258 | return false; |
259 | } | 259 | } |
260 | 260 | ||
261 | public bool Delete(string field, string val) | 261 | public virtual bool Delete(string field, string key) |
262 | { | 262 | { |
263 | return Delete(new string[] { field }, new string[] { key }); | ||
264 | } | ||
265 | |||
266 | public bool Delete(string[] fields, string[] keys) | ||
267 | { | ||
268 | if (fields.Length != keys.Length) | ||
269 | return false; | ||
270 | |||
271 | List<string> terms = new List<string>(); | ||
272 | |||
263 | SqliteCommand cmd = new SqliteCommand(); | 273 | SqliteCommand cmd = new SqliteCommand(); |
264 | 274 | ||
265 | cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field); | 275 | for (int i = 0 ; i < fields.Length ; i++) |
266 | cmd.Parameters.Add(new SqliteParameter(field, val)); | 276 | { |
277 | cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i])); | ||
278 | terms.Add("`" + fields[i] + "` = :" + fields[i]); | ||
279 | } | ||
280 | |||
281 | string where = String.Join(" and ", terms.ToArray()); | ||
267 | 282 | ||
268 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | 283 | string query = String.Format("delete * from {0} where {1}", m_Realm, where); |
269 | return true; | ||
270 | 284 | ||
271 | return false; | 285 | cmd.CommandText = query; |
286 | |||
287 | return ExecuteNonQuery(cmd, m_Connection) > 0; | ||
272 | } | 288 | } |
273 | } | 289 | } |
274 | } | 290 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index ccbd86e..02edc30 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs | |||
@@ -91,11 +91,21 @@ namespace OpenSim.Data.SQLite | |||
91 | return m_Folders.Delete(field, val); | 91 | return m_Folders.Delete(field, val); |
92 | } | 92 | } |
93 | 93 | ||
94 | public bool DeleteFolders(string[] fields, string[] vals) | ||
95 | { | ||
96 | return m_Folders.Delete(fields, vals); | ||
97 | } | ||
98 | |||
94 | public bool DeleteItems(string field, string val) | 99 | public bool DeleteItems(string field, string val) |
95 | { | 100 | { |
96 | return m_Items.Delete(field, val); | 101 | return m_Items.Delete(field, val); |
97 | } | 102 | } |
98 | 103 | ||
104 | public bool DeleteItems(string[] fields, string[] vals) | ||
105 | { | ||
106 | return m_Items.Delete(fields, vals); | ||
107 | } | ||
108 | |||
99 | public bool MoveItem(string id, string newParent) | 109 | public bool MoveItem(string id, string newParent) |
100 | { | 110 | { |
101 | return m_Items.MoveItem(id, newParent); | 111 | return m_Items.MoveItem(id, newParent); |
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs index 9aa95af..aa4c6aa 100644 --- a/OpenSim/Framework/Tests/AnimationTests.cs +++ b/OpenSim/Framework/Tests/AnimationTests.cs | |||
@@ -33,7 +33,6 @@ using OpenMetaverse.StructuredData; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Tests.Common; | 34 | using OpenSim.Tests.Common; |
35 | using OpenSim.Tests.Common.Mock; | 35 | using OpenSim.Tests.Common.Mock; |
36 | using OpenSim.Tests.Common.Setup; | ||
37 | using Animation = OpenSim.Framework.Animation; | 36 | using Animation = OpenSim.Framework.Animation; |
38 | 37 | ||
39 | namespace OpenSim.Framework.Tests | 38 | namespace OpenSim.Framework.Tests |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 5ba08ee..aadeedb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
44 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 46 | using OpenSim.Tests.Common.Mock; |
47 | using OpenSim.Tests.Common.Setup; | ||
48 | 47 | ||
49 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
50 | { | 49 | { |
@@ -104,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
104 | Scene scene = SceneSetupHelpers.SetupScene(); | 103 | Scene scene = SceneSetupHelpers.SetupScene(); |
105 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 104 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
106 | 105 | ||
107 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 106 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
108 | 107 | ||
109 | MemoryStream archiveWriteStream = new MemoryStream(); | 108 | MemoryStream archiveWriteStream = new MemoryStream(); |
110 | 109 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 52232a0..d97311a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
44 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 46 | using OpenSim.Tests.Common.Mock; |
47 | using OpenSim.Tests.Common.Setup; | ||
48 | 47 | ||
49 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
50 | { | 49 | { |
@@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
72 | TestHelper.InMethod(); | 71 | TestHelper.InMethod(); |
73 | // log4net.Config.XmlConfigurator.Configure(); | 72 | // log4net.Config.XmlConfigurator.Configure(); |
74 | 73 | ||
75 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | 74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); |
76 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | 75 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); |
77 | 76 | ||
78 | InventoryItemBase coaItem | 77 | InventoryItemBase coaItem |
@@ -138,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
138 | string userLastName = "Stirrup"; | 137 | string userLastName = "Stirrup"; |
139 | string userPassword = "troll"; | 138 | string userPassword = "troll"; |
140 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 139 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
141 | UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); | 140 | UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); |
142 | 141 | ||
143 | // Create asset | 142 | // Create asset |
144 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 143 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
@@ -229,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
229 | TestHelper.InMethod(); | 228 | TestHelper.InMethod(); |
230 | // log4net.Config.XmlConfigurator.Configure(); | 229 | // log4net.Config.XmlConfigurator.Configure(); |
231 | 230 | ||
232 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); | 231 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); |
233 | 232 | ||
234 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); | 233 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); |
235 | InventoryItemBase foundItem1 | 234 | InventoryItemBase foundItem1 |
@@ -261,8 +260,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
261 | TestHelper.InMethod(); | 260 | TestHelper.InMethod(); |
262 | // log4net.Config.XmlConfigurator.Configure(); | 261 | // log4net.Config.XmlConfigurator.Configure(); |
263 | 262 | ||
264 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); | 263 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); |
265 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); | 264 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); |
266 | 265 | ||
267 | m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | 266 | m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); |
268 | InventoryItemBase foundItem1 | 267 | InventoryItemBase foundItem1 |
@@ -294,7 +293,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
294 | TestHelper.InMethod(); | 293 | TestHelper.InMethod(); |
295 | // log4net.Config.XmlConfigurator.Configure(); | 294 | // log4net.Config.XmlConfigurator.Configure(); |
296 | 295 | ||
297 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "password"); | 296 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); |
298 | m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); | 297 | m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); |
299 | 298 | ||
300 | InventoryItemBase foundItem1 | 299 | InventoryItemBase foundItem1 |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index c7dae52..127d5f8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
44 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 46 | using OpenSim.Tests.Common.Mock; |
47 | using OpenSim.Tests.Common.Setup; | ||
48 | 47 | ||
49 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
50 | { | 49 | { |
@@ -71,7 +70,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
71 | string userLastName = "Stirrup"; | 70 | string userLastName = "Stirrup"; |
72 | string userPassword = "troll"; | 71 | string userPassword = "troll"; |
73 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 72 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
74 | UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); | 73 | UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); |
75 | 74 | ||
76 | // Create asset | 75 | // Create asset |
77 | SceneObjectGroup object1; | 76 | SceneObjectGroup object1; |
@@ -184,8 +183,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
184 | 183 | ||
185 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 184 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
186 | 185 | ||
187 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "meowfood"); | 186 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); |
188 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 187 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
189 | 188 | ||
190 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | 189 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); |
191 | InventoryItemBase foundItem1 | 190 | InventoryItemBase foundItem1 |
@@ -194,7 +193,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
194 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | 193 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
195 | 194 | ||
196 | // Now try loading to a root child folder | 195 | // Now try loading to a root child folder |
197 | UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA"); | 196 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA"); |
198 | MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); | 197 | MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); |
199 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream); | 198 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream); |
200 | 199 | ||
@@ -203,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
203 | Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); | 202 | Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); |
204 | 203 | ||
205 | // Now try loading to a more deeply nested folder | 204 | // Now try loading to a more deeply nested folder |
206 | UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC"); | 205 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC"); |
207 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); | 206 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); |
208 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream); | 207 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream); |
209 | 208 | ||
@@ -226,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
226 | Scene scene = SceneSetupHelpers.SetupScene(); | 225 | Scene scene = SceneSetupHelpers.SetupScene(); |
227 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 226 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
228 | 227 | ||
229 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password"); | 228 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); |
230 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); | 229 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); |
231 | 230 | ||
232 | InventoryItemBase foundItem1 | 231 | InventoryItemBase foundItem1 |
@@ -255,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
255 | string userFirstName = "Jock"; | 254 | string userFirstName = "Jock"; |
256 | string userLastName = "Stirrup"; | 255 | string userLastName = "Stirrup"; |
257 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 256 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
258 | UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); | 257 | UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); |
259 | 258 | ||
260 | // Create asset | 259 | // Create asset |
261 | SceneObjectGroup object1; | 260 | SceneObjectGroup object1; |
@@ -328,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
328 | // log4net.Config.XmlConfigurator.Configure(); | 327 | // log4net.Config.XmlConfigurator.Configure(); |
329 | 328 | ||
330 | Scene scene = SceneSetupHelpers.SetupScene(); | 329 | Scene scene = SceneSetupHelpers.SetupScene(); |
331 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 330 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
332 | 331 | ||
333 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); | 332 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); |
334 | HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>(); | 333 | HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>(); |
@@ -395,13 +394,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
395 | //log4net.Config.XmlConfigurator.Configure(); | 394 | //log4net.Config.XmlConfigurator.Configure(); |
396 | 395 | ||
397 | Scene scene = SceneSetupHelpers.SetupScene(); | 396 | Scene scene = SceneSetupHelpers.SetupScene(); |
398 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 397 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
399 | 398 | ||
400 | string folder1ExistingName = "a"; | 399 | string folder1ExistingName = "a"; |
401 | string folder2Name = "b"; | 400 | string folder2Name = "b"; |
402 | 401 | ||
403 | InventoryFolderBase folder1 | 402 | InventoryFolderBase folder1 |
404 | = UserInventoryTestUtils.CreateInventoryFolder( | 403 | = UserInventoryHelpers.CreateInventoryFolder( |
405 | scene.InventoryService, ua1.PrincipalID, folder1ExistingName); | 404 | scene.InventoryService, ua1.PrincipalID, folder1ExistingName); |
406 | 405 | ||
407 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); | 406 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); |
@@ -446,13 +445,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
446 | // log4net.Config.XmlConfigurator.Configure(); | 445 | // log4net.Config.XmlConfigurator.Configure(); |
447 | 446 | ||
448 | Scene scene = SceneSetupHelpers.SetupScene(); | 447 | Scene scene = SceneSetupHelpers.SetupScene(); |
449 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 448 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
450 | 449 | ||
451 | string folder1ExistingName = "a"; | 450 | string folder1ExistingName = "a"; |
452 | string folder2Name = "b"; | 451 | string folder2Name = "b"; |
453 | 452 | ||
454 | InventoryFolderBase folder1 | 453 | InventoryFolderBase folder1 |
455 | = UserInventoryTestUtils.CreateInventoryFolder( | 454 | = UserInventoryHelpers.CreateInventoryFolder( |
456 | scene.InventoryService, ua1.PrincipalID, folder1ExistingName); | 455 | scene.InventoryService, ua1.PrincipalID, folder1ExistingName); |
457 | 456 | ||
458 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); | 457 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 8d53cf1..733ad25 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs | |||
@@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
45 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
46 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
47 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
48 | using OpenSim.Tests.Common.Setup; | ||
49 | 48 | ||
50 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | 49 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests |
51 | { | 50 | { |
@@ -73,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
73 | string userFirstName = "Jock"; | 72 | string userFirstName = "Jock"; |
74 | string userLastName = "Stirrup"; | 73 | string userLastName = "Stirrup"; |
75 | string userPassword = "troll"; | 74 | string userPassword = "troll"; |
76 | UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword); | 75 | UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword); |
77 | 76 | ||
78 | AgentCircuitData acd = new AgentCircuitData(); | 77 | AgentCircuitData acd = new AgentCircuitData(); |
79 | acd.AgentID = m_userId; | 78 | acd.AgentID = m_userId; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index 18db9fa..c044407 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | |||
@@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; | |||
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
42 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
43 | using OpenSim.Tests.Common.Setup; | ||
44 | 43 | ||
45 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | 44 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests |
46 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs index e471f75..4556df3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs | |||
@@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; | |||
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | 41 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; |
42 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
43 | using OpenSim.Tests.Common.Setup; | ||
44 | 43 | ||
45 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | 44 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests |
46 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 729e9f7..2eb2861 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes; | |||
43 | using OpenSim.Region.Framework.Scenes.Serialization; | 43 | using OpenSim.Region.Framework.Scenes.Serialization; |
44 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | 45 | using OpenSim.Tests.Common.Mock; |
46 | using OpenSim.Tests.Common.Setup; | ||
47 | using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; | 46 | using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; |
48 | using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; | 47 | using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; |
49 | using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; | 48 | using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; |
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 67b00ac..a3aa38d 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 39 | using OpenSim.Tests.Common.Mock; |
40 | using OpenSim.Tests.Common.Setup; | ||
41 | 40 | ||
42 | namespace OpenSim.Region.CoreModules.World.Land.Tests | 41 | namespace OpenSim.Region.CoreModules.World.Land.Tests |
43 | { | 42 | { |
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index 5b85830..d5b7082 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs | |||
@@ -40,7 +40,6 @@ using OpenSim.Region.Framework.Scenes; | |||
40 | using OpenSim.Region.Framework.Scenes.Serialization; | 40 | using OpenSim.Region.Framework.Scenes.Serialization; |
41 | using OpenSim.Tests.Common; | 41 | using OpenSim.Tests.Common; |
42 | using OpenSim.Tests.Common.Mock; | 42 | using OpenSim.Tests.Common.Mock; |
43 | using OpenSim.Tests.Common.Setup; | ||
44 | 43 | ||
45 | namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests | 44 | namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests |
46 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index a866fd9..4f752ab 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -35,7 +35,6 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Scenes.Serialization; | 36 | using OpenSim.Region.Framework.Scenes.Serialization; |
37 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
38 | using OpenSim.Tests.Common.Setup; | ||
39 | 38 | ||
40 | namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | 39 | namespace OpenSim.Region.CoreModules.World.Serialiser.Tests |
41 | { | 40 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7b88f4f..3c47873 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2095,19 +2095,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2095 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); | 2095 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); |
2096 | } | 2096 | } |
2097 | 2097 | ||
2098 | AddNewSceneObject(group, true); | 2098 | AddNewSceneObject(group, true, pos, rot, vel); |
2099 | |||
2100 | group.AbsolutePosition = pos; | ||
2101 | group.Velocity = vel; | ||
2102 | |||
2103 | if (rot != null) | ||
2104 | group.UpdateGroupRotationR((Quaternion)rot); | ||
2105 | |||
2106 | // TODO: This needs to be refactored with the similar code in | ||
2107 | // SceneGraph.AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | ||
2108 | // possibly by allowing this method to take a null rotation. | ||
2109 | if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) | ||
2110 | group.RootPart.ApplyImpulse((vel * group.GetMass()), false); | ||
2111 | 2099 | ||
2112 | // We can only call this after adding the scene object, since the scene object references the scene | 2100 | // We can only call this after adding the scene object, since the scene object references the scene |
2113 | // to find out if scripts should be activated at all. | 2101 | // to find out if scripts should be activated at all. |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9df7340..b9690fe 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1971,16 +1971,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1971 | /// <summary> | 1971 | /// <summary> |
1972 | /// Add a newly created object to the scene. | 1972 | /// Add a newly created object to the scene. |
1973 | /// </summary> | 1973 | /// </summary> |
1974 | /// | 1974 | /// <remarks> |
1975 | /// This method does not send updates to the client - callers need to handle this themselves. | 1975 | /// This method does not send updates to the client - callers need to handle this themselves. |
1976 | /// </remarks> | ||
1976 | /// <param name="sceneObject"></param> | 1977 | /// <param name="sceneObject"></param> |
1977 | /// <param name="attachToBackup"></param> | 1978 | /// <param name="attachToBackup"></param> |
1978 | /// <param name="pos">Position of the object</param> | 1979 | /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param> |
1979 | /// <param name="rot">Rotation of the object</param> | 1980 | /// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param> |
1980 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> | 1981 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> |
1981 | /// <returns></returns> | 1982 | /// <returns></returns> |
1982 | public bool AddNewSceneObject( | 1983 | public bool AddNewSceneObject( |
1983 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 1984 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
1984 | { | 1985 | { |
1985 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) | 1986 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) |
1986 | { | 1987 | { |
@@ -4278,7 +4279,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4278 | // } | 4279 | // } |
4279 | 4280 | ||
4280 | /// <summary> | 4281 | /// <summary> |
4281 | /// Get a named prim contained in this scene (will return the first | 4282 | /// Get a group via its UUID |
4283 | /// </summary> | ||
4284 | /// <param name="fullID"></param> | ||
4285 | /// <returns>null if no group with that name exists</returns> | ||
4286 | public SceneObjectGroup GetSceneObjectGroup(UUID fullID) | ||
4287 | { | ||
4288 | return m_sceneGraph.GetSceneObjectGroup(fullID); | ||
4289 | } | ||
4290 | |||
4291 | /// <summary> | ||
4292 | /// Get a group by name from the scene (will return the first | ||
4293 | /// found, if there are more than one prim with the same name) | ||
4294 | /// </summary> | ||
4295 | /// <param name="name"></param> | ||
4296 | /// <returns>null if no group with that name exists</returns> | ||
4297 | public SceneObjectGroup GetSceneObjectGroup(string name) | ||
4298 | { | ||
4299 | return m_sceneGraph.GetSceneObjectGroup(name); | ||
4300 | } | ||
4301 | |||
4302 | /// <summary> | ||
4303 | /// Get a prim by name from the scene (will return the first | ||
4282 | /// found, if there are more than one prim with the same name) | 4304 | /// found, if there are more than one prim with the same name) |
4283 | /// </summary> | 4305 | /// </summary> |
4284 | /// <param name="name"></param> | 4306 | /// <param name="name"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fc31b65..cdb4e41 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -311,25 +311,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
311 | /// This method does not send updates to the client - callers need to handle this themselves. | 311 | /// This method does not send updates to the client - callers need to handle this themselves. |
312 | /// <param name="sceneObject"></param> | 312 | /// <param name="sceneObject"></param> |
313 | /// <param name="attachToBackup"></param> | 313 | /// <param name="attachToBackup"></param> |
314 | /// <param name="pos">Position of the object</param> | 314 | /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param> |
315 | /// <param name="rot">Rotation of the object</param> | 315 | /// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param> |
316 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> | 316 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> |
317 | /// <returns></returns> | 317 | /// <returns></returns> |
318 | public bool AddNewSceneObject( | 318 | public bool AddNewSceneObject( |
319 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 319 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
320 | { | 320 | { |
321 | AddNewSceneObject(sceneObject, true, false); | 321 | AddNewSceneObject(sceneObject, true, false); |
322 | 322 | ||
323 | // we set it's position in world. | 323 | if (pos != null) |
324 | sceneObject.AbsolutePosition = pos; | 324 | sceneObject.AbsolutePosition = (Vector3)pos; |
325 | 325 | ||
326 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) | 326 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) |
327 | { | 327 | { |
328 | sceneObject.ClearPartAttachmentData(); | 328 | sceneObject.ClearPartAttachmentData(); |
329 | } | 329 | } |
330 | 330 | ||
331 | sceneObject.UpdateGroupRotationR(rot); | 331 | if (rot != null) |
332 | 332 | sceneObject.UpdateGroupRotationR((Quaternion)rot); | |
333 | |||
333 | //group.ApplyPhysics(m_physicalPrim); | 334 | //group.ApplyPhysics(m_physicalPrim); |
334 | if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) | 335 | if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) |
335 | { | 336 | { |
@@ -344,6 +345,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
344 | /// Add an object to the scene. This will both update the scene, and send information about the | 345 | /// Add an object to the scene. This will both update the scene, and send information about the |
345 | /// new object to all clients interested in the scene. | 346 | /// new object to all clients interested in the scene. |
346 | /// </summary> | 347 | /// </summary> |
348 | /// <remarks> | ||
349 | /// The object's stored position, rotation and velocity are used. | ||
350 | /// </remarks> | ||
347 | /// <param name="sceneObject"></param> | 351 | /// <param name="sceneObject"></param> |
348 | /// <param name="attachToBackup"> | 352 | /// <param name="attachToBackup"> |
349 | /// If true, the object is made persistent into the scene. | 353 | /// If true, the object is made persistent into the scene. |
@@ -973,6 +977,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
973 | } | 977 | } |
974 | 978 | ||
975 | /// <summary> | 979 | /// <summary> |
980 | /// Get a group in the scene | ||
981 | /// </summary> | ||
982 | /// <param name="fullID">UUID of the group</param> | ||
983 | /// <returns>null if no such group was found</returns> | ||
984 | protected internal SceneObjectGroup GetSceneObjectGroup(UUID fullID) | ||
985 | { | ||
986 | lock (SceneObjectGroupsByFullID) | ||
987 | { | ||
988 | if (SceneObjectGroupsByFullID.ContainsKey(fullID)) | ||
989 | return SceneObjectGroupsByFullID[fullID]; | ||
990 | } | ||
991 | |||
992 | return null; | ||
993 | } | ||
994 | |||
995 | /// <summary> | ||
996 | /// Get a group by name from the scene (will return the first | ||
997 | /// found, if there are more than one prim with the same name) | ||
998 | /// </summary> | ||
999 | /// <param name="name"></param> | ||
1000 | /// <returns>null if the part was not found</returns> | ||
1001 | protected internal SceneObjectGroup GetSceneObjectGroup(string name) | ||
1002 | { | ||
1003 | SceneObjectGroup so = null; | ||
1004 | |||
1005 | Entities.Find( | ||
1006 | delegate(EntityBase entity) | ||
1007 | { | ||
1008 | if (entity is SceneObjectGroup) | ||
1009 | { | ||
1010 | if (entity.Name == name) | ||
1011 | { | ||
1012 | so = (SceneObjectGroup)entity; | ||
1013 | return true; | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | return false; | ||
1018 | } | ||
1019 | ); | ||
1020 | |||
1021 | return so; | ||
1022 | } | ||
1023 | |||
1024 | /// <summary> | ||
976 | /// Get a part contained in this scene. | 1025 | /// Get a part contained in this scene. |
977 | /// </summary> | 1026 | /// </summary> |
978 | /// <param name="localID"></param> | 1027 | /// <param name="localID"></param> |
@@ -986,7 +1035,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
986 | } | 1035 | } |
987 | 1036 | ||
988 | /// <summary> | 1037 | /// <summary> |
989 | /// Get a named prim contained in this scene (will return the first | 1038 | /// Get a prim by name from the scene (will return the first |
990 | /// found, if there are more than one prim with the same name) | 1039 | /// found, if there are more than one prim with the same name) |
991 | /// </summary> | 1040 | /// </summary> |
992 | /// <param name="name"></param> | 1041 | /// <param name="name"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index 855b589..cff649b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
44 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | 45 | using OpenSim.Tests.Common.Mock; |
46 | using OpenSim.Tests.Common.Setup; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 47 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 48 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index 667b74e..f69a4b4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Tests.Common; | 39 | using OpenSim.Tests.Common; |
40 | using OpenSim.Tests.Common.Setup; | ||
41 | 40 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 42 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index ca635d7..895f2bb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -34,7 +34,6 @@ using OpenSim.Framework.Communications; | |||
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
36 | using OpenSim.Tests.Common.Mock; | 36 | using OpenSim.Tests.Common.Mock; |
37 | using OpenSim.Tests.Common.Setup; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
40 | { | 39 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index a6a95ef..0a82c4f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -34,7 +34,6 @@ using OpenSim.Framework.Communications; | |||
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
36 | using OpenSim.Tests.Common.Mock; | 36 | using OpenSim.Tests.Common.Mock; |
37 | using OpenSim.Tests.Common.Setup; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
40 | { | 39 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 0d26026..5357a06 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Region.CoreModules.World.Permissions; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 39 | using OpenSim.Tests.Common.Mock; |
40 | using OpenSim.Tests.Common.Setup; | ||
41 | 40 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 42 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index bdfcd1d..cb1d531 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -35,7 +35,6 @@ using OpenSim.Framework.Communications; | |||
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
38 | using OpenSim.Tests.Common.Setup; | ||
39 | using log4net; | 38 | using log4net; |
40 | 39 | ||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace OpenSim.Region.Framework.Scenes.Tests |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index 8876a43..77bd4c2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | |||
@@ -40,7 +40,6 @@ using OpenSim.Region.Framework.Scenes; | |||
40 | using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; | 40 | using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; |
41 | using OpenSim.Tests.Common; | 41 | using OpenSim.Tests.Common; |
42 | using OpenSim.Tests.Common.Mock; | 42 | using OpenSim.Tests.Common.Mock; |
43 | using OpenSim.Tests.Common.Setup; | ||
44 | 43 | ||
45 | namespace OpenSim.Region.Framework.Scenes.Tests | 44 | namespace OpenSim.Region.Framework.Scenes.Tests |
46 | { | 45 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index efb757f..03ac252 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 46 | using OpenSim.Tests.Common.Mock; |
47 | using OpenSim.Tests.Common.Setup; | ||
48 | 47 | ||
49 | namespace OpenSim.Region.Framework.Scenes.Tests | 48 | namespace OpenSim.Region.Framework.Scenes.Tests |
50 | { | 49 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index abcce66..13d93f9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
44 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | 45 | using OpenSim.Tests.Common.Mock; |
46 | using OpenSim.Tests.Common.Setup; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 47 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 48 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index dd28416..1b5a54e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs | |||
@@ -36,7 +36,6 @@ using OpenSim.Region.Framework.Interfaces; | |||
36 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 36 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
37 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
38 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
39 | using OpenSim.Tests.Common.Setup; | ||
40 | using System.Threading; | 39 | using System.Threading; |
41 | 40 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 2aef4b0..f4e14d4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -46,55 +46,55 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | |||
46 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
47 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
48 | using OpenSim.Tests.Common.Mock; | 48 | using OpenSim.Tests.Common.Mock; |
49 | using OpenSim.Tests.Common.Setup; | ||
50 | 49 | ||
51 | namespace OpenSim.Region.Framework.Tests | 50 | namespace OpenSim.Region.Framework.Tests |
52 | { | 51 | { |
53 | [TestFixture] | 52 | [TestFixture] |
54 | public class TaskInventoryTests | 53 | public class TaskInventoryTests |
55 | { | 54 | { |
56 | protected UserAccount CreateUser(Scene scene) | 55 | [Test] |
57 | { | 56 | public void TestRezObjectFromInventoryItem() |
58 | string userFirstName = "Jock"; | ||
59 | string userLastName = "Stirrup"; | ||
60 | string userPassword = "troll"; | ||
61 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | ||
62 | return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); | ||
63 | } | ||
64 | |||
65 | protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) | ||
66 | { | ||
67 | string part1Name = "part1"; | ||
68 | UUID part1Id = UUID.Parse("10000000-0000-0000-0000-000000000000"); | ||
69 | SceneObjectPart part1 | ||
70 | = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
71 | { Name = part1Name, UUID = part1Id }; | ||
72 | return new SceneObjectGroup(part1); | ||
73 | } | ||
74 | |||
75 | protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) | ||
76 | { | 57 | { |
77 | AssetNotecard nc = new AssetNotecard(); | 58 | TestHelper.InMethod(); |
78 | nc.BodyText = "Hello World!"; | 59 | // log4net.Config.XmlConfigurator.Configure(); |
79 | nc.Encode(); | ||
80 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | ||
81 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | ||
82 | AssetBase ncAsset | ||
83 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | ||
84 | scene.AssetService.Store(ncAsset); | ||
85 | TaskInventoryItem ncItem | ||
86 | = new TaskInventoryItem | ||
87 | { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, | ||
88 | Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; | ||
89 | part.Inventory.AddInventoryItem(ncItem, true); | ||
90 | 60 | ||
91 | return ncItem; | 61 | Scene scene = SceneSetupHelpers.SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | ||
63 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); | ||
64 | SceneObjectPart sop1 = sog1.RootPart; | ||
65 | |||
66 | // Create an object embedded inside the first | ||
67 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | ||
68 | TaskInventoryItem taskSceneObjectItem | ||
69 | = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId); | ||
70 | |||
71 | scene.AddSceneObject(sog1); | ||
72 | |||
73 | Vector3 rezPos = new Vector3(10, 10, 10); | ||
74 | Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f); | ||
75 | Vector3 rezVel = new Vector3(2, 2, 2); | ||
76 | |||
77 | scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0); | ||
78 | |||
79 | SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso"); | ||
80 | |||
81 | Assert.That(rezzedObject, Is.Not.Null); | ||
82 | Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos)); | ||
83 | |||
84 | // Velocity doesn't get applied, probably because there is no physics in tests (yet) | ||
85 | // Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel)); | ||
86 | Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero)); | ||
87 | |||
88 | // Confusingly, this isn't the rezzedObject.Rotation | ||
89 | Assert.That(rezzedObject.RootPart.RotationOffset, Is.EqualTo(rezRot)); | ||
92 | } | 90 | } |
93 | 91 | ||
94 | /// <summary> | 92 | /// <summary> |
95 | /// Test MoveTaskInventoryItem where the item has no parent folder assigned. | 93 | /// Test MoveTaskInventoryItem where the item has no parent folder assigned. |
96 | /// </summary> | 94 | /// </summary> |
95 | /// <remarks> | ||
97 | /// This should place it in the most suitable user folder. | 96 | /// This should place it in the most suitable user folder. |
97 | /// </remarks> | ||
98 | [Test] | 98 | [Test] |
99 | public void TestMoveTaskInventoryItem() | 99 | public void TestMoveTaskInventoryItem() |
100 | { | 100 | { |
@@ -102,10 +102,11 @@ namespace OpenSim.Region.Framework.Tests | |||
102 | // log4net.Config.XmlConfigurator.Configure(); | 102 | // log4net.Config.XmlConfigurator.Configure(); |
103 | 103 | ||
104 | Scene scene = SceneSetupHelpers.SetupScene(); | 104 | Scene scene = SceneSetupHelpers.SetupScene(); |
105 | UserAccount user1 = CreateUser(scene); | 105 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
106 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); | 106 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); |
107 | SceneObjectPart sop1 = sog1.RootPart; | 107 | SceneObjectPart sop1 = sog1.RootPart; |
108 | TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1); | 108 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
109 | |||
109 | InventoryFolderBase folder | 110 | InventoryFolderBase folder |
110 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 111 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
111 | 112 | ||
@@ -128,10 +129,10 @@ namespace OpenSim.Region.Framework.Tests | |||
128 | // log4net.Config.XmlConfigurator.Configure(); | 129 | // log4net.Config.XmlConfigurator.Configure(); |
129 | 130 | ||
130 | Scene scene = SceneSetupHelpers.SetupScene(); | 131 | Scene scene = SceneSetupHelpers.SetupScene(); |
131 | UserAccount user1 = CreateUser(scene); | 132 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
132 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); | 133 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); |
133 | SceneObjectPart sop1 = sog1.RootPart; | 134 | SceneObjectPart sop1 = sog1.RootPart; |
134 | TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1); | 135 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
135 | 136 | ||
136 | // Perform test | 137 | // Perform test |
137 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 138 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index dbf9e0f..4da8df1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -33,7 +33,6 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
36 | using OpenSim.Tests.Common.Setup; | ||
37 | using OpenSim.Tests.Common.Mock; | 36 | using OpenSim.Tests.Common.Mock; |
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index 6de97b7..ee52a39 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | |||
@@ -35,7 +35,6 @@ using OpenSim.Framework.Communications; | |||
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
38 | using OpenSim.Tests.Common.Setup; | ||
39 | 38 | ||
40 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | 39 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests |
41 | { | 40 | { |
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs index b74d6e7..ec9f157 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | |||
@@ -278,21 +278,21 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
278 | { | 278 | { |
279 | string sRegionName; | 279 | string sRegionName; |
280 | string sRegionLabel; | 280 | string sRegionLabel; |
281 | string prepend; | 281 | // string prepend; |
282 | AutoBackupModuleState state; | 282 | AutoBackupModuleState state; |
283 | 283 | ||
284 | if (parseDefault) | 284 | if (parseDefault) |
285 | { | 285 | { |
286 | sRegionName = null; | 286 | sRegionName = null; |
287 | sRegionLabel = "DEFAULT"; | 287 | sRegionLabel = "DEFAULT"; |
288 | prepend = ""; | 288 | // prepend = ""; |
289 | state = this.m_defaultState; | 289 | state = this.m_defaultState; |
290 | } | 290 | } |
291 | else | 291 | else |
292 | { | 292 | { |
293 | sRegionName = scene.RegionInfo.RegionName; | 293 | sRegionName = scene.RegionInfo.RegionName; |
294 | sRegionLabel = sRegionName; | 294 | sRegionLabel = sRegionName; |
295 | prepend = sRegionName + "."; | 295 | // prepend = sRegionName + "."; |
296 | state = null; | 296 | state = null; |
297 | } | 297 | } |
298 | 298 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0240227..1cf03b8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4458,6 +4458,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4458 | return result; | 4458 | return result; |
4459 | } | 4459 | } |
4460 | 4460 | ||
4461 | public LSL_Integer llGetLinkNumberOfSides(int link) | ||
4462 | { | ||
4463 | m_host.AddScriptLPS(1); | ||
4464 | |||
4465 | SceneObjectPart linkedPart; | ||
4466 | |||
4467 | if (link == ScriptBaseClass.LINK_ROOT) | ||
4468 | linkedPart = m_host.ParentGroup.RootPart; | ||
4469 | else if (link == ScriptBaseClass.LINK_THIS) | ||
4470 | linkedPart = m_host; | ||
4471 | else | ||
4472 | linkedPart = m_host.ParentGroup.GetLinkNumPart(link); | ||
4473 | |||
4474 | return GetNumberOfSides(linkedPart); | ||
4475 | } | ||
4476 | |||
4461 | public LSL_Integer llGetNumberOfSides() | 4477 | public LSL_Integer llGetNumberOfSides() |
4462 | { | 4478 | { |
4463 | m_host.AddScriptLPS(1); | 4479 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 298d664..461b473 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -1536,6 +1536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1536 | public struct LSLInteger | 1536 | public struct LSLInteger |
1537 | { | 1537 | { |
1538 | public int value; | 1538 | public int value; |
1539 | private static readonly Regex castRegex = new Regex(@"(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*(-?|\+?)[0-9][0-9]*)"); | ||
1539 | 1540 | ||
1540 | #region Constructors | 1541 | #region Constructors |
1541 | public LSLInteger(int i) | 1542 | public LSLInteger(int i) |
@@ -1555,9 +1556,10 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1555 | 1556 | ||
1556 | public LSLInteger(string s) | 1557 | public LSLInteger(string s) |
1557 | { | 1558 | { |
1558 | Regex r = new Regex("(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*-?[0-9][0-9]*)"); | 1559 | Match m = castRegex.Match(s); |
1559 | Match m = r.Match(s); | ||
1560 | string v = m.Groups[0].Value; | 1560 | string v = m.Groups[0].Value; |
1561 | // Leading plus sign is allowed, but ignored | ||
1562 | v = v.Replace("+", ""); | ||
1561 | 1563 | ||
1562 | if (v == String.Empty) | 1564 | if (v == String.Empty) |
1563 | { | 1565 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 1d55b95..80b60a4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -29,7 +29,6 @@ using System.Collections.Generic; | |||
29 | using NUnit.Framework; | 29 | using NUnit.Framework; |
30 | using OpenSim.Tests.Common; | 30 | using OpenSim.Tests.Common; |
31 | using OpenSim.Region.ScriptEngine.Shared; | 31 | using OpenSim.Region.ScriptEngine.Shared; |
32 | using OpenSim.Tests.Common.Setup; | ||
33 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
34 | using Nini.Config; | 33 | using Nini.Config; |
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 34 | using OpenSim.Region.ScriptEngine.Shared.Api; |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs index 045abb4..b635d5c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using NUnit.Framework; | 31 | using NUnit.Framework; |
32 | using OpenSim.Tests.Common.Setup; | ||
33 | using OpenSim.Tests.Common.Mock; | 32 | using OpenSim.Tests.Common.Mock; |
34 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenMetaverse; | 34 | using OpenMetaverse; |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 0af35c8..2282ee8 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -393,6 +393,10 @@ namespace OpenSim.Services.InventoryService | |||
393 | 393 | ||
394 | public virtual bool UpdateItem(InventoryItemBase item) | 394 | public virtual bool UpdateItem(InventoryItemBase item) |
395 | { | 395 | { |
396 | if (!m_AllowDelete) | ||
397 | if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder) | ||
398 | return false; | ||
399 | |||
396 | return m_Database.StoreItem(ConvertFromOpenSim(item)); | 400 | return m_Database.StoreItem(ConvertFromOpenSim(item)); |
397 | } | 401 | } |
398 | 402 | ||
@@ -411,12 +415,30 @@ namespace OpenSim.Services.InventoryService | |||
411 | public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) | 415 | public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) |
412 | { | 416 | { |
413 | if (!m_AllowDelete) | 417 | if (!m_AllowDelete) |
414 | return false; | 418 | { |
415 | 419 | // We must still allow links and links to folders to be deleted, otherwise they will build up | |
416 | // Just use the ID... *facepalms* | 420 | // in the player's inventory until they can no longer log in. Deletions of links due to code bugs or |
417 | // | 421 | // similar is inconvenient but on a par with accidental movement of items. The original item is never |
418 | foreach (UUID id in itemIDs) | 422 | // touched. |
419 | m_Database.DeleteItems("inventoryID", id.ToString()); | 423 | foreach (UUID id in itemIDs) |
424 | { | ||
425 | if (!m_Database.DeleteItems( | ||
426 | new string[] { "inventoryID", "assetType" }, | ||
427 | new string[] { id.ToString(), ((sbyte)AssetType.Link).ToString() })); | ||
428 | { | ||
429 | m_Database.DeleteItems( | ||
430 | new string[] { "inventoryID", "assetType" }, | ||
431 | new string[] { id.ToString(), ((sbyte)AssetType.LinkFolder).ToString() }); | ||
432 | } | ||
433 | } | ||
434 | } | ||
435 | else | ||
436 | { | ||
437 | // Just use the ID... *facepalms* | ||
438 | // | ||
439 | foreach (UUID id in itemIDs) | ||
440 | m_Database.DeleteItems("inventoryID", id.ToString()); | ||
441 | } | ||
420 | 442 | ||
421 | return true; | 443 | return true; |
422 | } | 444 | } |
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Helpers/AssetHelpers.cs index d572249..aa55bcd 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/AssetHelpers.cs | |||
@@ -56,10 +56,24 @@ namespace OpenSim.Tests.Common | |||
56 | AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); | 56 | AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); |
57 | scene.AssetService.Store(asset); | 57 | scene.AssetService.Store(asset); |
58 | return asset; | 58 | return asset; |
59 | } | 59 | } |
60 | |||
61 | /// <summary> | ||
62 | /// Create an asset from the given object. | ||
63 | /// </summary> | ||
64 | /// <param name="assetUuidTail"> | ||
65 | /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" | ||
66 | /// will be used. | ||
67 | /// </param> | ||
68 | /// <param name="sog"></param> | ||
69 | /// <returns></returns> | ||
70 | public static AssetBase CreateAsset(int assetUuidTail, SceneObjectGroup sog) | ||
71 | { | ||
72 | return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), sog); | ||
73 | } | ||
60 | 74 | ||
61 | /// <summary> | 75 | /// <summary> |
62 | /// Create an asset from the given scene object. | 76 | /// Create an asset from the given object. |
63 | /// </summary> | 77 | /// </summary> |
64 | /// <param name="assetUuid"></param> | 78 | /// <param name="assetUuid"></param> |
65 | /// <param name="sog"></param> | 79 | /// <param name="sog"></param> |
@@ -76,7 +90,7 @@ namespace OpenSim.Tests.Common | |||
76 | /// <summary> | 90 | /// <summary> |
77 | /// Create an asset from the given scene object. | 91 | /// Create an asset from the given scene object. |
78 | /// </summary> | 92 | /// </summary> |
79 | /// <param name="assetUuidTailZ"> | 93 | /// <param name="assetUuidTail"> |
80 | /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" | 94 | /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" |
81 | /// will be used. | 95 | /// will be used. |
82 | /// </param> | 96 | /// </param> |
diff --git a/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs b/OpenSim/Tests/Common/Helpers/BaseRequestHandlerHelpers.cs index eaf8b39..49c99c5 100644 --- a/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs +++ b/OpenSim/Tests/Common/Helpers/BaseRequestHandlerHelpers.cs | |||
@@ -34,9 +34,9 @@ using OpenSim.Framework.Servers; | |||
34 | using OpenSim.Framework.Servers.HttpServer; | 34 | using OpenSim.Framework.Servers.HttpServer; |
35 | using OpenSim.Tests.Common.Mock; | 35 | using OpenSim.Tests.Common.Mock; |
36 | 36 | ||
37 | namespace OpenSim.Tests.Common.Setup | 37 | namespace OpenSim.Tests.Common |
38 | { | 38 | { |
39 | public class BaseRequestHandlerTestHelper | 39 | public class BaseRequestHandlerHelpers |
40 | { | 40 | { |
41 | private static string[] m_emptyStringArray = new string[] { }; | 41 | private static string[] m_emptyStringArray = new string[] { }; |
42 | 42 | ||
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs index d122409..bef0481 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs | |||
@@ -49,7 +49,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; | |||
49 | using OpenSim.Services.Interfaces; | 49 | using OpenSim.Services.Interfaces; |
50 | using OpenSim.Tests.Common.Mock; | 50 | using OpenSim.Tests.Common.Mock; |
51 | 51 | ||
52 | namespace OpenSim.Tests.Common.Setup | 52 | namespace OpenSim.Tests.Common |
53 | { | 53 | { |
54 | /// <summary> | 54 | /// <summary> |
55 | /// Helpers for setting up scenes. | 55 | /// Helpers for setting up scenes. |
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs new file mode 100644 index 0000000..5215c34 --- /dev/null +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenMetaverse.Assets; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | |||
35 | namespace OpenSim.Tests.Common | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Utility functions for carrying out task inventory tests. | ||
39 | /// </summary> | ||
40 | /// | ||
41 | public static class TaskInventoryHelpers | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// Add a notecard item to the given part. | ||
45 | /// </summary> | ||
46 | /// <param name="scene"></param> | ||
47 | /// <param name="part"></param> | ||
48 | /// <returns>The item that was added</returns> | ||
49 | public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part) | ||
50 | { | ||
51 | AssetNotecard nc = new AssetNotecard(); | ||
52 | nc.BodyText = "Hello World!"; | ||
53 | nc.Encode(); | ||
54 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | ||
55 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | ||
56 | AssetBase ncAsset | ||
57 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | ||
58 | scene.AssetService.Store(ncAsset); | ||
59 | TaskInventoryItem ncItem | ||
60 | = new TaskInventoryItem | ||
61 | { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, | ||
62 | Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; | ||
63 | part.Inventory.AddInventoryItem(ncItem, true); | ||
64 | |||
65 | return ncItem; | ||
66 | } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Add a scene object item to the given part. | ||
70 | /// </summary> | ||
71 | /// <param name="scene"></param> | ||
72 | /// <param name="sop"></param> | ||
73 | /// <param name="itemName"></param> | ||
74 | /// <param name="id"></param> | ||
75 | public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id) | ||
76 | { | ||
77 | SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); | ||
78 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); | ||
79 | scene.AssetService.Store(taskSceneObjectAsset); | ||
80 | TaskInventoryItem taskSceneObjectItem | ||
81 | = new TaskInventoryItem | ||
82 | { Name = itemName, AssetID = taskSceneObjectAsset.FullID, ItemID = id, | ||
83 | Type = (int)AssetType.Object, InvType = (int)InventoryType.Object }; | ||
84 | sop.Inventory.AddInventoryItem(taskSceneObjectItem, true); | ||
85 | |||
86 | return taskSceneObjectItem; | ||
87 | } | ||
88 | } | ||
89 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs index d01521d..8cfad79 100644 --- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs +++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs | |||
@@ -31,12 +31,12 @@ using OpenSim.Framework.Communications; | |||
31 | using OpenSim.Region.Framework.Scenes; | 31 | using OpenSim.Region.Framework.Scenes; |
32 | using OpenSim.Services.Interfaces; | 32 | using OpenSim.Services.Interfaces; |
33 | 33 | ||
34 | namespace OpenSim.Tests.Common.Setup | 34 | namespace OpenSim.Tests.Common |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Utility functions for carrying out user profile related tests. | 37 | /// Utility functions for carrying out user profile related tests. |
38 | /// </summary> | 38 | /// </summary> |
39 | public static class UserProfileTestUtils | 39 | public static class UserAccountHelpers |
40 | { | 40 | { |
41 | // /// <summary> | 41 | // /// <summary> |
42 | // /// Create a test user with a standard inventory | 42 | // /// Create a test user with a standard inventory |
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 135c50e..0419134 100644 --- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | |||
@@ -34,9 +34,9 @@ using OpenSim.Services.Interfaces; | |||
34 | namespace OpenSim.Tests.Common | 34 | namespace OpenSim.Tests.Common |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Utility functions for carrying out user inventory related tests. | 37 | /// Utility functions for carrying out user inventory tests. |
38 | /// </summary> | 38 | /// </summary> |
39 | public static class UserInventoryTestUtils | 39 | public static class UserInventoryHelpers |
40 | { | 40 | { |
41 | public static readonly string PATH_DELIMITER = "/"; | 41 | public static readonly string PATH_DELIMITER = "/"; |
42 | 42 | ||