diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs | 83 |
1 files changed, 62 insertions, 21 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs index 43df685..d7acd54 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -66,19 +66,44 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests | |||
66 | Scene scene = SceneSetupHelpers.SetupScene(); | 66 | Scene scene = SceneSetupHelpers.SetupScene(); |
67 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | 67 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); |
68 | 68 | ||
69 | string partName = "My Little Pony"; | 69 | SceneObjectPart part1; |
70 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); | 70 | |
71 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 71 | // Create and add prim 1 |
72 | Vector3 groupPosition = new Vector3(10, 20, 30); | 72 | { |
73 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | 73 | string partName = "My Little Pony"; |
74 | Vector3 offsetPosition = new Vector3(5, 10, 15); | 74 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); |
75 | 75 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | |
76 | SceneObjectPart part | 76 | Vector3 groupPosition = new Vector3(10, 20, 30); |
77 | = new SceneObjectPart( | 77 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); |
78 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | 78 | Vector3 offsetPosition = new Vector3(5, 10, 15); |
79 | part.Name = partName; | 79 | |
80 | 80 | part1 | |
81 | scene.AddNewSceneObject(new SceneObjectGroup(part), false); | 81 | = new SceneObjectPart( |
82 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
83 | part1.Name = partName; | ||
84 | |||
85 | scene.AddNewSceneObject(new SceneObjectGroup(part1), false); | ||
86 | } | ||
87 | |||
88 | SceneObjectPart part2; | ||
89 | |||
90 | // Create and add prim 2 | ||
91 | { | ||
92 | string partName = "Action Man"; | ||
93 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016"); | ||
94 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); | ||
95 | Vector3 groupPosition = new Vector3(90, 80, 70); | ||
96 | Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); | ||
97 | Vector3 offsetPosition = new Vector3(20, 25, 30); | ||
98 | |||
99 | part2 | ||
100 | = new SceneObjectPart( | ||
101 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
102 | part2.Name = partName; | ||
103 | |||
104 | scene.AddNewSceneObject(new SceneObjectGroup(part2), false); | ||
105 | } | ||
106 | |||
82 | MemoryStream archiveWriteStream = new MemoryStream(); | 107 | MemoryStream archiveWriteStream = new MemoryStream(); |
83 | 108 | ||
84 | scene.EventManager.OnOarFileSaved += SaveCompleted; | 109 | scene.EventManager.OnOarFileSaved += SaveCompleted; |
@@ -90,12 +115,18 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests | |||
90 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | 115 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); |
91 | 116 | ||
92 | bool gotControlFile = false; | 117 | bool gotControlFile = false; |
93 | bool gotObjectFile = false; | 118 | bool gotObject1File = false; |
94 | string expectedObjectFileName = string.Format( | 119 | bool gotObject2File = false; |
120 | string expectedObject1FileName = string.Format( | ||
121 | "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", | ||
122 | part1.Name, | ||
123 | Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z), | ||
124 | part1.UUID); | ||
125 | string expectedObject2FileName = string.Format( | ||
95 | "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", | 126 | "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", |
96 | partName, | 127 | part2.Name, |
97 | Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), | 128 | Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z), |
98 | part.UUID); | 129 | part2.UUID); |
99 | 130 | ||
100 | string filePath; | 131 | string filePath; |
101 | TarArchiveReader.TarEntryType tarEntryType; | 132 | TarArchiveReader.TarEntryType tarEntryType; |
@@ -109,13 +140,23 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests | |||
109 | else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) | 140 | else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) |
110 | { | 141 | { |
111 | string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); | 142 | string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); |
112 | Assert.That(fileName, Is.EqualTo(expectedObjectFileName)); | 143 | |
113 | gotObjectFile = true; | 144 | if (fileName.StartsWith(part1.Name)) |
145 | { | ||
146 | Assert.That(fileName, Is.EqualTo(expectedObject1FileName)); | ||
147 | gotObject1File = true; | ||
148 | } | ||
149 | else if (fileName.StartsWith(part2.Name)) | ||
150 | { | ||
151 | Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); | ||
152 | gotObject2File = true; | ||
153 | } | ||
114 | } | 154 | } |
115 | } | 155 | } |
116 | 156 | ||
117 | Assert.That(gotControlFile, Is.True, "No control file in archive"); | 157 | Assert.That(gotControlFile, Is.True, "No control file in archive"); |
118 | Assert.That(gotObjectFile, Is.True, "No object file in archive"); | 158 | Assert.That(gotObject1File, Is.True, "No object1 file in archive"); |
159 | Assert.That(gotObject2File, Is.True, "No object2 file in archive"); | ||
119 | 160 | ||
120 | // TODO: Test presence of more files and contents of files. | 161 | // TODO: Test presence of more files and contents of files. |
121 | } | 162 | } |