aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs172
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs104
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs66
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs (renamed from OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs)224
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs (renamed from OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs)14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs6
16 files changed, 351 insertions, 365 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
deleted file mode 100644
index cff649b..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 TestHelper.InMethod();
66
67 scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
68 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
69
70 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
71 interregionComms.Initialise(new IniConfigSource());
72 interregionComms.PostInitialise();
73 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
74 SceneSetupHelpers.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 SceneSetupHelpers.AddRootAgent(scene, agent1);
87 }
88
89 [Test]
90 public void T030_TestAddAttachments()
91 {
92 TestHelper.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 TestHelper.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 TestHelper.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 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
130 SceneSetupHelpers.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
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index 3a0dd00..ab6311b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
41 [Test] 41 [Test]
42 public void TestCross() 42 public void TestCross()
43 { 43 {
44 TestHelper.InMethod(); 44 TestHelpers.InMethod();
45 45
46 List<Border> testborders = new List<Border>(); 46 List<Border> testborders = new List<Border>();
47 47
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
99 [Test] 99 [Test]
100 public void TestCrossSquare512() 100 public void TestCrossSquare512()
101 { 101 {
102 TestHelper.InMethod(); 102 TestHelpers.InMethod();
103 103
104 List<Border> testborders = new List<Border>(); 104 List<Border> testborders = new List<Border>();
105 105
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
179 [Test] 179 [Test]
180 public void TestCrossRectangle512x256() 180 public void TestCrossRectangle512x256()
181 { 181 {
182 TestHelper.InMethod(); 182 TestHelpers.InMethod();
183 183
184 List<Border> testborders = new List<Border>(); 184 List<Border> testborders = new List<Border>();
185 185
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
259 [Test] 259 [Test]
260 public void TestCrossOdd512x512w256hole() 260 public void TestCrossOdd512x512w256hole()
261 { 261 {
262 TestHelper.InMethod(); 262 TestHelpers.InMethod();
263 263
264 List<Border> testborders = new List<Border>(); 264 List<Border> testborders = new List<Border>();
265 // 512____ 265 // 512____
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index f69a4b4..a5d2b23 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -45,12 +45,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
45 { 45 {
46 static public Random random; 46 static public Random random;
47 SceneObjectGroup found; 47 SceneObjectGroup found;
48 Scene scene = SceneSetupHelpers.SetupScene(); 48 Scene scene = SceneHelpers.SetupScene();
49 49
50 [Test] 50 [Test]
51 public void T010_AddObjects() 51 public void T010_AddObjects()
52 { 52 {
53 TestHelper.InMethod(); 53 TestHelpers.InMethod();
54 54
55 random = new Random(); 55 random = new Random();
56 SceneObjectGroup found; 56 SceneObjectGroup found;
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
85 [Test] 85 [Test]
86 public void T011_ThreadAddRemoveTest() 86 public void T011_ThreadAddRemoveTest()
87 { 87 {
88 TestHelper.InMethod(); 88 TestHelpers.InMethod();
89 89
90 // This test adds and removes with mutiple threads, attempting to break the 90 // This test adds and removes with mutiple threads, attempting to break the
91 // uuid and localid dictionary coherence. 91 // uuid and localid dictionary coherence.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 895f2bb..9a60e50 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -43,8 +43,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
43 [Test] 43 [Test]
44 public void TestDuplicateObject() 44 public void TestDuplicateObject()
45 { 45 {
46 TestHelper.InMethod(); 46 TestHelpers.InMethod();
47 Scene scene = SceneSetupHelpers.SetupScene(); 47 Scene scene = SceneHelpers.SetupScene();
48 48
49 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); 49 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
50 string part1Name = "part1"; 50 string part1Name = "part1";
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 0a82c4f..1ea2329 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -49,9 +49,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 [Test] 49 [Test]
50 public void TestAddSceneObject() 50 public void TestAddSceneObject()
51 { 51 {
52 TestHelper.InMethod(); 52 TestHelpers.InMethod();
53 53
54 Scene scene = SceneSetupHelpers.SetupScene(); 54 Scene scene = SceneHelpers.SetupScene();
55 55
56 string objName = "obj1"; 56 string objName = "obj1";
57 UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); 57 UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -76,9 +76,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
76 /// </summary> 76 /// </summary>
77 public void TestAddExistingSceneObjectUuid() 77 public void TestAddExistingSceneObjectUuid()
78 { 78 {
79 TestHelper.InMethod(); 79 TestHelpers.InMethod();
80 80
81 Scene scene = SceneSetupHelpers.SetupScene(); 81 Scene scene = SceneHelpers.SetupScene();
82 82
83 string obj1Name = "Alfred"; 83 string obj1Name = "Alfred";
84 string obj2Name = "Betty"; 84 string obj2Name = "Betty";
@@ -110,10 +110,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
110 [Test] 110 [Test]
111 public void TestDeleteSceneObject() 111 public void TestDeleteSceneObject()
112 { 112 {
113 TestHelper.InMethod(); 113 TestHelpers.InMethod();
114 114
115 TestScene scene = SceneSetupHelpers.SetupScene(); 115 TestScene scene = SceneHelpers.SetupScene();
116 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 116 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
117 scene.DeleteSceneObject(part.ParentGroup, false); 117 scene.DeleteSceneObject(part.ParentGroup, false);
118 118
119 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 119 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
@@ -126,20 +126,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
126 [Test] 126 [Test]
127 public void TestDeleteSceneObjectAsync() 127 public void TestDeleteSceneObjectAsync()
128 { 128 {
129 TestHelper.InMethod(); 129 TestHelpers.InMethod();
130 //log4net.Config.XmlConfigurator.Configure(); 130 //log4net.Config.XmlConfigurator.Configure();
131 131
132 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 132 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
133 133
134 TestScene scene = SceneSetupHelpers.SetupScene(); 134 TestScene scene = SceneHelpers.SetupScene();
135 135
136 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 136 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
137 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 137 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
138 sogd.Enabled = false; 138 sogd.Enabled = false;
139 139
140 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 140 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
141 141
142 IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); 142 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
143 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); 143 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
144 144
145 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 145 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 5357a06..654b1a2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -56,17 +56,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests
56 [Test] 56 [Test]
57 public void TestDeRezSceneObject() 57 public void TestDeRezSceneObject()
58 { 58 {
59 TestHelper.InMethod(); 59 TestHelpers.InMethod();
60// log4net.Config.XmlConfigurator.Configure(); 60// log4net.Config.XmlConfigurator.Configure();
61 61
62 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 62 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
63 63
64 TestScene scene = SceneSetupHelpers.SetupScene(); 64 TestScene scene = SceneHelpers.SetupScene();
65 IConfigSource configSource = new IniConfigSource(); 65 IConfigSource configSource = new IniConfigSource();
66 IConfig config = configSource.AddConfig("Startup"); 66 IConfig config = configSource.AddConfig("Startup");
67 config.Set("serverside_object_permissions", true); 67 config.Set("serverside_object_permissions", true);
68 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 68 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
69 TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); 69 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
70 70
71 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 71 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
72 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 72 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
@@ -94,18 +94,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
94 [Test] 94 [Test]
95 public void TestDeRezSceneObjectNotOwner() 95 public void TestDeRezSceneObjectNotOwner()
96 { 96 {
97 TestHelper.InMethod(); 97 TestHelpers.InMethod();
98// log4net.Config.XmlConfigurator.Configure(); 98// log4net.Config.XmlConfigurator.Configure();
99 99
100 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 100 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
101 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); 101 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
102 102
103 TestScene scene = SceneSetupHelpers.SetupScene(); 103 TestScene scene = SceneHelpers.SetupScene();
104 IConfigSource configSource = new IniConfigSource(); 104 IConfigSource configSource = new IniConfigSource();
105 IConfig config = configSource.AddConfig("Startup"); 105 IConfig config = configSource.AddConfig("Startup");
106 config.Set("serverside_object_permissions", true); 106 config.Set("serverside_object_permissions", true);
107 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 107 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
108 TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); 108 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
109 109
110 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 110 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
111 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 111 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index cb1d531..2912a46 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -50,14 +50,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
50 [Test] 50 [Test]
51 public void TestLinkDelink2SceneObjects() 51 public void TestLinkDelink2SceneObjects()
52 { 52 {
53 TestHelper.InMethod(); 53 TestHelpers.InMethod();
54 54
55 bool debugtest = false; 55 bool debugtest = false;
56 56
57 Scene scene = SceneSetupHelpers.SetupScene(); 57 Scene scene = SceneHelpers.SetupScene();
58 SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); 58 SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
59 SceneObjectGroup grp1 = part1.ParentGroup; 59 SceneObjectGroup grp1 = part1.ParentGroup;
60 SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); 60 SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
61 SceneObjectGroup grp2 = part2.ParentGroup; 61 SceneObjectGroup grp2 = part2.ParentGroup;
62 62
63 grp1.AbsolutePosition = new Vector3(10, 10, 10); 63 grp1.AbsolutePosition = new Vector3(10, 10, 10);
@@ -132,18 +132,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
132 [Test] 132 [Test]
133 public void TestLinkDelink2groups4SceneObjects() 133 public void TestLinkDelink2groups4SceneObjects()
134 { 134 {
135 TestHelper.InMethod(); 135 TestHelpers.InMethod();
136 136
137 bool debugtest = false; 137 bool debugtest = false;
138 138
139 Scene scene = SceneSetupHelpers.SetupScene(); 139 Scene scene = SceneHelpers.SetupScene();
140 SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); 140 SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
141 SceneObjectGroup grp1 = part1.ParentGroup; 141 SceneObjectGroup grp1 = part1.ParentGroup;
142 SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); 142 SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
143 SceneObjectGroup grp2 = part2.ParentGroup; 143 SceneObjectGroup grp2 = part2.ParentGroup;
144 SceneObjectPart part3 = SceneSetupHelpers.AddSceneObject(scene); 144 SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene);
145 SceneObjectGroup grp3 = part3.ParentGroup; 145 SceneObjectGroup grp3 = part3.ParentGroup;
146 SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene); 146 SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene);
147 SceneObjectGroup grp4 = part4.ParentGroup; 147 SceneObjectGroup grp4 = part4.ParentGroup;
148 148
149 grp1.AbsolutePosition = new Vector3(10, 10, 10); 149 grp1.AbsolutePosition = new Vector3(10, 10, 10);
@@ -266,10 +266,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
266 [Test] 266 [Test]
267 public void TestNewSceneObjectLinkPersistence() 267 public void TestNewSceneObjectLinkPersistence()
268 { 268 {
269 TestHelper.InMethod(); 269 TestHelpers.InMethod();
270 //log4net.Config.XmlConfigurator.Configure(); 270 //log4net.Config.XmlConfigurator.Configure();
271 271
272 TestScene scene = SceneSetupHelpers.SetupScene(); 272 TestScene scene = SceneHelpers.SetupScene();
273 273
274 string rootPartName = "rootpart"; 274 string rootPartName = "rootpart";
275 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); 275 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -305,10 +305,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
305 [Test] 305 [Test]
306 public void TestDelinkPersistence() 306 public void TestDelinkPersistence()
307 { 307 {
308 TestHelper.InMethod(); 308 TestHelpers.InMethod();
309 //log4net.Config.XmlConfigurator.Configure(); 309 //log4net.Config.XmlConfigurator.Configure();
310 310
311 TestScene scene = SceneSetupHelpers.SetupScene(); 311 TestScene scene = SceneHelpers.SetupScene();
312 312
313 string rootPartName = "rootpart"; 313 string rootPartName = "rootpart";
314 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); 314 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
new file mode 100644
index 0000000..b49c6e7
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -0,0 +1,104 @@
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.Reflection;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37
38namespace OpenSim.Region.Framework.Scenes.Tests
39{
40 /// <summary>
41 /// Basic scene object resize tests
42 /// </summary>
43 [TestFixture]
44 public class SceneObjectResizeTests
45 {
46 /// <summary>
47 /// Test resizing an object
48 /// </summary>
49 [Test]
50 public void TestResizeSceneObject()
51 {
52 TestHelpers.InMethod();
53// log4net.Config.XmlConfigurator.Configure();
54
55 Scene scene = SceneHelpers.SetupScene();
56 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup;
57
58 g1.GroupResize(new Vector3(2, 3, 4));
59
60 SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);
61
62 Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2));
63 Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3));
64 Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4));
65
66 Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1));
67 }
68
69 /// <summary>
70 /// Test resizing an individual part in a scene object.
71 /// </summary>
72 [Test]
73 public void TestResizeSceneObjectPart()
74 {
75 TestHelpers.InMethod();
76 //log4net.Config.XmlConfigurator.Configure();
77
78 Scene scene = SceneHelpers.SetupScene();
79
80 SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero);
81 g1.RootPart.Scale = new Vector3(2, 3, 4);
82 g1.Parts[1].Scale = new Vector3(5, 6, 7);
83
84 scene.AddSceneObject(g1);
85
86 SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);
87
88 g1Post.Parts[1].Resize(new Vector3(8, 9, 10));
89
90 SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID);
91
92 SceneObjectPart g1RootPart = g1PostPost.RootPart;
93 SceneObjectPart g1ChildPart = g1PostPost.Parts[1];
94
95 Assert.That(g1RootPart.Scale.X, Is.EqualTo(2));
96 Assert.That(g1RootPart.Scale.Y, Is.EqualTo(3));
97 Assert.That(g1RootPart.Scale.Z, Is.EqualTo(4));
98
99 Assert.That(g1ChildPart.Scale.X, Is.EqualTo(8));
100 Assert.That(g1ChildPart.Scale.Y, Is.EqualTo(9));
101 Assert.That(g1ChildPart.Scale.Z, Is.EqualTo(10));
102 }
103 }
104} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
new file mode 100644
index 0000000..2a342d5
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -0,0 +1,66 @@
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.Reflection;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37
38namespace OpenSim.Region.Framework.Scenes.Tests
39{
40 /// <summary>
41 /// Basic scene object status tests
42 /// </summary>
43 [TestFixture]
44 public class SceneObjectStatusTests
45 {
46 [Test]
47 public void TestSetPhantom()
48 {
49 TestHelpers.InMethod();
50
51// Scene scene = SceneSetupHelpers.SetupScene();
52 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
53 SceneObjectPart rootPart = so.RootPart;
54 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
55
56 so.ScriptSetPhantomStatus(true);
57
58// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
59 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
60
61 so.ScriptSetPhantomStatus(false);
62
63 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
64 }
65 }
66} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index 77bd4c2..c13d82e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -53,12 +53,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
53 [Test] 53 [Test]
54 public void TestShareWithGroup() 54 public void TestShareWithGroup()
55 { 55 {
56 TestHelper.InMethod(); 56 TestHelpers.InMethod();
57// log4net.Config.XmlConfigurator.Configure(); 57// log4net.Config.XmlConfigurator.Configure();
58 58
59 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 59 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
60 60
61 TestScene scene = SceneSetupHelpers.SetupScene(); 61 TestScene scene = SceneHelpers.SetupScene();
62 IConfigSource configSource = new IniConfigSource(); 62 IConfigSource configSource = new IniConfigSource();
63 63
64 IConfig startupConfig = configSource.AddConfig("Startup"); 64 IConfig startupConfig = configSource.AddConfig("Startup");
@@ -69,13 +69,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
69 groupsConfig.Set("Module", "GroupsModule"); 69 groupsConfig.Set("Module", "GroupsModule");
70 groupsConfig.Set("DebugEnabled", true); 70 groupsConfig.Set("DebugEnabled", true);
71 71
72 SceneSetupHelpers.SetupSceneModules( 72 SceneHelpers.SetupSceneModules(
73 scene, configSource, new object[] 73 scene, configSource, new object[]
74 { new PermissionsModule(), 74 { new PermissionsModule(),
75 new GroupsModule(), 75 new GroupsModule(),
76 new MockGroupsServicesConnector() }); 76 new MockGroupsServicesConnector() });
77 77
78 TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); 78 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
79 79
80 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>(); 80 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();
81 81
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 03ac252..ce9d418 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
51 /// Scene presence tests 51 /// Scene presence tests
52 /// </summary> 52 /// </summary>
53 [TestFixture] 53 [TestFixture]
54 public class ScenePresenceTests 54 public class ScenePresenceAgentTests
55 { 55 {
56 public Scene scene, scene2, scene3; 56 public Scene scene, scene2, scene3;
57 public UUID agent1, agent2, agent3; 57 public UUID agent1, agent2, agent3;
@@ -64,90 +64,140 @@ namespace OpenSim.Region.Framework.Scenes.Tests
64 [TestFixtureSetUp] 64 [TestFixtureSetUp]
65 public void Init() 65 public void Init()
66 { 66 {
67 TestHelper.InMethod(); 67 TestHelpers.InMethod();
68 68
69 scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); 69 scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
70 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); 70 scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
71 scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); 71 scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
72 72
73 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 73 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
74 interregionComms.Initialise(new IniConfigSource()); 74 interregionComms.Initialise(new IniConfigSource());
75 interregionComms.PostInitialise(); 75 interregionComms.PostInitialise();
76 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); 76 SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
77 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); 77 SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
78 SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); 78 SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
79 79
80 agent1 = UUID.Random(); 80 agent1 = UUID.Random();
81 agent2 = UUID.Random(); 81 agent2 = UUID.Random();
82 agent3 = UUID.Random(); 82 agent3 = UUID.Random();
83 random = new Random(); 83 random = new Random();
84 sog1 = NewSOG(UUID.Random(), scene, agent1); 84 sog1 = SceneHelpers.CreateSceneObject(1, agent1);
85 sog2 = NewSOG(UUID.Random(), scene, agent1); 85 scene.AddSceneObject(sog1);
86 sog3 = NewSOG(UUID.Random(), scene, agent1); 86 sog2 = SceneHelpers.CreateSceneObject(1, agent1);
87 scene.AddSceneObject(sog2);
88 sog3 = SceneHelpers.CreateSceneObject(1, agent1);
89 scene.AddSceneObject(sog3);
87 90
88 //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
89 region1 = scene.RegionInfo.RegionHandle; 91 region1 = scene.RegionInfo.RegionHandle;
90 region2 = scene2.RegionInfo.RegionHandle; 92 region2 = scene2.RegionInfo.RegionHandle;
91 region3 = scene3.RegionInfo.RegionHandle; 93 region3 = scene3.RegionInfo.RegionHandle;
92 } 94 }
93 95
94 /// <summary>
95 /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
96 /// </summary>
97 [Test] 96 [Test]
98 public void T010_TestAddRootAgent() 97 public void TestCloseAgent()
99 { 98 {
100 TestHelper.InMethod(); 99 TestHelpers.InMethod();
101 100// log4net.Config.XmlConfigurator.Configure();
102 string firstName = "testfirstname";
103
104 AgentCircuitData agent = new AgentCircuitData();
105 agent.AgentID = agent1;
106 agent.firstname = firstName;
107 agent.lastname = "testlastname";
108 agent.SessionID = UUID.Random();
109 agent.SecureSessionID = UUID.Random();
110 agent.circuitcode = 123;
111 agent.BaseFolder = UUID.Zero;
112 agent.InventoryFolder = UUID.Zero;
113 agent.startpos = Vector3.Zero;
114 agent.CapsPath = GetRandomCapsObjectPath();
115 agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
116 agent.child = true;
117 101
118 scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); 102 TestScene scene = SceneHelpers.SetupScene();
103 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
119 104
120 string reason; 105 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null);
121 scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
122 testclient = new TestClient(agent, scene);
123 scene.AddNewClient(testclient);
124 106
125 ScenePresence presence = scene.GetScenePresence(agent1); 107 scene.IncomingCloseAgent(sp.UUID);
126 108
127 Assert.That(presence, Is.Not.Null, "presence is null"); 109 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
128 Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); 110 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
129 acd1 = agent;
130 } 111 }
131 112
132 /// <summary> 113 /// <summary>
133 /// Test removing an uncrossed root agent from a scene. 114 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
134 /// </summary> 115 /// </summary>
116 /// <remarks>
117 /// Please note that unlike the other tests here, this doesn't rely on structures
118 /// </remarks>
135 [Test] 119 [Test]
136 public void T011_TestRemoveRootAgent() 120 public void TestChildAgentEstablished()
137 { 121 {
138 TestHelper.InMethod(); 122 TestHelpers.InMethod();
139 123// log4net.Config.XmlConfigurator.Configure();
140 scene.RemoveClient(agent1); 124
141 125 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
142 ScenePresence presence = scene.GetScenePresence(agent1); 126
127 TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
128// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
129
130 IConfigSource configSource = new IniConfigSource();
131 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
132 EntityTransferModule etm = new EntityTransferModule();
133
134 SceneHelpers.SetupSceneModules(myScene1, configSource, etm);
135
136 SceneHelpers.AddScenePresence(myScene1, agent1Id);
137// ScenePresence childPresence = myScene2.GetScenePresence(agent1);
143 138
144 Assert.That(presence, Is.Null, "presence is not null"); 139 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
140// Assert.That(childPresence, Is.Not.Null);
141// Assert.That(childPresence.IsChildAgent, Is.True);
145 } 142 }
146 143
144// /// <summary>
145// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
146// /// </summary>
147// [Test]
148// public void T010_TestAddRootAgent()
149// {
150// TestHelpers.InMethod();
151//
152// string firstName = "testfirstname";
153//
154// AgentCircuitData agent = new AgentCircuitData();
155// agent.AgentID = agent1;
156// agent.firstname = firstName;
157// agent.lastname = "testlastname";
158// agent.SessionID = UUID.Random();
159// agent.SecureSessionID = UUID.Random();
160// agent.circuitcode = 123;
161// agent.BaseFolder = UUID.Zero;
162// agent.InventoryFolder = UUID.Zero;
163// agent.startpos = Vector3.Zero;
164// agent.CapsPath = GetRandomCapsObjectPath();
165// agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
166// agent.child = true;
167//
168// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
169//
170// string reason;
171// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
172// testclient = new TestClient(agent, scene);
173// scene.AddNewClient(testclient);
174//
175// ScenePresence presence = scene.GetScenePresence(agent1);
176//
177// Assert.That(presence, Is.Not.Null, "presence is null");
178// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same");
179// acd1 = agent;
180// }
181//
182// /// <summary>
183// /// Test removing an uncrossed root agent from a scene.
184// /// </summary>
185// [Test]
186// public void T011_TestRemoveRootAgent()
187// {
188// TestHelpers.InMethod();
189//
190// scene.RemoveClient(agent1);
191//
192// ScenePresence presence = scene.GetScenePresence(agent1);
193//
194// Assert.That(presence, Is.Null, "presence is not null");
195// }
196
147 [Test] 197 [Test]
148 public void T012_TestAddNeighbourRegion() 198 public void T012_TestAddNeighbourRegion()
149 { 199 {
150 TestHelper.InMethod(); 200 TestHelpers.InMethod();
151 201
152 string reason; 202 string reason;
153 203
@@ -157,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
157 scene.NewUserConnection(acd1, 0, out reason); 207 scene.NewUserConnection(acd1, 0, out reason);
158 if (testclient == null) 208 if (testclient == null)
159 testclient = new TestClient(acd1, scene); 209 testclient = new TestClient(acd1, scene);
160 scene.AddNewClient(testclient); 210 scene.AddNewClient(testclient, PresenceType.User);
161 211
162 ScenePresence presence = scene.GetScenePresence(agent1); 212 ScenePresence presence = scene.GetScenePresence(agent1);
163 presence.MakeRootAgent(new Vector3(90,90,90),false); 213 presence.MakeRootAgent(new Vector3(90,90,90),false);
@@ -175,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
175 [Test] 225 [Test]
176 public void T013_TestRemoveNeighbourRegion() 226 public void T013_TestRemoveNeighbourRegion()
177 { 227 {
178 TestHelper.InMethod(); 228 TestHelpers.InMethod();
179 229
180 ScenePresence presence = scene.GetScenePresence(agent1); 230 ScenePresence presence = scene.GetScenePresence(agent1);
181 presence.RemoveNeighbourRegion(region3); 231 presence.RemoveNeighbourRegion(region3);
@@ -188,37 +238,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
188 CompleteAvatarMovement 238 CompleteAvatarMovement
189 */ 239 */
190 } 240 }
191
192 /// <summary>
193 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
194 /// </summary>
195 /// <remarks>
196 /// Please note that unlike the other tests here, this doesn't rely on structures
197 /// </remarks>
198 [Test]
199 public void TestChildAgentEstablished()
200 {
201 TestHelper.InMethod();
202// log4net.Config.XmlConfigurator.Configure();
203
204 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
205
206 TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
207 TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
208
209 IConfigSource configSource = new IniConfigSource();
210 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
211 EntityTransferModule etm = new EntityTransferModule();
212
213 SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm);
214
215 SceneSetupHelpers.AddRootAgent(myScene1, agent1Id);
216 ScenePresence childPresence = myScene2.GetScenePresence(agent1);
217
218 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
219// Assert.That(childPresence, Is.Not.Null);
220// Assert.That(childPresence.IsChildAgent, Is.True);
221 }
222 241
223 // I'm commenting this test because it does not represent 242 // I'm commenting this test because it does not represent
224 // crossings. The Thread.Sleep's in here are not meaningful mocks, 243 // crossings. The Thread.Sleep's in here are not meaningful mocks,
@@ -230,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
230 //[Test] 249 //[Test]
231 public void T021_TestCrossToNewRegion() 250 public void T021_TestCrossToNewRegion()
232 { 251 {
233 TestHelper.InMethod(); 252 TestHelpers.InMethod();
234 253
235 scene.RegisterRegionWithGrid(); 254 scene.RegisterRegionWithGrid();
236 scene2.RegisterRegionWithGrid(); 255 scene2.RegisterRegionWithGrid();
@@ -238,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
238 // Adding child agent to region 1001 257 // Adding child agent to region 1001
239 string reason; 258 string reason;
240 scene2.NewUserConnection(acd1,0, out reason); 259 scene2.NewUserConnection(acd1,0, out reason);
241 scene2.AddNewClient(testclient); 260 scene2.AddNewClient(testclient, PresenceType.User);
242 261
243 ScenePresence presence = scene.GetScenePresence(agent1); 262 ScenePresence presence = scene.GetScenePresence(agent1);
244 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); 263 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
@@ -338,6 +357,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
338 agent.InventoryFolder = UUID.Zero; 357 agent.InventoryFolder = UUID.Zero;
339 agent.startpos = Vector3.Zero; 358 agent.startpos = Vector3.Zero;
340 agent.CapsPath = GetRandomCapsObjectPath(); 359 agent.CapsPath = GetRandomCapsObjectPath();
360 agent.Appearance = new AvatarAppearance();
341 361
342 acd1 = agent; 362 acd1 = agent;
343 } 363 }
@@ -349,37 +369,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
349 capsPath = capsPath.Remove(capsPath.Length - 4, 4); 369 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
350 return capsPath; 370 return capsPath;
351 } 371 }
352
353 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
354 {
355 SceneObjectPart sop = new SceneObjectPart();
356 sop.Name = RandomName();
357 sop.Description = RandomName();
358 sop.Text = RandomName();
359 sop.SitName = RandomName();
360 sop.TouchName = RandomName();
361 sop.UUID = uuid;
362 sop.Shape = PrimitiveBaseShape.Default;
363 sop.Shape.State = 1;
364 sop.OwnerID = agent;
365
366 SceneObjectGroup sog = new SceneObjectGroup(sop);
367 sog.SetScene(scene);
368
369 return sog;
370 }
371
372 private static string RandomName()
373 {
374 StringBuilder name = new StringBuilder();
375 int size = random.Next(5,12);
376 char ch ;
377 for (int i=0; i<size; i++)
378 {
379 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
380 name.Append(ch);
381 }
382 return name.ToString();
383 }
384 } 372 }
385} \ No newline at end of file 373} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 1b5a54e..39bb43a 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
44 /// Teleport tests in a standalone OpenSim 44 /// Teleport tests in a standalone OpenSim
45 /// </summary> 45 /// </summary>
46 [TestFixture] 46 [TestFixture]
47 public class StandaloneTeleportTests 47 public class ScenePresenceTeleportTests
48 { 48 {
49 /// <summary> 49 /// <summary>
50 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. 50 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
54 //[Test, LongRunning] 54 //[Test, LongRunning]
55 public void TestSimpleNotNeighboursTeleport() 55 public void TestSimpleNotNeighboursTeleport()
56 { 56 {
57 TestHelper.InMethod(); 57 TestHelpers.InMethod();
58 ThreadRunResults results = new ThreadRunResults(); 58 ThreadRunResults results = new ThreadRunResults();
59 results.Result = false; 59 results.Result = false;
60 results.Message = "Test did not run"; 60 results.Message = "Test did not run";
@@ -116,16 +116,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
116 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 116 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
117 117
118 118
119 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); 119 Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
120 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); 120 SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
121 sceneB.RegisterRegionWithGrid(); 121 sceneB.RegisterRegionWithGrid();
122 122
123 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); 123 Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000);
124 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); 124 SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
125 sceneA.RegisterRegionWithGrid(); 125 sceneA.RegisterRegionWithGrid();
126 126
127 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); 127 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
128 TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); 128 TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient;
129 129
130 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); 130 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();
131 131
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 13d93f9..8b8aea5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -58,9 +58,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
58 [Test] 58 [Test]
59 public void TestUpdateScene() 59 public void TestUpdateScene()
60 { 60 {
61 TestHelper.InMethod(); 61 TestHelpers.InMethod();
62 62
63 Scene scene = SceneSetupHelpers.SetupScene(); 63 Scene scene = SceneHelpers.SetupScene();
64 scene.Update(); 64 scene.Update();
65 65
66 Assert.That(scene.Frame, Is.EqualTo(1)); 66 Assert.That(scene.Frame, Is.EqualTo(1));
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index f4e14d4..1abef8d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests
55 [Test] 55 [Test]
56 public void TestRezObjectFromInventoryItem() 56 public void TestRezObjectFromInventoryItem()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure(); 59// log4net.Config.XmlConfigurator.Configure();
60 60
61 Scene scene = SceneSetupHelpers.SetupScene(); 61 Scene scene = SceneHelpers.SetupScene();
62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
63 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 63 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
64 SceneObjectPart sop1 = sog1.RootPart; 64 SceneObjectPart sop1 = sog1.RootPart;
65 65
66 // Create an object embedded inside the first 66 // Create an object embedded inside the first
@@ -98,12 +98,12 @@ namespace OpenSim.Region.Framework.Tests
98 [Test] 98 [Test]
99 public void TestMoveTaskInventoryItem() 99 public void TestMoveTaskInventoryItem()
100 { 100 {
101 TestHelper.InMethod(); 101 TestHelpers.InMethod();
102// log4net.Config.XmlConfigurator.Configure(); 102// log4net.Config.XmlConfigurator.Configure();
103 103
104 Scene scene = SceneSetupHelpers.SetupScene(); 104 Scene scene = SceneHelpers.SetupScene();
105 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 105 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
106 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 106 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
107 SceneObjectPart sop1 = sog1.RootPart; 107 SceneObjectPart sop1 = sog1.RootPart;
108 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); 108 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
109 109
@@ -125,12 +125,12 @@ namespace OpenSim.Region.Framework.Tests
125 [Test] 125 [Test]
126 public void TestMoveTaskInventoryItemNoParent() 126 public void TestMoveTaskInventoryItemNoParent()
127 { 127 {
128 TestHelper.InMethod(); 128 TestHelpers.InMethod();
129// log4net.Config.XmlConfigurator.Configure(); 129// log4net.Config.XmlConfigurator.Configure();
130 130
131 Scene scene = SceneSetupHelpers.SetupScene(); 131 Scene scene = SceneHelpers.SetupScene();
132 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 132 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
133 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 133 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
134 SceneObjectPart sop1 = sog1.RootPart; 134 SceneObjectPart sop1 = sog1.RootPart;
135 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); 135 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
136 136
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index abca792..55fc1e7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests
55 [Test] 55 [Test]
56 public void TestGiveInventoryItem() 56 public void TestGiveInventoryItem()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure(); 59// log4net.Config.XmlConfigurator.Configure();
60 60
61 Scene scene = SceneSetupHelpers.SetupScene(); 61 Scene scene = SceneHelpers.SetupScene();
62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); 62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
63 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); 63 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
64 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); 64 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
65 65
66 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); 66 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID);
@@ -82,12 +82,12 @@ namespace OpenSim.Region.Framework.Tests
82 [Test] 82 [Test]
83 public void TestGiveInventoryFolder() 83 public void TestGiveInventoryFolder()
84 { 84 {
85 TestHelper.InMethod(); 85 TestHelpers.InMethod();
86// log4net.Config.XmlConfigurator.Configure(); 86// log4net.Config.XmlConfigurator.Configure();
87 87
88 Scene scene = SceneSetupHelpers.SetupScene(); 88 Scene scene = SceneHelpers.SetupScene();
89 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); 89 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
90 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); 90 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
91 InventoryFolderBase folder1 91 InventoryFolderBase folder1
92 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); 92 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1");
93 93
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 4da8df1..24de56e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
47 public void Init() 47 public void Init()
48 { 48 {
49 // FIXME: We don't need a full scene here - it would be enough to set up the asset service. 49 // FIXME: We don't need a full scene here - it would be enough to set up the asset service.
50 Scene scene = SceneSetupHelpers.SetupScene(); 50 Scene scene = SceneHelpers.SetupScene();
51 m_assetService = scene.AssetService; 51 m_assetService = scene.AssetService;
52 m_uuidGatherer = new UuidGatherer(m_assetService); 52 m_uuidGatherer = new UuidGatherer(m_assetService);
53 } 53 }
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
55 [Test] 55 [Test]
56 public void TestCorruptAsset() 56 public void TestCorruptAsset()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59 59
60 UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 60 UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
61 AssetBase corruptAsset 61 AssetBase corruptAsset
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
75 [Test] 75 [Test]
76 public void TestMissingAsset() 76 public void TestMissingAsset()
77 { 77 {
78 TestHelper.InMethod(); 78 TestHelpers.InMethod();
79 79
80 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 80 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
81 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>(); 81 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();