aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common
diff options
context:
space:
mode:
authorTom2011-09-04 07:06:36 -0700
committerTom2011-09-04 07:06:36 -0700
commit66dec3b8742eff04fbbcc6e3249fe4ba87986500 (patch)
tree76cc708a821d35fac5cdbbce2de304b47064e732 /OpenSim/Tests/Common
parentGuard another nullref (diff)
parentFixed BulletSim config files for Linux *.so libraries. (diff)
downloadopensim-SC_OLD-66dec3b8742eff04fbbcc6e3249fe4ba87986500.zip
opensim-SC_OLD-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.gz
opensim-SC_OLD-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.bz2
opensim-SC_OLD-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.xz
Resolve merge commits, stage 1
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r--OpenSim/Tests/Common/Helpers/AssetHelpers.cs6
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs (renamed from OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs)51
-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
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs13
-rw-r--r--OpenSim/Tests/Common/TestHelpers.cs (renamed from OpenSim/Tests/Common/TestHelper.cs)2
7 files changed, 87 insertions, 32 deletions
diff --git a/OpenSim/Tests/Common/Helpers/AssetHelpers.cs b/OpenSim/Tests/Common/Helpers/AssetHelpers.cs
index 9b68331..99eb124 100644
--- a/OpenSim/Tests/Common/Helpers/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/AssetHelpers.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common
42 /// <returns></returns> 42 /// <returns></returns>
43 public static AssetBase CreateAsset() 43 public static AssetBase CreateAsset()
44 { 44 {
45 return CreateAsset(UUID.Random(), AssetType.Notecard, "hello", UUID.Random()); 45 return CreateAsset(UUID.Random());
46 } 46 }
47 47
48 /// <summary> 48 /// <summary>
@@ -50,9 +50,9 @@ namespace OpenSim.Tests.Common
50 /// </summary> 50 /// </summary>
51 /// <param name="creatorId">/param> 51 /// <param name="creatorId">/param>
52 /// <returns></returns> 52 /// <returns></returns>
53 public static AssetBase CreateAsset(UUID creatorId) 53 public static AssetBase CreateAsset(UUID id)
54 { 54 {
55 return CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); 55 return CreateAsset(id, AssetType.Notecard, "hello", UUID.Random());
56 } 56 }
57 57
58 /// <summary> 58 /// <summary>
diff --git a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index bef0481..ea433a6 100644
--- a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -40,6 +40,7 @@ using OpenSim.Region.Framework;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.CoreModules.Avatar.Gods; 42using OpenSim.Region.CoreModules.Avatar.Gods;
43using OpenSim.Region.CoreModules.Asset;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; 44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; 45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; 46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
@@ -54,8 +55,13 @@ namespace OpenSim.Tests.Common
54 /// <summary> 55 /// <summary>
55 /// Helpers for setting up scenes. 56 /// Helpers for setting up scenes.
56 /// </summary> 57 /// </summary>
57 public class SceneSetupHelpers 58 public class SceneHelpers
58 { 59 {
60 public static TestScene SetupScene()
61 {
62 return SetupScene(null);
63 }
64
59 /// <summary> 65 /// <summary>
60 /// Set up a test scene 66 /// Set up a test scene
61 /// </summary> 67 /// </summary>
@@ -63,9 +69,14 @@ namespace OpenSim.Tests.Common
63 /// Automatically starts service threads, as would the normal runtime. 69 /// Automatically starts service threads, as would the normal runtime.
64 /// </remarks> 70 /// </remarks>
65 /// <returns></returns> 71 /// <returns></returns>
66 public static TestScene SetupScene() 72 public static TestScene SetupScene(CoreAssetCache cache)
73 {
74 return SetupScene("Unit test region", UUID.Random(), 1000, 1000, cache);
75 }
76
77 public static TestScene SetupScene(string name, UUID id, uint x, uint y)
67 { 78 {
68 return SetupScene("Unit test region", UUID.Random(), 1000, 1000); 79 return SetupScene(name, id, x, y, null);
69 } 80 }
70 81
71 /// <summary> 82 /// <summary>
@@ -78,7 +89,7 @@ namespace OpenSim.Tests.Common
78 /// <param name="y">Y co-ordinate of the region</param> 89 /// <param name="y">Y co-ordinate of the region</param>
79 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> 90 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
80 /// <returns></returns> 91 /// <returns></returns>
81 public static TestScene SetupScene(string name, UUID id, uint x, uint y) 92 public static TestScene SetupScene(string name, UUID id, uint x, uint y, CoreAssetCache cache)
82 { 93 {
83 Console.WriteLine("Setting up test scene {0}", name); 94 Console.WriteLine("Setting up test scene {0}", name);
84 95
@@ -103,7 +114,7 @@ namespace OpenSim.Tests.Common
103 godsModule.Initialise(testScene, new IniConfigSource()); 114 godsModule.Initialise(testScene, new IniConfigSource());
104 testScene.AddModule(godsModule.Name, godsModule); 115 testScene.AddModule(godsModule.Name, godsModule);
105 116
106 LocalAssetServicesConnector assetService = StartAssetService(testScene); 117 LocalAssetServicesConnector assetService = StartAssetService(testScene, cache);
107 StartAuthenticationService(testScene); 118 StartAuthenticationService(testScene);
108 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); 119 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene);
109 StartGridService(testScene); 120 StartGridService(testScene);
@@ -132,7 +143,7 @@ namespace OpenSim.Tests.Common
132 return testScene; 143 return testScene;
133 } 144 }
134 145
135 private static LocalAssetServicesConnector StartAssetService(Scene testScene) 146 private static LocalAssetServicesConnector StartAssetService(Scene testScene, CoreAssetCache cache)
136 { 147 {
137 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); 148 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
138 IConfigSource config = new IniConfigSource(); 149 IConfigSource config = new IniConfigSource();
@@ -145,6 +156,20 @@ namespace OpenSim.Tests.Common
145 156
146 assetService.Initialise(config); 157 assetService.Initialise(config);
147 assetService.AddRegion(testScene); 158 assetService.AddRegion(testScene);
159
160 if (cache != null)
161 {
162 IConfigSource cacheConfig = new IniConfigSource();
163 cacheConfig.AddConfig("Modules");
164 cacheConfig.Configs["Modules"].Set("AssetCaching", "CoreAssetCache");
165 cacheConfig.AddConfig("AssetCache");
166
167 cache.Initialise(cacheConfig);
168 cache.AddRegion(testScene);
169 cache.RegionLoaded(testScene);
170 testScene.AddRegionModule(cache.Name, cache);
171 }
172
148 assetService.RegionLoaded(testScene); 173 assetService.RegionLoaded(testScene);
149 testScene.AddRegionModule(assetService.Name, assetService); 174 testScene.AddRegionModule(assetService.Name, assetService);
150 175
@@ -331,6 +356,8 @@ namespace OpenSim.Tests.Common
331 agentData.InventoryFolder = UUID.Zero; 356 agentData.InventoryFolder = UUID.Zero;
332 agentData.startpos = Vector3.Zero; 357 agentData.startpos = Vector3.Zero;
333 agentData.CapsPath = "http://wibble.com"; 358 agentData.CapsPath = "http://wibble.com";
359 agentData.ServiceURLs = new Dictionary<string, object>();
360 agentData.Appearance = new AvatarAppearance();
334 361
335 return agentData; 362 return agentData;
336 } 363 }
@@ -341,9 +368,9 @@ namespace OpenSim.Tests.Common
341 /// <param name="scene"></param> 368 /// <param name="scene"></param>
342 /// <param name="agentId"></param> 369 /// <param name="agentId"></param>
343 /// <returns></returns> 370 /// <returns></returns>
344 public static TestClient AddRootAgent(Scene scene, UUID agentId) 371 public static ScenePresence AddScenePresence(Scene scene, UUID agentId)
345 { 372 {
346 return AddRootAgent(scene, GenerateAgentData(agentId)); 373 return AddScenePresence(scene, GenerateAgentData(agentId));
347 } 374 }
348 375
349 /// <summary> 376 /// <summary>
@@ -364,7 +391,7 @@ namespace OpenSim.Tests.Common
364 /// <param name="scene"></param> 391 /// <param name="scene"></param>
365 /// <param name="agentData"></param> 392 /// <param name="agentData"></param>
366 /// <returns></returns> 393 /// <returns></returns>
367 public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData) 394 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
368 { 395 {
369 string reason; 396 string reason;
370 397
@@ -379,14 +406,14 @@ namespace OpenSim.Tests.Common
379 406
380 // Stage 2: add the new client as a child agent to the scene 407 // Stage 2: add the new client as a child agent to the scene
381 TestClient client = new TestClient(agentData, scene); 408 TestClient client = new TestClient(agentData, scene);
382 scene.AddNewClient(client); 409 scene.AddNewClient(client, PresenceType.User);
383 410
384 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. 411 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
385 ScenePresence scp = scene.GetScenePresence(agentData.AgentID); 412 ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
386 scp.CompleteMovement(client); 413 scp.CompleteMovement(client, true);
387 //scp.MakeRootAgent(new Vector3(90, 90, 90), true); 414 //scp.MakeRootAgent(new Vector3(90, 90, 90), true);
388 415
389 return client; 416 return scp;
390 } 417 }
391 418
392 /// <summary> 419 /// <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
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 0f89f84..014f7f6 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Tests.Common.Mock
95 public event DeRezObject OnDeRezObject; 95 public event DeRezObject OnDeRezObject;
96 public event Action<IClientAPI> OnRegionHandShakeReply; 96 public event Action<IClientAPI> OnRegionHandShakeReply;
97 public event GenericCall1 OnRequestWearables; 97 public event GenericCall1 OnRequestWearables;
98 public event GenericCall1 OnCompleteMovementToRegion; 98 public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
99 public event UpdateAgent OnPreAgentUpdate; 99 public event UpdateAgent OnPreAgentUpdate;
100 public event UpdateAgent OnAgentUpdate; 100 public event UpdateAgent OnAgentUpdate;
101 public event AgentRequestSit OnAgentRequestSit; 101 public event AgentRequestSit OnAgentRequestSit;
@@ -234,7 +234,7 @@ namespace OpenSim.Tests.Common.Mock
234 public event ScriptReset OnScriptReset; 234 public event ScriptReset OnScriptReset;
235 public event GetScriptRunning OnGetScriptRunning; 235 public event GetScriptRunning OnGetScriptRunning;
236 public event SetScriptRunning OnSetScriptRunning; 236 public event SetScriptRunning OnSetScriptRunning;
237 public event UpdateVector OnAutoPilotGo; 237 public event Action<Vector3, bool> OnAutoPilotGo;
238 238
239 public event TerrainUnacked OnUnackedTerrain; 239 public event TerrainUnacked OnUnackedTerrain;
240 240
@@ -455,7 +455,7 @@ namespace OpenSim.Tests.Common.Mock
455 455
456 public void CompleteMovement() 456 public void CompleteMovement()
457 { 457 {
458 OnCompleteMovementToRegion(this); 458 OnCompleteMovementToRegion(this, true);
459 } 459 }
460 460
461 public virtual void ActivateGesture(UUID assetId, UUID gestureId) 461 public virtual void ActivateGesture(UUID assetId, UUID gestureId)
@@ -579,7 +579,7 @@ namespace OpenSim.Tests.Common.Mock
579 579
580 // Stage 2: add the new client as a child agent to the scene 580 // Stage 2: add the new client as a child agent to the scene
581 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene); 581 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene);
582 TeleportTargetScene.AddNewClient(TeleportSceneClient); 582 TeleportTargetScene.AddNewClient(TeleportSceneClient, PresenceType.User);
583 } 583 }
584 584
585 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 585 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
@@ -759,9 +759,10 @@ namespace OpenSim.Tests.Common.Mock
759 759
760 if (OnCompleteMovementToRegion != null) 760 if (OnCompleteMovementToRegion != null)
761 { 761 {
762 OnCompleteMovementToRegion(this); 762 OnCompleteMovementToRegion(this, true);
763 } 763 }
764 } 764 }
765
765 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 766 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
766 { 767 {
767 } 768 }
@@ -890,7 +891,7 @@ namespace OpenSim.Tests.Common.Mock
890 } 891 }
891 public void Close(bool sendStop) 892 public void Close(bool sendStop)
892 { 893 {
893 m_scene.RemoveClient(AgentId); 894 m_scene.RemoveClient(AgentId, true);
894 } 895 }
895 896
896 public void Start() 897 public void Start()
diff --git a/OpenSim/Tests/Common/TestHelper.cs b/OpenSim/Tests/Common/TestHelpers.cs
index 86bd107..ced06de 100644
--- a/OpenSim/Tests/Common/TestHelper.cs
+++ b/OpenSim/Tests/Common/TestHelpers.cs
@@ -32,7 +32,7 @@ using OpenMetaverse;
32 32
33namespace OpenSim.Tests.Common 33namespace OpenSim.Tests.Common
34{ 34{
35 public class TestHelper 35 public class TestHelpers
36 { 36 {
37 public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) 37 public static bool AssertThisDelegateCausesArgumentException(TestDelegate d)
38 { 38 {