aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Setup
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Setup')
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs9
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs94
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs150
3 files changed, 139 insertions, 114 deletions
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index 1188b62..1fc3cb5 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -38,12 +38,9 @@ namespace OpenSim.Tests.Common
38 /// <summary> 38 /// <summary>
39 /// Create an asset from the given data 39 /// Create an asset from the given data
40 /// </summary> 40 /// </summary>
41 /// <param name="assetUuid"></param> 41 public static AssetBase CreateAsset(UUID assetUuid, string data, UUID creatorID)
42 /// <param name="data"></param>
43 /// <returns></returns>
44 public static AssetBase CreateAsset(UUID assetUuid, string data)
45 { 42 {
46 AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object); 43 AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, creatorID.ToString());
47 asset.Data = Encoding.ASCII.GetBytes(data); 44 asset.Data = Encoding.ASCII.GetBytes(data);
48 return asset; 45 return asset;
49 } 46 }
@@ -56,7 +53,7 @@ namespace OpenSim.Tests.Common
56 /// <returns></returns> 53 /// <returns></returns>
57 public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog) 54 public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog)
58 { 55 {
59 AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object); 56 AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, sog.OwnerID.ToString());
60 asset.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)); 57 asset.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog));
61 return asset; 58 return asset;
62 } 59 }
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index b13e8dd..9e718f6 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -32,7 +32,7 @@ using Nini.Config;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Cache; 35
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
@@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.Avatar.Gods;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; 45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; 46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
47using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 47using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
48using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
48using OpenSim.Services.Interfaces; 49using OpenSim.Services.Interfaces;
49using OpenSim.Tests.Common.Mock; 50using OpenSim.Tests.Common.Mock;
50 51
@@ -60,7 +61,7 @@ namespace OpenSim.Tests.Common.Setup
60 private static ISharedRegionModule m_assetService = null; 61 private static ISharedRegionModule m_assetService = null;
61 private static ISharedRegionModule m_inventoryService = null; 62 private static ISharedRegionModule m_inventoryService = null;
62 private static ISharedRegionModule m_gridService = null; 63 private static ISharedRegionModule m_gridService = null;
63 private static TestCommunicationsManager commsManager = null; 64 private static ISharedRegionModule m_userAccountService = null;
64 65
65 /// <summary> 66 /// <summary>
66 /// Set up a test scene 67 /// Set up a test scene
@@ -83,21 +84,23 @@ namespace OpenSim.Tests.Common.Setup
83 public static TestScene SetupScene(String realServices) 84 public static TestScene SetupScene(String realServices)
84 { 85 {
85 return SetupScene( 86 return SetupScene(
86 "Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager(), realServices); 87 "Unit test region", UUID.Random(), 1000, 1000, realServices);
87 } 88 }
88 89
89 /// <summary> 90 // REFACTORING PROBLEM. No idea what the difference is with the previous one
90 /// Set up a test scene 91 ///// <summary>
91 /// </summary> 92 ///// Set up a test scene
92 /// 93 ///// </summary>
93 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> 94 /////
94 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> 95 ///// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
95 /// <returns></returns> 96 ///// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
96 public static TestScene SetupScene(TestCommunicationsManager cm, String realServices) 97 ///// <returns></returns>
97 { 98 //public static TestScene SetupScene(String realServices)
98 return SetupScene( 99 //{
99 "Unit test region", UUID.Random(), 1000, 1000, cm, ""); 100 // return SetupScene(
100 } 101 // "Unit test region", UUID.Random(), 1000, 1000, "");
102 //}
103
101 /// <summary> 104 /// <summary>
102 /// Set up a test scene 105 /// Set up a test scene
103 /// </summary> 106 /// </summary>
@@ -107,9 +110,9 @@ namespace OpenSim.Tests.Common.Setup
107 /// <param name="y">Y co-ordinate of the region</param> 110 /// <param name="y">Y co-ordinate of the region</param>
108 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> 111 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
109 /// <returns></returns> 112 /// <returns></returns>
110 public static TestScene SetupScene(string name, UUID id, uint x, uint y, TestCommunicationsManager cm) 113 public static TestScene SetupScene(string name, UUID id, uint x, uint y)
111 { 114 {
112 return SetupScene(name, id, x, y, cm, ""); 115 return SetupScene(name, id, x, y,"");
113 } 116 }
114 117
115 118
@@ -125,23 +128,24 @@ namespace OpenSim.Tests.Common.Setup
125 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> 128 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
126 /// <returns></returns> 129 /// <returns></returns>
127 public static TestScene SetupScene( 130 public static TestScene SetupScene(
128 string name, UUID id, uint x, uint y, TestCommunicationsManager cm, String realServices) 131 string name, UUID id, uint x, uint y, String realServices)
129 { 132 {
130 bool newScene = false; 133 bool newScene = false;
131 134
132 Console.WriteLine("Setting up test scene {0}", name); 135 Console.WriteLine("Setting up test scene {0}", name);
133 136
134 // If cm is the same as our last commsManager used, this means the tester wants to link 137 // REFACTORING PROBLEM!
135 // regions. In this case, don't use the sameshared region modules and dont initialize them again. 138 //// If cm is the same as our last commsManager used, this means the tester wants to link
136 // Also, no need to start another MainServer and MainConsole instance. 139 //// regions. In this case, don't use the sameshared region modules and dont initialize them again.
137 if (cm == null || cm != commsManager) 140 //// Also, no need to start another MainServer and MainConsole instance.
138 { 141 //if (cm == null || cm != commsManager)
139 System.Console.WriteLine("Starting a brand new scene"); 142 //{
140 newScene = true; 143 // System.Console.WriteLine("Starting a brand new scene");
141 MainConsole.Instance = new LocalConsole("TEST PROMPT"); 144 // newScene = true;
142 MainServer.Instance = new BaseHttpServer(980); 145 // MainConsole.Instance = new LocalConsole("TEST PROMPT");
143 commsManager = cm; 146 // MainServer.Instance = new BaseHttpServer(980);
144 } 147 // commsManager = cm;
148 //}
145 149
146 // We must set up a console otherwise setup of some modules may fail 150 // We must set up a console otherwise setup of some modules may fail
147 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); 151 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
@@ -149,13 +153,13 @@ namespace OpenSim.Tests.Common.Setup
149 regInfo.RegionID = id; 153 regInfo.RegionID = id;
150 154
151 AgentCircuitManager acm = new AgentCircuitManager(); 155 AgentCircuitManager acm = new AgentCircuitManager();
152 SceneCommunicationService scs = new SceneCommunicationService(cm); 156 SceneCommunicationService scs = new SceneCommunicationService();
153 157
154 StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); 158 StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", "");
155 IConfigSource configSource = new IniConfigSource(); 159 IConfigSource configSource = new IniConfigSource();
156 160
157 TestScene testScene = new TestScene( 161 TestScene testScene = new TestScene(
158 regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null); 162 regInfo, acm, scs, sm, null, false, false, false, configSource, null);
159 163
160 INonSharedRegionModule capsModule = new CapabilitiesModule(); 164 INonSharedRegionModule capsModule = new CapabilitiesModule();
161 capsModule.Initialise(new IniConfigSource()); 165 capsModule.Initialise(new IniConfigSource());
@@ -181,6 +185,8 @@ namespace OpenSim.Tests.Common.Setup
181 StartInventoryService(testScene, false); 185 StartInventoryService(testScene, false);
182 if (realServices.Contains("grid")) 186 if (realServices.Contains("grid"))
183 StartGridService(testScene, true); 187 StartGridService(testScene, true);
188 if (realServices.Contains("useraccounts"))
189 StartUserAccountService(testScene, true);
184 190
185 } 191 }
186 // If not, make sure the shared module gets references to this new scene 192 // If not, make sure the shared module gets references to this new scene
@@ -194,8 +200,6 @@ namespace OpenSim.Tests.Common.Setup
194 m_inventoryService.PostInitialise(); 200 m_inventoryService.PostInitialise();
195 m_assetService.PostInitialise(); 201 m_assetService.PostInitialise();
196 202
197 testScene.CommsManager.UserService.SetInventoryService(testScene.InventoryService);
198
199 testScene.SetModuleInterfaces(); 203 testScene.SetModuleInterfaces();
200 204
201 testScene.LandChannel = new TestLandChannel(testScene); 205 testScene.LandChannel = new TestLandChannel(testScene);
@@ -269,6 +273,28 @@ namespace OpenSim.Tests.Common.Setup
269 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 273 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
270 } 274 }
271 275
276 private static void StartUserAccountService(Scene testScene, bool real)
277 {
278 IConfigSource config = new IniConfigSource();
279 config.AddConfig("Modules");
280 config.AddConfig("UserAccountService");
281 config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
282 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
283 if (real)
284 config.Configs["UserAccountService"].Set("LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
285 if (m_userAccountService == null)
286 {
287 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
288 userAccountService.Initialise(config);
289 m_userAccountService = userAccountService;
290 }
291 //else
292 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
293 m_userAccountService.AddRegion(testScene);
294 m_userAccountService.RegionLoaded(testScene);
295 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
296 }
297
272 298
273 /// <summary> 299 /// <summary>
274 /// Setup modules for a scene using their default settings. 300 /// Setup modules for a scene using their default settings.
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index cb76bc1..cd61fa6 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -27,8 +27,7 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework.Communications; 29using OpenSim.Framework.Communications;
30using OpenSim.Framework.Communications.Cache; 30
31using OpenSim.Region.Communications.Local;
32 31
33namespace OpenSim.Tests.Common.Setup 32namespace OpenSim.Tests.Common.Setup
34{ 33{
@@ -37,82 +36,85 @@ namespace OpenSim.Tests.Common.Setup
37 /// </summary> 36 /// </summary>
38 public static class UserProfileTestUtils 37 public static class UserProfileTestUtils
39 { 38 {
40 /// <summary> 39 // REFACTORING PROBLEM
41 /// Create a test user with a standard inventory 40 // This needs to be rewritten
42 /// </summary> 41
43 /// <param name="commsManager"></param> 42 ///// <summary>
44 /// <param name="callback"> 43 ///// Create a test user with a standard inventory
45 /// Callback to invoke when inventory has been loaded. This is required because 44 ///// </summary>
46 /// loading may be asynchronous, even on standalone 45 ///// <param name="commsManager"></param>
47 /// </param> 46 ///// <param name="callback">
48 /// <returns></returns> 47 ///// Callback to invoke when inventory has been loaded. This is required because
49 public static CachedUserInfo CreateUserWithInventory( 48 ///// loading may be asynchronous, even on standalone
50 CommunicationsManager commsManager, OnInventoryReceivedDelegate callback) 49 ///// </param>
51 { 50 ///// <returns></returns>
52 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); 51 //public static CachedUserInfo CreateUserWithInventory(
53 return CreateUserWithInventory(commsManager, userId, callback); 52 // CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
54 } 53 //{
54 // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
55 // return CreateUserWithInventory(commsManager, userId, callback);
56 //}
55 57
56 /// <summary> 58 ///// <summary>
57 /// Create a test user with a standard inventory 59 ///// Create a test user with a standard inventory
58 /// </summary> 60 ///// </summary>
59 /// <param name="commsManager"></param> 61 ///// <param name="commsManager"></param>
60 /// <param name="userId">User ID</param> 62 ///// <param name="userId">User ID</param>
61 /// <param name="callback"> 63 ///// <param name="callback">
62 /// Callback to invoke when inventory has been loaded. This is required because 64 ///// Callback to invoke when inventory has been loaded. This is required because
63 /// loading may be asynchronous, even on standalone 65 ///// loading may be asynchronous, even on standalone
64 /// </param> 66 ///// </param>
65 /// <returns></returns> 67 ///// <returns></returns>
66 public static CachedUserInfo CreateUserWithInventory( 68 //public static CachedUserInfo CreateUserWithInventory(
67 CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback) 69 // CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
68 { 70 //{
69 return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback); 71 // return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
70 } 72 //}
71 73
72 /// <summary> 74 ///// <summary>
73 /// Create a test user with a standard inventory 75 ///// Create a test user with a standard inventory
74 /// </summary> 76 ///// </summary>
75 /// <param name="commsManager"></param> 77 ///// <param name="commsManager"></param>
76 /// <param name="firstName">First name of user</param> 78 ///// <param name="firstName">First name of user</param>
77 /// <param name="lastName">Last name of user</param> 79 ///// <param name="lastName">Last name of user</param>
78 /// <param name="userId">User ID</param> 80 ///// <param name="userId">User ID</param>
79 /// <param name="callback"> 81 ///// <param name="callback">
80 /// Callback to invoke when inventory has been loaded. This is required because 82 ///// Callback to invoke when inventory has been loaded. This is required because
81 /// loading may be asynchronous, even on standalone 83 ///// loading may be asynchronous, even on standalone
82 /// </param> 84 ///// </param>
83 /// <returns></returns> 85 ///// <returns></returns>
84 public static CachedUserInfo CreateUserWithInventory( 86 //public static CachedUserInfo CreateUserWithInventory(
85 CommunicationsManager commsManager, string firstName, string lastName, 87 // CommunicationsManager commsManager, string firstName, string lastName,
86 UUID userId, OnInventoryReceivedDelegate callback) 88 // UUID userId, OnInventoryReceivedDelegate callback)
87 { 89 //{
88 return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback); 90 // return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
89 } 91 //}
90 92
91 /// <summary> 93 ///// <summary>
92 /// Create a test user with a standard inventory 94 ///// Create a test user with a standard inventory
93 /// </summary> 95 ///// </summary>
94 /// <param name="commsManager"></param> 96 ///// <param name="commsManager"></param>
95 /// <param name="firstName">First name of user</param> 97 ///// <param name="firstName">First name of user</param>
96 /// <param name="lastName">Last name of user</param> 98 ///// <param name="lastName">Last name of user</param>
97 /// <param name="password">Password</param> 99 ///// <param name="password">Password</param>
98 /// <param name="userId">User ID</param> 100 ///// <param name="userId">User ID</param>
99 /// <param name="callback"> 101 ///// <param name="callback">
100 /// Callback to invoke when inventory has been loaded. This is required because 102 ///// Callback to invoke when inventory has been loaded. This is required because
101 /// loading may be asynchronous, even on standalone 103 ///// loading may be asynchronous, even on standalone
102 /// </param> 104 ///// </param>
103 /// <returns></returns> 105 ///// <returns></returns>
104 public static CachedUserInfo CreateUserWithInventory( 106 //public static CachedUserInfo CreateUserWithInventory(
105 CommunicationsManager commsManager, string firstName, string lastName, string password, 107 // CommunicationsManager commsManager, string firstName, string lastName, string password,
106 UUID userId, OnInventoryReceivedDelegate callback) 108 // UUID userId, OnInventoryReceivedDelegate callback)
107 { 109 //{
108 LocalUserServices lus = (LocalUserServices)commsManager.UserService; 110 // LocalUserServices lus = (LocalUserServices)commsManager.UserService;
109 lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId); 111 // lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
110 112
111 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); 113 // CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
112 userInfo.OnInventoryReceived += callback; 114 // userInfo.OnInventoryReceived += callback;
113 userInfo.FetchInventory(); 115 // userInfo.FetchInventory();
114 116
115 return userInfo; 117 // return userInfo;
116 } 118 //}
117 } 119 }
118} 120}