aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-09-08 17:42:07 +0100
committerJustin Clark-Casey (justincc)2009-09-08 17:42:07 +0100
commitb7256f256733f1c7667edc95ec500694bbe35dab (patch)
tree7be2bc029b9c07672b757f7cc7aeb2ca4453da12 /OpenSim/Tests
parentrefactor: change method argument name (diff)
downloadopensim-SC_OLD-b7256f256733f1c7667edc95ec500694bbe35dab.zip
opensim-SC_OLD-b7256f256733f1c7667edc95ec500694bbe35dab.tar.gz
opensim-SC_OLD-b7256f256733f1c7667edc95ec500694bbe35dab.tar.bz2
opensim-SC_OLD-b7256f256733f1c7667edc95ec500694bbe35dab.tar.xz
extend load iar test to loading into a deeply nested directory
correct bug associated with this
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs97
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs2
2 files changed, 98 insertions, 1 deletions
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