aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-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/Common/Helpers/BaseRequestHandlerHelpers.cs1
-rw-r--r--OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs95
-rw-r--r--OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs1
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs72
-rw-r--r--OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs103
-rw-r--r--OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/BaseAssetRepository.cs11
-rw-r--r--OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs178
-rw-r--r--OpenSim/Tests/Common/Mock/MockScriptEngine.cs8
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs48
-rw-r--r--OpenSim/Tests/Common/Mock/TestHttpClientContext.cs110
-rw-r--r--OpenSim/Tests/Common/Mock/TestHttpRequest.cs174
-rw-r--r--OpenSim/Tests/Common/Mock/TestHttpResponse.cs171
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/TestLLUDPServer.cs (renamed from OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs)3
-rw-r--r--OpenSim/Tests/Common/Mock/TestLandChannel.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs6
-rw-r--r--OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs25
-rw-r--r--OpenSim/Tests/Common/OpenSimTestCase.cs1
-rw-r--r--OpenSim/Tests/Performance/NPCPerformanceTests.cs3
-rw-r--r--OpenSim/Tests/Performance/ObjectPerformanceTests.cs1
-rw-r--r--OpenSim/Tests/Performance/ScriptPerformanceTests.cs1
-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.cs206
-rw-r--r--OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs81
-rw-r--r--OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs86
-rw-r--r--OpenSim/Tests/Robust/Server/DemonServer.cs69
-rw-r--r--OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs3
37 files changed, 1519 insertions, 441 deletions
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/Common/Helpers/BaseRequestHandlerHelpers.cs b/OpenSim/Tests/Common/Helpers/BaseRequestHandlerHelpers.cs
index 49c99c5..82ecf9a 100644
--- a/OpenSim/Tests/Common/Helpers/BaseRequestHandlerHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/BaseRequestHandlerHelpers.cs
@@ -32,7 +32,6 @@ using NUnit.Framework;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
34using OpenSim.Framework.Servers.HttpServer; 34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Tests.Common.Mock;
36 35
37namespace OpenSim.Tests.Common 36namespace OpenSim.Tests.Common
38{ 37{
diff --git a/OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs b/OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs
new file mode 100644
index 0000000..33cd8a2
--- /dev/null
+++ b/OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs
@@ -0,0 +1,95 @@
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.Net;
30using Nini.Config;
31using OpenMetaverse;
32using OpenMetaverse.Packets;
33using OpenSim.Framework;
34using OpenSim.Region.ClientStack.LindenUDP;
35using OpenSim.Region.Framework.Scenes;
36
37namespace OpenSim.Tests.Common
38{
39 /// <summary>
40 /// This class adds full UDP client classes and associated scene presence to scene.
41 /// </summary>
42 /// <remarks>
43 /// This is used for testing client stack code. For testing other code, use SceneHelper methods instead since
44 /// they operate without the burden of setting up UDP structures which should be unnecessary for testing scene
45 /// code.
46 /// </remarks>
47 public static class ClientStackHelpers
48 {
49 public static ScenePresence AddChildClient(
50 Scene scene, LLUDPServer udpServer, UUID agentId, UUID sessionId, uint circuitCode)
51 {
52 IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
53
54 UseCircuitCodePacket uccp = new UseCircuitCodePacket();
55
56 UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
57 = new UseCircuitCodePacket.CircuitCodeBlock();
58 uccpCcBlock.Code = circuitCode;
59 uccpCcBlock.ID = agentId;
60 uccpCcBlock.SessionID = sessionId;
61 uccp.CircuitCode = uccpCcBlock;
62
63 byte[] uccpBytes = uccp.ToBytes();
64 UDPPacketBuffer upb = new UDPPacketBuffer(testEp, uccpBytes.Length);
65 upb.DataLength = uccpBytes.Length; // God knows why this isn't set by the constructor.
66 Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);
67
68 AgentCircuitData acd = new AgentCircuitData();
69 acd.AgentID = agentId;
70 acd.SessionID = sessionId;
71
72 scene.AuthenticateHandler.AddNewCircuit(circuitCode, acd);
73
74 udpServer.PacketReceived(upb);
75
76 return scene.GetScenePresence(agentId);
77 }
78
79 public static TestLLUDPServer AddUdpServer(Scene scene)
80 {
81 return AddUdpServer(scene, new IniConfigSource());
82 }
83
84 public static TestLLUDPServer AddUdpServer(Scene scene, IniConfigSource configSource)
85 {
86 uint port = 0;
87 AgentCircuitManager acm = scene.AuthenticateHandler;
88
89 TestLLUDPServer udpServer = new TestLLUDPServer(IPAddress.Any, ref port, 0, false, configSource, acm);
90 udpServer.AddScene(scene);
91
92 return udpServer;
93 }
94 }
95} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
index 84de47f..e6adcf7 100644
--- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.CoreModules.Framework; 44using OpenSim.Region.CoreModules.Framework;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Tests.Common 47namespace OpenSim.Tests.Common
49{ 48{
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index d36e42e..9ed3eae 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -30,6 +30,7 @@ using System.Net;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using Nini.Config; 31using Nini.Config;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Data.Null;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
@@ -48,7 +49,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
48using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; 49using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
49using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; 50using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
50using OpenSim.Services.Interfaces; 51using OpenSim.Services.Interfaces;
51using OpenSim.Tests.Common.Mock;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion; 52using GridRegion = OpenSim.Services.Interfaces.GridRegion;
53 53
54namespace OpenSim.Tests.Common 54namespace OpenSim.Tests.Common
@@ -63,9 +63,9 @@ namespace OpenSim.Tests.Common
63 /// </summary> 63 /// </summary>
64 public SceneManager SceneManager { get; private set; } 64 public SceneManager SceneManager { get; private set; }
65 65
66 public ISimulationDataService SimDataService { get; private set; }
67
66 private AgentCircuitManager m_acm = new AgentCircuitManager(); 68 private AgentCircuitManager m_acm = new AgentCircuitManager();
67 private ISimulationDataService m_simDataService
68 = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null);
69 private IEstateDataService m_estateDataService = null; 69 private IEstateDataService m_estateDataService = null;
70 70
71 private LocalAssetServicesConnector m_assetService; 71 private LocalAssetServicesConnector m_assetService;
@@ -96,6 +96,9 @@ namespace OpenSim.Tests.Common
96 m_presenceService.PostInitialise(); 96 m_presenceService.PostInitialise();
97 97
98 m_cache = cache; 98 m_cache = cache;
99
100 SimDataService
101 = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null);
99 } 102 }
100 103
101 /// <summary> 104 /// <summary>
@@ -115,6 +118,11 @@ namespace OpenSim.Tests.Common
115 return SetupScene(name, id, x, y, new IniConfigSource()); 118 return SetupScene(name, id, x, y, new IniConfigSource());
116 } 119 }
117 120
121 public TestScene SetupScene(string name, UUID id, uint x, uint y, IConfigSource configSource)
122 {
123 return SetupScene(name, id, x, y, Constants.RegionSize, Constants.RegionSize, configSource);
124 }
125
118 /// <summary> 126 /// <summary>
119 /// Set up a scene. 127 /// Set up a scene.
120 /// </summary> 128 /// </summary>
@@ -122,10 +130,12 @@ namespace OpenSim.Tests.Common
122 /// <param name="id">ID of the region</param> 130 /// <param name="id">ID of the region</param>
123 /// <param name="x">X co-ordinate of the region</param> 131 /// <param name="x">X co-ordinate of the region</param>
124 /// <param name="y">Y co-ordinate of the region</param> 132 /// <param name="y">Y co-ordinate of the region</param>
133 /// <param name="sizeX">X size of scene</param>
134 /// <param name="sizeY">Y size of scene</param>
125 /// <param name="configSource"></param> 135 /// <param name="configSource"></param>
126 /// <returns></returns> 136 /// <returns></returns>
127 public TestScene SetupScene( 137 public TestScene SetupScene(
128 string name, UUID id, uint x, uint y, IConfigSource configSource) 138 string name, UUID id, uint x, uint y, uint sizeX, uint sizeY, IConfigSource configSource)
129 { 139 {
130 Console.WriteLine("Setting up test scene {0}", name); 140 Console.WriteLine("Setting up test scene {0}", name);
131 141
@@ -135,18 +145,29 @@ namespace OpenSim.Tests.Common
135 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); 145 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
136 regInfo.RegionName = name; 146 regInfo.RegionName = name;
137 regInfo.RegionID = id; 147 regInfo.RegionID = id;
148 regInfo.RegionSizeX = sizeX;
149 regInfo.RegionSizeY = sizeY;
138 150
139 SceneCommunicationService scs = new SceneCommunicationService(); 151 SceneCommunicationService scs = new SceneCommunicationService();
140 152
141 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); 153 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
142 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); 154 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
155<<<<<<< HEAD
156 Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ);
157 PhysicsScene physicsScene
158=======
143 Vector3 regionExtent = new Vector3(regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ); 159 Vector3 regionExtent = new Vector3(regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ);
144 PhysicsScene physicsScene 160 PhysicsScene physicsScene
161>>>>>>> avn/ubitvar
145 = physicsPluginManager.GetPhysicsScene( 162 = physicsPluginManager.GetPhysicsScene(
146 "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent); 163 "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent);
147 164
148 TestScene testScene = new TestScene( 165 TestScene testScene = new TestScene(
166<<<<<<< HEAD
167 regInfo, m_acm, physicsScene, scs, SimDataService, m_estateDataService, configSource, null);
168=======
149 regInfo, m_acm, physicsScene, scs, m_simDataService, m_estateDataService, configSource, null); 169 regInfo, m_acm, physicsScene, scs, m_simDataService, m_estateDataService, configSource, null);
170>>>>>>> avn/ubitvar
150 171
151 INonSharedRegionModule godsModule = new GodsModule(); 172 INonSharedRegionModule godsModule = new GodsModule();
152 godsModule.Initialise(new IniConfigSource()); 173 godsModule.Initialise(new IniConfigSource());
@@ -189,7 +210,11 @@ namespace OpenSim.Tests.Common
189 testScene.SetModuleInterfaces(); 210 testScene.SetModuleInterfaces();
190 211
191 testScene.LandChannel = new TestLandChannel(testScene); 212 testScene.LandChannel = new TestLandChannel(testScene);
213<<<<<<< HEAD
214 testScene.LoadWorldMap();
215=======
192 testScene.LoadWorldMap(); 216 testScene.LoadWorldMap();
217>>>>>>> avn/ubitvar
193 218
194 testScene.RegionInfo.EstateSettings = new EstateSettings(); 219 testScene.RegionInfo.EstateSettings = new EstateSettings();
195 testScene.LoginsEnabled = true; 220 testScene.LoginsEnabled = true;
@@ -299,6 +324,11 @@ namespace OpenSim.Tests.Common
299 /// <param name="testScene"></param> 324 /// <param name="testScene"></param>
300 private static LocalPresenceServicesConnector StartPresenceService() 325 private static LocalPresenceServicesConnector StartPresenceService()
301 { 326 {
327 // Unfortunately, some services share data via statics, so we need to null every time to stop interference
328 // between tests.
329 // This is a massive non-obvious pita.
330 NullPresenceData.Instance = null;
331
302 IConfigSource config = new IniConfigSource(); 332 IConfigSource config = new IniConfigSource();
303 config.AddConfig("Modules"); 333 config.AddConfig("Modules");
304 config.AddConfig("PresenceService"); 334 config.AddConfig("PresenceService");
@@ -546,7 +576,7 @@ namespace OpenSim.Tests.Common
546 string reason; 576 string reason;
547 577
548 // Stage 1: tell the scene to expect a new user connection 578 // Stage 1: tell the scene to expect a new user connection
549 if (!scene.NewUserConnection(agentData, (uint)tf, out reason)) 579 if (!scene.NewUserConnection(agentData, (uint)tf, null, out reason))
550 Console.WriteLine("NewUserConnection failed: " + reason); 580 Console.WriteLine("NewUserConnection failed: " + reason);
551 581
552 // Stage 2: add the new client as a child agent to the scene 582 // Stage 2: add the new client as a child agent to the scene
@@ -557,7 +587,11 @@ namespace OpenSim.Tests.Common
557 587
558 public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId) 588 public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId)
559 { 589 {
560 AgentCircuitData acd = GenerateAgentData(agentId); 590 return AddChildScenePresence(scene, GenerateAgentData(agentId));
591 }
592
593 public static ScenePresence AddChildScenePresence(Scene scene, AgentCircuitData acd)
594 {
561 acd.child = true; 595 acd.child = true;
562 596
563 // XXX: ViaLogin may not be correct for child agents 597 // XXX: ViaLogin may not be correct for child agents
@@ -589,6 +623,32 @@ namespace OpenSim.Tests.Common
589 //part.UpdatePrimFlags(false, false, true); 623 //part.UpdatePrimFlags(false, false, true);
590 //part.ObjectFlags |= (uint)PrimFlags.Phantom; 624 //part.ObjectFlags |= (uint)PrimFlags.Phantom;
591 625
626 scene.AddNewSceneObject(so, true);
627
628 return so;
629 }
630
631 /// <summary>
632 /// Add a test object
633 /// </summary>
634 /// <param name="scene"></param>
635 /// <param name="parts">
636 /// The number of parts that should be in the scene object
637 /// </param>
638 /// <param name="ownerId"></param>
639 /// <param name="partNamePrefix">
640 /// The prefix to be given to part names. This will be suffixed with "Part<part no>"
641 /// (e.g. mynamePart1 for the root part)
642 /// </param>
643 /// <param name="uuidTail">
644 /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
645 /// will be given to the root part, and incremented for each part thereafter.
646 /// </param>
647 /// <returns></returns>
648 public static SceneObjectGroup AddSceneObject(Scene scene, int parts, UUID ownerId, string partNamePrefix, int uuidTail)
649 {
650 SceneObjectGroup so = CreateSceneObject(parts, ownerId, partNamePrefix, uuidTail);
651
592 scene.AddNewSceneObject(so, false); 652 scene.AddNewSceneObject(so, false);
593 653
594 return so; 654 return so;
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index bb4b55f..3a3b33a 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Tests.Common
43 /// <summary> 43 /// <summary>
44 /// Add a notecard item to the given part. 44 /// Add a notecard item to the given part.
45 /// </summary> 45 /// </summary>
46 /// <param name="scene"></param> 46 /// <param name="assetService"></param>
47 /// <param name="part"></param> 47 /// <param name="part"></param>
48 /// <param name="itemName"></param> 48 /// <param name="itemName"></param>
49 /// <param name="itemIDFrag">UUID or UUID stem</param> 49 /// <param name="itemIDFrag">UUID or UUID stem</param>
@@ -51,16 +51,16 @@ namespace OpenSim.Tests.Common
51 /// <param name="text">The tex to put in the notecard.</param> 51 /// <param name="text">The tex to put in the notecard.</param>
52 /// <returns>The item that was added</returns> 52 /// <returns>The item that was added</returns>
53 public static TaskInventoryItem AddNotecard( 53 public static TaskInventoryItem AddNotecard(
54 Scene scene, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text) 54 IAssetService assetService, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text)
55 { 55 {
56 return AddNotecard( 56 return AddNotecard(
57 scene, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text); 57 assetService, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text);
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
61 /// Add a notecard item to the given part. 61 /// Add a notecard item to the given part.
62 /// </summary> 62 /// </summary>
63 /// <param name="scene"></param> 63 /// <param name="assetService"></param>
64 /// <param name="part"></param> 64 /// <param name="part"></param>
65 /// <param name="itemName"></param> 65 /// <param name="itemName"></param>
66 /// <param name="itemID"></param> 66 /// <param name="itemID"></param>
@@ -68,7 +68,7 @@ namespace OpenSim.Tests.Common
68 /// <param name="text">The tex to put in the notecard.</param> 68 /// <param name="text">The tex to put in the notecard.</param>
69 /// <returns>The item that was added</returns> 69 /// <returns>The item that was added</returns>
70 public static TaskInventoryItem AddNotecard( 70 public static TaskInventoryItem AddNotecard(
71 Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text) 71 IAssetService assetService, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text)
72 { 72 {
73 AssetNotecard nc = new AssetNotecard(); 73 AssetNotecard nc = new AssetNotecard();
74 nc.BodyText = text; 74 nc.BodyText = text;
@@ -76,7 +76,7 @@ namespace OpenSim.Tests.Common
76 76
77 AssetBase ncAsset 77 AssetBase ncAsset
78 = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero); 78 = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero);
79 scene.AssetService.Store(ncAsset); 79 assetService.Store(ncAsset);
80 80
81 TaskInventoryItem ncItem 81 TaskInventoryItem ncItem
82 = new TaskInventoryItem 82 = new TaskInventoryItem
@@ -94,12 +94,12 @@ namespace OpenSim.Tests.Common
94 /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these 94 /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
95 /// functions more than once in a test. 95 /// functions more than once in a test.
96 /// </remarks> 96 /// </remarks>
97 /// <param name="scene"></param> 97 /// <param name="assetService"></param>
98 /// <param name="part"></param> 98 /// <param name="part"></param>
99 /// <returns>The item that was added</returns> 99 /// <returns>The item that was added</returns>
100 public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) 100 public static TaskInventoryItem AddScript(IAssetService assetService, SceneObjectPart part)
101 { 101 {
102 return AddScript(scene, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }"); 102 return AddScript(assetService, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }");
103 } 103 }
104 104
105 /// <summary> 105 /// <summary>
@@ -109,30 +109,47 @@ namespace OpenSim.Tests.Common
109 /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather 109 /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
110 /// than a random component. 110 /// than a random component.
111 /// </remarks> 111 /// </remarks>
112 /// <param name="scene"></param> 112 /// <param name="assetService"></param>
113 /// <param name="part"></param> 113 /// <param name="part"></param>
114 /// <param name="scriptName">Name of the script to add</param> 114 /// <param name="scriptName">Name of the script to add</param>
115 /// <param name="scriptSource">LSL script source</param> 115 /// <param name="scriptSource">LSL script source</param>
116 /// <returns>The item that was added</returns> 116 /// <returns>The item that was added</returns>
117 public static TaskInventoryItem AddScript( 117 public static TaskInventoryItem AddScript(
118 Scene scene, SceneObjectPart part, string scriptName, string scriptSource) 118 IAssetService assetService, SceneObjectPart part, string scriptName, string scriptSource)
119 {
120 return AddScript(assetService, part, UUID.Random(), UUID.Random(), scriptName, scriptSource);
121 }
122
123 /// <summary>
124 /// Add a simple script to the given part.
125 /// </summary>
126 /// <remarks>
127 /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
128 /// than a random component.
129 /// </remarks>
130 /// <param name="assetService"></param>
131 /// <param name="part"></param>
132 /// <param name="itemId">Item UUID for the script</param>
133 /// <param name="assetId">Asset UUID for the script</param>
134 /// <param name="scriptName">Name of the script to add</param>
135 /// <param name="scriptSource">LSL script source</param>
136 /// <returns>The item that was added</returns>
137 public static TaskInventoryItem AddScript(
138 IAssetService assetService, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource)
119 { 139 {
120 AssetScriptText ast = new AssetScriptText(); 140 AssetScriptText ast = new AssetScriptText();
121 ast.Source = scriptSource; 141 ast.Source = scriptSource;
122 ast.Encode(); 142 ast.Encode();
123 143
124 UUID assetUuid = UUID.Random();
125 UUID itemUuid = UUID.Random();
126
127 AssetBase asset 144 AssetBase asset
128 = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); 145 = AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero);
129 scene.AssetService.Store(asset); 146 assetService.Store(asset);
130 TaskInventoryItem item 147 TaskInventoryItem item
131 = new TaskInventoryItem 148 = new TaskInventoryItem
132 { Name = scriptName, AssetID = assetUuid, ItemID = itemUuid, 149 { Name = scriptName, AssetID = assetId, ItemID = itemId,
133 Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; 150 Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL };
134 part.Inventory.AddInventoryItem(item, true); 151 part.Inventory.AddInventoryItem(item, true);
135 152
136 return item; 153 return item;
137 } 154 }
138 155
@@ -144,28 +161,50 @@ namespace OpenSim.Tests.Common
144 /// functions more than once in a test. 161 /// functions more than once in a test.
145 /// </remarks> 162 /// </remarks>
146 /// 163 ///
147 /// <param name="scene"></param> 164 /// <param name="assetService"></param>
148 /// <param name="sop"></param> 165 /// <param name="sop"></param>
149 /// <param name="itemName"></param> 166 /// <param name="itemName"></param>
150 /// <param name="id"></param> 167 /// <param name="itemId"></param>
151 /// <param name="userId"></param> 168 /// <param name="soToAdd"></param>
169 /// <param name="soAssetId"></param>
152 public static TaskInventoryItem AddSceneObject( 170 public static TaskInventoryItem AddSceneObject(
153 Scene scene, SceneObjectPart sop, string itemName, UUID id, UUID userId) 171 IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, SceneObjectGroup soToAdd, UUID soAssetId)
154 { 172 {
155 SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); 173 AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(soAssetId, soToAdd);
156 AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); 174 assetService.Store(taskSceneObjectAsset);
157 scene.AssetService.Store(taskSceneObjectAsset);
158 TaskInventoryItem taskSceneObjectItem 175 TaskInventoryItem taskSceneObjectItem
159 = new TaskInventoryItem 176 = new TaskInventoryItem
160 { Name = itemName, 177 { Name = itemName,
161 AssetID = taskSceneObjectAsset.FullID, 178 AssetID = taskSceneObjectAsset.FullID,
162 ItemID = id, 179 ItemID = itemId,
163 OwnerID = userId, 180 OwnerID = soToAdd.OwnerID,
164 Type = (int)AssetType.Object, 181 Type = (int)AssetType.Object,
165 InvType = (int)InventoryType.Object }; 182 InvType = (int)InventoryType.Object };
166 sop.Inventory.AddInventoryItem(taskSceneObjectItem, true); 183 sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
167 184
168 return taskSceneObjectItem; 185 return taskSceneObjectItem;
169 } 186 }
187
188 /// <summary>
189 /// Add a scene object item to the given part.
190 /// </summary>
191 /// <remarks>
192 /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
193 /// functions more than once in a test.
194 /// </remarks>
195 ///
196 /// <param name="assetService"></param>
197 /// <param name="sop"></param>
198 /// <param name="itemName"></param>
199 /// <param name="id"></param>
200 /// <param name="userId"></param>
201 public static TaskInventoryItem AddSceneObject(
202 IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, UUID userId)
203 {
204 SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, userId);
205
206 return TaskInventoryHelpers.AddSceneObject(
207 assetService, sop, itemName, itemId, taskSceneObject, TestHelpers.ParseTail(0x10));
208 }
170 } 209 }
171} \ No newline at end of file 210} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
index b3b75af..5a36332 100644
--- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Tests.Common
102 { 102 {
103 return AddInventoryItem( 103 return AddInventoryItem(
104 scene, itemName, itemId, itemType, asset, userId, 104 scene, itemName, itemId, itemType, asset, userId,
105 scene.InventoryService.GetFolderForType(userId, (AssetType)asset.Type).Name); 105 scene.InventoryService.GetFolderForType(userId, (FolderType)asset.Type).Name);
106 } 106 }
107 107
108 /// <summary> 108 /// <summary>
diff --git a/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs b/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs
index cfefd38..cb4fb80 100644
--- a/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs
+++ b/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs
@@ -25,11 +25,12 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using OpenMetaverse; 30using OpenMetaverse;
30using OpenSim.Framework; 31using OpenSim.Framework;
31 32
32namespace OpenSim.Tests.Common.Mock 33namespace OpenSim.Tests.Common
33{ 34{
34 public class BaseAssetRepository 35 public class BaseAssetRepository
35 { 36 {
@@ -37,7 +38,7 @@ namespace OpenSim.Tests.Common.Mock
37 38
38 public AssetBase FetchAsset(UUID uuid) 39 public AssetBase FetchAsset(UUID uuid)
39 { 40 {
40 if (ExistsAsset(uuid)) 41 if (AssetsExist(new[] { uuid })[0])
41 return Assets[uuid]; 42 return Assets[uuid];
42 else 43 else
43 return null; 44 return null;
@@ -53,9 +54,9 @@ namespace OpenSim.Tests.Common.Mock
53 CreateAsset(asset); 54 CreateAsset(asset);
54 } 55 }
55 56
56 public bool ExistsAsset(UUID uuid) 57 public bool[] AssetsExist(UUID[] uuids)
57 { 58 {
58 return Assets.ContainsKey(uuid); 59 return Array.ConvertAll(uuids, id => Assets.ContainsKey(id));
59 } 60 }
60 } 61 }
61} \ No newline at end of file 62} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
index 5bab62c..aaf61e7 100644
--- a/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
@@ -31,7 +31,7 @@ using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Data; 32using OpenSim.Data;
33 33
34namespace OpenSim.Tests.Common.Mock 34namespace OpenSim.Tests.Common
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// In memory asset data plugin for test purposes. Could be another dll when properly filled out and when the 37 /// In memory asset data plugin for test purposes. Could be another dll when properly filled out and when the
diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs
index 3035cea..7f530d0 100644
--- a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs
+++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs
@@ -40,7 +40,7 @@ using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; 41using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
42 42
43namespace OpenSim.Tests.Common.Mock 43namespace OpenSim.Tests.Common
44{ 44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class MockGroupsServicesConnector : ISharedRegionModule, IGroupsServicesConnector 46 public class MockGroupsServicesConnector : ISharedRegionModule, IGroupsServicesConnector
@@ -138,33 +138,28 @@ namespace OpenSim.Tests.Common.Mock
138 { 138 {
139 } 139 }
140 140
141 private XGroup GetXGroup(UUID groupID, string name)
142 {
143 XGroup group = m_data.GetGroup(groupID);
144
145
146 if (group == null)
147 m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: No group found with ID {0}", groupID);
148
149 return group;
150 }
151
141 public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName) 152 public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName)
142 { 153 {
143 m_log.DebugFormat( 154 m_log.DebugFormat(
144 "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}", 155 "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}",
145 groupID, groupName); 156 groupID, groupName);
146 157
147 XGroup[] groups; 158 XGroup xg = GetXGroup(groupID, groupName);
148 string field, val;
149 159
150 if (groupID != UUID.Zero) 160 if (xg == null)
151 {
152 field = "groupID";
153 val = groupID.ToString();
154 }
155 else
156 {
157 field = "name";
158 val = groupName;
159 }
160
161 groups = m_data.GetGroups(field, val);
162
163 if (groups.Length == 0)
164 return null; 161 return null;
165 162
166 XGroup xg = groups[0];
167
168 GroupRecord gr = new GroupRecord() 163 GroupRecord gr = new GroupRecord()
169 { 164 {
170 GroupID = xg.groupID, 165 GroupID = xg.groupID,
@@ -196,8 +191,25 @@ namespace OpenSim.Tests.Common.Mock
196 { 191 {
197 } 192 }
198 193
199 public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) 194 public void SetAgentGroupInfo(UUID requestingAgentID, UUID agentID, UUID groupID, bool acceptNotices, bool listInProfile)
200 { 195 {
196 m_log.DebugFormat(
197 "[MOCK GROUPS SERVICES CONNECTOR]: SetAgentGroupInfo, requestingAgentID {0}, agentID {1}, groupID {2}, acceptNotices {3}, listInProfile {4}",
198 requestingAgentID, agentID, groupID, acceptNotices, listInProfile);
199
200 XGroup group = GetXGroup(groupID, null);
201
202 if (group == null)
203 return;
204
205 XGroupMember xgm = null;
206 if (!group.members.TryGetValue(agentID, out xgm))
207 return;
208
209 xgm.acceptNotices = acceptNotices;
210 xgm.listInProfile = listInProfile;
211
212 m_data.StoreGroup(group);
201 } 213 }
202 214
203 public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) 215 public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
@@ -213,8 +225,27 @@ namespace OpenSim.Tests.Common.Mock
213 { 225 {
214 } 226 }
215 227
216 public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) 228 public void AddAgentToGroup(UUID requestingAgentID, UUID agentID, UUID groupID, UUID roleID)
217 { 229 {
230 m_log.DebugFormat(
231 "[MOCK GROUPS SERVICES CONNECTOR]: AddAgentToGroup, requestingAgentID {0}, agentID {1}, groupID {2}, roleID {3}",
232 requestingAgentID, agentID, groupID, roleID);
233
234 XGroup group = GetXGroup(groupID, null);
235
236 if (group == null)
237 return;
238
239 XGroupMember groupMember = new XGroupMember()
240 {
241 agentID = agentID,
242 groupID = groupID,
243 roleID = roleID
244 };
245
246 group.members[agentID] = groupMember;
247
248 m_data.StoreGroup(group);
218 } 249 }
219 250
220 public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) 251 public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
@@ -259,9 +290,31 @@ namespace OpenSim.Tests.Common.Mock
259 return null; 290 return null;
260 } 291 }
261 292
262 public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) 293 public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID groupID)
263 { 294 {
264 return null; 295 m_log.DebugFormat(
296 "[MOCK GROUPS SERVICES CONNECTOR]: GetGroupMembers, requestingAgentID {0}, groupID {1}",
297 requestingAgentID, groupID);
298
299 List<GroupMembersData> groupMembers = new List<GroupMembersData>();
300
301 XGroup group = GetXGroup(groupID, null);
302
303 if (group == null)
304 return groupMembers;
305
306 foreach (XGroupMember xgm in group.members.Values)
307 {
308 GroupMembersData gmd = new GroupMembersData();
309 gmd.AgentID = xgm.agentID;
310 gmd.IsOwner = group.founderID == gmd.AgentID;
311 gmd.AcceptNotices = xgm.acceptNotices;
312 gmd.ListInProfile = xgm.listInProfile;
313
314 groupMembers.Add(gmd);
315 }
316
317 return groupMembers;
265 } 318 }
266 319
267 public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) 320 public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
@@ -269,18 +322,93 @@ namespace OpenSim.Tests.Common.Mock
269 return null; 322 return null;
270 } 323 }
271 324
272 public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) 325 public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID groupID)
273 { 326 {
274 return null; 327 XGroup group = GetXGroup(groupID, null);
328
329 if (group == null)
330 return null;
331
332 List<GroupNoticeData> notices = new List<GroupNoticeData>();
333
334 foreach (XGroupNotice notice in group.notices.Values)
335 {
336 GroupNoticeData gnd = new GroupNoticeData()
337 {
338 NoticeID = notice.noticeID,
339 Timestamp = notice.timestamp,
340 FromName = notice.fromName,
341 Subject = notice.subject,
342 HasAttachment = notice.hasAttachment,
343 AssetType = (byte)notice.assetType
344 };
345
346 notices.Add(gnd);
347 }
348
349 return notices;
275 } 350 }
276 351
277 public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) 352 public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
278 { 353 {
354 m_log.DebugFormat(
355 "[MOCK GROUPS SERVICES CONNECTOR]: GetGroupNotices, requestingAgentID {0}, noticeID {1}",
356 requestingAgentID, noticeID);
357
358 // Yes, not an efficient way to do it.
359 Dictionary<UUID, XGroup> groups = m_data.GetGroups();
360
361 foreach (XGroup group in groups.Values)
362 {
363 if (group.notices.ContainsKey(noticeID))
364 {
365 XGroupNotice n = group.notices[noticeID];
366
367 GroupNoticeInfo gni = new GroupNoticeInfo();
368 gni.GroupID = n.groupID;
369 gni.Message = n.message;
370 gni.BinaryBucket = n.binaryBucket;
371 gni.noticeData.NoticeID = n.noticeID;
372 gni.noticeData.Timestamp = n.timestamp;
373 gni.noticeData.FromName = n.fromName;
374 gni.noticeData.Subject = n.subject;
375 gni.noticeData.HasAttachment = n.hasAttachment;
376 gni.noticeData.AssetType = (byte)n.assetType;
377
378 return gni;
379 }
380 }
381
279 return null; 382 return null;
280 } 383 }
281 384
282 public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) 385 public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
283 { 386 {
387 m_log.DebugFormat(
388 "[MOCK GROUPS SERVICES CONNECTOR]: AddGroupNotice, requestingAgentID {0}, groupID {1}, noticeID {2}, fromName {3}, subject {4}, message {5}, binaryBucket.Length {6}",
389 requestingAgentID, groupID, noticeID, fromName, subject, message, binaryBucket.Length);
390
391 XGroup group = GetXGroup(groupID, null);
392
393 if (group == null)
394 return;
395
396 XGroupNotice groupNotice = new XGroupNotice()
397 {
398 groupID = groupID,
399 noticeID = noticeID,
400 fromName = fromName,
401 subject = subject,
402 message = message,
403 timestamp = (uint)Util.UnixTimeSinceEpoch(),
404 hasAttachment = false,
405 assetType = 0,
406 binaryBucket = binaryBucket
407 };
408
409 group.notices[noticeID] = groupNotice;
410
411 m_data.StoreGroup(group);
284 } 412 }
285 413
286 public void ResetAgentGroupChatSessions(UUID agentID) 414 public void ResetAgentGroupChatSessions(UUID agentID)
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
index b444241..d7a144c 100644
--- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
+++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
@@ -94,8 +94,10 @@ namespace OpenSim.Tests.Common
94 94
95 public Type ReplaceableInterface { get { return null; } } 95 public Type ReplaceableInterface { get { return null; } }
96 96
97#pragma warning disable 0067
97 public event ScriptRemoved OnScriptRemoved; 98 public event ScriptRemoved OnScriptRemoved;
98 public event ObjectRemoved OnObjectRemoved; 99 public event ObjectRemoved OnObjectRemoved;
100#pragma warning restore 0067
99 101
100 public string GetXMLState (UUID itemID) 102 public string GetXMLState (UUID itemID)
101 { 103 {
@@ -262,5 +264,9 @@ namespace OpenSim.Tests.Common
262 { 264 {
263 PostedEvents.Clear(); 265 PostedEvents.Clear();
264 } 266 }
267
268 public void SleepScript(UUID itemID, int delay)
269 {
270 }
265 } 271 }
266} \ No newline at end of file 272}
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 5daca1e..f034443 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -38,7 +38,7 @@ using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Framework.Client; 39using OpenSim.Framework.Client;
40 40
41namespace OpenSim.Tests.Common.Mock 41namespace OpenSim.Tests.Common
42{ 42{
43 public class TestClient : IClientAPI, IClientCore 43 public class TestClient : IClientAPI, IClientCore
44 { 44 {
@@ -62,12 +62,23 @@ namespace OpenSim.Tests.Common.Mock
62 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; 62 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion;
63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; 63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour;
64 public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; 64 public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport;
65
66 public event Action<ISceneEntity, PrimUpdateFlags> OnReceivedEntityUpdate;
67
68 public event OnReceivedChatMessageDelegate OnReceivedChatMessage;
65 public event Action<GridInstantMessage> OnReceivedInstantMessage; 69 public event Action<GridInstantMessage> OnReceivedInstantMessage;
66 70
71 public event Action<UUID> OnReceivedSendRebakeAvatarTextures;
72
67 public delegate void TestClientOnSendRegionTeleportDelegate( 73 public delegate void TestClientOnSendRegionTeleportDelegate(
68 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 74 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
69 uint locationID, uint flags, string capsURL); 75 uint locationID, uint flags, string capsURL);
70 76
77 public delegate void OnReceivedChatMessageDelegate(
78 string message, byte type, Vector3 fromPos, string fromName,
79 UUID fromAgentID, UUID ownerID, byte source, byte audible);
80
81
71// disable warning: public events, part of the public API 82// disable warning: public events, part of the public API
72#pragma warning disable 67 83#pragma warning disable 67
73 84
@@ -472,6 +483,34 @@ namespace OpenSim.Tests.Common.Mock
472 } 483 }
473 484
474 /// <summary> 485 /// <summary>
486 /// Trigger chat coming from this connection.
487 /// </summary>
488 /// <param name="channel"></param>
489 /// <param name="type"></param>
490 /// <param name="message"></param>
491 public bool Chat(int channel, ChatTypeEnum type, string message)
492 {
493 ChatMessage handlerChatFromClient = OnChatFromClient;
494
495 if (handlerChatFromClient != null)
496 {
497 OSChatMessage args = new OSChatMessage();
498 args.Channel = channel;
499 args.From = Name;
500 args.Message = message;
501 args.Type = type;
502
503 args.Scene = Scene;
504 args.Sender = this;
505 args.SenderUUID = AgentId;
506
507 handlerChatFromClient(this, args);
508 }
509
510 return true;
511 }
512
513 /// <summary>
475 /// Attempt a teleport to the given region. 514 /// Attempt a teleport to the given region.
476 /// </summary> 515 /// </summary>
477 /// <param name="regionHandle"></param> 516 /// <param name="regionHandle"></param>
@@ -572,6 +611,9 @@ namespace OpenSim.Tests.Common.Mock
572 string message, byte type, Vector3 fromPos, string fromName, 611 string message, byte type, Vector3 fromPos, string fromName,
573 UUID fromAgentID, UUID ownerID, byte source, byte audible) 612 UUID fromAgentID, UUID ownerID, byte source, byte audible)
574 { 613 {
614// Console.WriteLine("mmm {0} {1} {2}", message, Name, AgentId);
615 if (OnReceivedChatMessage != null)
616 OnReceivedChatMessage(message, type, fromPos, fromName, fromAgentID, ownerID, source, audible);
575 } 617 }
576 618
577 public void SendInstantMessage(GridInstantMessage im) 619 public void SendInstantMessage(GridInstantMessage im)
@@ -713,6 +755,8 @@ namespace OpenSim.Tests.Common.Mock
713 755
714 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 756 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
715 { 757 {
758 if (OnReceivedEntityUpdate != null)
759 OnReceivedEntityUpdate(entity, updateFlags);
716 } 760 }
717 761
718 public void ReprioritizeUpdates() 762 public void ReprioritizeUpdates()
@@ -1260,6 +1304,8 @@ namespace OpenSim.Tests.Common.Mock
1260 1304
1261 public void SendRebakeAvatarTextures(UUID textureID) 1305 public void SendRebakeAvatarTextures(UUID textureID)
1262 { 1306 {
1307 if (OnReceivedSendRebakeAvatarTextures != null)
1308 OnReceivedSendRebakeAvatarTextures(textureID);
1263 } 1309 }
1264 1310
1265 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) 1311 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)
diff --git a/OpenSim/Tests/Common/Mock/TestHttpClientContext.cs b/OpenSim/Tests/Common/Mock/TestHttpClientContext.cs
new file mode 100644
index 0000000..5a55b09
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/TestHttpClientContext.cs
@@ -0,0 +1,110 @@
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.Net;
32using System.Net.Sockets;
33using System.Text;
34using HttpServer;
35using OpenSim.Framework;
36
37namespace OpenSim.Tests.Common
38{
39 public class TestHttpClientContext: IHttpClientContext
40 {
41 /// <summary>
42 /// Bodies of responses from the server.
43 /// </summary>
44 public string ResponseBody
45 {
46 get { return Encoding.UTF8.GetString(m_responseStream.ToArray()); }
47 }
48
49 public Byte[] ResponseBodyBytes
50 {
51 get{ return m_responseStream.ToArray(); }
52 }
53
54 private MemoryStream m_responseStream = new MemoryStream();
55
56 public bool IsSecured { get; set; }
57
58 public bool Secured
59 {
60 get { return IsSecured; }
61 set { IsSecured = value; }
62 }
63
64 public TestHttpClientContext(bool secured)
65 {
66 Secured = secured;
67 }
68
69 public void Disconnect(SocketError error)
70 {
71// Console.WriteLine("TestHttpClientContext.Disconnect Received disconnect with status {0}", error);
72 }
73
74 public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body) {Console.WriteLine("x");}
75 public void Respond(string httpVersion, HttpStatusCode statusCode, string reason) {Console.WriteLine("xx");}
76 public void Respond(string body) { Console.WriteLine("xxx");}
77
78 public void Send(byte[] buffer)
79 {
80 // Getting header data here
81// Console.WriteLine("xxxx: Got {0}", Encoding.UTF8.GetString(buffer));
82 }
83
84 public void Send(byte[] buffer, int offset, int size)
85 {
86// Util.PrintCallStack();
87//
88// Console.WriteLine(
89// "TestHttpClientContext.Send(byte[], int, int) got offset={0}, size={1}, buffer={2}",
90// offset, size, Encoding.UTF8.GetString(buffer));
91
92 m_responseStream.Write(buffer, offset, size);
93 }
94
95 public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body, string contentType) {Console.WriteLine("xxxxxx");}
96 public void Close() { }
97 public bool EndWhenDone { get { return false;} set { return;}}
98
99 public HTTPNetworkContext GiveMeTheNetworkStreamIKnowWhatImDoing()
100 {
101 return new HTTPNetworkContext();
102 }
103
104 public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { };
105 /// <summary>
106 /// A request have been received in the context.
107 /// </summary>
108 public event EventHandler<RequestEventArgs> RequestReceived = delegate { };
109 }
110} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestHttpRequest.cs b/OpenSim/Tests/Common/Mock/TestHttpRequest.cs
new file mode 100644
index 0000000..b868895
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/TestHttpRequest.cs
@@ -0,0 +1,174 @@
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.Specialized;
30using System.IO;
31using HttpServer;
32using HttpServer.FormDecoders;
33
34namespace OpenSim.Tests.Common
35{
36 public class TestHttpRequest: IHttpRequest
37 {
38 private string _uriPath;
39 public bool BodyIsComplete
40 {
41 get { return true; }
42 }
43 public string[] AcceptTypes
44 {
45 get {return _acceptTypes; }
46 }
47 private string[] _acceptTypes;
48 public Stream Body
49 {
50 get { return _body; }
51 set { _body = value;}
52 }
53 private Stream _body;
54 public ConnectionType Connection
55 {
56 get { return _connection; }
57 set { _connection = value; }
58 }
59 private ConnectionType _connection;
60 public int ContentLength
61 {
62 get { return _contentLength; }
63 set { _contentLength = value; }
64 }
65 private int _contentLength;
66 public NameValueCollection Headers
67 {
68 get { return _headers; }
69 }
70 private NameValueCollection _headers = new NameValueCollection();
71
72 public string HttpVersion { get; set; }
73
74 public string Method
75 {
76 get { return _method; }
77 set { _method = value; }
78 }
79 private string _method = null;
80 public HttpInput QueryString
81 {
82 get { return _queryString; }
83 }
84 private HttpInput _queryString = null;
85 public Uri Uri
86 {
87 get { return _uri; }
88 set { _uri = value; }
89 }
90 private Uri _uri = null;
91 public string[] UriParts
92 {
93 get { return _uri.Segments; }
94 }
95 public HttpParam Param
96 {
97 get { return null; }
98 }
99 public HttpForm Form
100 {
101 get { return null; }
102 }
103 public bool IsAjax
104 {
105 get { return false; }
106 }
107 public RequestCookies Cookies
108 {
109 get { return null; }
110 }
111
112 public TestHttpRequest()
113 {
114 HttpVersion = "HTTP/1.1";
115 }
116
117 public TestHttpRequest(string contentEncoding, string contentType, string userAgent,
118 string remoteAddr, string remotePort, string[] acceptTypes,
119 ConnectionType connectionType, int contentLength, Uri uri) : base()
120 {
121 _headers["content-encoding"] = contentEncoding;
122 _headers["content-type"] = contentType;
123 _headers["user-agent"] = userAgent;
124 _headers["remote_addr"] = remoteAddr;
125 _headers["remote_port"] = remotePort;
126
127 _acceptTypes = acceptTypes;
128 _connection = connectionType;
129 _contentLength = contentLength;
130 _uri = uri;
131 }
132
133 public void DecodeBody(FormDecoderProvider providers) {}
134 public void SetCookies(RequestCookies cookies) {}
135 public void AddHeader(string name, string value)
136 {
137 _headers.Add(name, value);
138 }
139 public int AddToBody(byte[] bytes, int offset, int length)
140 {
141 return 0;
142 }
143 public void Clear() {}
144
145 public object Clone()
146 {
147 TestHttpRequest clone = new TestHttpRequest();
148 clone._acceptTypes = _acceptTypes;
149 clone._connection = _connection;
150 clone._contentLength = _contentLength;
151 clone._uri = _uri;
152 clone._headers = new NameValueCollection(_headers);
153
154 return clone;
155 }
156 public IHttpResponse CreateResponse(IHttpClientContext context)
157 {
158 return new HttpResponse(context, this);
159 }
160 /// <summary>
161 /// Path and query (will be merged with the host header) and put in Uri
162 /// </summary>
163 /// <see cref="Uri"/>
164 public string UriPath
165 {
166 get { return _uriPath; }
167 set
168 {
169 _uriPath = value;
170
171 }
172 }
173 }
174} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestHttpResponse.cs b/OpenSim/Tests/Common/Mock/TestHttpResponse.cs
new file mode 100644
index 0000000..ff47c10
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/TestHttpResponse.cs
@@ -0,0 +1,171 @@
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.IO;
30using System.Net;
31using System.Text;
32using HttpServer;
33
34namespace OpenSim.Tests.Common
35{
36 public class TestHttpResponse: IHttpResponse
37 {
38 public Stream Body
39 {
40 get { return _body; }
41
42 set { _body = value; }
43 }
44 private Stream _body;
45
46 public string ProtocolVersion
47 {
48 get { return _protocolVersion; }
49 set { _protocolVersion = value; }
50 }
51 private string _protocolVersion;
52
53 public bool Chunked
54 {
55 get { return _chunked; }
56
57 set { _chunked = value; }
58 }
59 private bool _chunked;
60
61 public ConnectionType Connection
62 {
63 get { return _connection; }
64
65 set { _connection = value; }
66 }
67 private ConnectionType _connection;
68
69 public Encoding Encoding
70 {
71 get { return _encoding; }
72
73 set { _encoding = value; }
74 }
75 private Encoding _encoding;
76
77 public int KeepAlive
78 {
79 get { return _keepAlive; }
80
81 set { _keepAlive = value; }
82 }
83 private int _keepAlive;
84
85 public HttpStatusCode Status
86 {
87 get { return _status; }
88
89 set { _status = value; }
90 }
91 private HttpStatusCode _status;
92
93 public string Reason
94 {
95 get { return _reason; }
96
97 set { _reason = value; }
98 }
99 private string _reason;
100
101 public long ContentLength
102 {
103 get { return _contentLength; }
104
105 set { _contentLength = value; }
106 }
107 private long _contentLength;
108
109 public string ContentType
110 {
111 get { return _contentType; }
112
113 set { _contentType = value; }
114 }
115 private string _contentType;
116
117 public bool HeadersSent
118 {
119 get { return _headersSent; }
120 }
121 private bool _headersSent;
122
123 public bool Sent
124 {
125 get { return _sent; }
126 }
127 private bool _sent;
128
129 public ResponseCookies Cookies
130 {
131 get { return _cookies; }
132 }
133 private ResponseCookies _cookies = null;
134
135 public TestHttpResponse()
136 {
137 _headersSent = false;
138 _sent = false;
139 }
140
141 public void AddHeader(string name, string value) {}
142
143 public void Send()
144 {
145 if (!_headersSent) SendHeaders();
146 if (_sent) throw new InvalidOperationException("stuff already sent");
147 _sent = true;
148 }
149
150 public void SendBody(byte[] buffer, int offset, int count)
151 {
152 if (!_headersSent) SendHeaders();
153 _sent = true;
154 }
155
156 public void SendBody(byte[] buffer)
157 {
158 if (!_headersSent) SendHeaders();
159 _sent = true;
160 }
161
162 public void SendHeaders()
163 {
164 if (_headersSent) throw new InvalidOperationException("headers already sent");
165 _headersSent = true;
166 }
167
168 public void Redirect(Uri uri) {}
169 public void Redirect(string url) {}
170 }
171} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index fc44358..c97a765 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -33,7 +33,7 @@ using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Data; 34using OpenSim.Data;
35 35
36namespace OpenSim.Tests.Common.Mock 36namespace OpenSim.Tests.Common
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// In memory inventory data plugin for test purposes. Could be another dll when properly filled out and when the 39 /// In memory inventory data plugin for test purposes. Could be another dll when properly filled out and when the
@@ -185,7 +185,7 @@ namespace OpenSim.Tests.Common.Mock
185 185
186 public void addInventoryItem(InventoryItemBase item) 186 public void addInventoryItem(InventoryItemBase item)
187 { 187 {
188// InventoryFolderBase folder = m_folders[item.Folder]; 188 InventoryFolderBase folder = m_folders[item.Folder];
189 189
190// m_log.DebugFormat( 190// m_log.DebugFormat(
191// "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID); 191// "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs b/OpenSim/Tests/Common/Mock/TestLLUDPServer.cs
index 27b9e5b..26887c9 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
+++ b/OpenSim/Tests/Common/Mock/TestLLUDPServer.cs
@@ -32,8 +32,9 @@ using System.Net.Sockets;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse.Packets; 33using OpenMetaverse.Packets;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Region.ClientStack.LindenUDP;
35 36
36namespace OpenSim.Region.ClientStack.LindenUDP.Tests 37namespace OpenSim.Tests.Common
37{ 38{
38 /// <summary> 39 /// <summary>
39 /// This class enables regression testing of the LLUDPServer by allowing us to intercept outgoing data. 40 /// This class enables regression testing of the LLUDPServer by allowing us to intercept outgoing data.
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs
index 8135bfc..23258ad 100644
--- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs
+++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs
@@ -32,7 +32,7 @@ using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.CoreModules.World.Land; 33using OpenSim.Region.CoreModules.World.Land;
34 34
35namespace OpenSim.Tests.Common.Mock 35namespace OpenSim.Tests.Common
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Land channel for test purposes 38 /// Land channel for test purposes
diff --git a/OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs b/OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs
index e769d30..7b1d2b5 100644
--- a/OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs
+++ b/OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs
@@ -35,7 +35,7 @@ using System.Text;
35using System.Web; 35using System.Web;
36using OpenSim.Framework.Servers.HttpServer; 36using OpenSim.Framework.Servers.HttpServer;
37 37
38namespace OpenSim.Tests.Common.Mock 38namespace OpenSim.Tests.Common
39{ 39{
40 public class TestOSHttpRequest : IOSHttpRequest 40 public class TestOSHttpRequest : IOSHttpRequest
41 { 41 {
diff --git a/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs b/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs
index e10fe82..2e17f1e 100644
--- a/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs
+++ b/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs
@@ -32,7 +32,7 @@ using System.Text;
32using System.Web; 32using System.Web;
33using OpenSim.Framework.Servers.HttpServer; 33using OpenSim.Framework.Servers.HttpServer;
34 34
35namespace OpenSim.Tests.Common.Mock 35namespace OpenSim.Tests.Common
36{ 36{
37 public class TestOSHttpResponse : IOSHttpResponse 37 public class TestOSHttpResponse : IOSHttpResponse
38 { 38 {
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 53a311e..e559871 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -34,8 +34,12 @@ using OpenSim.Region.Framework;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Physics.Manager; 36using OpenSim.Region.Physics.Manager;
37<<<<<<< HEAD
38using OpenSim.Services.Interfaces;
39=======
40>>>>>>> avn/ubitvar
37 41
38namespace OpenSim.Tests.Common.Mock 42namespace OpenSim.Tests.Common
39{ 43{
40 public class TestScene : Scene 44 public class TestScene : Scene
41 { 45 {
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
index 2be5524..2b272e6 100644
--- a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
@@ -35,7 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Data; 35using OpenSim.Data;
36using OpenSim.Data.Null; 36using OpenSim.Data.Null;
37 37
38namespace OpenSim.Tests.Common.Mock 38namespace OpenSim.Tests.Common
39{ 39{
40 public class TestXInventoryDataPlugin : NullGenericDataHandler, IXInventoryData 40 public class TestXInventoryDataPlugin : NullGenericDataHandler, IXInventoryData
41 { 41 {
@@ -46,20 +46,33 @@ namespace OpenSim.Tests.Common.Mock
46 46
47 public XInventoryItem[] GetItems(string[] fields, string[] vals) 47 public XInventoryItem[] GetItems(string[] fields, string[] vals)
48 { 48 {
49// Console.WriteLine(
50// "Requesting items, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
51
49 List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList()); 52 List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList());
50 53
51 return origItems.Select(i => i.Clone()).ToArray(); 54 XInventoryItem[] items = origItems.Select(i => i.Clone()).ToArray();
55
56// Console.WriteLine("Found {0} items", items.Length);
57// Array.ForEach(items, i => Console.WriteLine("Found item {0} {1}", i.inventoryName, i.inventoryID));
58
59 return items;
52 } 60 }
53 61
54 public XInventoryFolder[] GetFolders(string[] fields, string[] vals) 62 public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
55 { 63 {
56// Console.WriteLine( 64// Console.WriteLine(
57// "Requesting folders, fields {0}, vals {1}", string.Join(",", fields), string.Join(",", vals)); 65// "Requesting folders, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
58 66
59 List<XInventoryFolder> origFolders 67 List<XInventoryFolder> origFolders
60 = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList()); 68 = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList());
61 69
62 return origFolders.Select(f => f.Clone()).ToArray(); 70 XInventoryFolder[] folders = origFolders.Select(f => f.Clone()).ToArray();
71
72// Console.WriteLine("Found {0} folders", folders.Length);
73// Array.ForEach(folders, f => Console.WriteLine("Found folder {0} {1}", f.folderName, f.folderID));
74
75 return folders;
63 } 76 }
64 77
65 public bool StoreFolder(XInventoryFolder folder) 78 public bool StoreFolder(XInventoryFolder folder)
@@ -75,7 +88,9 @@ namespace OpenSim.Tests.Common.Mock
75 { 88 {
76 m_allItems[item.inventoryID] = item.Clone(); 89 m_allItems[item.inventoryID] = item.Clone();
77 90
78// Console.WriteLine("Added item {0} {1}, creator {2}, owner {3}", item.inventoryName, item.inventoryID, item.creatorID, item.avatarID); 91// Console.WriteLine(
92// "Added item {0} {1}, folder {2}, creator {3}, owner {4}",
93// item.inventoryName, item.inventoryID, item.parentFolderID, item.creatorID, item.avatarID);
79 94
80 return true; 95 return true;
81 } 96 }
diff --git a/OpenSim/Tests/Common/OpenSimTestCase.cs b/OpenSim/Tests/Common/OpenSimTestCase.cs
index 3c47faa..c1415af 100644
--- a/OpenSim/Tests/Common/OpenSimTestCase.cs
+++ b/OpenSim/Tests/Common/OpenSimTestCase.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using NUnit.Framework; 29using NUnit.Framework;
30using OpenSim.Framework;
30using OpenSim.Framework.Servers; 31using OpenSim.Framework.Servers;
31 32
32namespace OpenSim.Tests.Common 33namespace OpenSim.Tests.Common
diff --git a/OpenSim/Tests/Performance/NPCPerformanceTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs
index fde1b91..747c992 100644
--- a/OpenSim/Tests/Performance/NPCPerformanceTests.cs
+++ b/OpenSim/Tests/Performance/NPCPerformanceTests.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.OptionalModules.World.NPC; 45using OpenSim.Region.OptionalModules.World.NPC;
46using OpenSim.Services.AvatarService; 46using OpenSim.Services.AvatarService;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49 48
50namespace OpenSim.Tests.Performance 49namespace OpenSim.Tests.Performance
51{ 50{
@@ -187,4 +186,4 @@ namespace OpenSim.Tests.Performance
187 (endGcMemory - startGcMemory) / 1024 / 1024); 186 (endGcMemory - startGcMemory) / 1024 / 1024);
188 } 187 }
189 } 188 }
190} \ No newline at end of file 189}
diff --git a/OpenSim/Tests/Performance/ObjectPerformanceTests.cs b/OpenSim/Tests/Performance/ObjectPerformanceTests.cs
index 656a971..9dad423 100644
--- a/OpenSim/Tests/Performance/ObjectPerformanceTests.cs
+++ b/OpenSim/Tests/Performance/ObjectPerformanceTests.cs
@@ -34,7 +34,6 @@ using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38 37
39namespace OpenSim.Tests.Performance 38namespace OpenSim.Tests.Performance
40{ 39{
diff --git a/OpenSim/Tests/Performance/ScriptPerformanceTests.cs b/OpenSim/Tests/Performance/ScriptPerformanceTests.cs
index 4064edc..028f4b0 100644
--- a/OpenSim/Tests/Performance/ScriptPerformanceTests.cs
+++ b/OpenSim/Tests/Performance/ScriptPerformanceTests.cs
@@ -40,7 +40,6 @@ using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.ScriptEngine.XEngine; 41using OpenSim.Region.ScriptEngine.XEngine;
42using OpenSim.Tests.Common; 42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44 43
45namespace OpenSim.Tests.Performance 44namespace OpenSim.Tests.Performance
46{ 45{
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..0280b73
--- /dev/null
+++ b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs
@@ -0,0 +1,206 @@
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
40using OpenSim.Tests.Common;
41
42namespace Robust.Tests
43{
44 [TestFixture]
45 public class InventoryClient
46 {
47// private static readonly ILog m_log =
48// LogManager.GetLogger(
49// MethodBase.GetCurrentMethod().DeclaringType);
50
51 private UUID m_userID = new UUID("00000000-0000-0000-0000-333333333333");
52 private UUID m_rootFolderID;
53 private UUID m_notecardsFolder;
54 private UUID m_objectsFolder;
55
56 [Test]
57 public void Inventory_001_CreateInventory()
58 {
59 TestHelpers.InMethod();
60 XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address);
61
62 // Create an inventory that looks like this:
63 //
64 // /My Inventory
65 // <other system folders>
66 // /Objects
67 // Some Object
68 // /Notecards
69 // Notecard 1
70 // Notecard 2
71 // /Test Folder
72 // Link to notecard -> /Notecards/Notecard 2
73 // Link to Objects folder -> /Objects
74
75 bool success = m_Connector.CreateUserInventory(m_userID);
76 Assert.IsTrue(success, "Failed to create user inventory");
77
78 m_rootFolderID = m_Connector.GetRootFolder(m_userID).ID;
79 Assert.AreNotEqual(m_rootFolderID, UUID.Zero, "Root folder ID must not be UUID.Zero");
80
81 InventoryFolderBase of = m_Connector.GetFolderForType(m_userID, FolderType.Object);
82 Assert.IsNotNull(of, "Failed to retrieve Objects folder");
83 m_objectsFolder = of.ID;
84 Assert.AreNotEqual(m_objectsFolder, UUID.Zero, "Objects folder ID must not be UUID.Zero");
85
86 // Add an object
87 InventoryItemBase item = new InventoryItemBase(new UUID("b0000000-0000-0000-0000-00000000000b"), m_userID);
88 item.AssetID = UUID.Random();
89 item.AssetType = (int)AssetType.Object;
90 item.Folder = m_objectsFolder;
91 item.Name = "Some Object";
92 item.Description = string.Empty;
93 success = m_Connector.AddItem(item);
94 Assert.IsTrue(success, "Failed to add object to inventory");
95
96 InventoryFolderBase ncf = m_Connector.GetFolderForType(m_userID, FolderType.Notecard);
97 Assert.IsNotNull(of, "Failed to retrieve Notecards folder");
98 m_notecardsFolder = ncf.ID;
99 Assert.AreNotEqual(m_notecardsFolder, UUID.Zero, "Notecards folder ID must not be UUID.Zero");
100 m_notecardsFolder = ncf.ID;
101
102 // Add a notecard
103 item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID);
104 item.AssetID = UUID.Random();
105 item.AssetType = (int)AssetType.Notecard;
106 item.Folder = m_notecardsFolder;
107 item.Name = "Test Notecard 1";
108 item.Description = string.Empty;
109 success = m_Connector.AddItem(item);
110 Assert.IsTrue(success, "Failed to add Notecard 1 to inventory");
111 // Add another notecard
112 item.ID = new UUID("20000000-0000-0000-0000-000000000002");
113 item.AssetID = new UUID("a0000000-0000-0000-0000-00000000000a");
114 item.Name = "Test Notecard 2";
115 item.Description = string.Empty;
116 success = m_Connector.AddItem(item);
117 Assert.IsTrue(success, "Failed to add Notecard 2 to inventory");
118
119 // Add a folder
120 InventoryFolderBase folder = new InventoryFolderBase(new UUID("f0000000-0000-0000-0000-00000000000f"), "Test Folder", m_userID, m_rootFolderID);
121 folder.Type = (int)FolderType.None;
122 success = m_Connector.AddFolder(folder);
123 Assert.IsTrue(success, "Failed to add Test Folder to inventory");
124
125 // Add a link to notecard 2 in Test Folder
126 item.AssetID = item.ID; // use item ID of notecard 2
127 item.ID = new UUID("40000000-0000-0000-0000-000000000004");
128 item.AssetType = (int)AssetType.Link;
129 item.Folder = folder.ID;
130 item.Name = "Link to notecard";
131 item.Description = string.Empty;
132 success = m_Connector.AddItem(item);
133 Assert.IsTrue(success, "Failed to add link to notecard to inventory");
134
135 // Add a link to the Objects folder in Test Folder
136 item.AssetID = m_Connector.GetFolderForType(m_userID, FolderType.Object).ID; // use item ID of Objects folder
137 item.ID = new UUID("50000000-0000-0000-0000-000000000005");
138 item.AssetType = (int)AssetType.LinkFolder;
139 item.Folder = folder.ID;
140 item.Name = "Link to Objects folder";
141 item.Description = string.Empty;
142 success = m_Connector.AddItem(item);
143 Assert.IsTrue(success, "Failed to add link to objects folder to inventory");
144
145 InventoryCollection coll = m_Connector.GetFolderContent(m_userID, m_rootFolderID);
146 Assert.IsNotNull(coll, "Failed to retrieve contents of root folder");
147 Assert.Greater(coll.Folders.Count, 0, "Root folder does not have any subfolders");
148
149 coll = m_Connector.GetFolderContent(m_userID, folder.ID);
150 Assert.IsNotNull(coll, "Failed to retrieve contents of Test Folder");
151 Assert.AreEqual(coll.Items.Count + coll.Folders.Count, 2, "Test Folder is expected to have exactly 2 things inside");
152
153 }
154
155 [Test]
156 public void Inventory_002_MultipleItemsRequest()
157 {
158 TestHelpers.InMethod();
159 XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address);
160
161 // Prefetch Notecard 1, will be cached from here on
162 InventoryItemBase item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID);
163 item = m_Connector.GetItem(item);
164 Assert.NotNull(item, "Failed to get Notecard 1");
165 Assert.AreEqual("Test Notecard 1", item.Name, "Wrong name for Notecard 1");
166
167 UUID[] uuids = new UUID[2];
168 uuids[0] = item.ID;
169 uuids[1] = new UUID("20000000-0000-0000-0000-000000000002");
170
171 InventoryItemBase[] items = m_Connector.GetMultipleItems(m_userID, uuids);
172 Assert.NotNull(items, "Failed to get multiple items");
173 Assert.IsTrue(items.Length == 2, "Requested 2 items, but didn't receive 2 items");
174
175 // Now they should both be cached
176 items = m_Connector.GetMultipleItems(m_userID, uuids);
177 Assert.NotNull(items, "(Repeat) Failed to get multiple items");
178 Assert.IsTrue(items.Length == 2, "(Repeat) Requested 2 items, but didn't receive 2 items");
179
180 // This item doesn't exist, but [0] does, and it's cached.
181 uuids[1] = new UUID("bb000000-0000-0000-0000-0000000000bb");
182 // Fetching should return 2 items, but [1] should be null
183 items = m_Connector.GetMultipleItems(m_userID, uuids);
184 Assert.NotNull(items, "(Three times) Failed to get multiple items");
185 Assert.IsTrue(items.Length == 2, "(Three times) Requested 2 items, but didn't receive 2 items");
186 Assert.AreEqual("Test Notecard 1", items[0].Name, "(Three times) Wrong name for Notecard 1");
187 Assert.IsNull(items[1], "(Three times) Expecting 2nd item to be null");
188
189 // Now both don't exist
190 uuids[0] = new UUID("aa000000-0000-0000-0000-0000000000aa");
191 items = m_Connector.GetMultipleItems(m_userID, uuids);
192 Assert.Null(items[0], "Request to multiple non-existent items is supposed to return null [0]");
193 Assert.Null(items[1], "Request to multiple non-existent items is supposed to return null [1]");
194
195 // This item exists, and it's not cached
196 uuids[1] = new UUID("b0000000-0000-0000-0000-00000000000b");
197 // Fetching should return 2 items, but [0] should be null
198 items = m_Connector.GetMultipleItems(m_userID, uuids);
199 Assert.NotNull(items, "(Four times) Failed to get multiple items");
200 Assert.IsTrue(items.Length == 2, "(Four times) Requested 2 items, but didn't receive 2 items");
201 Assert.AreEqual("Some Object", items[1].Name, "(Four times) Wrong name for Some Object");
202 Assert.IsNull(items[0], "(Four times) Expecting 1st item to be null");
203
204 }
205 }
206}
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..3238dc9
--- /dev/null
+++ b/OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs
@@ -0,0 +1,86 @@
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 = new UserAccount(UUID.Zero, "DoesNot", "Exist", "xxx@xxx.com");
77 success = m_Connector.StoreUserAccount(account);
78 Assert.IsFalse(success, "Storing a non-existing account must fail");
79
80 account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist");
81 Assert.IsNull(account, "Account DoesNot Exist must not be there");
82
83 }
84
85 }
86}
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}
diff --git a/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs b/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs
index 1f220c0..0ab407e 100644
--- a/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs
+++ b/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs
@@ -41,7 +41,6 @@ using OpenSim.Region.CoreModules.Scripting.VectorRender;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Serialization; 42using OpenSim.Region.Framework.Scenes.Serialization;
43using OpenSim.Tests.Common; 43using OpenSim.Tests.Common;
44using OpenSim.Tests.Common.Mock;
45 44
46namespace OpenSim.Tests.Stress 45namespace OpenSim.Tests.Stress
47{ 46{
@@ -79,7 +78,7 @@ namespace OpenSim.Tests.Stress
79 Drawer d = new Drawer(this, i); 78 Drawer d = new Drawer(this, i);
80 drawers.Add(d); 79 drawers.Add(d);
81 Console.WriteLine("Starting drawer {0}", i); 80 Console.WriteLine("Starting drawer {0}", i);
82 Util.FireAndForget(o => d.Draw()); 81 Util.FireAndForget(o => d.Draw(), null, "VectorRenderModuleStressTests.TestConcurrentRepeatedDraw");
83 } 82 }
84 83
85 Thread.Sleep(10 * 60 * 1000); 84 Thread.Sleep(10 * 60 * 1000);