29 using System.Collections.Generic;
30 using System.Reflection;
33 using NUnit.Framework;
35 using OpenMetaverse.Assets;
36 using OpenSim.Framework;
37 using OpenSim.Region.CoreModules.Avatar.Inventory.Transfer;
38 using OpenSim.Region.Framework.Interfaces;
39 using OpenSim.Region.Framework.Scenes;
40 using OpenSim.Services.Interfaces;
41 using OpenSim.Tests.Common;
55 IConfigSource config =
new IniConfigSource();
56 config.AddConfig(
"Messaging");
57 config.Configs[
"Messaging"].Set(
"InventoryTransferModule",
"InventoryTransferModule");
68 UUID initialSessionId = TestHelpers.ParseTail(0x10);
69 UUID itemId = TestHelpers.ParseTail(0x100);
70 UUID assetId = TestHelpers.ParseTail(0x200);
73 = UserAccountHelpers.CreateUserWithInventory(m_scene,
"User",
"One", TestHelpers.ParseTail(0x1),
"pw");
75 = UserAccountHelpers.CreateUserWithInventory(m_scene,
"User",
"Two", TestHelpers.ParseTail(0x2),
"pw");
77 ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1);
85 = UserInventoryHelpers.CreateInventoryItem(
86 m_scene,
"givenObj", itemId, assetId, giverSp.
UUID, InventoryType.Object);
88 byte[] giveImBinaryBucket =
new byte[17];
89 byte[] itemIdBytes = itemId.GetBytes();
90 Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
98 (byte)InstantMessageDialog.InventoryOffered,
100 "inventory offered msg",
107 giverClient.HandleImprovedInstantMessage(giveIm);
116 (byte)InstantMessageDialog.InventoryAccepted,
118 "inventory accepted msg",
125 receiverClient.HandleImprovedInstantMessage(acceptIm);
130 = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, giverSp.UUID,
"Objects/givenObj");
132 Assert.That(originalItemAfterGive, Is.Not.Null);
133 Assert.That(originalItemAfterGive.ID, Is.EqualTo(originalItem.ID));
137 = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID,
"Objects/givenObj");
139 Assert.That(receivedItem, Is.Not.Null);
140 Assert.That(receivedItem.ID, Is.Not.EqualTo(originalItem.ID));
143 m_scene.InventoryService.DeleteItems(receiverSp.UUID,
new List<UUID>() { receivedItem.ID });
146 = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, giverSp.UUID,
"Objects/givenObj");
148 Assert.That(originalItemAfterDelete, Is.Not.Null);
164 UUID initialSessionId = TestHelpers.ParseTail(0x10);
165 UUID itemId = TestHelpers.ParseTail(0x100);
166 UUID assetId = TestHelpers.ParseTail(0x200);
169 = UserAccountHelpers.CreateUserWithInventory(m_scene,
"User",
"One", TestHelpers.ParseTail(0x1),
"pw");
171 = UserAccountHelpers.CreateUserWithInventory(m_scene,
"User",
"Two", TestHelpers.ParseTail(0x2),
"pw");
173 ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1);
181 = UserInventoryHelpers.CreateInventoryItem(
182 m_scene,
"givenObj", itemId, assetId, giverSp.
UUID, InventoryType.Object);
185 receiverClient.OnReceivedInstantMessage += im => receivedIm = im;
187 byte[] giveImBinaryBucket =
new byte[17];
188 byte[] itemIdBytes = itemId.GetBytes();
189 Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
197 (byte)InstantMessageDialog.InventoryOffered,
199 "inventory offered msg",
206 giverClient.HandleImprovedInstantMessage(giveIm);
216 (byte)InstantMessageDialog.InventoryDeclined,
218 "inventory declined msg",
225 receiverClient.HandleImprovedInstantMessage(rejectIm);
230 = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, giverSp.UUID,
"Objects/givenObj");
232 Assert.That(originalItemAfterGive, Is.Not.Null);
233 Assert.That(originalItemAfterGive.ID, Is.EqualTo(originalItem.ID));
237 = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID,
"Trash/givenObj");
240 = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, FolderType.Trash);
242 Assert.That(receivedItem, Is.Not.Null);
243 Assert.That(receivedItem.ID, Is.Not.EqualTo(originalItem.ID));
244 Assert.That(receivedItem.Folder, Is.EqualTo(trashFolder.ID));
247 m_scene.InventoryService.PurgeFolder(trashFolder);
250 = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, giverSp.UUID,
"Objects/givenObj");
252 Assert.That(originalItemAfterDelete, Is.Not.Null);
258 TestHelpers.InMethod();
261 UUID initialSessionId = TestHelpers.ParseTail(0x10);
262 UUID folderId = TestHelpers.ParseTail(0x100);
265 = UserAccountHelpers.CreateUserWithInventory(m_scene,
"User",
"One", TestHelpers.ParseTail(0x1),
"pw");
267 = UserAccountHelpers.CreateUserWithInventory(m_scene,
"User",
"Two", TestHelpers.ParseTail(0x2),
"pw");
269 ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1);
276 = UserInventoryHelpers.CreateInventoryFolder(
277 m_scene.InventoryService, giverSp.
UUID, folderId,
"f1",
true);
279 byte[] giveImBinaryBucket =
new byte[17];
280 giveImBinaryBucket[0] = (byte)AssetType.Folder;
281 byte[] itemIdBytes = folderId.GetBytes();
282 Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
290 (byte)InstantMessageDialog.InventoryOffered,
292 "inventory offered msg",
299 giverClient.HandleImprovedInstantMessage(giveIm);
308 (byte)InstantMessageDialog.InventoryAccepted,
310 "inventory accepted msg",
317 receiverClient.HandleImprovedInstantMessage(acceptIm);
322 = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, giverSp.UUID,
"f1");
324 Assert.That(originalFolderAfterGive, Is.Not.Null);
325 Assert.That(originalFolderAfterGive.ID, Is.EqualTo(originalFolder.ID));
329 = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID,
"f1");
331 Assert.That(receivedFolder, Is.Not.Null);
332 Assert.That(receivedFolder.ID, Is.Not.EqualTo(originalFolder.ID));
335 m_scene.InventoryService.DeleteFolders(receiverSp.UUID,
new List<UUID>() { receivedFolder.ID });
338 = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, giverSp.UUID,
"f1");
340 Assert.That(originalFolderAfterDelete, Is.Not.Null);
354 TestHelpers.InMethod();
357 UUID initialSessionId = TestHelpers.ParseTail(0x10);
358 UUID folderId = TestHelpers.ParseTail(0x100);
361 = UserAccountHelpers.CreateUserWithInventory(m_scene,
"User",
"One", TestHelpers.ParseTail(0x1),
"pw");
363 = UserAccountHelpers.CreateUserWithInventory(m_scene,
"User",
"Two", TestHelpers.ParseTail(0x2),
"pw");
365 ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1);
373 = UserInventoryHelpers.CreateInventoryFolder(
374 m_scene.InventoryService, giverSp.
UUID, folderId,
"f1",
true);
377 receiverClient.OnReceivedInstantMessage += im => receivedIm = im;
379 byte[] giveImBinaryBucket =
new byte[17];
380 giveImBinaryBucket[0] = (byte)AssetType.Folder;
381 byte[] itemIdBytes = folderId.GetBytes();
382 Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
390 (byte)InstantMessageDialog.InventoryOffered,
392 "inventory offered msg",
399 giverClient.HandleImprovedInstantMessage(giveIm);
409 (byte)InstantMessageDialog.InventoryDeclined,
411 "inventory declined msg",
418 receiverClient.HandleImprovedInstantMessage(rejectIm);
423 = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, giverSp.UUID,
"f1");
425 Assert.That(originalFolderAfterGive, Is.Not.Null);
426 Assert.That(originalFolderAfterGive.ID, Is.EqualTo(originalFolder.ID));
430 = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID,
"Trash/f1");
433 = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, FolderType.Trash);
435 Assert.That(receivedFolder, Is.Not.Null);
436 Assert.That(receivedFolder.ID, Is.Not.EqualTo(originalFolder.ID));
437 Assert.That(receivedFolder.ParentID, Is.EqualTo(trashFolder.ID));
440 m_scene.InventoryService.PurgeFolder(trashFolder);
443 = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, giverSp.UUID,
"f1");
445 Assert.That(originalFolderAfterDelete, Is.Not.Null);
IClientAPI ControllingClient
void TestAcceptGivenItem()
void TestRejectGivenFolder()
Test user rejection of a given item.
Inventory Item - contains all the properties associated with an individual inventory piece...
Helpers for setting up scenes.
Interactive OpenSim region server
void TestAcceptGivenFolder()
static ScenePresence AddScenePresence(Scene scene, UUID agentId)
Add a root agent where the details of the agent connection (apart from the id) are unimportant for th...
virtual string Name
The name of this entity
void TestRejectGivenItem()
Test user rejection of a given item.