* Reinstating UserProfileCacheServiceTests. One test still fails (TestUpdateFolder)
parent
57c4b69916
commit
c13f3649d2
|
@ -27,10 +27,12 @@
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NUnit.Framework.SyntaxHelpers;
|
using NUnit.Framework.SyntaxHelpers;
|
||||||
|
using System.Threading;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Communications.Local;
|
using OpenSim.Region.Communications.Local;
|
||||||
using OpenSim.Tests.Common.Mock;
|
using OpenSim.Tests.Common.Mock;
|
||||||
using OpenSim.Tests.Common.Setup;
|
using OpenSim.Tests.Common.Setup;
|
||||||
|
@ -109,59 +111,77 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//[Test]
|
[Test]
|
||||||
public void TestFetchInventory()
|
public void TestFetchInventory()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
Scene myScene = SceneSetupHelpers.SetupScene();
|
||||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager);
|
||||||
|
for (int i = 0 ; i < 50 ; i++)
|
||||||
Assert.That(userInfo.HasReceivedInventory, Is.True);
|
{
|
||||||
|
if (userInfo.HasReceivedInventory == true)
|
||||||
|
break;
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Test]
|
[Test]
|
||||||
public void TestGetChildFolder()
|
public void TestGetChildFolder()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
Scene myScene = SceneSetupHelpers.SetupScene();
|
||||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager);
|
||||||
|
for (int i = 0 ; i < 50 ; i++)
|
||||||
|
{
|
||||||
|
if (userInfo.HasReceivedInventory == true)
|
||||||
|
break;
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
|
||||||
|
|
||||||
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
|
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
|
||||||
|
|
||||||
Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null);
|
Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null);
|
||||||
userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID);
|
userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID);
|
||||||
|
|
||||||
Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null);
|
Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Test]
|
[Test]
|
||||||
public void TestCreateFolder()
|
public void TestCreateFolder()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
Scene myScene = SceneSetupHelpers.SetupScene();
|
||||||
IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
|
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager);
|
||||||
|
for (int i = 0 ; i < 50 ; i++)
|
||||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
{
|
||||||
|
if (userInfo.HasReceivedInventory == true)
|
||||||
|
break;
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
|
||||||
|
|
||||||
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010");
|
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010");
|
||||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False);
|
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False);
|
||||||
|
|
||||||
// 1: Try a folder create that should fail because the parent id given does not exist
|
// 1: Try a folder create that should fail because the parent id given does not exist
|
||||||
UUID missingFolderId = UUID.Random();
|
UUID missingFolderId = UUID.Random();
|
||||||
|
InventoryFolderBase myFolder = new InventoryFolderBase();
|
||||||
|
myFolder.ID = folderId;
|
||||||
|
|
||||||
Assert.That(
|
Assert.That(
|
||||||
userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False);
|
userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False);
|
||||||
Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Null);
|
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null);
|
||||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False);
|
Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False);
|
||||||
Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null);
|
Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null);
|
||||||
|
|
||||||
// 2: Try a folder create that should work
|
// 2: Try a folder create that should work
|
||||||
Assert.That(
|
Assert.That(
|
||||||
userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True);
|
userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True);
|
||||||
Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null);
|
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Not.Null);
|
||||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
|
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,13 +190,20 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
Scene myScene = SceneSetupHelpers.SetupScene();
|
||||||
IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
|
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager);
|
||||||
|
for (int i = 0 ; i < 50 ; i++)
|
||||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
{
|
||||||
|
if (userInfo.HasReceivedInventory == true)
|
||||||
|
break;
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
|
||||||
|
|
||||||
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||||
InventoryFolderImpl rootFolder = userInfo.RootFolder;
|
InventoryFolderImpl rootFolder = userInfo.RootFolder;
|
||||||
|
InventoryFolderBase myFolder = new InventoryFolderBase();
|
||||||
|
myFolder.ID = folder1Id;
|
||||||
|
|
||||||
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
||||||
|
|
||||||
|
@ -190,7 +217,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
|
Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
|
||||||
Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
|
Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
|
||||||
|
|
||||||
InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
|
InventoryFolderBase dataFolder1 = myScene.InventoryService.QueryFolder(myFolder);
|
||||||
Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
|
Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
|
||||||
Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
|
Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
|
||||||
}
|
}
|
||||||
|
@ -201,6 +228,9 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
|
userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
|
||||||
InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
|
InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
|
||||||
|
|
||||||
|
InventoryFolderBase myFolder2 = new InventoryFolderBase();
|
||||||
|
myFolder2.ID = folder2Id;
|
||||||
|
|
||||||
string newFolderName2 = "newFolderName2";
|
string newFolderName2 = "newFolderName2";
|
||||||
ushort folderType2 = (ushort)AssetType.Bodypart;
|
ushort folderType2 = (ushort)AssetType.Bodypart;
|
||||||
userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id);
|
userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id);
|
||||||
|
@ -213,7 +243,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
|
Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
|
||||||
Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
|
Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
|
||||||
|
|
||||||
InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
|
InventoryFolderBase dataFolder1 = myScene.InventoryService.QueryFolder(myFolder2);
|
||||||
Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
|
Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
|
||||||
Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
|
Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
|
||||||
Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
|
Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
|
||||||
|
@ -221,15 +251,20 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Test]
|
[Test]
|
||||||
public void TestMoveFolder()
|
public void TestMoveFolder()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
Scene myScene = SceneSetupHelpers.SetupScene();
|
||||||
IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
|
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager);
|
||||||
|
for (int i = 0 ; i < 50 ; i++)
|
||||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
{
|
||||||
|
if (userInfo.HasReceivedInventory == true)
|
||||||
|
break;
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
|
||||||
|
|
||||||
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||||
UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021");
|
UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021");
|
||||||
|
@ -248,34 +283,43 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
userInfo.MoveFolder(folderToMoveId, folder2Id);
|
userInfo.MoveFolder(folderToMoveId, folder2Id);
|
||||||
|
|
||||||
// Check folder is now in folder2 and no trace remains in folder1
|
// Check folder is now in folder2 and no trace remains in folder1
|
||||||
|
InventoryFolderBase myFolder = new InventoryFolderBase();
|
||||||
|
myFolder.ID = folderToMoveId;
|
||||||
Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True);
|
Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True);
|
||||||
Assert.That(inventoryDataPlugin.getInventoryFolder(folderToMoveId).ParentID, Is.EqualTo(folder2Id));
|
Assert.That(myScene.InventoryService.QueryFolder(myFolder).ParentID, Is.EqualTo(folder2Id));
|
||||||
|
|
||||||
Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
|
Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Test]
|
[Test]
|
||||||
public void TestPurgeFolder()
|
public void TestPurgeFolder()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
//log4net.Config.XmlConfigurator.Configure();
|
//log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
Scene myScene = SceneSetupHelpers.SetupScene();
|
||||||
IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
|
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager);
|
||||||
|
for (int i = 0 ; i < 50 ; i++)
|
||||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
{
|
||||||
|
if (userInfo.HasReceivedInventory == true)
|
||||||
|
break;
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
|
||||||
|
|
||||||
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070");
|
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070");
|
||||||
InventoryFolderImpl rootFolder = userInfo.RootFolder;
|
InventoryFolderImpl rootFolder = userInfo.RootFolder;
|
||||||
|
InventoryFolderBase myFolder = new InventoryFolderBase();
|
||||||
|
myFolder.ID = folder1Id;
|
||||||
|
|
||||||
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
||||||
Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Not.Null);
|
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Not.Null);
|
||||||
|
|
||||||
// Test purge
|
// Test purge
|
||||||
userInfo.PurgeFolder(rootFolder.ID);
|
userInfo.PurgeFolder(rootFolder.ID);
|
||||||
|
|
||||||
Assert.That(rootFolder.RequestListOfFolders(), Is.Empty);
|
Assert.That(rootFolder.RequestListOfFolders(), Is.Empty);
|
||||||
Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Null);
|
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
|
|
||||||
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
||||||
{
|
{
|
||||||
return null;
|
return getInventoryFolder(folderID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInventoryFolder(InventoryFolderBase folder)
|
public void addInventoryFolder(InventoryFolderBase folder)
|
||||||
|
|
|
@ -3556,6 +3556,7 @@
|
||||||
<Reference name="OpenSim.Framework.Communications"/>
|
<Reference name="OpenSim.Framework.Communications"/>
|
||||||
<Reference name="OpenSim.Services.Interfaces"/>
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
<Reference name="OpenSim.Data"/>
|
<Reference name="OpenSim.Data"/>
|
||||||
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
<Reference name="OpenSim.Region.Communications.Local"/>
|
<Reference name="OpenSim.Region.Communications.Local"/>
|
||||||
<Reference name="OpenSim.Tests.Common"/>
|
<Reference name="OpenSim.Tests.Common"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue