30 using System.Collections.Generic;
33 using OpenSim.Data.Null;
34 using OpenSim.Framework;
36 using OpenSim.Framework.Console;
37 using OpenSim.Framework.Servers;
38 using OpenSim.Framework.Servers.HttpServer;
39 using OpenSim.Region.PhysicsModules.SharedBase;
40 using OpenSim.Region.Framework;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Region.Framework.Scenes;
43 using OpenSim.Region.CoreModules.Avatar.Gods;
44 using OpenSim.Region.CoreModules.Asset;
45 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
46 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
47 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
48 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
49 using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
50 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
51 using OpenSim.Region.PhysicsModule.BasicPhysics;
52 using OpenSim.Services.Interfaces;
55 namespace OpenSim.Tests.Common
89 m_assetService = StartAssetService(cache);
90 m_authenticationService = StartAuthenticationService();
91 m_inventoryService = StartInventoryService();
92 m_gridService = StartGridService();
93 m_userAccountService = StartUserAccountService();
94 m_presenceService = StartPresenceService();
96 m_inventoryService.PostInitialise();
97 m_assetService.PostInitialise();
98 m_userAccountService.PostInitialise();
99 m_presenceService.PostInitialise();
103 m_physicsScene = StartPhysicsScene();
118 return SetupScene(
"Unit test region",
UUID.Random(), 1000, 1000);
123 return SetupScene(name,
id, x, y,
new IniConfigSource());
143 string name, UUID
id, uint x, uint y, uint sizeX, uint sizeY, IConfigSource configSource)
145 Console.WriteLine(
"Setting up test scene {0}", name);
150 RegionInfo regInfo =
new RegionInfo(x, y,
new IPEndPoint(IPAddress.Loopback, 9000),
"127.0.0.1");
151 regInfo.RegionName = name;
152 regInfo.RegionID = id;
153 regInfo.RegionSizeX = sizeX;
154 regInfo.RegionSizeY = sizeY;
157 regInfo, m_acm, SimDataService, m_estateDataService, configSource, null);
160 godsModule.Initialise(
new IniConfigSource());
161 godsModule.AddRegion(testScene);
168 m_assetService.AddRegion(testScene);
172 m_cache.AddRegion(testScene);
173 m_cache.RegionLoaded(testScene);
174 testScene.AddRegionModule(m_cache.Name, m_cache);
177 m_assetService.RegionLoaded(testScene);
178 testScene.AddRegionModule(m_assetService.Name, m_assetService);
180 m_authenticationService.AddRegion(testScene);
181 m_authenticationService.RegionLoaded(testScene);
182 testScene.AddRegionModule(m_authenticationService.Name, m_authenticationService);
184 m_inventoryService.AddRegion(testScene);
185 m_inventoryService.RegionLoaded(testScene);
186 testScene.AddRegionModule(m_inventoryService.Name, m_inventoryService);
188 m_gridService.AddRegion(testScene);
189 m_gridService.RegionLoaded(testScene);
190 testScene.AddRegionModule(m_gridService.Name, m_gridService);
192 m_userAccountService.AddRegion(testScene);
193 m_userAccountService.RegionLoaded(testScene);
194 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
196 m_presenceService.AddRegion(testScene);
197 m_presenceService.RegionLoaded(testScene);
198 testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
200 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
201 testScene.SetModuleInterfaces();
204 testScene.LoadWorldMap();
207 testScene.LoginsEnabled =
true;
208 testScene.RegisterRegionWithGrid();
210 SceneManager.Add(testScene);
217 IConfigSource config =
new IniConfigSource();
218 config.AddConfig(
"Modules");
219 config.Configs[
"Modules"].Set(
"AssetServices",
"LocalAssetServicesConnector");
220 config.AddConfig(
"AssetService");
221 config.Configs[
"AssetService"].Set(
"LocalServiceModule",
"OpenSim.Services.AssetService.dll:AssetService");
222 config.Configs[
"AssetService"].Set(
"StorageProvider",
"OpenSim.Tests.Common.dll");
225 assetService.Initialise(config);
229 IConfigSource cacheConfig =
new IniConfigSource();
230 cacheConfig.AddConfig(
"Modules");
231 cacheConfig.Configs[
"Modules"].Set(
"AssetCaching",
"CoreAssetCache");
232 cacheConfig.AddConfig(
"AssetCache");
234 cache.Initialise(cacheConfig);
242 IConfigSource config =
new IniConfigSource();
243 config.AddConfig(
"Modules");
244 config.AddConfig(
"AuthenticationService");
245 config.Configs[
"Modules"].Set(
"AuthenticationServices",
"LocalAuthenticationServicesConnector");
246 config.Configs[
"AuthenticationService"].Set(
247 "LocalServiceModule",
"OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
248 config.Configs[
"AuthenticationService"].Set(
"StorageProvider",
"OpenSim.Data.Null.dll");
251 service.Initialise(config);
258 IConfigSource config =
new IniConfigSource();
259 config.AddConfig(
"Modules");
260 config.AddConfig(
"InventoryService");
261 config.Configs[
"Modules"].Set(
"InventoryServices",
"LocalInventoryServicesConnector");
262 config.Configs[
"InventoryService"].Set(
"LocalServiceModule",
"OpenSim.Services.InventoryService.dll:XInventoryService");
263 config.Configs[
"InventoryService"].Set(
"StorageProvider",
"OpenSim.Tests.Common.dll");
266 inventoryService.Initialise(config);
268 return inventoryService;
273 IConfigSource config =
new IniConfigSource();
274 config.AddConfig(
"Modules");
275 config.AddConfig(
"GridService");
276 config.Configs[
"Modules"].Set(
"GridServices",
"LocalGridServicesConnector");
277 config.Configs[
"GridService"].Set(
"StorageProvider",
"OpenSim.Data.Null.dll:NullRegionData");
278 config.Configs[
"GridService"].Set(
"LocalServiceModule",
"OpenSim.Services.GridService.dll:GridService");
279 config.Configs[
"GridService"].Set(
"ConnectionString",
"!static");
282 gridService.Initialise(config);
294 IConfigSource config =
new IniConfigSource();
295 config.AddConfig(
"Modules");
296 config.AddConfig(
"UserAccountService");
297 config.Configs[
"Modules"].Set(
"UserAccountServices",
"LocalUserAccountServicesConnector");
298 config.Configs[
"UserAccountService"].Set(
"StorageProvider",
"OpenSim.Data.Null.dll");
299 config.Configs[
"UserAccountService"].Set(
300 "LocalServiceModule",
"OpenSim.Services.UserAccountService.dll:UserAccountService");
303 userAccountService.Initialise(config);
305 return userAccountService;
317 NullPresenceData.Instance = null;
319 IConfigSource config =
new IniConfigSource();
320 config.AddConfig(
"Modules");
321 config.AddConfig(
"PresenceService");
322 config.Configs[
"Modules"].Set(
"PresenceServices",
"LocalPresenceServicesConnector");
323 config.Configs[
"PresenceService"].Set(
"StorageProvider",
"OpenSim.Data.Null.dll");
324 config.Configs[
"PresenceService"].Set(
325 "LocalServiceModule",
"OpenSim.Services.PresenceService.dll:PresenceService");
328 presenceService.Initialise(config);
330 return presenceService;
335 IConfigSource config =
new IniConfigSource();
336 config.AddConfig(
"Startup");
337 config.Configs[
"Startup"].Set(
"physics",
"basicphysics");
341 mod.Initialise(config);
353 SetupSceneModules(scene,
new IniConfigSource(), modules);
367 SetupSceneModules(
new Scene[] { scene }, config, modules);
377 SetupSceneModules(scenes,
new IniConfigSource(), modules);
395 List<IRegionModuleBase> newModules =
new List<IRegionModuleBase>();
396 foreach (
object module
in modules)
400 m.Initialise(config);
411 foreach (
Scene scene
in scenes)
413 module.AddRegion(scene);
414 scene.AddRegionModule(module.Name, module);
420 foreach (
Scene scene
in scenes)
421 module.RegionLoaded(scene);
423 foreach (
Scene scene
in scenes) { scene.SetModuleInterfaces(); }
435 acd.AgentID = agentId;
436 acd.firstname =
"testfirstname";
437 acd.lastname =
"testlastname";
438 acd.ServiceURLs =
new Dictionary<string, object>();
452 acd.AgentID = ua.PrincipalID;
453 acd.firstname = ua.FirstName;
454 acd.lastname = ua.LastName;
455 acd.ServiceURLs = ua.ServiceURLs;
465 acd.SessionID = UUID.Random();
466 acd.SecureSessionID = UUID.Random();
468 acd.circuitcode = 123;
469 acd.BaseFolder = UUID.Zero;
470 acd.InventoryFolder = UUID.Zero;
471 acd.startpos = Vector3.Zero;
472 acd.CapsPath =
"http://wibble.com";
490 return AddScenePresence(scene, GenerateAgentData(agentId));
501 return AddScenePresence(scene, GenerateAgentData(ua));
524 return AddScenePresence(scene,
new TestClient(agentData, scene), agentData);
560 sp.CompleteMovement(sp.ControllingClient,
true);
580 Console.WriteLine(
"NewUserConnection failed: " + reason);
583 scene.AddNewAgent(client, PresenceType.User);
585 return scene.GetScenePresence(client.AgentId);
590 return AddChildScenePresence(scene, GenerateAgentData(agentId));
599 return IntroduceClientToScene(scene, client, acd,
TeleportFlags.ViaLogin);
609 return AddSceneObject(scene,
"Test Object",
UUID.Random());
626 scene.AddNewSceneObject(so,
true);
650 SceneObjectGroup so = CreateSceneObject(parts, ownerId, partNamePrefix, uuidTail);
652 scene.AddNewSceneObject(so,
false);
668 { Name = name,
UUID = id,
Scale =
new Vector3(1, 1, 1) };
684 return CreateSceneObject(parts, ownerId, 0x1);
699 return CreateSceneObject(parts, ownerId,
"", uuidTail);
720 string rawSogId = string.Format(
"00000000-0000-0000-0000-{0:X12}", uuidTail);
724 CreateSceneObjectPart(
string.Format(
"{0}Part1", partNamePrefix),
new UUID(rawSogId), ownerId));
727 for (
int i = 2; i <= parts; i++)
729 CreateSceneObjectPart(
730 string.Format(
"{0}Part{1}", partNamePrefix, i),
731 new UUID(
string.Format(
"00000000-0000-0000-0000-{0:X12}", uuidTail + i - 1)),
static void SetupSceneModules(Scene[] scenes, params object[] modules)
Setup modules for a scene using their default settings.
static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
Create a scene object but do not add it to the scene.
static SceneObjectGroup AddSceneObject(Scene scene, int parts, UUID ownerId, string partNamePrefix, int uuidTail)
Add a test object
static void SetupSceneModules(Scene scene, params object[] modules)
Setup modules for a scene using their default settings.
OpenSim.Framework.Constants.TeleportFlags TeleportFlags
static ScenePresence AddScenePresence(Scene scene, IClientAPI client, AgentCircuitData agentData)
Add a root agent.
TestScene SetupScene(string name, UUID id, uint x, uint y)
OpenSim.Framework.RegionInfo RegionInfo
static void SetupSceneModules(Scene scene, IConfigSource config, params object[] modules)
Setup modules for a scene.
Contains the Avatar's Appearance and methods to manipulate the appearance.
TestScene SetupScene(string name, UUID id, uint x, uint y, IConfigSource configSource)
static PrimitiveBaseShape Default
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, string partNamePrefix, int uuidTail)
Create a scene object but do not add it to the scene.
OpenSim.Services.Interfaces.GridRegion GridRegion
TestScene SetupScene(string name, UUID id, uint x, uint y, uint sizeX, uint sizeY, IConfigSource configSource)
Set up a scene.
static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId)
Create a scene object part.
bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
Store session information.
static SceneObjectGroup AddSceneObject(Scene scene, string name, UUID ownerId)
Add a test object
static ScenePresence AddChildScenePresence(Scene scene, AgentCircuitData acd)
SceneHelpers(CoreAssetCache cache)
static SceneObjectGroup AddSceneObject(Scene scene)
Add a test object
Circuit data for an agent. Connection information shared between regions that accept UDP connections ...
Manager for adding, closing and restarting scenes.
static AgentCircuitData GenerateAgentData(UUID agentId)
Generate some standard agent connection data.
bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, GridRegion source, out string reason)
Do the work necessary to initiate a new user connection for a particular scene.
static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail)
Create a scene object but do not add it to the scene.
Helpers for setting up scenes.
IPresenceService PresenceService
This is a Fake console that's used when setting up the Scene in Unit Tests Don't use this except for ...
This is an incomplete extremely basic physics implementation
TestScene SetupScene()
Set up a test scene
static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
Add a root agent.
IPresenceService m_PresenceService
Underlying presence service. Do not use directly.
static ScenePresence AddScenePresence(Scene scene, UserAccount ua)
Add a root agent.
Land channel for test purposes
UUID AgentID
Avatar Unique Agent Identifier
static ScenePresence AddScenePresence(Scene scene, UUID agentId)
Add a root agent where the details of the agent connection (apart from the id) are unimportant for th...
static void SetupSceneModules(Scene[] scenes, IConfigSource config, params object[] modules)
Setup modules for scenes.
static AgentCircuitData GenerateAgentData(UserAccount ua)
Generate some standard agent connection data.
static ScenePresence AddChildScenePresence(Scene scene, UUID agentId)