From 5170cd75775eb85922783fa8afe4f8025c054189 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 21 Mar 2012 11:22:39 -0700 Subject: Updated the UserAccountsClient a little bit, plus some more sanity checks on the service connector. --- .../Clients/UserAccounts/UserAccountsClient.cs | 66 +++++++++++++++------- 1 file changed, 45 insertions(+), 21 deletions(-) (limited to 'OpenSim/Tests/Clients') diff --git a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs index 56195b1..1e0a35b 100644 --- a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs +++ b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs @@ -62,25 +62,39 @@ namespace OpenSim.Tests.Clients.PresenceClient string last = "Clueless"; string email = "foo@bar.com"; - UserAccount account = new UserAccount(user1); - account.FirstName = first; - account.LastName = last; - account.Email = email; - account.ServiceURLs = new Dictionary(); - account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com"); - account.ServiceURLs.Add("AssetServerURI", "http://cnn.com"); - - bool success = m_Connector.StoreUserAccount(account); - if (success) - m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName); - else - m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName); + //UserAccount account = new UserAccount(user1); + //account.ScopeID = UUID.Zero; + //account.FirstName = first; + //account.LastName = last; + //account.Email = email; + //account.ServiceURLs = new Dictionary(); + //account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com"); + //account.ServiceURLs.Add("AssetServerURI", "http://cnn.com"); - System.Console.WriteLine("\n"); + //bool success = m_Connector.StoreUserAccount(account); + //if (success) + // m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName); + //else + // m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName); - account = m_Connector.GetUserAccount(UUID.Zero, user1); + //System.Console.WriteLine("\n"); + + //account = m_Connector.GetUserAccount(UUID.Zero, user1); + //if (account == null) + // m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1); + //else + //{ + // m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", + // account.PrincipalID, account.FirstName, account.LastName, account.Email); + // foreach (KeyValuePair kvp in account.ServiceURLs) + // m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); + //} + + //System.Console.WriteLine("\n"); + + UserAccount account = m_Connector.GetUserAccount(UUID.Zero, first, last); if (account == null) - m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1); + m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name "); else { m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", @@ -90,10 +104,9 @@ namespace OpenSim.Tests.Clients.PresenceClient } System.Console.WriteLine("\n"); - - account = m_Connector.GetUserAccount(UUID.Zero, first, last); + account = m_Connector.GetUserAccount(UUID.Zero, email); if (account == null) - m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name for {0}", user1); + m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email"); else { m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", @@ -103,9 +116,9 @@ namespace OpenSim.Tests.Clients.PresenceClient } System.Console.WriteLine("\n"); - account = m_Connector.GetUserAccount(UUID.Zero, email); + account = m_Connector.GetUserAccount(UUID.Zero, user1); if (account == null) - m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email for {0}", user1); + m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1); else { m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", @@ -114,6 +127,17 @@ namespace OpenSim.Tests.Clients.PresenceClient m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); } + System.Console.WriteLine("\n"); + account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist"); + if (account == null) + m_log.InfoFormat("[USER CLIENT]: Unable to retrieve account 'DoesNot Exist'"); + else + { + m_log.InfoFormat("[USER CLIENT]: Account 'DoesNot Exist' retrieved correctly. REALLY??? userID={0}; FirstName={1}; LastName={2}; Email={3}", + account.PrincipalID, account.FirstName, account.LastName, account.Email); + foreach (KeyValuePair kvp in account.ServiceURLs) + m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); + } } } -- cgit v1.1