diff options
author | Justin Clark-Casey (justincc) | 2011-04-14 20:59:52 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-04-14 20:59:52 +0100 |
commit | 821e67fb950721c0bb8105318e41d7982cf986f2 (patch) | |
tree | e05670ffa1dcbafbbec6b6c19bfb9a671c5855d6 | |
parent | simplify InventoryArchiveTestCase setup (diff) | |
download | opensim-SC-821e67fb950721c0bb8105318e41d7982cf986f2.zip opensim-SC-821e67fb950721c0bb8105318e41d7982cf986f2.tar.gz opensim-SC-821e67fb950721c0bb8105318e41d7982cf986f2.tar.bz2 opensim-SC-821e67fb950721c0bb8105318e41d7982cf986f2.tar.xz |
implement stub TestLoadCoalesecedItem(). Doesn't do what it's meant to do yet.
Diffstat (limited to '')
3 files changed, 64 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 7ee6f28..f2d050c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -68,17 +68,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
68 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), | 68 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), |
69 | FirstName = "Mr", | 69 | FirstName = "Mr", |
70 | LastName = "Tiddles" }; | 70 | LastName = "Tiddles" }; |
71 | |||
71 | protected UserAccount m_uaLL1 | 72 | protected UserAccount m_uaLL1 |
72 | = new UserAccount { | 73 | = new UserAccount { |
73 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), | 74 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), |
74 | FirstName = "Lord", | 75 | FirstName = "Lord", |
75 | LastName = "Lucan" }; | 76 | LastName = "Lucan" }; |
77 | |||
76 | protected UserAccount m_uaLL2 | 78 | protected UserAccount m_uaLL2 |
77 | = new UserAccount { | 79 | = new UserAccount { |
78 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), | 80 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), |
79 | FirstName = "Lord", | 81 | FirstName = "Lord", |
80 | LastName = "Lucan" }; | 82 | LastName = "Lucan" }; |
83 | |||
81 | protected string m_item1Name = "Ray Gun Item"; | 84 | protected string m_item1Name = "Ray Gun Item"; |
85 | protected string m_coaItemName = "Coalesced Item"; | ||
82 | 86 | ||
83 | [SetUp] | 87 | [SetUp] |
84 | public virtual void SetUp() | 88 | public virtual void SetUp() |
@@ -104,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
104 | 108 | ||
105 | MemoryStream archiveWriteStream = new MemoryStream(); | 109 | MemoryStream archiveWriteStream = new MemoryStream(); |
106 | 110 | ||
107 | // Create asset | 111 | // Create scene object asset |
108 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 112 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
109 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); | 113 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); |
110 | 114 | ||
@@ -112,7 +116,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
112 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 116 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
113 | scene.AssetService.Store(asset1); | 117 | scene.AssetService.Store(asset1); |
114 | 118 | ||
115 | // Create item | 119 | // Create scene object item |
116 | InventoryItemBase item1 = new InventoryItemBase(); | 120 | InventoryItemBase item1 = new InventoryItemBase(); |
117 | item1.Name = m_item1Name; | 121 | item1.Name = m_item1Name; |
118 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 122 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
@@ -123,8 +127,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
123 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 127 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
124 | scene.AddInventoryItem(item1); | 128 | scene.AddInventoryItem(item1); |
125 | 129 | ||
130 | // Create coalesced objects asset | ||
131 | SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); | ||
132 | cobj1.AbsolutePosition = new Vector3(15, 30, 45); | ||
133 | |||
134 | SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); | ||
135 | cobj2.AbsolutePosition = new Vector3(25, 50, 75); | ||
136 | |||
137 | CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); | ||
138 | |||
139 | AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa); | ||
140 | scene.AssetService.Store(coaAsset); | ||
141 | |||
142 | // Create coalesced objects inventory item | ||
143 | InventoryItemBase coaItem = new InventoryItemBase(); | ||
144 | coaItem.Name = m_coaItemName; | ||
145 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); | ||
146 | coaItem.AssetID = asset1.FullID; | ||
147 | coaItem.GroupID = UUID.Random(); | ||
148 | coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; | ||
149 | coaItem.Owner = m_uaLL1.PrincipalID; | ||
150 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | ||
151 | scene.AddInventoryItem(coaItem); | ||
152 | |||
126 | archiverModule.ArchiveInventory( | 153 | archiverModule.ArchiveInventory( |
127 | Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream); | 154 | Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); |
128 | 155 | ||
129 | m_iarStreamBytes = archiveWriteStream.ToArray(); | 156 | m_iarStreamBytes = archiveWriteStream.ToArray(); |
130 | } | 157 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 9e3e7d4..0c4e364 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -257,5 +257,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
257 | 257 | ||
258 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); | 258 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); |
259 | } | 259 | } |
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 | } | ||
260 | } | 277 | } |
261 | } \ No newline at end of file | 278 | } \ No newline at end of file |
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index af66d7f..971c6bc 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Tests.Common | |||
55 | AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); | 55 | AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); |
56 | scene.AssetService.Store(asset); | 56 | scene.AssetService.Store(asset); |
57 | return asset; | 57 | return asset; |
58 | } | 58 | } |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// Create an asset from the given scene object. | 61 | /// Create an asset from the given scene object. |
@@ -75,6 +75,20 @@ namespace OpenSim.Tests.Common | |||
75 | /// <summary> | 75 | /// <summary> |
76 | /// Create an asset from the given scene object. | 76 | /// Create an asset from the given scene object. |
77 | /// </summary> | 77 | /// </summary> |
78 | /// <param name="assetUuidTailZ"> | ||
79 | /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" | ||
80 | /// will be used. | ||
81 | /// </param> | ||
82 | /// <param name="coa"></param> | ||
83 | /// <returns></returns> | ||
84 | public static AssetBase CreateAsset(int assetUuidTail, CoalescedSceneObjects coa) | ||
85 | { | ||
86 | return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), coa); | ||
87 | } | ||
88 | |||
89 | /// <summary> | ||
90 | /// Create an asset from the given scene object. | ||
91 | /// </summary> | ||
78 | /// <param name="assetUuid"></param> | 92 | /// <param name="assetUuid"></param> |
79 | /// <param name="coa"></param> | 93 | /// <param name="coa"></param> |
80 | /// <returns></returns> | 94 | /// <returns></returns> |
@@ -85,7 +99,7 @@ namespace OpenSim.Tests.Common | |||
85 | AssetType.Object, | 99 | AssetType.Object, |
86 | Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), | 100 | Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), |
87 | coa.CreatorId); | 101 | coa.CreatorId); |
88 | } | 102 | } |
89 | 103 | ||
90 | /// <summary> | 104 | /// <summary> |
91 | /// Create an asset from the given data. | 105 | /// Create an asset from the given data. |