aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-01-29 21:27:14 +0000
committerJustin Clark-Casey (justincc)2010-01-29 21:27:14 +0000
commit75dcd721de7aec4e43d091724ac883b1d945aae2 (patch)
treefc66f2bcdfe7a0c6941ed8ccbc3db4daa62f9409 /OpenSim/Region/CoreModules/World/Archiver
parentrefactor out scene object 1 creation n ArchiverTetss (diff)
downloadopensim-SC-75dcd721de7aec4e43d091724ac883b1d945aae2.zip
opensim-SC-75dcd721de7aec4e43d091724ac883b1d945aae2.tar.gz
opensim-SC-75dcd721de7aec4e43d091724ac883b1d945aae2.tar.bz2
opensim-SC-75dcd721de7aec4e43d091724ac883b1d945aae2.tar.xz
use common part1 creation in ArchiverTests.TestLoadOarV0_2()
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs58
1 files changed, 28 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index b4af8a6..a0958d1 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -55,8 +55,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
55 55
56 protected TestScene m_scene; 56 protected TestScene m_scene;
57 protected ArchiverModule m_archiverModule; 57 protected ArchiverModule m_archiverModule;
58
59 protected SceneObjectPart m_part1;
60 58
61 [SetUp] 59 [SetUp]
62 public void SetUp() 60 public void SetUp()
@@ -92,7 +90,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
92 } 90 }
93 } 91 }
94 92
95 protected void AddSceneObject1() 93 protected SceneObjectPart CreateSceneObjectPart1()
96 { 94 {
97 string partName = "My Little Pony"; 95 string partName = "My Little Pony";
98 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); 96 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015");
@@ -101,10 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
101 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 99 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
102 Vector3 offsetPosition = new Vector3(5, 10, 15); 100 Vector3 offsetPosition = new Vector3(5, 10, 15);
103 101
104 m_part1 102 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
105 = new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
106
107 m_scene.AddNewSceneObject(new SceneObjectGroup(m_part1), false);
108 } 103 }
109 104
110 /// <summary> 105 /// <summary>
@@ -116,7 +111,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
116 TestHelper.InMethod(); 111 TestHelper.InMethod();
117 //log4net.Config.XmlConfigurator.Configure(); 112 //log4net.Config.XmlConfigurator.Configure();
118 113
119 AddSceneObject1(); 114 SceneObjectPart part1 = CreateSceneObjectPart1();
115 m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
120 116
121 SceneObjectPart part2; 117 SceneObjectPart part2;
122 118
@@ -163,9 +159,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
163 bool gotObject2File = false; 159 bool gotObject2File = false;
164 string expectedObject1FileName = string.Format( 160 string expectedObject1FileName = string.Format(
165 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 161 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
166 m_part1.Name, 162 part1.Name,
167 Math.Round(m_part1.GroupPosition.X), Math.Round(m_part1.GroupPosition.Y), Math.Round(m_part1.GroupPosition.Z), 163 Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z),
168 m_part1.UUID); 164 part1.UUID);
169 string expectedObject2FileName = string.Format( 165 string expectedObject2FileName = string.Format(
170 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 166 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
171 part2.Name, 167 part2.Name,
@@ -185,7 +181,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
185 { 181 {
186 string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); 182 string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length);
187 183
188 if (fileName.StartsWith(m_part1.Name)) 184 if (fileName.StartsWith(part1.Name))
189 { 185 {
190 Assert.That(fileName, Is.EqualTo(expectedObject1FileName)); 186 Assert.That(fileName, Is.EqualTo(expectedObject1FileName));
191 gotObject1File = true; 187 gotObject1File = true;
@@ -226,19 +222,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
226 222
227 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 223 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
228 224
229 AddSceneObject1(); 225 SceneObjectPart part1 = CreateSceneObjectPart1();
230 string part1Name = "object1";
231 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
232 Vector3 groupPosition = new Vector3(90, 80, 70);
233 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
234 Vector3 offsetPosition = new Vector3(20, 25, 30);
235
236 SceneObjectPart part1
237 = new SceneObjectPart(
238 UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition);
239 part1.Name = part1Name;
240 SceneObjectGroup object1 = new SceneObjectGroup(part1); 226 SceneObjectGroup object1 = new SceneObjectGroup(part1);
241 227
228// string part1Name = "object1";
229// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
230// Vector3 groupPosition = new Vector3(90, 80, 70);
231// Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
232// Vector3 offsetPosition = new Vector3(20, 25, 30);
233//
234// SceneObjectPart part1
235// = new SceneObjectPart(
236// UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition);
237// part1.Name = part1Name;
238// SceneObjectGroup object1 = new SceneObjectGroup(part1);
239
242 // Let's put some inventory items into our object 240 // Let's put some inventory items into our object
243 string soundItemName = "sound-item1"; 241 string soundItemName = "sound-item1";
244 UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); 242 UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
@@ -283,8 +281,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
283 281
284 string object1FileName = string.Format( 282 string object1FileName = string.Format(
285 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 283 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
286 part1Name, 284 part1.Name,
287 Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), 285 Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z),
288 part1.UUID); 286 part1.UUID);
289 tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1)); 287 tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1));
290 288
@@ -300,15 +298,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
300 298
301 Assert.That(m_lastErrorMessage, Is.Null); 299 Assert.That(m_lastErrorMessage, Is.Null);
302 300
303 SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1Name); 301 SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
304 302
305 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); 303 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
306 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical"); 304 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical");
307 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal"); 305 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal");
308 Assert.That( 306 Assert.That(
309 object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); 307 object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
310 Assert.That( 308 Assert.That(
311 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); 309 object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
312 310
313 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; 311 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
314 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); 312 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");