diff options
Diffstat (limited to '')
4 files changed, 49 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 01170aa..f3d2f26 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -471,16 +471,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
471 | if (m_creatorIdForAssetId.ContainsKey(assetId)) | 471 | if (m_creatorIdForAssetId.ContainsKey(assetId)) |
472 | { | 472 | { |
473 | string xmlData = Utils.BytesToString(data); | 473 | string xmlData = Utils.BytesToString(data); |
474 | SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 474 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); |
475 | foreach (SceneObjectPart sop in sog.Parts) | 475 | |
476 | CoalescedSceneObjects coa = null; | ||
477 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | ||
478 | { | ||
479 | // m_log.DebugFormat( | ||
480 | // "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | ||
481 | |||
482 | sceneObjects.AddRange(coa.Objects); | ||
483 | } | ||
484 | else | ||
476 | { | 485 | { |
477 | if (sop.CreatorData == null || sop.CreatorData == "") | 486 | sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData)); |
478 | { | ||
479 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
480 | } | ||
481 | } | 487 | } |
482 | 488 | ||
483 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)); | 489 | foreach (SceneObjectGroup sog in sceneObjects) |
490 | foreach (SceneObjectPart sop in sog.Parts) | ||
491 | if (sop.CreatorData == null || sop.CreatorData == "") | ||
492 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
493 | |||
494 | if (coa != null) | ||
495 | data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa)); | ||
496 | else | ||
497 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0])); | ||
484 | } | 498 | } |
485 | } | 499 | } |
486 | 500 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index f2d050c..e2316f0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
143 | InventoryItemBase coaItem = new InventoryItemBase(); | 143 | InventoryItemBase coaItem = new InventoryItemBase(); |
144 | coaItem.Name = m_coaItemName; | 144 | coaItem.Name = m_coaItemName; |
145 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); | 145 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); |
146 | coaItem.AssetID = asset1.FullID; | 146 | coaItem.AssetID = coaAsset.FullID; |
147 | coaItem.GroupID = UUID.Random(); | 147 | coaItem.GroupID = UUID.Random(); |
148 | coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; | 148 | coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; |
149 | coaItem.Owner = m_uaLL1.PrincipalID; | 149 | coaItem.Owner = m_uaLL1.PrincipalID; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 0c4e364..f747c89 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -62,9 +62,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
62 | SerialiserModule serialiserModule = new SerialiserModule(); | 62 | SerialiserModule serialiserModule = new SerialiserModule(); |
63 | m_archiverModule = new InventoryArchiverModule(); | 63 | m_archiverModule = new InventoryArchiverModule(); |
64 | 64 | ||
65 | m_scene = SceneSetupHelpers.SetupScene("Inventory"); | 65 | m_scene = SceneSetupHelpers.SetupScene("asset inventory"); |
66 | SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | 66 | SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); |
67 | } | 67 | } |
68 | |||
69 | [Test] | ||
70 | public void TestLoadCoalesecedItem() | ||
71 | { | ||
72 | TestHelper.InMethod(); | ||
73 | // log4net.Config.XmlConfigurator.Configure(); | ||
74 | |||
75 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | ||
76 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | ||
77 | |||
78 | InventoryItemBase coaItem | ||
79 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | ||
80 | |||
81 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); | ||
82 | |||
83 | string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); | ||
84 | |||
85 | CoalescedSceneObjects coa; | ||
86 | bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); | ||
87 | |||
88 | Assert.That(readResult, Is.True); | ||
89 | |||
90 | // TODO: Check that the loaded coalesence is valid and that the required scene object assets are around | ||
91 | } | ||
68 | 92 | ||
69 | /// <summary> | 93 | /// <summary> |
70 | /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive | 94 | /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive |
@@ -257,22 +281,5 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
257 | 281 | ||
258 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); | 282 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); |
259 | } | 283 | } |
260 | |||
261 | [Test] | ||
262 | public void TestLoadCoalesecedItem() | ||
263 | { | ||
264 | TestHelper.InMethod(); | ||
265 | // log4net.Config.XmlConfigurator.Configure(); | ||
266 | |||
267 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | ||
268 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | ||
269 | |||
270 | InventoryItemBase coaItem | ||
271 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | ||
272 | |||
273 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); | ||
274 | |||
275 | // TODO: Check that the loaded coalesence is valid and that the required scene object assets are around | ||
276 | } | ||
277 | } | 284 | } |
278 | } \ No newline at end of file | 285 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 1b3419d..51d1d59 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -195,6 +195,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
195 | 195 | ||
196 | public byte[] GetData(string id) | 196 | public byte[] GetData(string id) |
197 | { | 197 | { |
198 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Requesting data for asset {0}", id); | ||
199 | |||
198 | AssetBase asset = m_Cache.Get(id); | 200 | AssetBase asset = m_Cache.Get(id); |
199 | 201 | ||
200 | if (asset != null) | 202 | if (asset != null) |