aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
diff options
context:
space:
mode:
authorSean Dague2009-02-26 21:29:16 +0000
committerSean Dague2009-02-26 21:29:16 +0000
commit57ab79e3312d9856a3534a1e2343b45c6cf74ac6 (patch)
tree470f8e5afc93a0604aa1b6cdf5dde9530de1898e /OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
parent* Apply http://opensimulator.org/mantis/view.php?id=3191 (diff)
downloadopensim-SC_OLD-57ab79e3312d9856a3534a1e2343b45c6cf74ac6.zip
opensim-SC_OLD-57ab79e3312d9856a3534a1e2343b45c6cf74ac6.tar.gz
opensim-SC_OLD-57ab79e3312d9856a3534a1e2343b45c6cf74ac6.tar.bz2
opensim-SC_OLD-57ab79e3312d9856a3534a1e2343b45c6cf74ac6.tar.xz
* Update ScenePresenceTests to reflect current REST communication workflow.
* Fixed an issue with AssetCache where it would break unit tests randomly. From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>
Diffstat (limited to '')
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs113
1 files changed, 58 insertions, 55 deletions
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index b52c081..bcc9426 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -40,12 +40,12 @@ using OpenSim.Region.CoreModules.Agent.Capabilities;
40using OpenSim.Tests.Common.Mock; 40using OpenSim.Tests.Common.Mock;
41 41
42namespace OpenSim.Tests.Common.Setup 42namespace OpenSim.Tests.Common.Setup
43{ 43{
44 /// <summary> 44 /// <summary>
45 /// Helpers for setting up scenes. 45 /// Helpers for setting up scenes.
46 /// </summary> 46 /// </summary>
47 public class SceneSetupHelpers 47 public class SceneSetupHelpers
48 { 48 {
49 /// <summary> 49 /// <summary>
50 /// Set up a test scene 50 /// Set up a test scene
51 /// </summary> 51 /// </summary>
@@ -54,7 +54,7 @@ namespace OpenSim.Tests.Common.Setup
54 { 54 {
55 return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); 55 return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager());
56 } 56 }
57 57
58 /// <summary> 58 /// <summary>
59 /// Set up a test scene 59 /// Set up a test scene
60 /// </summary> 60 /// </summary>
@@ -69,32 +69,32 @@ namespace OpenSim.Tests.Common.Setup
69 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); 69 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
70 regInfo.RegionName = name; 70 regInfo.RegionName = name;
71 regInfo.RegionID = id; 71 regInfo.RegionID = id;
72 72
73 AgentCircuitManager acm = new AgentCircuitManager(); 73 AgentCircuitManager acm = new AgentCircuitManager();
74 SceneCommunicationService scs = new SceneCommunicationService(cm); 74 SceneCommunicationService scs = new SceneCommunicationService(cm);
75 75
76 StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); 76 StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", "");
77 IConfigSource configSource = new IniConfigSource(); 77 IConfigSource configSource = new IniConfigSource();
78 78
79 TestScene testScene = new TestScene( 79 TestScene testScene = new TestScene(
80 regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null); 80 regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null);
81 81
82 IRegionModule capsModule = new CapabilitiesModule(); 82 IRegionModule capsModule = new CapabilitiesModule();
83 capsModule.Initialise(testScene, new IniConfigSource()); 83 capsModule.Initialise(testScene, new IniConfigSource());
84 testScene.AddModule(capsModule.Name, capsModule); 84 testScene.AddModule(capsModule.Name, capsModule);
85 testScene.SetModuleInterfaces(); 85 testScene.SetModuleInterfaces();
86 86
87 testScene.LandChannel = new TestLandChannel(); 87 testScene.LandChannel = new TestLandChannel();
88 testScene.LoadWorldMap(); 88 testScene.LoadWorldMap();
89 89
90 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); 90 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
91 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); 91 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
92 testScene.PhysicsScene 92 testScene.PhysicsScene
93 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); 93 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test");
94 94
95 return testScene; 95 return testScene;
96 } 96 }
97 97
98 /// <summary> 98 /// <summary>
99 /// Setup modules for a scene using their default settings. 99 /// Setup modules for a scene using their default settings.
100 /// </summary> 100 /// </summary>
@@ -102,9 +102,9 @@ namespace OpenSim.Tests.Common.Setup
102 /// <param name="modules"></param> 102 /// <param name="modules"></param>
103 public static void SetupSceneModules(Scene scene, params IRegionModule[] modules) 103 public static void SetupSceneModules(Scene scene, params IRegionModule[] modules)
104 { 104 {
105 SetupSceneModules(scene, null, modules); 105 SetupSceneModules(scene, null, modules);
106 } 106 }
107 107
108 /// <summary> 108 /// <summary>
109 /// Setup modules for a scene. 109 /// Setup modules for a scene.
110 /// </summary> 110 /// </summary>
@@ -115,13 +115,13 @@ namespace OpenSim.Tests.Common.Setup
115 { 115 {
116 foreach (IRegionModule module in modules) 116 foreach (IRegionModule module in modules)
117 { 117 {
118 module.Initialise(scene, config); 118 module.Initialise(scene, config);
119 scene.AddModule(module.Name, module); 119 scene.AddModule(module.Name, module);
120 } 120 }
121 121
122 scene.SetModuleInterfaces(); 122 scene.SetModuleInterfaces();
123 } 123 }
124 124
125 /// <summary> 125 /// <summary>
126 /// Generate some standard agent connection data. 126 /// Generate some standard agent connection data.
127 /// </summary> 127 /// </summary>
@@ -130,7 +130,7 @@ namespace OpenSim.Tests.Common.Setup
130 public static AgentCircuitData GenerateAgentData(UUID agentId) 130 public static AgentCircuitData GenerateAgentData(UUID agentId)
131 { 131 {
132 string firstName = "testfirstname"; 132 string firstName = "testfirstname";
133 133
134 AgentCircuitData agentData = new AgentCircuitData(); 134 AgentCircuitData agentData = new AgentCircuitData();
135 agentData.AgentID = agentId; 135 agentData.AgentID = agentId;
136 agentData.firstname = firstName; 136 agentData.firstname = firstName;
@@ -142,10 +142,10 @@ namespace OpenSim.Tests.Common.Setup
142 agentData.InventoryFolder = UUID.Zero; 142 agentData.InventoryFolder = UUID.Zero;
143 agentData.startpos = Vector3.Zero; 143 agentData.startpos = Vector3.Zero;
144 agentData.CapsPath = "http://wibble.com"; 144 agentData.CapsPath = "http://wibble.com";
145 145
146 return agentData; 146 return agentData;
147 } 147 }
148 148
149 /// <summary> 149 /// <summary>
150 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test 150 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test
151 /// </summary> 151 /// </summary>
@@ -153,55 +153,58 @@ namespace OpenSim.Tests.Common.Setup
153 /// <param name="agentId"></param> 153 /// <param name="agentId"></param>
154 /// <returns></returns> 154 /// <returns></returns>
155 public static TestClient AddRootAgent(Scene scene, UUID agentId) 155 public static TestClient AddRootAgent(Scene scene, UUID agentId)
156 { 156 {
157 return AddRootAgent(scene, GenerateAgentData(agentId)); 157 return AddRootAgent(scene, GenerateAgentData(agentId));
158 } 158 }
159 159
160 /// <summary> 160 /// <summary>
161 /// Add a root agent. 161 /// Add a root agent.
162 /// </summary> 162 /// </summary>
163 /// 163 ///
164 /// This function 164 /// This function
165 /// 165 ///
166 /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the 166 /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
167 /// userserver if grid) would give initial login data back to the client and separately tell the scene that the 167 /// userserver if grid) would give initial login data back to the client and separately tell the scene that the
168 /// agent was coming. 168 /// agent was coming.
169 /// 169 ///
170 /// 2) Connects the agent with the scene 170 /// 2) Connects the agent with the scene
171 /// 171 ///
172 /// This function performs actions equivalent with notifying the scene that an agent is 172 /// This function performs actions equivalent with notifying the scene that an agent is
173 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first 173 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first
174 /// 174 ///
175 /// <param name="scene"></param> 175 /// <param name="scene"></param>
176 /// <param name="agentData"></param> 176 /// <param name="agentData"></param>
177 /// <returns></returns> 177 /// <returns></returns>
178 public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData) 178 public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData)
179 { 179 {
180 // We emulate the proper login sequence here by doing things in three stages 180 // We emulate the proper login sequence here by doing things in three stages
181 // Stage 1: simulate login by telling the scene to expect a new user connection 181 // Stage 1: simulate login by telling the scene to expect a new user connection
182 scene.NewUserConnection(agentData); 182 scene.NewUserConnection(agentData);
183 183
184 // Stage 2: add the new client as a child agent to the scene 184 // Stage 2: add the new client as a child agent to the scene
185 TestClient client = new TestClient(agentData, scene); 185 TestClient client = new TestClient(agentData, scene);
186 scene.AddNewClient(client); 186 scene.AddNewClient(client);
187 187
188 // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, 188 // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,
189 // inventory, etc.) 189 // inventory, etc.)
190 scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); 190 //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
191 191
192 return client; 192 ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
193 scp.MakeRootAgent(new Vector3(90,90,90), true);
194
195 return client;
193 } 196 }
194 197
195 /// <summary> 198 /// <summary>
196 /// Add a test object 199 /// Add a test object
197 /// </summary> 200 /// </summary>
198 /// <param name="scene"></param> 201 /// <param name="scene"></param>
199 /// <returns></returns> 202 /// <returns></returns>
200 public static SceneObjectPart AddSceneObject(Scene scene) 203 public static SceneObjectPart AddSceneObject(Scene scene)
201 { 204 {
202 return AddSceneObject(scene, "Test Object"); 205 return AddSceneObject(scene, "Test Object");
203 } 206 }
204 207
205 /// <summary> 208 /// <summary>
206 /// Add a test object 209 /// Add a test object
207 /// </summary> 210 /// </summary>
@@ -209,19 +212,19 @@ namespace OpenSim.Tests.Common.Setup
209 /// <param name="name"></param> 212 /// <param name="name"></param>
210 /// <returns></returns> 213 /// <returns></returns>
211 public static SceneObjectPart AddSceneObject(Scene scene, string name) 214 public static SceneObjectPart AddSceneObject(Scene scene, string name)
212 { 215 {
213 SceneObjectPart part 216 SceneObjectPart part
214 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); 217 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
215 part.Name = name; 218 part.Name = name;
216 219
217 //part.UpdatePrimFlags(false, false, true); 220 //part.UpdatePrimFlags(false, false, true);
218 //part.ObjectFlags |= (uint)PrimFlags.Phantom; 221 //part.ObjectFlags |= (uint)PrimFlags.Phantom;
219 222
220 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 223 scene.AddNewSceneObject(new SceneObjectGroup(part), false);
221 224
222 return part; 225 return part;
223 } 226 }
224 227
225 /// <summary> 228 /// <summary>
226 /// Delete a scene object asynchronously 229 /// Delete a scene object asynchronously
227 /// </summary> 230 /// </summary>
@@ -238,7 +241,7 @@ namespace OpenSim.Tests.Common.Setup
238 sogd.Enabled = false; 241 sogd.Enabled = false;
239 242
240 scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId); 243 scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId);
241 sogd.InventoryDeQueueAndDelete(); 244 sogd.InventoryDeQueueAndDelete();
242 } 245 }
243 } 246 }
244} 247}