diff options
author | Diva Canto | 2015-05-11 19:55:23 -0700 |
---|---|---|
committer | Diva Canto | 2015-05-11 19:55:23 -0700 |
commit | 923a57a91fa9629a844da6cd59ca8e9d2b0fbcde (patch) | |
tree | 859b98b1cdfb51c485d4704e3d0a1292300ca446 /OpenSim/Tests/Clients | |
parent | Forgot to delete an unused project from Prebuild. Done now. (diff) | |
download | opensim-SC_OLD-923a57a91fa9629a844da6cd59ca8e9d2b0fbcde.zip opensim-SC_OLD-923a57a91fa9629a844da6cd59ca8e9d2b0fbcde.tar.gz opensim-SC_OLD-923a57a91fa9629a844da6cd59ca8e9d2b0fbcde.tar.bz2 opensim-SC_OLD-923a57a91fa9629a844da6cd59ca8e9d2b0fbcde.tar.xz |
Added tests for UserAccountService in Robust. In the process fixed a couple of bugs in the network connectors. For some reason the robust-bound code had a CreateUser method, while the client-bound code had no such method. I assume someone is extending the client-side code with their own connectors. I added the missing method, but didn't add it to the service interface.
Diffstat (limited to 'OpenSim/Tests/Clients')
-rw-r--r-- | OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini | 33 | ||||
-rw-r--r-- | OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs | 144 |
2 files changed, 0 insertions, 177 deletions
diff --git a/OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini b/OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini deleted file mode 100644 index 453e17e..0000000 --- a/OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | ; * Run a ROBUST server shell like this, from bin: | ||
2 | ; * $ OpenSim.Server.exe -inifile ../OpenSim/Tests/Clients/Presence/OpenSim.Server.ini | ||
3 | ; * | ||
4 | ; * Then run this client like this, from bin: | ||
5 | ; * $ OpenSim.Tests.Clients.UserAccountClient.exe | ||
6 | ; * | ||
7 | ; * | ||
8 | |||
9 | [Startup] | ||
10 | ServiceConnectors = "OpenSim.Server.Handlers.dll:UserAccountServiceConnector" | ||
11 | |||
12 | ; * This is common for all services, it's the network setup for the entire | ||
13 | ; * server instance | ||
14 | ; * | ||
15 | [Network] | ||
16 | port = 8003 | ||
17 | |||
18 | ; * The following are for the remote console | ||
19 | ; * They have no effect for the local or basic console types | ||
20 | ; * Leave commented to diable logins to the console | ||
21 | ;ConsoleUser = Test | ||
22 | ;ConsolePass = secret | ||
23 | |||
24 | ; * As an example, the below configuration precisely mimicks the legacy | ||
25 | ; * asset server. It is read by the asset IN connector (defined above) | ||
26 | ; * and it then loads the OUT connector (a local database module). That, | ||
27 | ; * in turn, reads the asset loader and database connection information | ||
28 | ; * | ||
29 | [UserAccountService] | ||
30 | LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" | ||
31 | StorageProvider = "OpenSim.Data.MySQL.dll" | ||
32 | ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;Old Guids=true;" | ||
33 | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenMetaverse; | ||
34 | using log4net; | ||
35 | using log4net.Appender; | ||
36 | using log4net.Layout; | ||
37 | |||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using OpenSim.Services.Connectors; | ||
41 | |||
42 | namespace 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 | } | ||