aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Setup
diff options
context:
space:
mode:
authorSean McNamara2011-04-23 18:33:08 -0400
committerSean McNamara2011-04-23 18:33:08 -0400
commitd287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9 (patch)
tree30a24bf66050c66ebe74b68745c4f1764fe09181 /OpenSim/Tests/Common/Setup
parentAutoBackup: Removed unneeded imports. (diff)
parentAdded MaxAgents configuration option to RegionConfig.ini allowing region host... (diff)
downloadopensim-SC_OLD-d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9.zip
opensim-SC_OLD-d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9.tar.gz
opensim-SC_OLD-d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9.tar.bz2
opensim-SC_OLD-d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9.tar.xz
Merge git://opensimulator.org/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs38
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs98
2 files changed, 63 insertions, 73 deletions
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index ff4423f..d572249 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -30,6 +30,7 @@ using OpenMetaverse;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Scenes.Serialization; 32using OpenSim.Region.Framework.Scenes.Serialization;
33using OpenSim.Services.Interfaces;
33 34
34namespace OpenSim.Tests.Common 35namespace OpenSim.Tests.Common
35{ 36{
@@ -55,7 +56,7 @@ namespace OpenSim.Tests.Common
55 AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); 56 AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
56 scene.AssetService.Store(asset); 57 scene.AssetService.Store(asset);
57 return asset; 58 return asset;
58 } 59 }
59 60
60 /// <summary> 61 /// <summary>
61 /// Create an asset from the given scene object. 62 /// Create an asset from the given scene object.
@@ -71,6 +72,35 @@ namespace OpenSim.Tests.Common
71 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)), 72 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)),
72 sog.OwnerID); 73 sog.OwnerID);
73 } 74 }
75
76 /// <summary>
77 /// Create an asset from the given scene object.
78 /// </summary>
79 /// <param name="assetUuidTailZ">
80 /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
81 /// will be used.
82 /// </param>
83 /// <param name="coa"></param>
84 /// <returns></returns>
85 public static AssetBase CreateAsset(int assetUuidTail, CoalescedSceneObjects coa)
86 {
87 return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), coa);
88 }
89
90 /// <summary>
91 /// Create an asset from the given scene object.
92 /// </summary>
93 /// <param name="assetUuid"></param>
94 /// <param name="coa"></param>
95 /// <returns></returns>
96 public static AssetBase CreateAsset(UUID assetUuid, CoalescedSceneObjects coa)
97 {
98 return CreateAsset(
99 assetUuid,
100 AssetType.Object,
101 Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)),
102 coa.CreatorId);
103 }
74 104
75 /// <summary> 105 /// <summary>
76 /// Create an asset from the given data. 106 /// Create an asset from the given data.
@@ -89,5 +119,11 @@ namespace OpenSim.Tests.Common
89 asset.Data = data; 119 asset.Data = data;
90 return asset; 120 return asset;
91 } 121 }
122
123 public static string ReadAssetAsString(IAssetService assetService, UUID uuid)
124 {
125 byte[] assetData = assetService.GetData(uuid.ToString());
126 return Encoding.ASCII.GetString(assetData);
127 }
92 } 128 }
93} 129}
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 709dd78..99517d2 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -66,32 +66,7 @@ namespace OpenSim.Tests.Common.Setup
66 /// <returns></returns> 66 /// <returns></returns>
67 public static TestScene SetupScene() 67 public static TestScene SetupScene()
68 { 68 {
69 return SetupScene(""); 69 return SetupScene("Unit test region", UUID.Random(), 1000, 1000);
70 }
71
72 /// <summary>
73 /// Set up a test scene
74 /// </summary>
75 ///
76 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
77 /// <returns></returns>
78 public static TestScene SetupScene(String realServices)
79 {
80 return SetupScene("Unit test region", UUID.Random(), 1000, 1000, realServices);
81 }
82
83 /// <summary>
84 /// Set up a test scene
85 /// </summary>
86 /// <param name="name">Name of the region</param>
87 /// <param name="id">ID of the region</param>
88 /// <param name="x">X co-ordinate of the region</param>
89 /// <param name="y">Y co-ordinate of the region</param>
90 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
91 /// <returns></returns>
92 public static TestScene SetupScene(string name, UUID id, uint x, uint y)
93 {
94 return SetupScene(name, id, x, y, "");
95 } 70 }
96 71
97 /// <summary> 72 /// <summary>
@@ -103,10 +78,8 @@ namespace OpenSim.Tests.Common.Setup
103 /// <param name="x">X co-ordinate of the region</param> 78 /// <param name="x">X co-ordinate of the region</param>
104 /// <param name="y">Y co-ordinate of the region</param> 79 /// <param name="y">Y co-ordinate of the region</param>
105 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> 80 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
106 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
107 /// <returns></returns> 81 /// <returns></returns>
108 public static TestScene SetupScene( 82 public static TestScene SetupScene(string name, UUID id, uint x, uint y)
109 string name, UUID id, uint x, uint y, String realServices)
110 { 83 {
111 Console.WriteLine("Setting up test scene {0}", name); 84 Console.WriteLine("Setting up test scene {0}", name);
112 85
@@ -130,15 +103,11 @@ namespace OpenSim.Tests.Common.Setup
130 IRegionModule godsModule = new GodsModule(); 103 IRegionModule godsModule = new GodsModule();
131 godsModule.Initialise(testScene, new IniConfigSource()); 104 godsModule.Initialise(testScene, new IniConfigSource());
132 testScene.AddModule(godsModule.Name, godsModule); 105 testScene.AddModule(godsModule.Name, godsModule);
133 realServices = realServices.ToLower();
134
135 LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset"));
136
137 // For now, always started a 'real' authentication service
138 StartAuthenticationService(testScene, true);
139 106
140 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory")); 107 LocalAssetServicesConnector assetService = StartAssetService(testScene);
141 StartGridService(testScene, true); 108 StartAuthenticationService(testScene);
109 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene);
110 StartGridService(testScene);
142 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); 111 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
143 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); 112 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
144 113
@@ -164,18 +133,17 @@ namespace OpenSim.Tests.Common.Setup
164 return testScene; 133 return testScene;
165 } 134 }
166 135
167 private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real) 136 private static LocalAssetServicesConnector StartAssetService(Scene testScene)
168 { 137 {
169 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); 138 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
170 IConfigSource config = new IniConfigSource(); 139 IConfigSource config = new IniConfigSource();
171 config.AddConfig("Modules"); 140
141 config.AddConfig("Modules");
142 config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
172 config.AddConfig("AssetService"); 143 config.AddConfig("AssetService");
173 config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); 144 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
174 if (real)
175 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
176 else
177 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
178 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 145 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
146
179 assetService.Initialise(config); 147 assetService.Initialise(config);
180 assetService.AddRegion(testScene); 148 assetService.AddRegion(testScene);
181 assetService.RegionLoaded(testScene); 149 assetService.RegionLoaded(testScene);
@@ -184,20 +152,18 @@ namespace OpenSim.Tests.Common.Setup
184 return assetService; 152 return assetService;
185 } 153 }
186 154
187 private static void StartAuthenticationService(Scene testScene, bool real) 155 private static void StartAuthenticationService(Scene testScene)
188 { 156 {
189 ISharedRegionModule service = new LocalAuthenticationServicesConnector(); 157 ISharedRegionModule service = new LocalAuthenticationServicesConnector();
190 IConfigSource config = new IniConfigSource(); 158 IConfigSource config = new IniConfigSource();
159
191 config.AddConfig("Modules"); 160 config.AddConfig("Modules");
192 config.AddConfig("AuthenticationService"); 161 config.AddConfig("AuthenticationService");
193 config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); 162 config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector");
194 if (real) 163 config.Configs["AuthenticationService"].Set(
195 config.Configs["AuthenticationService"].Set( 164 "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
196 "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
197 else
198 config.Configs["AuthenticationService"].Set(
199 "LocalServiceModule", "OpenSim.Tests.Common.dll:MockAuthenticationService");
200 config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 165 config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
166
201 service.Initialise(config); 167 service.Initialise(config);
202 service.AddRegion(testScene); 168 service.AddRegion(testScene);
203 service.RegionLoaded(testScene); 169 service.RegionLoaded(testScene);
@@ -205,24 +171,17 @@ namespace OpenSim.Tests.Common.Setup
205 //m_authenticationService = service; 171 //m_authenticationService = service;
206 } 172 }
207 173
208 private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real) 174 private static LocalInventoryServicesConnector StartInventoryService(Scene testScene)
209 { 175 {
210 LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); 176 LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();
211 IConfigSource config = new IniConfigSource(); 177
178 IConfigSource config = new IniConfigSource();
212 config.AddConfig("Modules"); 179 config.AddConfig("Modules");
213 config.AddConfig("InventoryService"); 180 config.AddConfig("InventoryService");
214 config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); 181 config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
215 182 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
216 if (real)
217 {
218 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
219 }
220 else
221 {
222 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService");
223 }
224
225 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 183 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
184
226 inventoryService.Initialise(config); 185 inventoryService.Initialise(config);
227 inventoryService.AddRegion(testScene); 186 inventoryService.AddRegion(testScene);
228 inventoryService.RegionLoaded(testScene); 187 inventoryService.RegionLoaded(testScene);
@@ -231,24 +190,19 @@ namespace OpenSim.Tests.Common.Setup
231 return inventoryService; 190 return inventoryService;
232 } 191 }
233 192
234 private static LocalGridServicesConnector StartGridService(Scene testScene, bool real) 193 private static LocalGridServicesConnector StartGridService(Scene testScene)
235 { 194 {
236 IConfigSource config = new IniConfigSource(); 195 IConfigSource config = new IniConfigSource();
237 config.AddConfig("Modules"); 196 config.AddConfig("Modules");
238 config.AddConfig("GridService"); 197 config.AddConfig("GridService");
239 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); 198 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
240 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); 199 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
241 if (real) 200 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
242 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
243 201
244 LocalGridServicesConnector gridService = new LocalGridServicesConnector(); 202 LocalGridServicesConnector gridService = new LocalGridServicesConnector();
245 gridService.Initialise(config); 203 gridService.Initialise(config);
246
247 //else
248 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
249 gridService.AddRegion(testScene); 204 gridService.AddRegion(testScene);
250 gridService.RegionLoaded(testScene); 205 gridService.RegionLoaded(testScene);
251 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
252 206
253 return gridService; 207 return gridService;
254 } 208 }
@@ -472,10 +426,10 @@ namespace OpenSim.Tests.Common.Setup
472 /// <param name="ownerId"></param> 426 /// <param name="ownerId"></param>
473 /// <returns></returns> 427 /// <returns></returns>
474 public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) 428 public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId)
475 { 429 {
476 return new SceneObjectPart( 430 return new SceneObjectPart(
477 ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 431 ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
478 { Name = name, UUID = id }; 432 { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) };
479 } 433 }
480 434
481 /// <summary> 435 /// <summary>