123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Reflection;
- using OpenMetaverse;
- using log4net;
- using log4net.Appender;
- using log4net.Layout;
- using OpenSim.Framework;
- using OpenSim.Services.Interfaces;
- using OpenSim.Services.Connectors;
- namespace OpenSim.Tests.Clients.PresenceClient
- {
- public class UserAccountsClient
- {
- private static readonly ILog m_log =
- LogManager.GetLogger(
- MethodBase.GetCurrentMethod().DeclaringType);
-
- public static void Main(string[] args)
- {
- ConsoleAppender consoleAppender = new ConsoleAppender();
- consoleAppender.Layout =
- new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
- log4net.Config.BasicConfigurator.Configure(consoleAppender);
- string serverURI = "http://127.0.0.1:8003";
- UserAccountServicesConnector m_Connector = new UserAccountServicesConnector(serverURI);
- UUID user1 = UUID.Random();
- string first = "Completely";
- string last = "Clueless";
- string email = "foo@bar.com";
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- UserAccount account = m_Connector.GetUserAccount(UUID.Zero, first, last);
- if (account == null)
- 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}",
- 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, 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);
- 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");
- 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<string, object> kvp in account.ServiceURLs)
- m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
- }
- }
- }
- }
|