aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs172
1 files changed, 0 insertions, 172 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
deleted file mode 100644
index 07b30f4..0000000
--- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
+++ /dev/null
@@ -1,172 +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.Reflection;
31using System.Text;
32using System.Threading;
33using System.Timers;
34using Timer=System.Timers.Timer;
35using Nini.Config;
36using NUnit.Framework;
37using OpenMetaverse;
38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock;
46
47namespace OpenSim.Region.Framework.Scenes.Tests
48{
49 /// <summary>
50 /// Attachment tests
51 /// </summary>
52 [TestFixture]
53 public class AttachmentTests
54 {
55 public Scene scene, scene2;
56 public UUID agent1;
57 public static Random random;
58 public ulong region1, region2;
59 public AgentCircuitData acd1;
60 public SceneObjectGroup sog1, sog2, sog3;
61
62 [TestFixtureSetUp]
63 public void Init()
64 {
65 TestHelpers.InMethod();
66
67 scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
68 scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
69
70 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
71 interregionComms.Initialise(new IniConfigSource());
72 interregionComms.PostInitialise();
73 SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
74 SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
75
76 agent1 = UUID.Random();
77 random = new Random();
78 sog1 = NewSOG(UUID.Random(), scene, agent1);
79 sog2 = NewSOG(UUID.Random(), scene, agent1);
80 sog3 = NewSOG(UUID.Random(), scene, agent1);
81
82 //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
83 region1 = scene.RegionInfo.RegionHandle;
84 region2 = scene2.RegionInfo.RegionHandle;
85
86 SceneHelpers.AddScenePresence(scene, agent1);
87 }
88
89 [Test]
90 public void T030_TestAddAttachments()
91 {
92 TestHelpers.InMethod();
93
94 ScenePresence presence = scene.GetScenePresence(agent1);
95
96 presence.AddAttachment(sog1);
97 presence.AddAttachment(sog2);
98 presence.AddAttachment(sog3);
99
100 Assert.That(presence.HasAttachments(), Is.True);
101 Assert.That(presence.ValidateAttachments(), Is.True);
102 }
103
104 [Test]
105 public void T031_RemoveAttachments()
106 {
107 TestHelpers.InMethod();
108
109 ScenePresence presence = scene.GetScenePresence(agent1);
110 presence.RemoveAttachment(sog1);
111 presence.RemoveAttachment(sog2);
112 presence.RemoveAttachment(sog3);
113 Assert.That(presence.HasAttachments(), Is.False);
114 }
115
116 // I'm commenting this test because scene setup NEEDS InventoryService to
117 // be non-null
118 //[Test]
119 public void T032_CrossAttachments()
120 {
121 TestHelpers.InMethod();
122
123 ScenePresence presence = scene.GetScenePresence(agent1);
124 ScenePresence presence2 = scene2.GetScenePresence(agent1);
125 presence2.AddAttachment(sog1);
126 presence2.AddAttachment(sog2);
127
128 ISharedRegionModule serialiser = new SerialiserModule();
129 SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
130 SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
131
132 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
133
134 //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
135 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
136 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
137 }
138
139 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
140 {
141 SceneObjectPart sop = new SceneObjectPart();
142 sop.Name = RandomName();
143 sop.Description = RandomName();
144 sop.Text = RandomName();
145 sop.SitName = RandomName();
146 sop.TouchName = RandomName();
147 sop.UUID = uuid;
148 sop.Shape = PrimitiveBaseShape.Default;
149 sop.Shape.State = 1;
150 sop.OwnerID = agent;
151
152 SceneObjectGroup sog = new SceneObjectGroup(sop);
153 sog.SetScene(scene);
154
155 return sog;
156 }
157
158 private static string RandomName()
159 {
160 StringBuilder name = new StringBuilder();
161 int size = random.Next(5,12);
162 char ch;
163 for (int i = 0; i < size; i++)
164 {
165 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
166 name.Append(ch);
167 }
168
169 return name.ToString();
170 }
171 }
172} \ No newline at end of file