From a7cbb9edc98fabc6d2705d69310f4356e84c7596 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 29 Apr 2013 20:50:49 +0100
Subject: Add regression test for offer, accept and subsequent receiver delete
of an item offered via instant message.
---
OpenSim/Tests/Common/Mock/TestClient.cs | 12 ++++++++++++
1 file changed, 12 insertions(+)
(limited to 'OpenSim/Tests')
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index d26e3f7..b7a7463 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -484,6 +484,18 @@ namespace OpenSim.Tests.Common.Mock
OnCompleteMovementToRegion(this, true);
}
+ ///
+ /// Emulate sending an IM from the viewer to the simulator.
+ ///
+ ///
+ public void HandleImprovedInstantMessage(GridInstantMessage im)
+ {
+ ImprovedInstantMessage handlerInstantMessage = OnInstantMessage;
+
+ if (handlerInstantMessage != null)
+ handlerInstantMessage(this, im);
+ }
+
public virtual void ActivateGesture(UUID assetId, UUID gestureId)
{
}
--
cgit v1.1
From 0beccf23c0c2e7b2420f4f150d5f2566f0d63370 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 29 Apr 2013 21:11:44 +0100
Subject: Add regression test for inventory item give, reject and subsequent
trash folder purge by receiver.
This commit also actually adds the InventoryTransferModuleTests file which I previously forgot
---
OpenSim/Tests/Common/Mock/TestClient.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Tests')
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index b7a7463..41402a4 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Tests.Common.Mock
// Test client specific events - for use by tests to implement some IClientAPI behaviour.
public event Action OnReceivedMoveAgentIntoRegion;
public event Action OnTestClientInformClientOfNeighbour;
+ public event Action OnReceivedInstantMessage;
// disable warning: public events, part of the public API
#pragma warning disable 67
@@ -550,7 +551,8 @@ namespace OpenSim.Tests.Common.Mock
public void SendInstantMessage(GridInstantMessage im)
{
-
+ if (OnReceivedInstantMessage != null)
+ OnReceivedInstantMessage(im);
}
public void SendGenericMessage(string method, UUID invoice, List message)
--
cgit v1.1
From 67789201c3ae40bd4697f3479eb183599baa3658 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 29 Apr 2013 22:14:13 +0100
Subject: Add TestRejectGivenFolder() and TestAcceptGivenFolder() regression
tests
---
.../Tests/Common/Helpers/UserInventoryHelpers.cs | 41 +++++++++++++++++++---
.../Tests/Common/Mock/TestXInventoryDataPlugin.cs | 28 ++++++++++++++-
2 files changed, 64 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Tests')
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
index a1794c9..b3b75af 100644
--- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
@@ -218,12 +218,37 @@ namespace OpenSim.Tests.Common
public static InventoryFolderBase CreateInventoryFolder(
IInventoryService inventoryService, UUID userId, string path, bool useExistingFolders)
{
+ return CreateInventoryFolder(inventoryService, userId, UUID.Random(), path, useExistingFolders);
+ }
+
+ ///
+ /// Create inventory folders starting from the user's root folder.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER
+ ///
+ ///
+ /// If true, then folders in the path which already the same name are
+ /// used. This applies to the terminal folder as well.
+ /// If false, then all folders in the path are created, even if there is already a folder at a particular
+ /// level with the same name.
+ ///
+ ///
+ /// The folder created. If the path contains multiple folders then the last one created is returned.
+ /// Will return null if the root folder could not be found.
+ ///
+ public static InventoryFolderBase CreateInventoryFolder(
+ IInventoryService inventoryService, UUID userId, UUID folderId, string path, bool useExistingFolders)
+ {
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (null == rootFolder)
return null;
- return CreateInventoryFolder(inventoryService, rootFolder, path, useExistingFolders);
+ return CreateInventoryFolder(inventoryService, folderId, rootFolder, path, useExistingFolders);
}
///
@@ -235,6 +260,7 @@ namespace OpenSim.Tests.Common
/// TODO: May need to make it an option to create duplicate folders.
///
///
+ /// ID of the folder to create
///
///
/// The folder to create.
@@ -249,7 +275,7 @@ namespace OpenSim.Tests.Common
/// The folder created. If the path contains multiple folders then the last one created is returned.
///
public static InventoryFolderBase CreateInventoryFolder(
- IInventoryService inventoryService, InventoryFolderBase parentFolder, string path, bool useExistingFolders)
+ IInventoryService inventoryService, UUID folderId, InventoryFolderBase parentFolder, string path, bool useExistingFolders)
{
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
@@ -262,9 +288,16 @@ namespace OpenSim.Tests.Common
{
// Console.WriteLine("Creating folder {0} at {1}", components[0], parentFolder.Name);
+ UUID folderIdForCreate;
+
+ if (components.Length > 1)
+ folderIdForCreate = UUID.Random();
+ else
+ folderIdForCreate = folderId;
+
folder
= new InventoryFolderBase(
- UUID.Random(), components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0);
+ folderIdForCreate, components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0);
inventoryService.AddFolder(folder);
}
@@ -274,7 +307,7 @@ namespace OpenSim.Tests.Common
// }
if (components.Length > 1)
- return CreateInventoryFolder(inventoryService, folder, components[1], useExistingFolders);
+ return CreateInventoryFolder(inventoryService, folderId, folder, components[1], useExistingFolders);
else
return folder;
}
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
index ccbdf81..30b1f38 100644
--- a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
@@ -53,6 +53,9 @@ namespace OpenSim.Tests.Common.Mock
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
{
+// Console.WriteLine(
+// "Requesting folders, fields {0}, vals {1}", string.Join(",", fields), string.Join(",", vals));
+
List origFolders
= Get(fields, vals, m_allFolders.Values.ToList());
@@ -104,7 +107,30 @@ namespace OpenSim.Tests.Common.Mock
}
public bool MoveItem(string id, string newParent) { throw new NotImplementedException(); }
- public bool MoveFolder(string id, string newParent) { throw new NotImplementedException(); }
+
+ public bool MoveFolder(string id, string newParent)
+ {
+ // Don't use GetFolders() here - it takes a clone!
+ XInventoryFolder folder = m_allFolders[new UUID(id)];
+
+ if (folder == null)
+ return false;
+
+ folder.parentFolderID = new UUID(newParent);
+
+ XInventoryFolder[] newParentFolders
+ = GetFolders(new string[] { "folderID" }, new string[] { folder.parentFolderID.ToString() });
+
+// Console.WriteLine(
+// "Moved folder {0} {1}, to {2} {3}",
+// folder.folderName, folder.folderID, newParentFolders[0].folderName, folder.parentFolderID);
+
+ // TODO: Really need to implement folder version incrementing, though this should be common code anyway,
+ // not reimplemented in each db plugin.
+
+ return true;
+ }
+
public XInventoryItem[] GetActiveGestures(UUID principalID) { throw new NotImplementedException(); }
public int GetAssetPermissions(UUID principalID, UUID assetID) { throw new NotImplementedException(); }
}
--
cgit v1.1