aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-12 19:24:45 +0000
committerJustin Clarke Casey2008-12-12 19:24:45 +0000
commit7bbab121589a6e42e7744ffad37b35e62775b2f9 (patch)
treef5a73c37bb6b7474c34f5c90d68839d4d3b7d013 /OpenSim/Framework/Communications
parent* extend user profile create folder test to check that one can't create a fol... (diff)
downloadopensim-SC_OLD-7bbab121589a6e42e7744ffad37b35e62775b2f9.zip
opensim-SC_OLD-7bbab121589a6e42e7744ffad37b35e62775b2f9.tar.gz
opensim-SC_OLD-7bbab121589a6e42e7744ffad37b35e62775b2f9.tar.bz2
opensim-SC_OLD-7bbab121589a6e42e7744ffad37b35e62775b2f9.tar.xz
* Add user info move inventory folder test
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs55
1 files changed, 46 insertions, 9 deletions
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index a229e2a..215fa81 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -72,6 +72,23 @@ namespace OpenSim.Framework.Communications.Tests
72 72
73 Assert.That(userInfo.HasReceivedInventory, Is.True); 73 Assert.That(userInfo.HasReceivedInventory, Is.True);
74 } 74 }
75
76 /// <summary>
77 /// Test retrieving a child folder
78 /// </summary>
79 [Test]
80 public void TestGetChildFolder()
81 {
82 CommunicationsManager commsManager = UserProfileTestUtils.SetupServices();
83 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
84
85 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
86
87 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null);
88 userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID);
89
90 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null);
91 }
75 92
76 /// <summary> 93 /// <summary>
77 /// Test creating an inventory folder 94 /// Test creating an inventory folder
@@ -104,22 +121,42 @@ namespace OpenSim.Framework.Communications.Tests
104 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); 121 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null);
105 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); 122 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
106 } 123 }
107 124
108 /// <summary> 125 /// <summary>
109 /// Test retrieving a child folder 126 /// Test moving an inventory folder
110 /// </summary> 127 /// </summary>
111 [Test] 128 [Test]
112 public void TestGetChildFolder() 129 public void TestMoveFolder()
113 { 130 {
114 CommunicationsManager commsManager = UserProfileTestUtils.SetupServices(); 131 IUserDataPlugin userDataPlugin = new TestUserDataPlugin();
132 IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin();
133
134 CommunicationsManager commsManager
135 = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin);
115 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 136 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
137
138 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020");
139 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021");
140 UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030");
116 141
117 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); 142 InventoryFolderImpl rootFolder = userInfo.RootFolder;
118 143
119 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); 144 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
120 userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID); 145 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
146 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
147 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
121 148
122 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null); 149 // Check folder is currently in folder1
123 } 150 userInfo.CreateFolder("folderToMove", folderToMoveId, (ushort)AssetType.Animation, folder1Id);
151 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.True);
152
153 userInfo.MoveFolder(folderToMoveId, folder2Id);
154
155 // Check folder is now in folder2 and no trace remains in folder1
156 Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True);
157 Assert.That(inventoryDataPlugin.getInventoryFolder(folderToMoveId).ParentID, Is.EqualTo(folder2Id));
158
159 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
160 }
124 } 161 }
125} 162}