aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/InventoryFolderBase.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs46
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs67
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs62
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs3
-rw-r--r--OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs97
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs2
8 files changed, 228 insertions, 61 deletions
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs
index 0edb2c6..3eef6f6 100644
--- a/OpenSim/Framework/InventoryFolderBase.cs
+++ b/OpenSim/Framework/InventoryFolderBase.cs
@@ -84,6 +84,14 @@ namespace OpenSim.Framework
84 Owner = owner; 84 Owner = owner;
85 } 85 }
86 86
87 public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent)
88 {
89 ID = id;
90 Name = name;
91 Owner = owner;
92 ParentID = parent;
93 }
94
87 public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version) 95 public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
88 { 96 {
89 ID = id; 97 ID = id;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index ff583e5..50c0f93 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
206 /// <summary> 206 /// <summary>
207 /// Replicate the inventory paths in the archive to the user's inventory as necessary. 207 /// Replicate the inventory paths in the archive to the user's inventory as necessary.
208 /// </summary> 208 /// </summary>
209 /// <param name="fsPath"></param> 209 /// <param name="archivePath">The item archive path to replicate</param>
210 /// <param name="isDir">Is the path we're dealing with a directory?</param> 210 /// <param name="isDir">Is the path we're dealing with a directory?</param>
211 /// <param name="rootDestinationFolder">The root folder for the inventory load</param> 211 /// <param name="rootDestinationFolder">The root folder for the inventory load</param>
212 /// <param name="foldersCreated"> 212 /// <param name="foldersCreated">
@@ -218,49 +218,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
218 /// </param> 218 /// </param>
219 /// <returns>The last user inventory folder created or found for the archive path</returns> 219 /// <returns>The last user inventory folder created or found for the archive path</returns>
220 public InventoryFolderBase ReplicateArchivePathToUserInventory( 220 public InventoryFolderBase ReplicateArchivePathToUserInventory(
221 string fsPath, 221 string archivePath,
222 bool isDir, 222 bool isDir,
223 InventoryFolderBase rootDestFolder, 223 InventoryFolderBase rootDestFolder,
224 Dictionary <string, InventoryFolderBase> foldersCreated, 224 Dictionary <string, InventoryFolderBase> foldersCreated,
225 List<InventoryNodeBase> nodesLoaded) 225 List<InventoryNodeBase> nodesLoaded)
226 { 226 {
227 fsPath = fsPath.Substring(ArchiveConstants.INVENTORY_PATH.Length); 227 archivePath = archivePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
228 228
229 // Remove the file portion if we aren't already dealing with a directory path 229 // Remove the file portion if we aren't already dealing with a directory path
230 if (!isDir) 230 if (!isDir)
231 fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1); 231 archivePath = archivePath.Remove(archivePath.LastIndexOf("/") + 1);
232 232
233 string originalFsPath = fsPath; 233 string originalArchivePath = archivePath;
234 234
235 m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath); 235 m_log.DebugFormat(
236 "[INVENTORY ARCHIVER]: Loading to folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
236 237
237 InventoryFolderBase destFolder = null; 238 InventoryFolderBase destFolder = null;
238 239
239 // XXX: Nasty way of dealing with a path that has no directory component 240 // XXX: Nasty way of dealing with a path that has no directory component
240 if (fsPath.Length > 0) 241 if (archivePath.Length > 0)
241 { 242 {
242 while (null == destFolder && fsPath.Length > 0) 243 while (null == destFolder && archivePath.Length > 0)
243 { 244 {
244 if (foldersCreated.ContainsKey(fsPath)) 245 if (foldersCreated.ContainsKey(archivePath))
245 { 246 {
246 m_log.DebugFormat("[INVENTORY ARCHIVER]: Found previously created fs path {0}", fsPath); 247 m_log.DebugFormat(
247 destFolder = foldersCreated[fsPath]; 248 "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
249 destFolder = foldersCreated[archivePath];
248 } 250 }
249 else 251 else
250 { 252 {
251 // Don't include the last slash 253 // Don't include the last slash
252 int penultimateSlashIndex = fsPath.LastIndexOf("/", fsPath.Length - 2); 254 int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
253 255
254 if (penultimateSlashIndex >= 0) 256 if (penultimateSlashIndex >= 0)
255 { 257 {
256 fsPath = fsPath.Remove(penultimateSlashIndex + 1); 258 archivePath = archivePath.Remove(penultimateSlashIndex + 1);
257 } 259 }
258 else 260 else
259 { 261 {
260 m_log.DebugFormat( 262 m_log.DebugFormat(
261 "[INVENTORY ARCHIVER]: Found no previously created fs path for {0}", 263 "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
262 originalFsPath); 264 originalArchivePath);
263 fsPath = string.Empty; 265 archivePath = string.Empty;
264 destFolder = rootDestFolder; 266 destFolder = rootDestFolder;
265 } 267 }
266 } 268 }
@@ -271,14 +273,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
271 destFolder = rootDestFolder; 273 destFolder = rootDestFolder;
272 } 274 }
273 275
274 string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length); 276 string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length);
275 string[] rawDirsToCreate 277 string[] rawDirsToCreate
276 = fsPathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); 278 = archivePathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
277 int i = 0; 279 int i = 0;
278 280
279 while (i < rawDirsToCreate.Length) 281 while (i < rawDirsToCreate.Length)
280 { 282 {
281 m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawDirsToCreate[i]); 283 m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading archived folder {0}", rawDirsToCreate[i]);
282 284
283 int identicalNameIdentifierIndex 285 int identicalNameIdentifierIndex
284 = rawDirsToCreate[i].LastIndexOf( 286 = rawDirsToCreate[i].LastIndexOf(
@@ -305,9 +307,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
305// foundFolder.Name, foundFolder.ID); 307// foundFolder.Name, foundFolder.ID);
306 308
307 // Record that we have now created this folder 309 // Record that we have now created this folder
308 fsPath += rawDirsToCreate[i] + "/"; 310 archivePath += rawDirsToCreate[i] + "/";
309 m_log.DebugFormat("[INVENTORY ARCHIVER]: Recording creation of fs path {0}", fsPath); 311 m_log.DebugFormat("[INVENTORY ARCHIVER]: Loaded archive path {0}", archivePath);
310 foldersCreated[fsPath] = destFolder; 312 foldersCreated[archivePath] = destFolder;
311 313
312 if (0 == i) 314 if (0 == i)
313 nodesLoaded.Add(destFolder); 315 nodesLoaded.Add(destFolder);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 2eeb637..5ebf2fa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -106,8 +106,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
106 if (path == PATH_DELIMITER) 106 if (path == PATH_DELIMITER)
107 return startFolder; 107 return startFolder;
108 108
109 InventoryFolderBase foundFolder = null;
110
111 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); 109 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
112 InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); 110 InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
113 111
@@ -116,7 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
116 if (folder.Name == components[0]) 114 if (folder.Name == components[0])
117 { 115 {
118 if (components.Length > 1) 116 if (components.Length > 1)
119 return FindFolderByPath(inventoryService, foundFolder, components[1]); 117 return FindFolderByPath(inventoryService, folder, components[1]);
120 else 118 else
121 return folder; 119 return folder;
122 } 120 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index dee4a5d..b178772 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
138 138
139 protected void SaveInvItem(InventoryItemBase inventoryItem, string path) 139 protected void SaveInvItem(InventoryItemBase inventoryItem, string path)
140 { 140 {
141 string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID); 141 string filename = path + CreateArchiveItemName(inventoryItem);
142 142
143 // Record the creator of this item for user record purposes (which might go away soon) 143 // Record the creator of this item for user record purposes (which might go away soon)
144 m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; 144 m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
@@ -162,12 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
162 { 162 {
163 if (saveThisFolderItself) 163 if (saveThisFolderItself)
164 { 164 {
165 path += 165 path += CreateArchiveFolderName(inventoryFolder);
166 string.Format(
167 "{0}{1}{2}/",
168 inventoryFolder.Name,
169 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
170 inventoryFolder.ID);
171 166
172 // We need to make sure that we record empty folders 167 // We need to make sure that we record empty folders
173 m_archiveWriter.WriteDir(path); 168 m_archiveWriter.WriteDir(path);
@@ -356,5 +351,63 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
356 } 351 }
357 } 352 }
358 } 353 }
354
355 /// <summary>
356 /// Create the archive name for a particular folder.
357 /// </summary>
358 ///
359 /// These names are prepended with an inventory folder's UUID so that more than one folder can have the
360 /// same name
361 ///
362 /// <param name="folder"></param>
363 /// <returns></returns>
364 public static string CreateArchiveFolderName(InventoryFolderBase folder)
365 {
366 return CreateArchiveFolderName(folder.Name, folder.ID);
367 }
368
369 /// <summary>
370 /// Create the archive name for a particular item.
371 /// </summary>
372 ///
373 /// These names are prepended with an inventory item's UUID so that more than one item can have the
374 /// same name
375 ///
376 /// <param name="item"></param>
377 /// <returns></returns>
378 public static string CreateArchiveItemName(InventoryItemBase item)
379 {
380 return CreateArchiveItemName(item.Name, item.ID);
381 }
382
383 /// <summary>
384 /// Create an archive folder name given its constituent components
385 /// </summary>
386 /// <param name="name"></param>
387 /// <param name="id"></param>
388 /// <returns></returns>
389 public static string CreateArchiveFolderName(string name, UUID id)
390 {
391 return string.Format(
392 "{0}{1}{2}/",
393 name,
394 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
395 id);
396 }
397
398 /// <summary>
399 /// Create an archive item name given its constituent components
400 /// </summary>
401 /// <param name="name"></param>
402 /// <param name="id"></param>
403 /// <returns></returns>
404 public static string CreateArchiveItemName(string name, UUID id)
405 {
406 return string.Format(
407 "{0}{1}{2}.xml",
408 name,
409 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
410 id);
411 }
359 } 412 }
360} 413}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d579a81..384a1f2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -153,19 +153,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
153 //bool gotControlFile = false; 153 //bool gotControlFile = false;
154 bool gotObject1File = false; 154 bool gotObject1File = false;
155 //bool gotObject2File = false; 155 //bool gotObject2File = false;
156 string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
156 string expectedObject1FilePath = string.Format( 157 string expectedObject1FilePath = string.Format(
157 "{0}{1}/{2}_{3}.xml", 158 "{0}{1}{2}",
158 ArchiveConstants.INVENTORY_PATH, 159 ArchiveConstants.INVENTORY_PATH,
159 string.Format( 160 InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
160 "Objects{0}{1}", ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, objsFolder.ID), 161 expectedObject1FileName);
161 item1.Name,
162 item1Id);
163
164// string expectedObject2FileName = string.Format(
165// "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
166// part2.Name,
167// Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z),
168// part2.UUID);
169 162
170 string filePath; 163 string filePath;
171 TarArchiveReader.TarEntryType tarEntryType; 164 TarArchiveReader.TarEntryType tarEntryType;
@@ -187,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
187// 180//
188// if (fileName.StartsWith(part1.Name)) 181// if (fileName.StartsWith(part1.Name))
189// { 182// {
190 Assert.That(filePath, Is.EqualTo(expectedObject1FilePath)); 183 Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
191 gotObject1File = true; 184 gotObject1File = true;
192// } 185// }
193// else if (fileName.StartsWith(part2.Name)) 186// else if (fileName.StartsWith(part2.Name))
@@ -202,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
202 Assert.That(gotObject1File, Is.True, "No item1 file in archive"); 195 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
203// Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 196// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
204 197
205 // TODO: Test presence of more files and contents of files. 198 // TODO: Test presence of more files and contents of files.
206 } 199 }
207 200
208 /// <summary> 201 /// <summary>
@@ -264,24 +257,43 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
264 CachedUserInfo userInfo 257 CachedUserInfo userInfo
265 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); 258 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
266 259
267 InventoryItemBase foundItem 260 InventoryItemBase foundItem1
268 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); 261 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName);
269 262
270 Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item"); 263 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
271 Assert.That( 264 Assert.That(
272 foundItem.CreatorId, Is.EqualTo(item1.CreatorId), 265 foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
273 "Loaded item non-uuid creator doesn't match original"); 266 "Loaded item non-uuid creator doesn't match original");
274 Assert.That( 267 Assert.That(
275 foundItem.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), 268 foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid),
276 "Loaded item uuid creator doesn't match original"); 269 "Loaded item uuid creator doesn't match original");
277 Assert.That(foundItem.Owner, Is.EqualTo(userUuid), 270 Assert.That(foundItem1.Owner, Is.EqualTo(userUuid),
278 "Loaded item owner doesn't match inventory reciever"); 271 "Loaded item owner doesn't match inventory reciever");
272
273 // Now try loading to a root child folder
274 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA");
275 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
276 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", archiveReadStream);
277
278 InventoryItemBase foundItem2
279 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + itemName);
280 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
281
282 // Now try loading to a more deeply nested folder
283 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC");
284 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
285 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", archiveReadStream);
286
287 InventoryItemBase foundItem3
288 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + itemName);
289 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
279 } 290 }
280 291
281 /// <summary> 292 /// <summary>
282 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 293 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
283 /// no account exists with the creator name 294 /// no account exists with the creator name
284 /// </summary> 295 /// </summary>
296 /// Disabled since temporary profiles have not yet been implemented.
285 //[Test] 297 //[Test]
286 public void TestLoadIarV0_1TempProfiles() 298 public void TestLoadIarV0_1TempProfiles()
287 { 299 {
@@ -385,16 +397,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
385 string folder2Name = "b"; 397 string folder2Name = "b";
386 string itemName = "c.lsl"; 398 string itemName = "c.lsl";
387 399
388 string folder1ArchiveName 400 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
389 = string.Format( 401 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
390 "{0}{1}{2}", folder1Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random()); 402 string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
391 string folder2ArchiveName 403
392 = string.Format(
393 "{0}{1}{2}", folder2Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random());
394 string itemArchivePath 404 string itemArchivePath
395 = string.Format( 405 = string.Format(
396 "{0}{1}/{2}/{3}", 406 "{0}{1}{2}{3}",
397 ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName); 407 ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
398 408
399 //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); 409 //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
400 410
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 9da869c..f513d68 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -588,10 +588,9 @@ namespace OpenSim.Region.CoreModules.World.Land
588 RegionConnections connectiondata, ScenePresence rootPresence) 588 RegionConnections connectiondata, ScenePresence rootPresence)
589 { 589 {
590 RegionData[] rdata = connectiondata.ConnectedRegions.ToArray(); 590 RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
591 List<IClientAPI> clients = new List<IClientAPI>(); 591 //List<IClientAPI> clients = new List<IClientAPI>();
592 Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>(); 592 Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>();
593 593
594
595 // Root Region entry 594 // Root Region entry
596 RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct(); 595 RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct();
597 rootupdatedata.Locations = new List<Vector3>(); 596 rootupdatedata.Locations = new List<Vector3>();
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
new file mode 100644
index 0000000..3528072
--- /dev/null
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -0,0 +1,97 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using OpenSim.Framework;
31using OpenSim.Services.Interfaces;
32
33namespace OpenSim.Tests.Common
34{
35 /// <summary>
36 /// Utility functions for carrying out user inventory related tests.
37 /// </summary>
38 public static class UserInventoryTestUtils
39 {
40 public static readonly string PATH_DELIMITER = "/";
41
42 /// <summary>
43 /// Create inventory folders starting from the user's root folder.
44 /// </summary>
45 ///
46 /// Ignores any existing folders with the same name
47 ///
48 /// <param name="inventoryService"></param>
49 /// <param name="userId"></param>
50 /// <param name="path">
51 /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER
52 /// </param>
53 /// <returns>
54 /// The folder created. If the path contains multiple folders then the last one created is returned.
55 /// Will return null if the root folder could not be found.
56 /// </returns>
57 public static InventoryFolderBase CreateInventoryFolder(
58 IInventoryService inventoryService, UUID userId, string path)
59 {
60 InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
61
62 if (null == rootFolder)
63 return null;
64
65 return CreateInventoryFolder(inventoryService, rootFolder, path);
66 }
67
68 /// <summary>
69 /// Create inventory folders starting from a given parent folder
70 /// </summary>
71 ///
72 /// Ignores any existing folders with the same name
73 ///
74 /// <param name="inventoryService"></param>
75 /// <param name="parentFolder"></param>
76 /// <param name="path">
77 /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER
78 /// </param>
79 /// <returns>
80 /// The folder created. If the path contains multiple folders then the last one created is returned.
81 /// </returns>
82 public static InventoryFolderBase CreateInventoryFolder(
83 IInventoryService inventoryService, InventoryFolderBase parentFolder, string path)
84 {
85 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
86
87 InventoryFolderBase newFolder
88 = new InventoryFolderBase(UUID.Random(), components[0], parentFolder.Owner, parentFolder.ID);
89 inventoryService.AddFolder(newFolder);
90
91 if (components.Length > 1)
92 return CreateInventoryFolder(inventoryService, newFolder, components[1]);
93 else
94 return newFolder;
95 }
96 }
97} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index f146a15..4ad9926 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Tests.Common.Setup
35 /// <summary> 35 /// <summary>
36 /// Utility functions for carrying out user profile related tests. 36 /// Utility functions for carrying out user profile related tests.
37 /// </summary> 37 /// </summary>
38 public class UserProfileTestUtils 38 public static class UserProfileTestUtils
39 { 39 {
40 /// <summary> 40 /// <summary>
41 /// Create a test user with a standard inventory 41 /// Create a test user with a standard inventory