diff options
author | Justin Clarke Casey | 2009-05-18 17:46:14 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-05-18 17:46:14 +0000 |
commit | ad7214620f43666aba7a48c4777ee24dbd664b86 (patch) | |
tree | 7c33b604c660a1f8e25800e1d4c2b83903db8c90 /OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |
parent | From: Chris Yeoh <yeohc@au1.ibm.com> (diff) | |
download | opensim-SC_OLD-ad7214620f43666aba7a48c4777ee24dbd664b86.zip opensim-SC_OLD-ad7214620f43666aba7a48c4777ee24dbd664b86.tar.gz opensim-SC_OLD-ad7214620f43666aba7a48c4777ee24dbd664b86.tar.bz2 opensim-SC_OLD-ad7214620f43666aba7a48c4777ee24dbd664b86.tar.xz |
* Re-enable save oar test by loading asset data plugins from test mock class
* Actually spit out the exception caught by the plugin loader - not much point having plugins throw exceptions if we are just going to ignore them
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 240 |
1 files changed, 120 insertions, 120 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 2ba94f7..9741399 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -74,129 +74,129 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | ///// <summary> | 77 | /// <summary> |
78 | ///// Test saving a V0.2 OpenSim Region Archive. | 78 | /// Test saving a V0.2 OpenSim Region Archive. |
79 | ///// </summary> | 79 | /// </summary> |
80 | //[Test] | 80 | [Test] |
81 | //public void TestSaveOarV0p2() | 81 | public void TestSaveOarV0p2() |
82 | //{ | 82 | { |
83 | // TestHelper.InMethod(); | 83 | TestHelper.InMethod(); |
84 | // //log4net.Config.XmlConfigurator.Configure(); | 84 | log4net.Config.XmlConfigurator.Configure(); |
85 | 85 | ||
86 | // ArchiverModule archiverModule = new ArchiverModule(); | 86 | ArchiverModule archiverModule = new ArchiverModule(); |
87 | // SerialiserModule serialiserModule = new SerialiserModule(); | 87 | SerialiserModule serialiserModule = new SerialiserModule(); |
88 | // TerrainModule terrainModule = new TerrainModule(); | 88 | TerrainModule terrainModule = new TerrainModule(); |
89 | 89 | ||
90 | // Scene scene = SceneSetupHelpers.SetupScene(false); | 90 | Scene scene = SceneSetupHelpers.SetupScene(false); |
91 | // SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | 91 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); |
92 | 92 | ||
93 | // SceneObjectPart part1; | 93 | SceneObjectPart part1; |
94 | 94 | ||
95 | // // Create and add prim 1 | 95 | // Create and add prim 1 |
96 | // { | 96 | { |
97 | // string partName = "My Little Pony"; | 97 | string partName = "My Little Pony"; |
98 | // UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); | 98 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); |
99 | // PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 99 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); |
100 | // Vector3 groupPosition = new Vector3(10, 20, 30); | 100 | Vector3 groupPosition = new Vector3(10, 20, 30); |
101 | // Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | 101 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); |
102 | // Vector3 offsetPosition = new Vector3(5, 10, 15); | 102 | Vector3 offsetPosition = new Vector3(5, 10, 15); |
103 | 103 | ||
104 | // part1 | 104 | part1 |
105 | // = new SceneObjectPart( | 105 | = new SceneObjectPart( |
106 | // ownerId, shape, groupPosition, rotationOffset, offsetPosition); | 106 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); |
107 | // part1.Name = partName; | 107 | part1.Name = partName; |
108 | 108 | ||
109 | // scene.AddNewSceneObject(new SceneObjectGroup(part1), false); | 109 | scene.AddNewSceneObject(new SceneObjectGroup(part1), false); |
110 | // } | 110 | } |
111 | 111 | ||
112 | // SceneObjectPart part2; | 112 | SceneObjectPart part2; |
113 | 113 | ||
114 | // // Create and add prim 2 | 114 | // Create and add prim 2 |
115 | // { | 115 | { |
116 | // string partName = "Action Man"; | 116 | string partName = "Action Man"; |
117 | // UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016"); | 117 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016"); |
118 | // PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); | 118 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); |
119 | // Vector3 groupPosition = new Vector3(90, 80, 70); | 119 | Vector3 groupPosition = new Vector3(90, 80, 70); |
120 | // Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); | 120 | Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); |
121 | // Vector3 offsetPosition = new Vector3(20, 25, 30); | 121 | Vector3 offsetPosition = new Vector3(20, 25, 30); |
122 | 122 | ||
123 | // part2 | 123 | part2 |
124 | // = new SceneObjectPart( | 124 | = new SceneObjectPart( |
125 | // ownerId, shape, groupPosition, rotationOffset, offsetPosition); | 125 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); |
126 | // part2.Name = partName; | 126 | part2.Name = partName; |
127 | 127 | ||
128 | // scene.AddNewSceneObject(new SceneObjectGroup(part2), false); | 128 | scene.AddNewSceneObject(new SceneObjectGroup(part2), false); |
129 | // } | 129 | } |
130 | 130 | ||
131 | // MemoryStream archiveWriteStream = new MemoryStream(); | 131 | MemoryStream archiveWriteStream = new MemoryStream(); |
132 | // scene.EventManager.OnOarFileSaved += SaveCompleted; | 132 | scene.EventManager.OnOarFileSaved += SaveCompleted; |
133 | 133 | ||
134 | // Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); | 134 | Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); |
135 | 135 | ||
136 | // lock (this) | 136 | lock (this) |
137 | // { | 137 | { |
138 | // archiverModule.ArchiveRegion(archiveWriteStream, requestId); | 138 | archiverModule.ArchiveRegion(archiveWriteStream, requestId); |
139 | // //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; | 139 | //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; |
140 | // //while (assetServer.HasWaitingRequests()) | 140 | //while (assetServer.HasWaitingRequests()) |
141 | // // assetServer.ProcessNextRequest(); | 141 | // assetServer.ProcessNextRequest(); |
142 | 142 | ||
143 | // Monitor.Wait(this, 60000); | 143 | Monitor.Wait(this, 60000); |
144 | // } | 144 | } |
145 | 145 | ||
146 | // Assert.That(m_lastRequestId, Is.EqualTo(requestId)); | 146 | Assert.That(m_lastRequestId, Is.EqualTo(requestId)); |
147 | 147 | ||
148 | // byte[] archive = archiveWriteStream.ToArray(); | 148 | byte[] archive = archiveWriteStream.ToArray(); |
149 | // MemoryStream archiveReadStream = new MemoryStream(archive); | 149 | MemoryStream archiveReadStream = new MemoryStream(archive); |
150 | // TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | 150 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); |
151 | 151 | ||
152 | // bool gotControlFile = false; | 152 | bool gotControlFile = false; |
153 | // bool gotObject1File = false; | 153 | bool gotObject1File = false; |
154 | // bool gotObject2File = false; | 154 | bool gotObject2File = false; |
155 | // string expectedObject1FileName = string.Format( | 155 | string expectedObject1FileName = string.Format( |
156 | // "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", | 156 | "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", |
157 | // part1.Name, | 157 | part1.Name, |
158 | // Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z), | 158 | Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z), |
159 | // part1.UUID); | 159 | part1.UUID); |
160 | // string expectedObject2FileName = string.Format( | 160 | string expectedObject2FileName = string.Format( |
161 | // "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", | 161 | "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", |
162 | // part2.Name, | 162 | part2.Name, |
163 | // Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z), | 163 | Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z), |
164 | // part2.UUID); | 164 | part2.UUID); |
165 | 165 | ||
166 | // string filePath; | 166 | string filePath; |
167 | // TarArchiveReader.TarEntryType tarEntryType; | 167 | TarArchiveReader.TarEntryType tarEntryType; |
168 | 168 | ||
169 | // while (tar.ReadEntry(out filePath, out tarEntryType) != null) | 169 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) |
170 | // { | 170 | { |
171 | // if (ArchiveConstants.CONTROL_FILE_PATH == filePath) | 171 | if (ArchiveConstants.CONTROL_FILE_PATH == filePath) |
172 | // { | 172 | { |
173 | // gotControlFile = true; | 173 | gotControlFile = true; |
174 | // } | 174 | } |
175 | // else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) | 175 | else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) |
176 | // { | 176 | { |
177 | // string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); | 177 | string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); |
178 | 178 | ||
179 | // if (fileName.StartsWith(part1.Name)) | 179 | if (fileName.StartsWith(part1.Name)) |
180 | // { | 180 | { |
181 | // Assert.That(fileName, Is.EqualTo(expectedObject1FileName)); | 181 | Assert.That(fileName, Is.EqualTo(expectedObject1FileName)); |
182 | // gotObject1File = true; | 182 | gotObject1File = true; |
183 | // } | 183 | } |
184 | // else if (fileName.StartsWith(part2.Name)) | 184 | else if (fileName.StartsWith(part2.Name)) |
185 | // { | 185 | { |
186 | // Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); | 186 | Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); |
187 | // gotObject2File = true; | 187 | gotObject2File = true; |
188 | // } | 188 | } |
189 | // } | 189 | } |
190 | // } | 190 | } |
191 | 191 | ||
192 | // Assert.That(gotControlFile, Is.True, "No control file in archive"); | 192 | Assert.That(gotControlFile, Is.True, "No control file in archive"); |
193 | // Assert.That(gotObject1File, Is.True, "No object1 file in archive"); | 193 | Assert.That(gotObject1File, Is.True, "No object1 file in archive"); |
194 | // Assert.That(gotObject2File, Is.True, "No object2 file in archive"); | 194 | Assert.That(gotObject2File, Is.True, "No object2 file in archive"); |
195 | 195 | ||
196 | // // TODO: Test presence of more files and contents of files. | 196 | // TODO: Test presence of more files and contents of files. |
197 | // // Temporary | 197 | // Temporary |
198 | // Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | 198 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); |
199 | //} | 199 | } |
200 | 200 | ||
201 | /// <summary> | 201 | /// <summary> |
202 | /// Test loading a V0.2 OpenSim Region Archive. | 202 | /// Test loading a V0.2 OpenSim Region Archive. |