aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs')
-rw-r--r--OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs144
1 files changed, 0 insertions, 144 deletions
diff --git a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs
deleted file mode 100644
index 1e0a35b..0000000
--- a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs
+++ /dev/null
@@ -1,144 +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;
29using System.Collections.Generic;
30using System.Text;
31using System.Reflection;
32
33using OpenMetaverse;
34using log4net;
35using log4net.Appender;
36using log4net.Layout;
37
38using OpenSim.Framework;
39using OpenSim.Services.Interfaces;
40using OpenSim.Services.Connectors;
41
42namespace OpenSim.Tests.Clients.PresenceClient
43{
44 public class UserAccountsClient
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 public static void Main(string[] args)
51 {
52 ConsoleAppender consoleAppender = new ConsoleAppender();
53 consoleAppender.Layout =
54 new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
55 log4net.Config.BasicConfigurator.Configure(consoleAppender);
56
57 string serverURI = "http://127.0.0.1:8003";
58 UserAccountServicesConnector m_Connector = new UserAccountServicesConnector(serverURI);
59
60 UUID user1 = UUID.Random();
61 string first = "Completely";
62 string last = "Clueless";
63 string email = "foo@bar.com";
64
65 //UserAccount account = new UserAccount(user1);
66 //account.ScopeID = UUID.Zero;
67 //account.FirstName = first;
68 //account.LastName = last;
69 //account.Email = email;
70 //account.ServiceURLs = new Dictionary<string, object>();
71 //account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com");
72 //account.ServiceURLs.Add("AssetServerURI", "http://cnn.com");
73
74 //bool success = m_Connector.StoreUserAccount(account);
75 //if (success)
76 // m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName);
77 //else
78 // m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName);
79
80 //System.Console.WriteLine("\n");
81
82 //account = m_Connector.GetUserAccount(UUID.Zero, user1);
83 //if (account == null)
84 // m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1);
85 //else
86 //{
87 // m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
88 // account.PrincipalID, account.FirstName, account.LastName, account.Email);
89 // foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
90 // m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
91 //}
92
93 //System.Console.WriteLine("\n");
94
95 UserAccount account = m_Connector.GetUserAccount(UUID.Zero, first, last);
96 if (account == null)
97 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name ");
98 else
99 {
100 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
101 account.PrincipalID, account.FirstName, account.LastName, account.Email);
102 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
103 m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
104 }
105
106 System.Console.WriteLine("\n");
107 account = m_Connector.GetUserAccount(UUID.Zero, email);
108 if (account == null)
109 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email");
110 else
111 {
112 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
113 account.PrincipalID, account.FirstName, account.LastName, account.Email);
114 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
115 m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
116 }
117
118 System.Console.WriteLine("\n");
119 account = m_Connector.GetUserAccount(UUID.Zero, user1);
120 if (account == null)
121 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1);
122 else
123 {
124 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
125 account.PrincipalID, account.FirstName, account.LastName, account.Email);
126 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
127 m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
128 }
129
130 System.Console.WriteLine("\n");
131 account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist");
132 if (account == null)
133 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve account 'DoesNot Exist'");
134 else
135 {
136 m_log.InfoFormat("[USER CLIENT]: Account 'DoesNot Exist' retrieved correctly. REALLY??? userID={0}; FirstName={1}; LastName={2}; Email={3}",
137 account.PrincipalID, account.FirstName, account.LastName, account.Email);
138 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
139 m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
140 }
141 }
142
143 }
144}