diff options
Diffstat (limited to 'OpenSim/Tests/Common/Mock')
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | 77 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockScriptEngine.cs | 266 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 37 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs | 178 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestLandChannel.cs | 5 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestScene.cs | 3 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | 25 |
7 files changed, 536 insertions, 55 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs index 6fb9df1..3035cea 100644 --- a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs +++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | |||
@@ -26,12 +26,15 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using log4net; | 32 | using log4net; |
32 | using Mono.Addins; | 33 | using Mono.Addins; |
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | ||
37 | using OpenSim.Data.Null; | ||
35 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
@@ -44,6 +47,8 @@ namespace OpenSim.Tests.Common.Mock | |||
44 | { | 47 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 49 | ||
50 | IXGroupData m_data = new NullXGroupData(null, null); | ||
51 | |||
47 | public string Name | 52 | public string Name |
48 | { | 53 | { |
49 | get { return "MockGroupsServicesConnector"; } | 54 | get { return "MockGroupsServicesConnector"; } |
@@ -84,7 +89,33 @@ namespace OpenSim.Tests.Common.Mock | |||
84 | int membershipFee, bool openEnrollment, bool allowPublish, | 89 | int membershipFee, bool openEnrollment, bool allowPublish, |
85 | bool maturePublish, UUID founderID) | 90 | bool maturePublish, UUID founderID) |
86 | { | 91 | { |
87 | return UUID.Zero; | 92 | XGroup group = new XGroup() |
93 | { | ||
94 | groupID = UUID.Random(), | ||
95 | ownerRoleID = UUID.Random(), | ||
96 | name = name, | ||
97 | charter = charter, | ||
98 | showInList = showInList, | ||
99 | insigniaID = insigniaID, | ||
100 | membershipFee = membershipFee, | ||
101 | openEnrollment = openEnrollment, | ||
102 | allowPublish = allowPublish, | ||
103 | maturePublish = maturePublish, | ||
104 | founderID = founderID, | ||
105 | everyonePowers = (ulong)XmlRpcGroupsServicesConnectorModule.DefaultEveryonePowers, | ||
106 | ownersPowers = (ulong)XmlRpcGroupsServicesConnectorModule.DefaultOwnerPowers | ||
107 | }; | ||
108 | |||
109 | if (m_data.StoreGroup(group)) | ||
110 | { | ||
111 | m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: Created group {0} {1}", group.name, group.groupID); | ||
112 | return group.groupID; | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | m_log.ErrorFormat("[MOCK GROUPS SERVICES CONNECTOR]: Failed to create group {0}", name); | ||
117 | return UUID.Zero; | ||
118 | } | ||
88 | } | 119 | } |
89 | 120 | ||
90 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, | 121 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
@@ -107,9 +138,49 @@ namespace OpenSim.Tests.Common.Mock | |||
107 | { | 138 | { |
108 | } | 139 | } |
109 | 140 | ||
110 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) | 141 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName) |
111 | { | 142 | { |
112 | return null; | 143 | m_log.DebugFormat( |
144 | "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}", | ||
145 | groupID, groupName); | ||
146 | |||
147 | XGroup[] groups; | ||
148 | string field, val; | ||
149 | |||
150 | if (groupID != UUID.Zero) | ||
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; | ||
165 | |||
166 | XGroup xg = groups[0]; | ||
167 | |||
168 | GroupRecord gr = new GroupRecord() | ||
169 | { | ||
170 | GroupID = xg.groupID, | ||
171 | GroupName = xg.name, | ||
172 | AllowPublish = xg.allowPublish, | ||
173 | MaturePublish = xg.maturePublish, | ||
174 | Charter = xg.charter, | ||
175 | FounderID = xg.founderID, | ||
176 | // FIXME: group picture storage location unknown | ||
177 | MembershipFee = xg.membershipFee, | ||
178 | OpenEnrollment = xg.openEnrollment, | ||
179 | OwnerRoleID = xg.ownerRoleID, | ||
180 | ShowInList = xg.showInList | ||
181 | }; | ||
182 | |||
183 | return gr; | ||
113 | } | 184 | } |
114 | 185 | ||
115 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) | 186 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs new file mode 100644 index 0000000..b444241 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
38 | using OpenSim.Region.ScriptEngine.Shared; | ||
39 | |||
40 | namespace OpenSim.Tests.Common | ||
41 | { | ||
42 | public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine | ||
43 | { | ||
44 | public IConfigSource ConfigSource { get; private set; } | ||
45 | |||
46 | public IConfig Config { get; private set; } | ||
47 | |||
48 | private Scene m_scene; | ||
49 | |||
50 | /// <summary> | ||
51 | /// Expose posted events to tests. | ||
52 | /// </summary> | ||
53 | public Dictionary<UUID, List<EventParams>> PostedEvents { get; private set; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// A very primitive way of hooking text cose to a posed event. | ||
57 | /// </summary> | ||
58 | /// <remarks> | ||
59 | /// May be replaced with something that uses more original code in the future. | ||
60 | /// </remarks> | ||
61 | public event Action<UUID, EventParams> PostEventHook; | ||
62 | |||
63 | public void Initialise(IConfigSource source) | ||
64 | { | ||
65 | ConfigSource = source; | ||
66 | |||
67 | // Can set later on if required | ||
68 | Config = new IniConfig("MockScriptEngine", ConfigSource); | ||
69 | |||
70 | PostedEvents = new Dictionary<UUID, List<EventParams>>(); | ||
71 | } | ||
72 | |||
73 | public void Close() | ||
74 | { | ||
75 | } | ||
76 | |||
77 | public void AddRegion(Scene scene) | ||
78 | { | ||
79 | m_scene = scene; | ||
80 | |||
81 | m_scene.StackModuleInterface<IScriptModule>(this); | ||
82 | } | ||
83 | |||
84 | public void RemoveRegion(Scene scene) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | public void RegionLoaded(Scene scene) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | public string Name { get { return "Mock Script Engine"; } } | ||
93 | public string ScriptEngineName { get { return Name; } } | ||
94 | |||
95 | public Type ReplaceableInterface { get { return null; } } | ||
96 | |||
97 | public event ScriptRemoved OnScriptRemoved; | ||
98 | public event ObjectRemoved OnObjectRemoved; | ||
99 | |||
100 | public string GetXMLState (UUID itemID) | ||
101 | { | ||
102 | throw new System.NotImplementedException (); | ||
103 | } | ||
104 | |||
105 | public bool SetXMLState(UUID itemID, string xml) | ||
106 | { | ||
107 | throw new System.NotImplementedException (); | ||
108 | } | ||
109 | |||
110 | public bool PostScriptEvent(UUID itemID, string name, object[] args) | ||
111 | { | ||
112 | // Console.WriteLine("Posting event {0} for {1}", name, itemID); | ||
113 | |||
114 | return PostScriptEvent(itemID, new EventParams(name, args, null)); | ||
115 | } | ||
116 | |||
117 | public bool PostScriptEvent(UUID itemID, EventParams evParams) | ||
118 | { | ||
119 | List<EventParams> eventsForItem; | ||
120 | |||
121 | if (!PostedEvents.ContainsKey(itemID)) | ||
122 | { | ||
123 | eventsForItem = new List<EventParams>(); | ||
124 | PostedEvents.Add(itemID, eventsForItem); | ||
125 | } | ||
126 | else | ||
127 | { | ||
128 | eventsForItem = PostedEvents[itemID]; | ||
129 | } | ||
130 | |||
131 | eventsForItem.Add(evParams); | ||
132 | |||
133 | if (PostEventHook != null) | ||
134 | PostEventHook(itemID, evParams); | ||
135 | |||
136 | return true; | ||
137 | } | ||
138 | |||
139 | public bool PostObjectEvent(uint localID, EventParams evParams) | ||
140 | { | ||
141 | return PostObjectEvent(m_scene.GetSceneObjectPart(localID), evParams); | ||
142 | } | ||
143 | |||
144 | public bool PostObjectEvent(UUID itemID, string name, object[] args) | ||
145 | { | ||
146 | return PostObjectEvent(m_scene.GetSceneObjectPart(itemID), new EventParams(name, args, null)); | ||
147 | } | ||
148 | |||
149 | private bool PostObjectEvent(SceneObjectPart part, EventParams evParams) | ||
150 | { | ||
151 | foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems(InventoryType.LSL)) | ||
152 | PostScriptEvent(item.ItemID, evParams); | ||
153 | |||
154 | return true; | ||
155 | } | ||
156 | |||
157 | public void SuspendScript(UUID itemID) | ||
158 | { | ||
159 | throw new System.NotImplementedException (); | ||
160 | } | ||
161 | |||
162 | public void ResumeScript(UUID itemID) | ||
163 | { | ||
164 | throw new System.NotImplementedException (); | ||
165 | } | ||
166 | |||
167 | public ArrayList GetScriptErrors(UUID itemID) | ||
168 | { | ||
169 | throw new System.NotImplementedException (); | ||
170 | } | ||
171 | |||
172 | public bool HasScript(UUID itemID, out bool running) | ||
173 | { | ||
174 | throw new System.NotImplementedException (); | ||
175 | } | ||
176 | |||
177 | public bool GetScriptState(UUID itemID) | ||
178 | { | ||
179 | throw new System.NotImplementedException (); | ||
180 | } | ||
181 | |||
182 | public void SaveAllState() | ||
183 | { | ||
184 | throw new System.NotImplementedException (); | ||
185 | } | ||
186 | |||
187 | public void StartProcessing() | ||
188 | { | ||
189 | throw new System.NotImplementedException (); | ||
190 | } | ||
191 | |||
192 | public float GetScriptExecutionTime(List<UUID> itemIDs) | ||
193 | { | ||
194 | throw new System.NotImplementedException (); | ||
195 | } | ||
196 | |||
197 | public Dictionary<uint, float> GetObjectScriptsExecutionTimes() | ||
198 | { | ||
199 | throw new System.NotImplementedException (); | ||
200 | } | ||
201 | |||
202 | public IScriptWorkItem QueueEventHandler(object parms) | ||
203 | { | ||
204 | throw new System.NotImplementedException (); | ||
205 | } | ||
206 | |||
207 | public DetectParams GetDetectParams(UUID item, int number) | ||
208 | { | ||
209 | throw new System.NotImplementedException (); | ||
210 | } | ||
211 | |||
212 | public void SetMinEventDelay(UUID itemID, double delay) | ||
213 | { | ||
214 | throw new System.NotImplementedException (); | ||
215 | } | ||
216 | |||
217 | public int GetStartParameter(UUID itemID) | ||
218 | { | ||
219 | throw new System.NotImplementedException (); | ||
220 | } | ||
221 | |||
222 | public void SetScriptState(UUID itemID, bool state) | ||
223 | { | ||
224 | throw new System.NotImplementedException (); | ||
225 | } | ||
226 | |||
227 | public void SetState(UUID itemID, string newState) | ||
228 | { | ||
229 | throw new System.NotImplementedException (); | ||
230 | } | ||
231 | |||
232 | public void ApiResetScript(UUID itemID) | ||
233 | { | ||
234 | throw new System.NotImplementedException (); | ||
235 | } | ||
236 | |||
237 | public void ResetScript (UUID itemID) | ||
238 | { | ||
239 | throw new System.NotImplementedException (); | ||
240 | } | ||
241 | |||
242 | public IScriptApi GetApi(UUID itemID, string name) | ||
243 | { | ||
244 | throw new System.NotImplementedException (); | ||
245 | } | ||
246 | |||
247 | public Scene World { get { return m_scene; } } | ||
248 | |||
249 | public IScriptModule ScriptModule { get { return this; } } | ||
250 | |||
251 | public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} | ||
252 | |||
253 | public string ScriptClassName { get { throw new System.NotImplementedException (); } } | ||
254 | |||
255 | public string ScriptBaseClassName { get { throw new System.NotImplementedException (); } } | ||
256 | |||
257 | public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } | ||
258 | |||
259 | public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } | ||
260 | |||
261 | public void ClearPostedEvents() | ||
262 | { | ||
263 | PostedEvents.Clear(); | ||
264 | } | ||
265 | } | ||
266 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 2714429..07de06c 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -46,8 +46,6 @@ namespace OpenSim.Tests.Common.Mock | |||
46 | 46 | ||
47 | EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); | 47 | EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); |
48 | 48 | ||
49 | private TestClient TeleportSceneClient; | ||
50 | |||
51 | private Scene m_scene; | 49 | private Scene m_scene; |
52 | private SceneManager m_sceneManager; | 50 | private SceneManager m_sceneManager; |
53 | 51 | ||
@@ -60,6 +58,10 @@ namespace OpenSim.Tests.Common.Mock | |||
60 | public List<ImagePacketPacket> SentImagePacketPackets { get; private set; } | 58 | public List<ImagePacketPacket> SentImagePacketPackets { get; private set; } |
61 | public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; } | 59 | public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; } |
62 | 60 | ||
61 | // Test client specific events - for use by tests to implement some IClientAPI behaviour. | ||
62 | public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; | ||
63 | public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; | ||
64 | |||
63 | // disable warning: public events, part of the public API | 65 | // disable warning: public events, part of the public API |
64 | #pragma warning disable 67 | 66 | #pragma warning disable 67 |
65 | 67 | ||
@@ -548,12 +550,12 @@ namespace OpenSim.Tests.Common.Mock | |||
548 | 550 | ||
549 | } | 551 | } |
550 | 552 | ||
551 | public void SendGenericMessage(string method, List<string> message) | 553 | public void SendGenericMessage(string method, UUID invoice, List<string> message) |
552 | { | 554 | { |
553 | 555 | ||
554 | } | 556 | } |
555 | 557 | ||
556 | public void SendGenericMessage(string method, List<byte[]> message) | 558 | public void SendGenericMessage(string method, UUID invoice, List<byte[]> message) |
557 | { | 559 | { |
558 | 560 | ||
559 | } | 561 | } |
@@ -575,6 +577,8 @@ namespace OpenSim.Tests.Common.Mock | |||
575 | 577 | ||
576 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) | 578 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) |
577 | { | 579 | { |
580 | if (OnReceivedMoveAgentIntoRegion != null) | ||
581 | OnReceivedMoveAgentIntoRegion(regInfo, pos, look); | ||
578 | } | 582 | } |
579 | 583 | ||
580 | public virtual AgentCircuitData RequestClientInfo() | 584 | public virtual AgentCircuitData RequestClientInfo() |
@@ -600,23 +604,8 @@ namespace OpenSim.Tests.Common.Mock | |||
600 | 604 | ||
601 | public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) | 605 | public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) |
602 | { | 606 | { |
603 | m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour"); | 607 | if (OnTestClientInformClientOfNeighbour != null) |
604 | 608 | OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint); | |
605 | // In response to this message, we are going to make a teleport to the scene we've previous been told | ||
606 | // about by test code (this needs to be improved). | ||
607 | AgentCircuitData newAgent = RequestClientInfo(); | ||
608 | |||
609 | // Stage 2: add the new client as a child agent to the scene | ||
610 | uint x, y; | ||
611 | Utils.LongToUInts(neighbourHandle, out x, out y); | ||
612 | x /= Constants.RegionSize; | ||
613 | y /= Constants.RegionSize; | ||
614 | |||
615 | Scene neighbourScene; | ||
616 | m_sceneManager.TryGetScene(x, y, out neighbourScene); | ||
617 | |||
618 | TeleportSceneClient = new TestClient(newAgent, neighbourScene, m_sceneManager); | ||
619 | neighbourScene.AddNewClient(TeleportSceneClient, PresenceType.User); | ||
620 | } | 609 | } |
621 | 610 | ||
622 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | 611 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, |
@@ -631,12 +620,6 @@ namespace OpenSim.Tests.Common.Mock | |||
631 | // CompleteTeleportClientSide(); | 620 | // CompleteTeleportClientSide(); |
632 | } | 621 | } |
633 | 622 | ||
634 | public void CompleteTeleportClientSide() | ||
635 | { | ||
636 | TeleportSceneClient.CompleteMovement(); | ||
637 | //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false); | ||
638 | } | ||
639 | |||
640 | public virtual void SendTeleportFailed(string reason) | 623 | public virtual void SendTeleportFailed(string reason) |
641 | { | 624 | { |
642 | m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason); | 625 | m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason); |
diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs new file mode 100644 index 0000000..6707019 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs | |||
@@ -0,0 +1,178 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Threading; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using Mono.Addins; | ||
37 | using OpenMetaverse; | ||
38 | using OpenMetaverse.StructuredData; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Servers; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | namespace OpenSim.Tests.Common | ||
45 | { | ||
46 | public class TestEventQueueGetModule : IEventQueue, INonSharedRegionModule | ||
47 | { | ||
48 | public class Event | ||
49 | { | ||
50 | public string Name { get; set; } | ||
51 | public object[] Args { get; set; } | ||
52 | |||
53 | public Event(string name, object[] args) | ||
54 | { | ||
55 | name = Name; | ||
56 | args = Args; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | public Dictionary<UUID, List<Event>> Events { get; set; } | ||
61 | |||
62 | public void Initialise(IConfigSource source) {} | ||
63 | |||
64 | public void Close() {} | ||
65 | |||
66 | public void AddRegion(Scene scene) | ||
67 | { | ||
68 | Events = new Dictionary<UUID, List<Event>>(); | ||
69 | scene.RegisterModuleInterface<IEventQueue>(this); | ||
70 | } | ||
71 | |||
72 | public void RemoveRegion (Scene scene) {} | ||
73 | |||
74 | public void RegionLoaded (Scene scene) {} | ||
75 | |||
76 | public string Name { get { return "TestEventQueueGetModule"; } } | ||
77 | |||
78 | public Type ReplaceableInterface { get { return null; } } | ||
79 | |||
80 | private void AddEvent(UUID avatarID, string name, params object[] args) | ||
81 | { | ||
82 | Console.WriteLine("Adding event {0} for {1}", name, avatarID); | ||
83 | |||
84 | List<Event> avEvents; | ||
85 | |||
86 | if (!Events.ContainsKey(avatarID)) | ||
87 | { | ||
88 | avEvents = new List<Event>(); | ||
89 | Events[avatarID] = avEvents; | ||
90 | } | ||
91 | else | ||
92 | { | ||
93 | avEvents = Events[avatarID]; | ||
94 | } | ||
95 | |||
96 | avEvents.Add(new Event(name, args)); | ||
97 | } | ||
98 | |||
99 | public void ClearEvents() | ||
100 | { | ||
101 | if (Events != null) | ||
102 | Events.Clear(); | ||
103 | } | ||
104 | |||
105 | public bool Enqueue(OSD o, UUID avatarID) | ||
106 | { | ||
107 | AddEvent(avatarID, "Enqueue", o); | ||
108 | return true; | ||
109 | } | ||
110 | |||
111 | public void DisableSimulator(ulong handle, UUID avatarID) | ||
112 | { | ||
113 | AddEvent(avatarID, "DisableSimulator", handle); | ||
114 | } | ||
115 | |||
116 | public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID) | ||
117 | { | ||
118 | AddEvent(avatarID, "EnableSimulator", handle); | ||
119 | } | ||
120 | |||
121 | public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath) | ||
122 | { | ||
123 | AddEvent(avatarID, "EstablishAgentCommunication", endPoint, capsPath); | ||
124 | } | ||
125 | |||
126 | public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID) | ||
127 | { | ||
128 | AddEvent(agentID, "TeleportFinishEvent", regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL); | ||
129 | } | ||
130 | |||
131 | public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL, UUID avatarID, UUID sessionID) | ||
132 | { | ||
133 | AddEvent(avatarID, "CrossRegion", handle, pos, lookAt, newRegionExternalEndPoint, capsURL, sessionID); | ||
134 | } | ||
135 | |||
136 | public void ChatterboxInvitation( | ||
137 | UUID sessionID, string sessionName, UUID fromAgent, string message, UUID toAgent, string fromName, | ||
138 | byte dialog, uint timeStamp, bool offline, int parentEstateID, Vector3 position, uint ttl, | ||
139 | UUID transactionID, bool fromGroup, byte[] binaryBucket) | ||
140 | { | ||
141 | AddEvent( | ||
142 | toAgent, "ChatterboxInvitation", sessionID, sessionName, fromAgent, message, toAgent, fromName, dialog, | ||
143 | timeStamp, offline, parentEstateID, position, ttl, transactionID, fromGroup, binaryBucket); | ||
144 | } | ||
145 | |||
146 | public void ChatterBoxSessionAgentListUpdates (UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute) | ||
147 | { | ||
148 | AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute); | ||
149 | } | ||
150 | |||
151 | public void ParcelProperties (OpenMetaverse.Messages.Linden.ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) | ||
152 | { | ||
153 | AddEvent(avatarID, "ParcelProperties", parcelPropertiesMessage); | ||
154 | } | ||
155 | |||
156 | public void GroupMembership (OpenMetaverse.Packets.AgentGroupDataUpdatePacket groupUpdate, UUID avatarID) | ||
157 | { | ||
158 | AddEvent(avatarID, "GroupMembership", groupUpdate); | ||
159 | } | ||
160 | |||
161 | public OSD ScriptRunningEvent (UUID objectID, UUID itemID, bool running, bool mono) | ||
162 | { | ||
163 | Console.WriteLine("ONE"); | ||
164 | throw new System.NotImplementedException (); | ||
165 | } | ||
166 | |||
167 | public OSD BuildEvent (string eventName, OSD eventBody) | ||
168 | { | ||
169 | Console.WriteLine("TWO"); | ||
170 | throw new System.NotImplementedException (); | ||
171 | } | ||
172 | |||
173 | public void partPhysicsProperties (uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID) | ||
174 | { | ||
175 | AddEvent(avatarID, "partPhysicsProperties", localID, physhapetype, density, friction, bounce, gravmod); | ||
176 | } | ||
177 | } | ||
178 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 4b4d52d..3115035 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs | |||
@@ -81,6 +81,11 @@ namespace OpenSim.Tests.Common.Mock | |||
81 | return obj; | 81 | return obj; |
82 | } | 82 | } |
83 | 83 | ||
84 | public ILandObject GetLandObject(Vector3 position) | ||
85 | { | ||
86 | return GetLandObject(position.X, position.Y); | ||
87 | } | ||
88 | |||
84 | public ILandObject GetLandObject(int x, int y) | 89 | public ILandObject GetLandObject(int x, int y) |
85 | { | 90 | { |
86 | return GetNoLand(); | 91 | return GetNoLand(); |
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index d4b5648..a7e0dfb 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs | |||
@@ -41,10 +41,9 @@ namespace OpenSim.Tests.Common.Mock | |||
41 | public TestScene( | 41 | public TestScene( |
42 | RegionInfo regInfo, AgentCircuitManager authen, | 42 | RegionInfo regInfo, AgentCircuitManager authen, |
43 | SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, | 43 | SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, |
44 | bool dumpAssetsToFile, | ||
45 | IConfigSource config, string simulatorVersion) | 44 | IConfigSource config, string simulatorVersion) |
46 | : base(regInfo, authen, sceneGridService, simDataService, estateDataService, | 45 | : base(regInfo, authen, sceneGridService, simDataService, estateDataService, |
47 | dumpAssetsToFile, config, simulatorVersion) | 46 | config, simulatorVersion) |
48 | { | 47 | { |
49 | } | 48 | } |
50 | 49 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs index f9bf768..ccbdf81 100644 --- a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | |||
@@ -33,10 +33,11 @@ using log4net; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Data; | 35 | using OpenSim.Data; |
36 | using OpenSim.Data.Null; | ||
36 | 37 | ||
37 | namespace OpenSim.Tests.Common.Mock | 38 | namespace OpenSim.Tests.Common.Mock |
38 | { | 39 | { |
39 | public class TestXInventoryDataPlugin : IXInventoryData | 40 | public class TestXInventoryDataPlugin : NullGenericDataHandler, IXInventoryData |
40 | { | 41 | { |
41 | private Dictionary<UUID, XInventoryFolder> m_allFolders = new Dictionary<UUID, XInventoryFolder>(); | 42 | private Dictionary<UUID, XInventoryFolder> m_allFolders = new Dictionary<UUID, XInventoryFolder>(); |
42 | private Dictionary<UUID, XInventoryItem> m_allItems = new Dictionary<UUID, XInventoryItem>(); | 43 | private Dictionary<UUID, XInventoryItem> m_allItems = new Dictionary<UUID, XInventoryItem>(); |
@@ -58,28 +59,6 @@ namespace OpenSim.Tests.Common.Mock | |||
58 | return origFolders.Select(f => f.Clone()).ToArray(); | 59 | return origFolders.Select(f => f.Clone()).ToArray(); |
59 | } | 60 | } |
60 | 61 | ||
61 | private List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities) | ||
62 | { | ||
63 | List<T> entities = inputEntities; | ||
64 | |||
65 | for (int i = 0; i < fields.Length; i++) | ||
66 | { | ||
67 | entities | ||
68 | = entities.Where( | ||
69 | e => | ||
70 | { | ||
71 | FieldInfo fi = typeof(T).GetField(fields[i]); | ||
72 | if (fi == null) | ||
73 | throw new NotImplementedException(string.Format("No field {0} for val {1}", fields[i], vals[i])); | ||
74 | |||
75 | return fi.GetValue(e).ToString() == vals[i]; | ||
76 | } | ||
77 | ).ToList(); | ||
78 | } | ||
79 | |||
80 | return entities; | ||
81 | } | ||
82 | |||
83 | public bool StoreFolder(XInventoryFolder folder) | 62 | public bool StoreFolder(XInventoryFolder folder) |
84 | { | 63 | { |
85 | m_allFolders[folder.folderID] = folder.Clone(); | 64 | m_allFolders[folder.folderID] = folder.Clone(); |