Updated the UserAccountsClient a little bit, plus some more sanity checks on the service connector.

0.7.4.1
Diva Canto 2012-03-21 11:22:39 -07:00
parent 4a9ca3ca8f
commit 5170cd7577
2 changed files with 60 additions and 29 deletions

View File

@ -197,8 +197,15 @@ namespace OpenSim.Services.Connectors
Dictionary<string, object> structData = data.ToKeyValuePairs(); Dictionary<string, object> structData = data.ToKeyValuePairs();
foreach (KeyValuePair<string,object> kvp in structData) foreach (KeyValuePair<string, object> kvp in structData)
{
if (kvp.Value == null)
{
m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Null value for {0}", kvp.Key);
continue;
}
sendData[kvp.Key] = kvp.Value.ToString(); sendData[kvp.Key] = kvp.Value.ToString();
}
return SendAndGetBoolReply(sendData); return SendAndGetBoolReply(sendData);
} }

View File

@ -62,22 +62,60 @@ namespace OpenSim.Tests.Clients.PresenceClient
string last = "Clueless"; string last = "Clueless";
string email = "foo@bar.com"; string email = "foo@bar.com";
UserAccount account = new UserAccount(user1); //UserAccount account = new UserAccount(user1);
account.FirstName = first; //account.ScopeID = UUID.Zero;
account.LastName = last; //account.FirstName = first;
account.Email = email; //account.LastName = last;
account.ServiceURLs = new Dictionary<string, object>(); //account.Email = email;
account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com"); //account.ServiceURLs = new Dictionary<string, object>();
account.ServiceURLs.Add("AssetServerURI", "http://cnn.com"); //account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com");
//account.ServiceURLs.Add("AssetServerURI", "http://cnn.com");
bool success = m_Connector.StoreUserAccount(account); //bool success = m_Connector.StoreUserAccount(account);
if (success) //if (success)
m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName); // 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);
//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<string, object> 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 name ");
else else
m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName); {
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<string, object> kvp in account.ServiceURLs)
m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
}
System.Console.WriteLine("\n"); System.Console.WriteLine("\n");
account = m_Connector.GetUserAccount(UUID.Zero, email);
if (account == null)
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}",
account.PrincipalID, account.FirstName, account.LastName, account.Email);
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
}
System.Console.WriteLine("\n");
account = m_Connector.GetUserAccount(UUID.Zero, user1); account = m_Connector.GetUserAccount(UUID.Zero, user1);
if (account == null) 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 UUID for {0}", user1);
@ -90,30 +128,16 @@ namespace OpenSim.Tests.Clients.PresenceClient
} }
System.Console.WriteLine("\n"); System.Console.WriteLine("\n");
account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist");
account = m_Connector.GetUserAccount(UUID.Zero, first, last);
if (account == null) 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 account 'DoesNot Exist'");
else else
{ {
m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", 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); account.PrincipalID, account.FirstName, account.LastName, account.Email);
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
} }
System.Console.WriteLine("\n");
account = m_Connector.GetUserAccount(UUID.Zero, email);
if (account == null)
m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email 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<string, object> kvp in account.ServiceURLs)
m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
}
} }
} }