aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorMichael Heilmann2015-05-19 15:18:45 -0400
committerMichael Heilmann2015-05-19 15:18:45 -0400
commit140ea04b9d692344d803fc87364fb252561725c3 (patch)
treed503b7ae17baca374d704b548fc7da512f512388 /OpenSim/Tests
parentMerge pull request #7 from gamucf/moses.metricsPhase2 (diff)
parentresolve possible nullref when sending appearance packet. Thanks to zadark for... (diff)
downloadopensim-SC-140ea04b9d692344d803fc87364fb252561725c3.zip
opensim-SC-140ea04b9d692344d803fc87364fb252561725c3.tar.gz
opensim-SC-140ea04b9d692344d803fc87364fb252561725c3.tar.bz2
opensim-SC-140ea04b9d692344d803fc87364fb252561725c3.tar.xz
Merging Opensim upstream before generating patch
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Clients/Grid/GridClient.cs205
-rw-r--r--OpenSim/Tests/Clients/Presence/OpenSim.Server.ini33
-rw-r--r--OpenSim/Tests/Clients/Presence/PresenceClient.cs115
-rw-r--r--OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini33
-rw-r--r--OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs144
-rw-r--r--OpenSim/Tests/Robust/Clients/Grid/GridClient.cs133
-rw-r--r--OpenSim/Tests/Robust/Clients/Grid/GridForm.html (renamed from OpenSim/Tests/Clients/Grid/GridForm.html)0
-rw-r--r--OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs (renamed from OpenSim/Tests/Clients/InstantMessage/IMClient.cs)31
-rw-r--r--OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs153
-rw-r--r--OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs81
-rw-r--r--OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs85
-rw-r--r--OpenSim/Tests/Robust/Server/DemonServer.cs69
12 files changed, 528 insertions, 554 deletions
diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs
deleted file mode 100644
index fed7a16..0000000
--- a/OpenSim/Tests/Clients/Grid/GridClient.cs
+++ /dev/null
@@ -1,205 +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 GridRegion = OpenSim.Services.Interfaces.GridRegion;
41using OpenSim.Services.Connectors;
42
43namespace OpenSim.Tests.Clients.GridClient
44{
45 public class GridClient
46 {
47// private static readonly ILog m_log =
48// LogManager.GetLogger(
49// MethodBase.GetCurrentMethod().DeclaringType);
50
51 public static void Main(string[] args)
52 {
53 ConsoleAppender consoleAppender = new ConsoleAppender();
54 consoleAppender.Layout =
55 new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
56 log4net.Config.BasicConfigurator.Configure(consoleAppender);
57
58 string serverURI = "http://127.0.0.1:8001";
59 GridServicesConnector m_Connector = new GridServicesConnector(serverURI);
60
61 GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000);
62 GridRegion r2 = CreateRegion("Test Region 2", 1001, 1000);
63 GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000);
64
65 Console.WriteLine("[GRID CLIENT]: *** Registering region 1");
66 string msg = m_Connector.RegisterRegion(UUID.Zero, r1);
67 if (msg == String.Empty)
68 Console.WriteLine("[GRID CLIENT]: Successfully registered region 1");
69 else
70 Console.WriteLine("[GRID CLIENT]: region 1 failed to register");
71
72 Console.WriteLine("[GRID CLIENT]: *** Registering region 2");
73 msg = m_Connector.RegisterRegion(UUID.Zero, r2);
74 if (msg == String.Empty)
75 Console.WriteLine("[GRID CLIENT]: Successfully registered region 2");
76 else
77 Console.WriteLine("[GRID CLIENT]: region 2 failed to register");
78
79 Console.WriteLine("[GRID CLIENT]: *** Registering region 3");
80 msg = m_Connector.RegisterRegion(UUID.Zero, r3);
81 if (msg == String.Empty)
82 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
83 else
84 Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
85
86
87 bool success;
88 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
89 success = m_Connector.DeregisterRegion(r3.RegionID);
90 if (success)
91 Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 3");
92 else
93 Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
94 Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again");
95 msg = m_Connector.RegisterRegion(UUID.Zero, r3);
96 if (msg == String.Empty)
97 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
98 else
99 Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
100
101 Console.WriteLine("[GRID CLIENT]: *** GetNeighbours of region 1");
102 List<GridRegion> regions = m_Connector.GetNeighbours(UUID.Zero, r1.RegionID);
103 if (regions == null)
104 Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 failed");
105 else if (regions.Count > 0)
106 {
107 if (regions.Count != 1)
108 Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned more neighbours than expected: " + regions.Count);
109 else
110 Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned the right neighbour " + regions[0].RegionName);
111 }
112 else
113 Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned 0 neighbours");
114
115
116 Console.WriteLine("[GRID CLIENT]: *** GetRegionByUUID of region 2 (this should succeed)");
117 GridRegion region = m_Connector.GetRegionByUUID(UUID.Zero, r2.RegionID);
118 if (region == null)
119 Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned null");
120 else
121 Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned region " + region.RegionName);
122
123 Console.WriteLine("[GRID CLIENT]: *** GetRegionByUUID of non-existent region (this should fail)");
124 region = m_Connector.GetRegionByUUID(UUID.Zero, UUID.Random());
125 if (region == null)
126 Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned null");
127 else
128 Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned region " + region.RegionName);
129
130 Console.WriteLine("[GRID CLIENT]: *** GetRegionByName of region 3 (this should succeed)");
131 region = m_Connector.GetRegionByName(UUID.Zero, r3.RegionName);
132 if (region == null)
133 Console.WriteLine("[GRID CLIENT]: GetRegionByName returned null");
134 else
135 Console.WriteLine("[GRID CLIENT]: GetRegionByName returned region " + region.RegionName);
136
137 Console.WriteLine("[GRID CLIENT]: *** GetRegionByName of non-existent region (this should fail)");
138 region = m_Connector.GetRegionByName(UUID.Zero, "Foo");
139 if (region == null)
140 Console.WriteLine("[GRID CLIENT]: GetRegionByName returned null");
141 else
142 Console.WriteLine("[GRID CLIENT]: GetRegionByName returned region " + region.RegionName);
143
144 Console.WriteLine("[GRID CLIENT]: *** GetRegionsByName (this should return 3 regions)");
145 regions = m_Connector.GetRegionsByName(UUID.Zero, "Test", 10);
146 if (regions == null)
147 Console.WriteLine("[GRID CLIENT]: GetRegionsByName returned null");
148 else
149 Console.WriteLine("[GRID CLIENT]: GetRegionsByName returned " + regions.Count + " regions");
150
151 Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
152 regions = m_Connector.GetRegionRange(UUID.Zero,
153 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002),
154 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002) );
155 if (regions == null)
156 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
157 else
158 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
159 Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
160 regions = m_Connector.GetRegionRange(UUID.Zero,
161 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950),
162 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950) );
163 if (regions == null)
164 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
165 else
166 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
167
168 Console.Write("Proceed to deregister? Press enter...");
169 Console.ReadLine();
170
171 // Deregister them all
172 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 1");
173 success = m_Connector.DeregisterRegion(r1.RegionID);
174 if (success)
175 Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 1");
176 else
177 Console.WriteLine("[GRID CLIENT]: region 1 failed to deregister");
178 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 2");
179 success = m_Connector.DeregisterRegion(r2.RegionID);
180 if (success)
181 Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 2");
182 else
183 Console.WriteLine("[GRID CLIENT]: region 2 failed to deregister");
184 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
185 success = m_Connector.DeregisterRegion(r3.RegionID);
186 if (success)
187 Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 3");
188 else
189 Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
190
191 }
192
193 private static GridRegion CreateRegion(string name, uint xcell, uint ycell)
194 {
195 GridRegion region = new GridRegion(xcell, ycell);
196 region.RegionName = name;
197 region.RegionID = UUID.Random();
198 region.ExternalHostName = "127.0.0.1";
199 region.HttpPort = 9000;
200 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 9000);
201
202 return region;
203 }
204 }
205}
diff --git a/OpenSim/Tests/Clients/Presence/OpenSim.Server.ini b/OpenSim/Tests/Clients/Presence/OpenSim.Server.ini
deleted file mode 100644
index 8610c78..0000000
--- a/OpenSim/Tests/Clients/Presence/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.PresenceClient.exe
6; *
7; *
8
9[Startup]
10ServiceConnectors = "OpenSim.Server.Handlers.dll:PresenceServiceConnector"
11
12; * This is common for all services, it's the network setup for the entire
13; * server instance
14; *
15[Network]
16port = 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[PresenceService]
30 LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
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/Presence/PresenceClient.cs b/OpenSim/Tests/Clients/Presence/PresenceClient.cs
deleted file mode 100644
index fd3905a..0000000
--- a/OpenSim/Tests/Clients/Presence/PresenceClient.cs
+++ /dev/null
@@ -1,115 +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 PresenceClient
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 PresenceServicesConnector m_Connector = new PresenceServicesConnector(serverURI);
59
60 UUID user1 = UUID.Random();
61 UUID session1 = UUID.Random();
62 UUID region1 = UUID.Random();
63
64 bool success = m_Connector.LoginAgent(user1.ToString(), session1, UUID.Zero);
65 if (success)
66 m_log.InfoFormat("[PRESENCE CLIENT]: Successfully logged in user {0} with session {1}", user1, session1);
67 else
68 m_log.InfoFormat("[PRESENCE CLIENT]: failed to login user {0}", user1);
69
70 System.Console.WriteLine("\n");
71
72 PresenceInfo pinfo = m_Connector.GetAgent(session1);
73 if (pinfo == null)
74 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0}", user1);
75 else
76 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={1}",
77 pinfo.UserID, pinfo.RegionID);
78
79 System.Console.WriteLine("\n");
80 success = m_Connector.ReportAgent(session1, region1);
81 if (success)
82 m_log.InfoFormat("[PRESENCE CLIENT]: Successfully reported session {0} in region {1}", user1, region1);
83 else
84 m_log.InfoFormat("[PRESENCE CLIENT]: failed to report session {0}", session1);
85 pinfo = m_Connector.GetAgent(session1);
86 if (pinfo == null)
87 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for second time", user1);
88 else
89 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={2}",
90 pinfo.UserID, pinfo.RegionID);
91
92 System.Console.WriteLine("\n");
93 success = m_Connector.LogoutAgent(session1);
94 if (success)
95 m_log.InfoFormat("[PRESENCE CLIENT]: Successfully logged out user {0}", user1);
96 else
97 m_log.InfoFormat("[PRESENCE CLIENT]: failed to logout user {0}", user1);
98 pinfo = m_Connector.GetAgent(session1);
99 if (pinfo == null)
100 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for fourth time", user1);
101 else
102 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={1}",
103 pinfo.UserID, pinfo.RegionID);
104
105 System.Console.WriteLine("\n");
106 success = m_Connector.ReportAgent(session1, UUID.Random());
107 if (success)
108 m_log.InfoFormat("[PRESENCE CLIENT]: Report agent succeeded, but this is wrong");
109 else
110 m_log.InfoFormat("[PRESENCE CLIENT]: failed to report agent, as it should because user is not logged in");
111
112 }
113
114 }
115}
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]
10ServiceConnectors = "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]
16port = 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
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}
diff --git a/OpenSim/Tests/Robust/Clients/Grid/GridClient.cs b/OpenSim/Tests/Robust/Clients/Grid/GridClient.cs
new file mode 100644
index 0000000..671aca7
--- /dev/null
+++ b/OpenSim/Tests/Robust/Clients/Grid/GridClient.cs
@@ -0,0 +1,133 @@
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 NUnit.Framework;
35
36using OpenSim.Framework;
37using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39using OpenSim.Services.Connectors;
40
41namespace Robust.Tests
42{
43 [TestFixture]
44 public class GridClient
45 {
46// private static readonly ILog m_log =
47// LogManager.GetLogger(
48// MethodBase.GetCurrentMethod().DeclaringType);
49
50 [Test]
51 public void Grid_001()
52 {
53 GridServicesConnector m_Connector = new GridServicesConnector(DemonServer.Address);
54
55 GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000);
56 GridRegion r2 = CreateRegion("Test Region 2", 1001, 1000);
57 GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000);
58
59 string msg = m_Connector.RegisterRegion(UUID.Zero, r1);
60 Assert.AreEqual(msg, string.Empty, "Region 1 failed to register");
61
62 msg = m_Connector.RegisterRegion(UUID.Zero, r2);
63 Assert.AreEqual(msg, string.Empty, "Region 2 failed to register");
64
65 msg = m_Connector.RegisterRegion(UUID.Zero, r3);
66 Assert.AreEqual(msg, string.Empty, "Region 3 failed to register");
67
68 bool success;
69 success = m_Connector.DeregisterRegion(r3.RegionID);
70 Assert.AreEqual(success, true, "Region 3 failed to deregister");
71
72 msg = m_Connector.RegisterRegion(UUID.Zero, r3);
73 Assert.AreEqual(msg, string.Empty, "Region 3 failed to re-register");
74
75 List<GridRegion> regions = m_Connector.GetNeighbours(UUID.Zero, r1.RegionID);
76 Assert.AreNotEqual(regions, null, "GetNeighbours of region 1 failed");
77 Assert.AreEqual(regions.Count, 1, "Region 1 should have 1 neighbor");
78 Assert.AreEqual(regions[0].RegionName, "Test Region 2", "Region 1 has the wrong neighbor");
79
80 GridRegion region = m_Connector.GetRegionByUUID(UUID.Zero, r2.RegionID);
81 Assert.AreNotEqual(region, null, "GetRegionByUUID for region 2 failed");
82 Assert.AreEqual(region.RegionName, "Test Region 2", "GetRegionByUUID of region 2 returned wrong region");
83
84 region = m_Connector.GetRegionByUUID(UUID.Zero, UUID.Random());
85 Assert.AreEqual(region, null, "Region with randon id should not exist");
86
87 region = m_Connector.GetRegionByName(UUID.Zero, r3.RegionName);
88 Assert.AreNotEqual(region, null, "GetRegionByUUID for region 3 failed");
89 Assert.AreEqual(region.RegionName, "Test Region 3", "GetRegionByUUID of region 3 returned wrong region");
90
91 region = m_Connector.GetRegionByName(UUID.Zero, "Foo");
92 Assert.AreEqual(region, null, "Region Foo should not exist");
93
94 regions = m_Connector.GetRegionsByName(UUID.Zero, "Test", 10);
95 Assert.AreNotEqual(regions, null, "GetRegionsByName failed");
96 Assert.AreEqual(regions.Count, 3, "GetRegionsByName should return 3");
97
98 regions = m_Connector.GetRegionRange(UUID.Zero,
99 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002),
100 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002) );
101 Assert.AreNotEqual(regions, null, "GetRegionRange failed");
102 Assert.AreEqual(regions.Count, 2, "GetRegionRange should return 2");
103
104 regions = m_Connector.GetRegionRange(UUID.Zero,
105 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950),
106 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950) );
107 Assert.AreNotEqual(regions, null, "GetRegionRange (bis) failed");
108 Assert.AreEqual(regions.Count, 0, "GetRegionRange (bis) should return 0");
109
110 // Deregister them all
111 success = m_Connector.DeregisterRegion(r1.RegionID);
112 Assert.AreEqual(success, true, "Region 1 failed to deregister");
113
114 success = m_Connector.DeregisterRegion(r2.RegionID);
115 Assert.AreEqual(success, true, "Region 2 failed to deregister");
116
117 success = m_Connector.DeregisterRegion(r3.RegionID);
118 Assert.AreEqual(success, true, "Region 3 failed to deregister");
119 }
120
121 private static GridRegion CreateRegion(string name, uint xcell, uint ycell)
122 {
123 GridRegion region = new GridRegion(xcell, ycell);
124 region.RegionName = name;
125 region.RegionID = UUID.Random();
126 region.ExternalHostName = "127.0.0.1";
127 region.HttpPort = 9000;
128 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 9000);
129
130 return region;
131 }
132 }
133}
diff --git a/OpenSim/Tests/Clients/Grid/GridForm.html b/OpenSim/Tests/Robust/Clients/Grid/GridForm.html
index 252920f..252920f 100644
--- a/OpenSim/Tests/Clients/Grid/GridForm.html
+++ b/OpenSim/Tests/Robust/Clients/Grid/GridForm.html
diff --git a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs b/OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs
index e7304a2..8f312eb 100644
--- a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs
+++ b/OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs
@@ -28,47 +28,30 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using System.Reflection;
32 31
33using OpenMetaverse; 32using OpenMetaverse;
34using log4net; 33using NUnit.Framework;
35using log4net.Appender;
36using log4net.Layout;
37 34
38using OpenSim.Framework; 35using OpenSim.Framework;
39using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
40using OpenSim.Services.Connectors.InstantMessage; 37using OpenSim.Services.Connectors.InstantMessage;
41 38
42namespace OpenSim.Tests.Clients.InstantMessage 39namespace Robust.Tests
43{ 40{
41 [TestFixture]
44 public class IMClient 42 public class IMClient
45 { 43 {
46 private static readonly ILog m_log = 44 [Test]
47 LogManager.GetLogger( 45 public void HGIM_001()
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 public static void Main(string[] args)
51 { 46 {
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:8002";
58 GridInstantMessage im = new GridInstantMessage(); 47 GridInstantMessage im = new GridInstantMessage();
59 im.fromAgentID = new Guid(); 48 im.fromAgentID = new Guid();
60 im.toAgentID = new Guid(); 49 im.toAgentID = new Guid();
61 im.message = "Hello"; 50 im.message = "Hello";
62 im.imSessionID = new Guid(); 51 im.imSessionID = new Guid();
63 52
64 bool success = InstantMessageServiceConnector.SendInstantMessage(serverURI, im); 53 bool success = InstantMessageServiceConnector.SendInstantMessage(DemonServer.Address, im);
65 54 Assert.IsFalse(success, "Sending of IM succeeded, but it should have failed");
66 if (success)
67 m_log.InfoFormat("[IM CLIENT]: Successfully IMed {0}", serverURI);
68 else
69 m_log.InfoFormat("[IM CLIENT]: failed to IM {0}", serverURI);
70
71 System.Console.WriteLine("\n");
72 } 55 }
73 56
74 } 57 }
diff --git a/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs
new file mode 100644
index 0000000..9d3f400
--- /dev/null
+++ b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs
@@ -0,0 +1,153 @@
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 NUnit.Framework;
35
36using OpenSim.Framework;
37using OpenSim.Services.Interfaces;
38using OpenSim.Services.Connectors;
39
40namespace Robust.Tests
41{
42 [TestFixture]
43 public class InventoryClient
44 {
45// private static readonly ILog m_log =
46// LogManager.GetLogger(
47// MethodBase.GetCurrentMethod().DeclaringType);
48
49 private UUID m_userID = new UUID("00000000-0000-0000-0000-333333333333");
50 private UUID m_rootFolderID;
51 private UUID m_notecardsFolder;
52 private UUID m_objectsFolder;
53
54 [Test]
55 public void Inventory_001_CreateInventory()
56 {
57 XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address);
58
59 // Create an inventory that looks like this:
60 //
61 // /My Inventory
62 // <other system folders>
63 // /Objects
64 // Some Object
65 // /Notecards
66 // Notecard 1
67 // Notecard 2
68 // /Test Folder
69 // Link to notecard -> /Notecards/Notecard 2
70 // Link to Objects folder -> /Objects
71
72 Console.WriteLine("Starting inventory test");
73 bool success = m_Connector.CreateUserInventory(m_userID);
74 Assert.IsTrue(success, "Failed to create user inventory");
75
76 m_rootFolderID = m_Connector.GetRootFolder(m_userID).ID;
77 Assert.AreNotEqual(m_rootFolderID, UUID.Zero, "Root folder ID must not be UUID.Zero");
78
79 InventoryFolderBase of = m_Connector.GetFolderForType(m_userID, AssetType.Object);
80 Assert.IsNotNull(of, "Failed to retrieve Objects folder");
81 m_objectsFolder = of.ID;
82 Assert.AreNotEqual(m_objectsFolder, UUID.Zero, "Objects folder ID must not be UUID.Zero");
83
84 // Add an object
85 InventoryItemBase item = new InventoryItemBase(new UUID("b0000000-0000-0000-0000-00000000000b"), m_userID);
86 item.AssetID = UUID.Random();
87 item.AssetType = (int)AssetType.Object;
88 item.Folder = m_objectsFolder;
89 item.Name = "Some Object";
90 item.Description = string.Empty;
91 success = m_Connector.AddItem(item);
92 Assert.IsTrue(success, "Failed to add object to inventory");
93
94 InventoryFolderBase ncf = m_Connector.GetFolderForType(m_userID, AssetType.Notecard);
95 Assert.IsNotNull(of, "Failed to retrieve Notecards folder");
96 m_notecardsFolder = ncf.ID;
97 Assert.AreNotEqual(m_notecardsFolder, UUID.Zero, "Notecards folder ID must not be UUID.Zero");
98 m_notecardsFolder = ncf.ID;
99
100 // Add a notecard
101 item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID);
102 item.AssetID = UUID.Random();
103 item.AssetType = (int)AssetType.Notecard;
104 item.Folder = m_notecardsFolder;
105 item.Name = "Test Notecard 1";
106 item.Description = string.Empty;
107 success = m_Connector.AddItem(item);
108 Assert.IsTrue(success, "Failed to add Notecard 1 to inventory");
109 // Add another notecard
110 item.ID = new UUID("20000000-0000-0000-0000-000000000002");
111 item.AssetID = new UUID("a0000000-0000-0000-0000-00000000000a");
112 item.Name = "Test Notecard 2";
113 item.Description = string.Empty;
114 success = m_Connector.AddItem(item);
115 Assert.IsTrue(success, "Failed to add Notecard 2 to inventory");
116
117 // Add a folder
118 InventoryFolderBase folder = new InventoryFolderBase(new UUID("f0000000-0000-0000-0000-00000000000f"), "Test Folder", m_userID, m_rootFolderID);
119 folder.Type = (int)AssetType.Folder;
120 success = m_Connector.AddFolder(folder);
121 Assert.IsTrue(success, "Failed to add Test Folder to inventory");
122
123 // Add a link to notecard 2 in Test Folder
124 item.AssetID = item.ID; // use item ID of notecard 2
125 item.ID = new UUID("40000000-0000-0000-0000-000000000004");
126 item.AssetType = (int)AssetType.Link;
127 item.Folder = folder.ID;
128 item.Name = "Link to notecard";
129 item.Description = string.Empty;
130 success = m_Connector.AddItem(item);
131 Assert.IsTrue(success, "Failed to add link to notecard to inventory");
132
133 // Add a link to the Objects folder in Test Folder
134 item.AssetID = m_Connector.GetFolderForType(m_userID, AssetType.Object).ID; // use item ID of Objects folder
135 item.ID = new UUID("50000000-0000-0000-0000-000000000005");
136 item.AssetType = (int)AssetType.LinkFolder;
137 item.Folder = folder.ID;
138 item.Name = "Link to Objects folder";
139 item.Description = string.Empty;
140 success = m_Connector.AddItem(item);
141 Assert.IsTrue(success, "Failed to add link to objects folder to inventory");
142
143 InventoryCollection coll = m_Connector.GetFolderContent(m_userID, m_rootFolderID);
144 Assert.IsNotNull(coll, "Failed to retrieve contents of root folder");
145 Assert.Greater(coll.Folders.Count, 0, "Root folder does not have any subfolders");
146
147 coll = m_Connector.GetFolderContent(m_userID, folder.ID);
148 Assert.IsNotNull(coll, "Failed to retrieve contents of Test Folder");
149 Assert.AreEqual(coll.Items.Count + coll.Folders.Count, 2, "Test Folder is expected to have exactly 2 things inside");
150
151 }
152 }
153}
diff --git a/OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs b/OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs
new file mode 100644
index 0000000..31c8ee9
--- /dev/null
+++ b/OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs
@@ -0,0 +1,81 @@
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 NUnit.Framework;
35
36using OpenSim.Framework;
37using OpenSim.Services.Interfaces;
38using OpenSim.Services.Connectors;
39
40namespace Robust.Tests
41{
42 [TestFixture]
43 public class PresenceClient
44 {
45 [Test]
46 public void Presence_001()
47 {
48 PresenceServicesConnector m_Connector = new PresenceServicesConnector(DemonServer.Address);
49
50 UUID user1 = UUID.Random();
51 UUID session1 = UUID.Random();
52 UUID region1 = UUID.Random();
53
54 bool success = m_Connector.LoginAgent(user1.ToString(), session1, UUID.Zero);
55 Assert.AreEqual(success, true, "Failed to add user session");
56
57 PresenceInfo pinfo = m_Connector.GetAgent(session1);
58 Assert.AreNotEqual(pinfo, null, "Unable to retrieve session");
59 Assert.AreEqual(pinfo.UserID, user1.ToString(), "Retrieved session does not match expected userID");
60 Assert.AreNotEqual(pinfo.RegionID, region1, "Retrieved session is unexpectedly in region");
61
62 success = m_Connector.ReportAgent(session1, region1);
63 Assert.AreEqual(success, true, "Failed to report session in region 1");
64
65 pinfo = m_Connector.GetAgent(session1);
66 Assert.AreNotEqual(pinfo, null, "Unable to session presence");
67 Assert.AreEqual(pinfo.UserID, user1.ToString(), "Retrieved session does not match expected userID");
68 Assert.AreEqual(pinfo.RegionID, region1, "Retrieved session is not in expected region");
69
70 success = m_Connector.LogoutAgent(session1);
71 Assert.AreEqual(success, true, "Failed to remove session");
72
73 pinfo = m_Connector.GetAgent(session1);
74 Assert.AreEqual(pinfo, null, "Session is still there, even though it shouldn't");
75
76 success = m_Connector.ReportAgent(session1, UUID.Random());
77 Assert.AreEqual(success, false, "Remove non-existing session should fail");
78 }
79
80 }
81}
diff --git a/OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs b/OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs
new file mode 100644
index 0000000..2c327e8
--- /dev/null
+++ b/OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs
@@ -0,0 +1,85 @@
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 NUnit.Framework;
35
36using OpenSim.Framework;
37using OpenSim.Services.Interfaces;
38using OpenSim.Services.Connectors;
39
40namespace Robust.Tests
41{
42 [TestFixture]
43 public class UserAccountsClient
44 {
45 [Test]
46 public void UserAccounts_001()
47 {
48 UserAccountServicesConnector m_Connector = new UserAccountServicesConnector(DemonServer.Address);
49
50 string first = "Completely";
51 string last = "Clueless";
52 string email = "foo@bar.com";
53
54 UserAccount account = m_Connector.CreateUser(first, last, "123", email, UUID.Zero);
55 Assert.IsNotNull(account, "Failed to create account " + first + " " + last);
56 UUID user1 = account.PrincipalID;
57
58 account = m_Connector.GetUserAccount(UUID.Zero, user1);
59 Assert.NotNull(account, "Failed to retrieve account for user id " + user1);
60 Assert.AreEqual(account.FirstName, first, "First name does not match");
61 Assert.AreEqual(account.LastName, last, "Last name does not match");
62
63 account = m_Connector.GetUserAccount(UUID.Zero, first, last);
64 Assert.IsNotNull(account, "Failed to retrieve account for user " + first + " " + last);
65 Assert.AreEqual(account.FirstName, first, "First name does not match (bis)");
66 Assert.AreEqual(account.LastName, last, "Last name does not match (bis)");
67
68 account.Email = "user@example.com";
69 bool success = m_Connector.StoreUserAccount(account);
70 Assert.IsTrue(success, "Failed to store existing account");
71
72 account = m_Connector.GetUserAccount(UUID.Zero, user1);
73 Assert.NotNull(account, "Failed to retrieve account for user id " + user1);
74 Assert.AreEqual(account.Email, "user@example.com", "Incorrect email");
75
76 account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist");
77 Assert.IsNull(account, "Account DoesNot Exit must not be there");
78
79 account = new UserAccount(UUID.Zero, "DoesNot", "Exist", "xxx@xxx.com");
80 success = m_Connector.StoreUserAccount(account);
81 Assert.IsFalse(success, "Storing a non-existing account must fail");
82 }
83
84 }
85}
diff --git a/OpenSim/Tests/Robust/Server/DemonServer.cs b/OpenSim/Tests/Robust/Server/DemonServer.cs
new file mode 100644
index 0000000..1e0797e
--- /dev/null
+++ b/OpenSim/Tests/Robust/Server/DemonServer.cs
@@ -0,0 +1,69 @@
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.IO;
31using System.Threading;
32
33using Nini.Config;
34using log4net;
35using NUnit.Framework;
36
37using OpenSim.Server;
38
39namespace Robust.Tests
40{
41 [SetUpFixture]
42 public class DemonServer : OpenSimServer
43 {
44 private Thread m_demon;
45
46 public static string Address = "http://localhost:8888";
47
48 [SetUp]
49 public void StartDemon()
50 {
51 if (File.Exists("Robust.Tests.log"))
52 File.Delete("Robust.Tests.log");
53
54 Console.WriteLine("**** Starting demon Robust server ****");
55 m_demon = new Thread( () => Main(new string[] {"-inifile=Robust.Tests.ini"}));
56 m_demon.Start();
57 // Give some time for the server to instantiate all services
58 Thread.Sleep(3000);
59 Console.WriteLine("**** Setup Finished ****");
60 }
61
62 [TearDown]
63 public void StopDemon()
64 {
65 Console.WriteLine("**** Killing demon Robust Server ****");
66 m_Server.Shutdown();
67 }
68 }
69}