diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 72 |
2 files changed, 33 insertions, 41 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index d77bff2..31e6d75 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
81 | protected string m_item1Name = "Ray Gun Item"; | 81 | protected string m_item1Name = "Ray Gun Item"; |
82 | 82 | ||
83 | [SetUp] | 83 | [SetUp] |
84 | public void SetUp() | 84 | public virtual void SetUp() |
85 | { | 85 | { |
86 | m_iarStream = new MemoryStream(m_iarStreamBytes); | 86 | m_iarStream = new MemoryStream(m_iarStreamBytes); |
87 | } | 87 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 78faefd..79b4777 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -50,7 +50,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
50 | { | 50 | { |
51 | [TestFixture] | 51 | [TestFixture] |
52 | public class InventoryArchiverTests : InventoryArchiveTestCase | 52 | public class InventoryArchiverTests : InventoryArchiveTestCase |
53 | { | 53 | { |
54 | protected TestScene m_scene; | ||
55 | protected InventoryArchiverModule m_archiverModule; | ||
56 | |||
57 | [SetUp] | ||
58 | public override void SetUp() | ||
59 | { | ||
60 | base.SetUp(); | ||
61 | |||
62 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
63 | m_archiverModule = new InventoryArchiverModule(); | ||
64 | |||
65 | m_scene = SceneSetupHelpers.SetupScene("Inventory"); | ||
66 | SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | ||
67 | } | ||
68 | |||
54 | /// <summary> | 69 | /// <summary> |
55 | /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive | 70 | /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive |
56 | /// (subject to change since there is no fixed format yet). | 71 | /// (subject to change since there is no fixed format yet). |
@@ -61,17 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
61 | TestHelper.InMethod(); | 76 | TestHelper.InMethod(); |
62 | // log4net.Config.XmlConfigurator.Configure(); | 77 | // log4net.Config.XmlConfigurator.Configure(); |
63 | 78 | ||
64 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | ||
65 | |||
66 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | ||
67 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | ||
68 | |||
69 | // Create user | 79 | // Create user |
70 | string userFirstName = "Jock"; | 80 | string userFirstName = "Jock"; |
71 | string userLastName = "Stirrup"; | 81 | string userLastName = "Stirrup"; |
72 | string userPassword = "troll"; | 82 | string userPassword = "troll"; |
73 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 83 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
74 | UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); | 84 | UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); |
75 | 85 | ||
76 | // Create asset | 86 | // Create asset |
77 | SceneObjectGroup object1; | 87 | SceneObjectGroup object1; |
@@ -90,12 +100,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
90 | part1.Name = partName; | 100 | part1.Name = partName; |
91 | 101 | ||
92 | object1 = new SceneObjectGroup(part1); | 102 | object1 = new SceneObjectGroup(part1); |
93 | scene.AddNewSceneObject(object1, false); | 103 | m_scene.AddNewSceneObject(object1, false); |
94 | } | 104 | } |
95 | 105 | ||
96 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 106 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
97 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 107 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
98 | scene.AssetService.Store(asset1); | 108 | m_scene.AssetService.Store(asset1); |
99 | 109 | ||
100 | // Create item | 110 | // Create item |
101 | UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); | 111 | UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); |
@@ -105,15 +115,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
105 | item1.AssetID = asset1.FullID; | 115 | item1.AssetID = asset1.FullID; |
106 | item1.ID = item1Id; | 116 | item1.ID = item1Id; |
107 | InventoryFolderBase objsFolder | 117 | InventoryFolderBase objsFolder |
108 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; | 118 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, userId, "Objects")[0]; |
109 | item1.Folder = objsFolder.ID; | 119 | item1.Folder = objsFolder.ID; |
110 | scene.AddInventoryItem(item1); | 120 | m_scene.AddInventoryItem(item1); |
111 | 121 | ||
112 | MemoryStream archiveWriteStream = new MemoryStream(); | 122 | MemoryStream archiveWriteStream = new MemoryStream(); |
113 | archiverModule.OnInventoryArchiveSaved += SaveCompleted; | 123 | m_archiverModule.OnInventoryArchiveSaved += SaveCompleted; |
114 | 124 | ||
115 | mre.Reset(); | 125 | mre.Reset(); |
116 | archiverModule.ArchiveInventory( | 126 | m_archiverModule.ArchiveInventory( |
117 | Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); | 127 | Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); |
118 | mre.WaitOne(60000, false); | 128 | mre.WaitOne(60000, false); |
119 | 129 | ||
@@ -177,27 +187,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
177 | { | 187 | { |
178 | TestHelper.InMethod(); | 188 | TestHelper.InMethod(); |
179 | // log4net.Config.XmlConfigurator.Configure(); | 189 | // log4net.Config.XmlConfigurator.Configure(); |
180 | |||
181 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
182 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | ||
183 | |||
184 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | ||
185 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | ||
186 | |||
187 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
188 | 190 | ||
189 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); | 191 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_ua1, "meowfood"); |
190 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua3, "hampshire"); | 192 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_ua3, "hampshire"); |
191 | 193 | ||
192 | archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); | 194 | m_archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); |
193 | InventoryItemBase foundItem1 | 195 | InventoryItemBase foundItem1 |
194 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); | 196 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_ua1.PrincipalID, m_item1Name); |
195 | 197 | ||
196 | // We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the | ||
197 | // UUID, not the OSPA itself. | ||
198 | // Assert.That( | ||
199 | // foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), | ||
200 | // "Loaded item non-uuid creator doesn't match original"); | ||
201 | Assert.That( | 198 | Assert.That( |
202 | foundItem1.CreatorId, Is.EqualTo(m_ua3.PrincipalID.ToString()), | 199 | foundItem1.CreatorId, Is.EqualTo(m_ua3.PrincipalID.ToString()), |
203 | "Loaded item non-uuid creator doesn't match original"); | 200 | "Loaded item non-uuid creator doesn't match original"); |
@@ -207,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
207 | Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID), | 204 | Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID), |
208 | "Loaded item owner doesn't match inventory reciever"); | 205 | "Loaded item owner doesn't match inventory reciever"); |
209 | 206 | ||
210 | AssetBase asset1 = scene.AssetService.Get(foundItem1.AssetID.ToString()); | 207 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
211 | string xmlData = Utils.BytesToString(asset1.Data); | 208 | string xmlData = Utils.BytesToString(asset1.Data); |
212 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 209 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
213 | 210 | ||
@@ -224,16 +221,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
224 | TestHelper.InMethod(); | 221 | TestHelper.InMethod(); |
225 | // log4net.Config.XmlConfigurator.Configure(); | 222 | // log4net.Config.XmlConfigurator.Configure(); |
226 | 223 | ||
227 | SerialiserModule serialiserModule = new SerialiserModule(); | 224 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_ua1, "password"); |
228 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 225 | m_archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "password", m_iarStream); |
229 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | ||
230 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
231 | |||
232 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); | ||
233 | archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "password", m_iarStream); | ||
234 | 226 | ||
235 | InventoryItemBase foundItem1 | 227 | InventoryItemBase foundItem1 |
236 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); | 228 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_ua1.PrincipalID, m_item1Name); |
237 | 229 | ||
238 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | 230 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
239 | Assert.That( | 231 | Assert.That( |
@@ -243,7 +235,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
243 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua1.PrincipalID), | 235 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua1.PrincipalID), |
244 | "Loaded item uuid creator doesn't match that of the loading user"); | 236 | "Loaded item uuid creator doesn't match that of the loading user"); |
245 | 237 | ||
246 | AssetBase asset1 = scene.AssetService.Get(foundItem1.AssetID.ToString()); | 238 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
247 | string xmlData = Utils.BytesToString(asset1.Data); | 239 | string xmlData = Utils.BytesToString(asset1.Data); |
248 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 240 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
249 | 241 | ||