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/Avatar | |
parent | From: Chris Yeoh <yeohc@au1.ibm.com> (diff) | |
download | opensim-SC-ad7214620f43666aba7a48c4777ee24dbd664b86.zip opensim-SC-ad7214620f43666aba7a48c4777ee24dbd664b86.tar.gz opensim-SC-ad7214620f43666aba7a48c4777ee24dbd664b86.tar.bz2 opensim-SC-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 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 195 |
1 files changed, 96 insertions, 99 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 296d4c1..b979a35 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -66,135 +66,132 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). | 67 | /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). |
68 | /// </summary> | 68 | /// </summary> |
69 | // [Test] | 69 | //[Test] |
70 | // public void TestSaveIarV0p1() | 70 | public void TestSaveIarV0p1() |
71 | // { | 71 | { |
72 | // TestHelper.InMethod(); | 72 | TestHelper.InMethod(); |
73 | // //log4net.Config.XmlConfigurator.Configure(); | 73 | //log4net.Config.XmlConfigurator.Configure(); |
74 | 74 | ||
75 | // InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 75 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
76 | 76 | ||
77 | // Scene scene = SceneSetupHelpers.SetupScene(false); | 77 | Scene scene = SceneSetupHelpers.SetupScene(false); |
78 | // SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 78 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
79 | // CommunicationsManager cm = scene.CommsManager; | 79 | CommunicationsManager cm = scene.CommsManager; |
80 | 80 | ||
81 | // // Create user | 81 | // Create user |
82 | // string userFirstName = "Jock"; | 82 | string userFirstName = "Jock"; |
83 | // string userLastName = "Stirrup"; | 83 | string userLastName = "Stirrup"; |
84 | // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 84 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
85 | // cm.UserAdminService.AddUser(userFirstName, userLastName, string.Empty, string.Empty, 1000, 1000, userId); | 85 | cm.UserAdminService.AddUser(userFirstName, userLastName, string.Empty, string.Empty, 1000, 1000, userId); |
86 | // CachedUserInfo userInfo = cm.UserProfileCacheService.GetUserDetails(userId); | 86 | CachedUserInfo userInfo = cm.UserProfileCacheService.GetUserDetails(userId); |
87 | // userInfo.FetchInventory(); | 87 | userInfo.FetchInventory(); |
88 | 88 | ||
89 | // // Create asset | 89 | // Create asset |
90 | // SceneObjectGroup object1; | 90 | SceneObjectGroup object1; |
91 | // SceneObjectPart part1; | 91 | SceneObjectPart part1; |
92 | // { | 92 | { |
93 | // string partName = "My Little Dog Object"; | 93 | string partName = "My Little Dog Object"; |
94 | // UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 94 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
95 | // PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 95 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); |
96 | // Vector3 groupPosition = new Vector3(10, 20, 30); | 96 | Vector3 groupPosition = new Vector3(10, 20, 30); |
97 | // Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | 97 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); |
98 | // Vector3 offsetPosition = new Vector3(5, 10, 15); | 98 | Vector3 offsetPosition = new Vector3(5, 10, 15); |
99 | 99 | ||
100 | // part1 | 100 | part1 |
101 | // = new SceneObjectPart( | 101 | = new SceneObjectPart( |
102 | // ownerId, shape, groupPosition, rotationOffset, offsetPosition); | 102 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); |
103 | // part1.Name = partName; | 103 | part1.Name = partName; |
104 | 104 | ||
105 | // object1 = new SceneObjectGroup(part1); | 105 | object1 = new SceneObjectGroup(part1); |
106 | // scene.AddNewSceneObject(object1, false); | 106 | scene.AddNewSceneObject(object1, false); |
107 | // } | 107 | } |
108 | 108 | ||
109 | // UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 109 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
110 | // AssetBase asset1 = new AssetBase(); | 110 | AssetBase asset1 = new AssetBase(); |
111 | // asset1.FullID = asset1Id; | 111 | asset1.FullID = asset1Id; |
112 | // asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1)); | 112 | asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1)); |
113 | // scene.AssetService.Store(asset1); | 113 | scene.AssetService.Store(asset1); |
114 | 114 | ||
115 | // // Create item | 115 | // Create item |
116 | // UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); | 116 | UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); |
117 | // InventoryItemBase item1 = new InventoryItemBase(); | 117 | InventoryItemBase item1 = new InventoryItemBase(); |
118 | // item1.Name = "My Little Dog"; | 118 | item1.Name = "My Little Dog"; |
119 | // item1.AssetID = asset1.FullID; | 119 | item1.AssetID = asset1.FullID; |
120 | // item1.ID = item1Id; | 120 | item1.ID = item1Id; |
121 | // item1.Folder = userInfo.RootFolder.FindFolderByPath("Objects").ID; | 121 | item1.Folder = userInfo.RootFolder.FindFolderByPath("Objects").ID; |
122 | // scene.AddInventoryItem(userId, item1); | 122 | scene.AddInventoryItem(userId, item1); |
123 | 123 | ||
124 | // MemoryStream archiveWriteStream = new MemoryStream(); | 124 | MemoryStream archiveWriteStream = new MemoryStream(); |
125 | // archiverModule.OnInventoryArchiveSaved += SaveCompleted; | 125 | archiverModule.OnInventoryArchiveSaved += SaveCompleted; |
126 | 126 | ||
127 | // lock (this) | 127 | lock (this) |
128 | // { | 128 | { |
129 | // archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream); | 129 | archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream); |
130 | // //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; | 130 | //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; |
131 | // //while (assetServer.HasWaitingRequests()) | 131 | //while (assetServer.HasWaitingRequests()) |
132 | // // assetServer.ProcessNextRequest(); | 132 | // assetServer.ProcessNextRequest(); |
133 | 133 | ||
134 | // Monitor.Wait(this, 60000); | 134 | Monitor.Wait(this, 60000); |
135 | // } | 135 | } |
136 | 136 | ||
137 | // byte[] archive = archiveWriteStream.ToArray(); | 137 | byte[] archive = archiveWriteStream.ToArray(); |
138 | // MemoryStream archiveReadStream = new MemoryStream(archive); | 138 | MemoryStream archiveReadStream = new MemoryStream(archive); |
139 | // TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | 139 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); |
140 | 140 | ||
141 | // InventoryFolderImpl objectsFolder = userInfo.RootFolder.FindFolderByPath("Objects"); | 141 | InventoryFolderImpl objectsFolder = userInfo.RootFolder.FindFolderByPath("Objects"); |
142 | 142 | ||
143 | // //bool gotControlFile = false; | 143 | //bool gotControlFile = false; |
144 | // bool gotObject1File = false; | 144 | bool gotObject1File = false; |
145 | // //bool gotObject2File = false; | 145 | //bool gotObject2File = false; |
146 | // string expectedObject1FilePath = string.Format( | 146 | string expectedObject1FilePath = string.Format( |
147 | // "{0}{1}/{2}_{3}.xml", | 147 | "{0}{1}/{2}_{3}.xml", |
148 | // ArchiveConstants.INVENTORY_PATH, | 148 | ArchiveConstants.INVENTORY_PATH, |
149 | // string.Format( | 149 | string.Format( |
150 | // "Objects{0}{1}", ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, objectsFolder.ID), | 150 | "Objects{0}{1}", ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, objectsFolder.ID), |
151 | // item1.Name, | 151 | item1.Name, |
152 | // item1Id); | 152 | item1Id); |
153 | 153 | ||
154 | ///* | ||
155 | // string expectedObject2FileName = string.Format( | 154 | // string expectedObject2FileName = string.Format( |
156 | // "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", | 155 | // "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", |
157 | // part2.Name, | 156 | // part2.Name, |
158 | // Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z), | 157 | // Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z), |
159 | // part2.UUID); | 158 | // part2.UUID); |
160 | // */ | ||
161 | 159 | ||
162 | // string filePath; | 160 | string filePath; |
163 | // TarArchiveReader.TarEntryType tarEntryType; | 161 | TarArchiveReader.TarEntryType tarEntryType; |
164 | 162 | ||
165 | // while (tar.ReadEntry(out filePath, out tarEntryType) != null) | 163 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) |
166 | // { | 164 | { |
167 | // Console.WriteLine("Got {0}", filePath); | 165 | //Console.WriteLine("Got {0}", filePath); |
168 | 166 | ||
169 | // /* | ||
170 | // if (ArchiveConstants.CONTROL_FILE_PATH == filePath) | 167 | // if (ArchiveConstants.CONTROL_FILE_PATH == filePath) |
171 | // { | 168 | // { |
172 | // gotControlFile = true; | 169 | // gotControlFile = true; |
173 | // } | 170 | // } |
174 | // */ | 171 | |
175 | // if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml")) | 172 | if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml")) |
176 | // { | 173 | { |
177 | // //string fileName = filePath.Remove(0, "Objects/".Length); | 174 | string fileName = filePath.Remove(0, "Objects/".Length); |
178 | 175 | ||
179 | // //if (fileName.StartsWith(part1.Name)) | 176 | if (fileName.StartsWith(part1.Name)) |
180 | // //{ | 177 | { |
181 | // Assert.That(filePath, Is.EqualTo(expectedObject1FilePath)); | 178 | Assert.That(filePath, Is.EqualTo(expectedObject1FilePath)); |
182 | // gotObject1File = true; | 179 | gotObject1File = true; |
183 | // //} | 180 | } |
184 | // //else if (fileName.StartsWith(part2.Name)) | 181 | // else if (fileName.StartsWith(part2.Name)) |
185 | // //{ | 182 | // { |
186 | // // Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); | 183 | // Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); |
187 | // // gotObject2File = true; | 184 | // gotObject2File = true; |
188 | // //} | 185 | // } |
189 | // } | 186 | } |
190 | // } | 187 | } |
191 | 188 | ||
192 | // //Assert.That(gotControlFile, Is.True, "No control file in archive"); | 189 | // Assert.That(gotControlFile, Is.True, "No control file in archive"); |
193 | // Assert.That(gotObject1File, Is.True, "No item1 file in archive"); | 190 | Assert.That(gotObject1File, Is.True, "No item1 file in archive"); |
194 | // //Assert.That(gotObject2File, Is.True, "No object2 file in archive"); | 191 | // Assert.That(gotObject2File, Is.True, "No object2 file in archive"); |
195 | 192 | ||
196 | // // TODO: Test presence of more files and contents of files. | 193 | // TODO: Test presence of more files and contents of files. |
197 | // } | 194 | } |
198 | 195 | ||
199 | /// <summary> | 196 | /// <summary> |
200 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 197 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |