aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-05-28 21:14:15 +0100
committerJustin Clark-Casey (justincc)2010-05-28 21:14:15 +0100
commit505cb82dee27fc1b681fd7c4b6f904ef18315995 (patch)
tree1499973e425cd2ef08d8e7227e8efa511a03e955
parentIf a command has descriptive help, add a line above and below the print out f... (diff)
downloadopensim-SC_OLD-505cb82dee27fc1b681fd7c4b6f904ef18315995.zip
opensim-SC_OLD-505cb82dee27fc1b681fd7c4b6f904ef18315995.tar.gz
opensim-SC_OLD-505cb82dee27fc1b681fd7c4b6f904ef18315995.tar.bz2
opensim-SC_OLD-505cb82dee27fc1b681fd7c4b6f904ef18315995.tar.xz
fission UserAccountService.HandleCreateUser() into two methods, one which handles user command parsing and another which actually does the work
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs102
-rw-r--r--OpenSim/Server/ServerMain.cs2
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs18
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs159
4 files changed, 143 insertions, 138 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 9c95e78..e434e46 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -38,7 +38,6 @@ using OpenSim.Framework;
38using OpenSim.Framework.Serialization; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External; 39using OpenSim.Framework.Serialization.External;
40using OpenSim.Framework.Communications; 40using OpenSim.Framework.Communications;
41
42using OpenSim.Framework.Communications.Osp; 41using OpenSim.Framework.Communications.Osp;
43using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 42using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
44using OpenSim.Region.CoreModules.World.Serialiser; 43using OpenSim.Region.CoreModules.World.Serialiser;
@@ -541,56 +540,55 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
541 /// <summary> 540 /// <summary>
542 /// Test replication of an archive path to the user's inventory. 541 /// Test replication of an archive path to the user's inventory.
543 /// </summary> 542 /// </summary>
544 //[Test] 543// [Test]
545 //public void TestReplicateArchivePathToUserInventory() 544// public void TestReplicateArchivePathToUserInventory()
546 //{ 545// {
547 // TestHelper.InMethod(); 546// TestHelper.InMethod();
548 547// //log4net.Config.XmlConfigurator.Configure();
549 // //log4net.Config.XmlConfigurator.Configure(); 548//
550 549// Scene scene = SceneSetupHelpers.SetupScene("inventory");
551 // Scene scene = SceneSetupHelpers.SetupScene("inventory"); 550// CommunicationsManager commsManager = scene.CommsManager;
552 // CommunicationsManager commsManager = scene.CommsManager; 551// CachedUserInfo userInfo;
553 // CachedUserInfo userInfo; 552//
554 553// lock (this)
555 // lock (this) 554// {
556 // { 555// // !!! REFACTORING PROBLEM. This needs to be rewritten
557 // // !!! REFACTORING PROBLEM. This needs to be rewritten 556// userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived);
558 // userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); 557// Monitor.Wait(this, 60000);
559 // Monitor.Wait(this, 60000); 558// }
560 // } 559//
561 560// //Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder);
562 // //Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); 561//
563 562// Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
564 // Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); 563// List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
565 // List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); 564//
566 565// string folder1Name = "a";
567 // string folder1Name = "a"; 566// string folder2Name = "b";
568 // string folder2Name = "b"; 567// string itemName = "c.lsl";
569 // string itemName = "c.lsl"; 568//
570 569// string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
571 // string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); 570// string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
572 // string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 571// string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
573 // string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); 572//
574 573// string itemArchivePath
575 // string itemArchivePath 574// = string.Format(
576 // = string.Format( 575// "{0}{1}{2}{3}",
577 // "{0}{1}{2}{3}", 576// ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
578 // ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); 577//
579 578// //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
580 // //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); 579//
581 580// new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null)
582 // new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null) 581// .ReplicateArchivePathToUserInventory(
583 // .ReplicateArchivePathToUserInventory( 582// itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID),
584 // itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID), 583// foldersCreated, nodesLoaded);
585 // foldersCreated, nodesLoaded); 584//
586 585// //Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
587 // //Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); 586// //InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
588 // //InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); 587// InventoryFolderBase folder1
589 // InventoryFolderBase folder1 588// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a");
590 // = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a"); 589// Assert.That(folder1, Is.Not.Null, "Could not find folder a");
591 // Assert.That(folder1, Is.Not.Null, "Could not find folder a"); 590// InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
592 // InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b"); 591// Assert.That(folder2, Is.Not.Null, "Could not find folder b");
593 // Assert.That(folder2, Is.Not.Null, "Could not find folder b"); 592// }
594 //}
595 } 593 }
596} 594}
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs
index d3e65a4..9503c4c 100644
--- a/OpenSim/Server/ServerMain.cs
+++ b/OpenSim/Server/ServerMain.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Server
61 string connList = serverConfig.GetString("ServiceConnectors", String.Empty); 61 string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
62 string[] conns = connList.Split(new char[] {',', ' '}); 62 string[] conns = connList.Split(new char[] {',', ' '});
63 63
64 int i = 0; 64// int i = 0;
65 foreach (string c in conns) 65 foreach (string c in conns)
66 { 66 {
67 if (c == String.Empty) 67 if (c == String.Empty)
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 6923293..3f1744d 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -277,8 +277,9 @@ namespace OpenSim.Services.UserAccountService
277 #endregion 277 #endregion
278 278
279 #region Console commands 279 #region Console commands
280
280 /// <summary> 281 /// <summary>
281 /// Create a new user 282 /// Handle the create user command from the console.
282 /// </summary> 283 /// </summary>
283 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param> 284 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
284 protected void HandleCreateUser(string module, string[] cmdparams) 285 protected void HandleCreateUser(string module, string[] cmdparams)
@@ -304,6 +305,18 @@ namespace OpenSim.Services.UserAccountService
304 email = MainConsole.Instance.CmdPrompt("Email", ""); 305 email = MainConsole.Instance.CmdPrompt("Email", "");
305 else email = cmdparams[5]; 306 else email = cmdparams[5];
306 307
308 CreateUser(firstName, lastName, password, email);
309 }
310
311 /// <summary>
312 /// Create a user
313 /// </summary>
314 /// <param name="firstName"></param>
315 /// <param name="lastName"></param>
316 /// <param name="password"></param>
317 /// <param name="email"></param>
318 public void CreateUser(string firstName, string lastName, string password, string email)
319 {
307 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); 320 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
308 if (null == account) 321 if (null == account)
309 { 322 {
@@ -338,7 +351,6 @@ namespace OpenSim.Services.UserAccountService
338 else 351 else
339 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.", 352 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
340 firstName, lastName); 353 firstName, lastName);
341
342 } 354 }
343 else 355 else
344 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", 356 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
@@ -350,7 +362,6 @@ namespace OpenSim.Services.UserAccountService
350 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", 362 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
351 firstName, lastName); 363 firstName, lastName);
352 364
353
354 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName); 365 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
355 } 366 }
356 } 367 }
@@ -358,7 +369,6 @@ namespace OpenSim.Services.UserAccountService
358 { 369 {
359 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); 370 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
360 } 371 }
361
362 } 372 }
363 373
364 protected void HandleResetUserPassword(string module, string[] cmdparams) 374 protected void HandleResetUserPassword(string module, string[] cmdparams)
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index cd61fa6..2b14d97 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -36,85 +36,82 @@ namespace OpenSim.Tests.Common.Setup
36 /// </summary> 36 /// </summary>
37 public static class UserProfileTestUtils 37 public static class UserProfileTestUtils
38 { 38 {
39 // REFACTORING PROBLEM 39// /// <summary>
40 // This needs to be rewritten 40// /// Create a test user with a standard inventory
41 41// /// </summary>
42 ///// <summary> 42// /// <param name="commsManager"></param>
43 ///// Create a test user with a standard inventory 43// /// <param name="callback">
44 ///// </summary> 44// /// Callback to invoke when inventory has been loaded. This is required because
45 ///// <param name="commsManager"></param> 45// /// loading may be asynchronous, even on standalone
46 ///// <param name="callback"> 46// /// </param>
47 ///// Callback to invoke when inventory has been loaded. This is required because 47// /// <returns></returns>
48 ///// loading may be asynchronous, even on standalone 48// public static CachedUserInfo CreateUserWithInventory(
49 ///// </param> 49// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
50 ///// <returns></returns> 50// {
51 //public static CachedUserInfo CreateUserWithInventory( 51// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
52 // CommunicationsManager commsManager, OnInventoryReceivedDelegate callback) 52// return CreateUserWithInventory(commsManager, userId, callback);
53 //{ 53// }
54 // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); 54//
55 // return CreateUserWithInventory(commsManager, userId, callback); 55// /// <summary>
56 //} 56// /// Create a test user with a standard inventory
57 57// /// </summary>
58 ///// <summary> 58// /// <param name="commsManager"></param>
59 ///// Create a test user with a standard inventory 59// /// <param name="userId">User ID</param>
60 ///// </summary> 60// /// <param name="callback">
61 ///// <param name="commsManager"></param> 61// /// Callback to invoke when inventory has been loaded. This is required because
62 ///// <param name="userId">User ID</param> 62// /// loading may be asynchronous, even on standalone
63 ///// <param name="callback"> 63// /// </param>
64 ///// Callback to invoke when inventory has been loaded. This is required because 64// /// <returns></returns>
65 ///// loading may be asynchronous, even on standalone 65// public static CachedUserInfo CreateUserWithInventory(
66 ///// </param> 66// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
67 ///// <returns></returns> 67// {
68 //public static CachedUserInfo CreateUserWithInventory( 68// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
69 // CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback) 69// }
70 //{ 70//
71 // return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback); 71// /// <summary>
72 //} 72// /// Create a test user with a standard inventory
73 73// /// </summary>
74 ///// <summary> 74// /// <param name="commsManager"></param>
75 ///// Create a test user with a standard inventory 75// /// <param name="firstName">First name of user</param>
76 ///// </summary> 76// /// <param name="lastName">Last name of user</param>
77 ///// <param name="commsManager"></param> 77// /// <param name="userId">User ID</param>
78 ///// <param name="firstName">First name of user</param> 78// /// <param name="callback">
79 ///// <param name="lastName">Last name of user</param> 79// /// Callback to invoke when inventory has been loaded. This is required because
80 ///// <param name="userId">User ID</param> 80// /// loading may be asynchronous, even on standalone
81 ///// <param name="callback"> 81// /// </param>
82 ///// Callback to invoke when inventory has been loaded. This is required because 82// /// <returns></returns>
83 ///// loading may be asynchronous, even on standalone 83// public static CachedUserInfo CreateUserWithInventory(
84 ///// </param> 84// CommunicationsManager commsManager, string firstName, string lastName,
85 ///// <returns></returns> 85// UUID userId, OnInventoryReceivedDelegate callback)
86 //public static CachedUserInfo CreateUserWithInventory( 86// {
87 // CommunicationsManager commsManager, string firstName, string lastName, 87// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
88 // UUID userId, OnInventoryReceivedDelegate callback) 88// }
89 //{ 89//
90 // return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback); 90// /// <summary>
91 //} 91// /// Create a test user with a standard inventory
92 92// /// </summary>
93 ///// <summary> 93// /// <param name="commsManager"></param>
94 ///// Create a test user with a standard inventory 94// /// <param name="firstName">First name of user</param>
95 ///// </summary> 95// /// <param name="lastName">Last name of user</param>
96 ///// <param name="commsManager"></param> 96// /// <param name="password">Password</param>
97 ///// <param name="firstName">First name of user</param> 97// /// <param name="userId">User ID</param>
98 ///// <param name="lastName">Last name of user</param> 98// /// <param name="callback">
99 ///// <param name="password">Password</param> 99// /// Callback to invoke when inventory has been loaded. This is required because
100 ///// <param name="userId">User ID</param> 100// /// loading may be asynchronous, even on standalone
101 ///// <param name="callback"> 101// /// </param>
102 ///// Callback to invoke when inventory has been loaded. This is required because 102// /// <returns></returns>
103 ///// loading may be asynchronous, even on standalone 103// public static CachedUserInfo CreateUserWithInventory(
104 ///// </param> 104// CommunicationsManager commsManager, string firstName, string lastName, string password,
105 ///// <returns></returns> 105// UUID userId, OnInventoryReceivedDelegate callback)
106 //public static CachedUserInfo CreateUserWithInventory( 106// {
107 // CommunicationsManager commsManager, string firstName, string lastName, string password, 107// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
108 // UUID userId, OnInventoryReceivedDelegate callback) 108// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
109 //{ 109//
110 // LocalUserServices lus = (LocalUserServices)commsManager.UserService; 110// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
111 // lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId); 111// userInfo.OnInventoryReceived += callback;
112 112// userInfo.FetchInventory();
113 // CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); 113//
114 // userInfo.OnInventoryReceived += callback; 114// return userInfo;
115 // userInfo.FetchInventory(); 115// }
116
117 // return userInfo;
118 //}
119 } 116 }
120} 117} \ No newline at end of file