aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-05-21 00:11:52 +0100
committerJustin Clark-Casey (justincc)2011-05-21 00:11:52 +0100
commit534ee52a121c209752101476e031a2c097637d82 (patch)
treef641f53c3ffb9e62ce76530eb83f79caf0e83670 /OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
parentrefactor: in TaskInventoryTests, use UserProfileTestUtils.CreateUserWithInvet... (diff)
downloadopensim-SC_OLD-534ee52a121c209752101476e031a2c097637d82.zip
opensim-SC_OLD-534ee52a121c209752101476e031a2c097637d82.tar.gz
opensim-SC_OLD-534ee52a121c209752101476e031a2c097637d82.tar.bz2
opensim-SC_OLD-534ee52a121c209752101476e031a2c097637d82.tar.xz
rename UserProfileTestUtils to UserAccountHelpers to be consistent with other test helper names
Diffstat (limited to 'OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs')
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs145
1 files changed, 0 insertions, 145 deletions
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
deleted file mode 100644
index d01521d..0000000
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ /dev/null
@@ -1,145 +0,0 @@
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.Collections.Generic;
29using OpenMetaverse;
30using OpenSim.Framework.Communications;
31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Services.Interfaces;
33
34namespace OpenSim.Tests.Common.Setup
35{
36 /// <summary>
37 /// Utility functions for carrying out user profile related tests.
38 /// </summary>
39 public static class UserProfileTestUtils
40 {
41// /// <summary>
42// /// Create a test user with a standard inventory
43// /// </summary>
44// /// <param name="commsManager"></param>
45// /// <param name="callback">
46// /// Callback to invoke when inventory has been loaded. This is required because
47// /// loading may be asynchronous, even on standalone
48// /// </param>
49// /// <returns></returns>
50// public static CachedUserInfo CreateUserWithInventory(
51// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
52// {
53// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
54// return CreateUserWithInventory(commsManager, userId, callback);
55// }
56//
57// /// <summary>
58// /// Create a test user with a standard inventory
59// /// </summary>
60// /// <param name="commsManager"></param>
61// /// <param name="userId">User ID</param>
62// /// <param name="callback">
63// /// Callback to invoke when inventory has been loaded. This is required because
64// /// loading may be asynchronous, even on standalone
65// /// </param>
66// /// <returns></returns>
67// public static CachedUserInfo CreateUserWithInventory(
68// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
69// {
70// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
71// }
72//
73// /// <summary>
74// /// Create a test user with a standard inventory
75// /// </summary>
76// /// <param name="commsManager"></param>
77// /// <param name="firstName">First name of user</param>
78// /// <param name="lastName">Last name of user</param>
79// /// <param name="userId">User ID</param>
80// /// <param name="callback">
81// /// Callback to invoke when inventory has been loaded. This is required because
82// /// loading may be asynchronous, even on standalone
83// /// </param>
84// /// <returns></returns>
85// public static CachedUserInfo CreateUserWithInventory(
86// CommunicationsManager commsManager, string firstName, string lastName,
87// UUID userId, OnInventoryReceivedDelegate callback)
88// {
89// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
90// }
91//
92// /// <summary>
93// /// Create a test user with a standard inventory
94// /// </summary>
95// /// <param name="commsManager"></param>
96// /// <param name="firstName">First name of user</param>
97// /// <param name="lastName">Last name of user</param>
98// /// <param name="password">Password</param>
99// /// <param name="userId">User ID</param>
100// /// <param name="callback">
101// /// Callback to invoke when inventory has been loaded. This is required because
102// /// loading may be asynchronous, even on standalone
103// /// </param>
104// /// <returns></returns>
105// public static CachedUserInfo CreateUserWithInventory(
106// CommunicationsManager commsManager, string firstName, string lastName, string password,
107// UUID userId, OnInventoryReceivedDelegate callback)
108// {
109// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
110// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
111//
112// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
113// userInfo.OnInventoryReceived += callback;
114// userInfo.FetchInventory();
115//
116// return userInfo;
117// }
118
119 public static UserAccount CreateUserWithInventory(Scene scene)
120 {
121 return CreateUserWithInventory(
122 scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
123 }
124
125 public static UserAccount CreateUserWithInventory(
126 Scene scene, string firstName, string lastName, UUID userId, string pw)
127 {
128 UserAccount ua
129 = new UserAccount(userId)
130 { FirstName = firstName, LastName = lastName };
131 CreateUserWithInventory(scene, ua, pw);
132 return ua;
133 }
134
135 public static void CreateUserWithInventory(Scene scene, UserAccount ua, string pw)
136 {
137 // FIXME: This should really be set up by UserAccount itself
138 ua.ServiceURLs = new Dictionary<string, object>();
139
140 scene.UserAccountService.StoreUserAccount(ua);
141 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
142 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
143 }
144 }
145} \ No newline at end of file