From b1f018aa2600281cc379128f17c3c141b478f39d Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 12 Dec 2008 20:43:42 +0000
Subject: * Create update folder test * Correct small logic elidation
---
.../Communications/Cache/CachedUserInfo.cs | 1 +
.../Tests/Cache/UserProfileCacheServiceTests.cs | 32 ++++++++++++++++++++++
.../Tests/Common/Mock/TestInventoryDataPlugin.cs | 7 +++--
3 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 80fd1ae..dcf63cc 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -436,6 +436,7 @@ namespace OpenSim.Framework.Communications.Cache
if (folder != null)
{
folder.Name = name;
+ folder.Type = (short)type;
folder.ParentID = parentID;
}
}
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index 0914bfb..41c8e3c 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -122,6 +122,38 @@ namespace OpenSim.Framework.Communications.Tests
Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null);
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
}
+
+ ///
+ /// Test updating a folder
+ ///
+ [Test]
+ public void TestUpdateFolder()
+ {
+ IUserDataPlugin userDataPlugin = new TestUserDataPlugin();
+ IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin();
+
+ CommunicationsManager commsManager
+ = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin);
+ CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
+
+ UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
+ InventoryFolderImpl rootFolder = userInfo.RootFolder;
+
+ userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
+
+ // 1: Test updates that don't involve moving the folder
+ string newFolderName1 = "newFolderName1";
+ ushort folderType1 = (ushort)AssetType.Texture;
+ userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
+
+ InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
+ Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
+ Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
+
+ InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
+ Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
+ Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
+ }
///
/// Test moving an inventory folder
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index 808c212..8e19aec 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -122,12 +122,15 @@ namespace OpenSim.Tests.Common.Mock
m_rootFolders[folder.Owner] = folder;
}
- public void updateInventoryFolder(InventoryFolderBase folder) {}
+ public void updateInventoryFolder(InventoryFolderBase folder)
+ {
+ m_folders[folder.ID] = folder;
+ }
public void moveInventoryFolder(InventoryFolderBase folder)
{
// Simple replace
- m_folders[folder.ID] = folder;
+ updateInventoryFolder(folder);
}
public void deleteInventoryFolder(UUID folderId)
--
cgit v1.1