aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs35
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs17
2 files changed, 48 insertions, 4 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