aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Helpers
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Helpers')
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs (renamed from OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs)15
-rw-r--r--OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs8
-rw-r--r--OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs37
4 files changed, 45 insertions, 17 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 70621d5..086a725 100644
--- a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Tests.Common
54 /// <summary> 54 /// <summary>
55 /// Helpers for setting up scenes. 55 /// Helpers for setting up scenes.
56 /// </summary> 56 /// </summary>
57 public class SceneSetupHelpers 57 public class SceneHelpers
58 { 58 {
59 /// <summary> 59 /// <summary>
60 /// Set up a test scene 60 /// Set up a test scene
@@ -331,6 +331,7 @@ namespace OpenSim.Tests.Common
331 agentData.InventoryFolder = UUID.Zero; 331 agentData.InventoryFolder = UUID.Zero;
332 agentData.startpos = Vector3.Zero; 332 agentData.startpos = Vector3.Zero;
333 agentData.CapsPath = "http://wibble.com"; 333 agentData.CapsPath = "http://wibble.com";
334 agentData.ServiceURLs = new Dictionary<string, object>();
334 335
335 return agentData; 336 return agentData;
336 } 337 }
@@ -341,9 +342,9 @@ namespace OpenSim.Tests.Common
341 /// <param name="scene"></param> 342 /// <param name="scene"></param>
342 /// <param name="agentId"></param> 343 /// <param name="agentId"></param>
343 /// <returns></returns> 344 /// <returns></returns>
344 public static TestClient AddClient(Scene scene, UUID agentId) 345 public static ScenePresence AddScenePresence(Scene scene, UUID agentId)
345 { 346 {
346 return AddClient(scene, GenerateAgentData(agentId)); 347 return AddScenePresence(scene, GenerateAgentData(agentId));
347 } 348 }
348 349
349 /// <summary> 350 /// <summary>
@@ -364,7 +365,7 @@ namespace OpenSim.Tests.Common
364 /// <param name="scene"></param> 365 /// <param name="scene"></param>
365 /// <param name="agentData"></param> 366 /// <param name="agentData"></param>
366 /// <returns></returns> 367 /// <returns></returns>
367 public static TestClient AddClient(Scene scene, AgentCircuitData agentData) 368 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
368 { 369 {
369 string reason; 370 string reason;
370 371
@@ -379,14 +380,14 @@ namespace OpenSim.Tests.Common
379 380
380 // Stage 2: add the new client as a child agent to the scene 381 // Stage 2: add the new client as a child agent to the scene
381 TestClient client = new TestClient(agentData, scene); 382 TestClient client = new TestClient(agentData, scene);
382 scene.AddNewClient(client); 383 scene.AddNewClient(client, PresenceType.User);
383 384
384 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. 385 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
385 ScenePresence scp = scene.GetScenePresence(agentData.AgentID); 386 ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
386 scp.CompleteMovement(client); 387 scp.CompleteMovement(client, true);
387 //scp.MakeRootAgent(new Vector3(90, 90, 90), true); 388 //scp.MakeRootAgent(new Vector3(90, 90, 90), true);
388 389
389 return client; 390 return scp;
390 } 391 }
391 392
392 /// <summary> 393 /// <summary>
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index 5215c34..a8f0d59 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Tests.Common
74 /// <param name="id"></param> 74 /// <param name="id"></param>
75 public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id) 75 public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id)
76 { 76 {
77 SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); 77 SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero);
78 AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); 78 AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
79 scene.AssetService.Store(taskSceneObjectAsset); 79 scene.AssetService.Store(taskSceneObjectAsset);
80 TaskInventoryItem taskSceneObjectItem 80 TaskInventoryItem taskSceneObjectItem
diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
index d924ecd..b73df2c 100644
--- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
@@ -118,13 +118,12 @@ namespace OpenSim.Tests.Common
118 118
119 public static UserAccount CreateUserWithInventory(Scene scene) 119 public static UserAccount CreateUserWithInventory(Scene scene)
120 { 120 {
121 return CreateUserWithInventory(scene, 99); 121 return CreateUserWithInventory(scene, TestHelpers.ParseTail(99));
122 } 122 }
123 123
124 public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail) 124 public static UserAccount CreateUserWithInventory(Scene scene, UUID userId)
125 { 125 {
126 return CreateUserWithInventory( 126 return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll");
127 scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll");
128 } 127 }
129 128
130 public static UserAccount CreateUserWithInventory( 129 public static UserAccount CreateUserWithInventory(
@@ -139,7 +138,6 @@ namespace OpenSim.Tests.Common
139 { 138 {
140 // FIXME: This should really be set up by UserAccount itself 139 // FIXME: This should really be set up by UserAccount itself
141 ua.ServiceURLs = new Dictionary<string, object>(); 140 ua.ServiceURLs = new Dictionary<string, object>();
142
143 scene.UserAccountService.StoreUserAccount(ua); 141 scene.UserAccountService.StoreUserAccount(ua);
144 scene.InventoryService.CreateUserInventory(ua.PrincipalID); 142 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
145 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); 143 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
index 1703597..4e60ca9 100644
--- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
@@ -52,7 +52,22 @@ namespace OpenSim.Tests.Common
52 /// <returns></returns> 52 /// <returns></returns>
53 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) 53 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId)
54 { 54 {
55 return CreateInventoryItem(scene, itemName, UUID.Random(), userId); 55 return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, InventoryType.Notecard);
56 }
57
58 /// <summary>
59 /// Creates an item of the given type with an accompanying asset.
60 /// </summary>
61 /// <param name="scene"></param>
62 /// <param name="itemName"></param>
63 /// <param name="itemId"></param>
64 /// <param name="userId"></param>
65 /// <param name="type">Type of item to create</param>
66 /// <returns></returns>
67 public static InventoryItemBase CreateInventoryItem(
68 Scene scene, string itemName, UUID userId, InventoryType type)
69 {
70 return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, type);
56 } 71 }
57 72
58 /// <summary> 73 /// <summary>
@@ -61,18 +76,32 @@ namespace OpenSim.Tests.Common
61 /// <param name="scene"></param> 76 /// <param name="scene"></param>
62 /// <param name="itemName"></param> 77 /// <param name="itemName"></param>
63 /// <param name="itemId"></param> 78 /// <param name="itemId"></param>
79 /// <param name="assetId"></param>
64 /// <param name="userId"></param> 80 /// <param name="userId"></param>
81 /// <param name="type">Type of item to create</param>
65 /// <returns></returns> 82 /// <returns></returns>
66 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) 83 public static InventoryItemBase CreateInventoryItem(
84 Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type)
67 { 85 {
68 AssetBase asset = AssetHelpers.CreateAsset(scene, userId); 86 AssetBase asset = null;
87
88 if (type == InventoryType.Notecard)
89 asset = AssetHelpers.CreateAsset(scene, userId);
90 else if (type == InventoryType.Object)
91 asset
92 = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId));
93 else
94 throw new Exception(string.Format("Inventory type {0} not supported", type));
95
96 scene.AssetService.Store(asset);
97
69 InventoryItemBase item = new InventoryItemBase(); 98 InventoryItemBase item = new InventoryItemBase();
70 item.Name = itemName; 99 item.Name = itemName;
71 item.AssetID = asset.FullID; 100 item.AssetID = asset.FullID;
72 item.ID = itemId; 101 item.ID = itemId;
73 item.Owner = userId; 102 item.Owner = userId;
74 item.AssetType = asset.Type; 103 item.AssetType = asset.Type;
75 item.InvType = (int)InventoryType.Notecard; 104 item.InvType = (int)type;
76 105
77 InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); 106 InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
78 107