Temporarily re-enable save iar test by manually insert the item into the old cache during the test

remotes/origin/0.6.7-post-fixes
Justin Clark-Casey (justincc) 2009-09-06 19:30:03 +01:00
parent 7ca61e0174
commit 304c78bbbb
3 changed files with 24 additions and 6 deletions

View File

@ -207,6 +207,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
InventoryFolderImpl inventoryFolder = null; InventoryFolderImpl inventoryFolder = null;
InventoryItemBase inventoryItem = null; InventoryItemBase inventoryItem = null;
// XXX: Very temporarily, drop and refetch inventory to make sure we have any newly created items in cache
// This will disappear very soon once we stop using the old cached inventory.
/*
m_userInfo.DropInventory();
m_userInfo.FetchInventory();
*/
if (!m_userInfo.HasReceivedInventory) if (!m_userInfo.HasReceivedInventory)
{ {
// If the region server has access to the user admin service (by which users are created), // If the region server has access to the user admin service (by which users are created),

View File

@ -77,7 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
/// </summary> /// </summary>
// Commenting for now! The mock inventory service needs more beef, at least for // Commenting for now! The mock inventory service needs more beef, at least for
// GetFolderForType // GetFolderForType
//[Test] [Test]
public void TestSaveIarV0_1() public void TestSaveIarV0_1()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
@ -93,11 +93,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userFirstName = "Jock"; string userFirstName = "Jock";
string userLastName = "Stirrup"; string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
// CachedUserInfo userInfo; CachedUserInfo userInfo;
lock (this) lock (this)
{ {
UserProfileTestUtils.CreateUserWithInventory( userInfo = UserProfileTestUtils.CreateUserWithInventory(
cm, userFirstName, userLastName, userId, InventoryReceived); cm, userFirstName, userLastName, userId, InventoryReceived);
Monitor.Wait(this, 60000); Monitor.Wait(this, 60000);
} }
@ -136,18 +136,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
item1.Name = "My Little Dog"; item1.Name = "My Little Dog";
item1.AssetID = asset1.FullID; item1.AssetID = asset1.FullID;
item1.ID = item1Id; item1.ID = item1Id;
//userInfo.RootFolder.FindFolderByPath("Objects").ID; InventoryFolderImpl objsFolder = userInfo.RootFolder.FindFolderByPath("Objects");
//InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); //InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
Console.WriteLine("here2"); Console.WriteLine("here2");
/*
IInventoryService inventoryService = scene.InventoryService; IInventoryService inventoryService = scene.InventoryService;
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
InventoryCollection rootContents = inventoryService.GetFolderContent(userId, rootFolder.ID); InventoryCollection rootContents = inventoryService.GetFolderContent(userId, rootFolder.ID);
*/
/*
InventoryFolderBase objsFolder = null; InventoryFolderBase objsFolder = null;
foreach (InventoryFolderBase folder in rootContents.Folders) foreach (InventoryFolderBase folder in rootContents.Folders)
if (folder.Name == "Objects") if (folder.Name == "Objects")
objsFolder = folder; objsFolder = folder;
*/
item1.Folder = objsFolder.ID; item1.Folder = objsFolder.ID;
scene.AddInventoryItem(userId, item1); scene.AddInventoryItem(userId, item1);
userInfo.AddItem(item1);
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted; archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@ -155,7 +160,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
mre.Reset(); mre.Reset();
archiverModule.ArchiveInventory( archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream); Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream);
mre.WaitOne(); mre.WaitOne(60000, false);
byte[] archive = archiveWriteStream.ToArray(); byte[] archive = archiveWriteStream.ToArray();
MemoryStream archiveReadStream = new MemoryStream(archive); MemoryStream archiveReadStream = new MemoryStream(archive);

View File

@ -154,7 +154,13 @@ namespace OpenSim.Tests.Common.Mock
m_folders.Remove(folderId); m_folders.Remove(folderId);
} }
public void addInventoryItem(InventoryItemBase item) { m_items[item.ID] = item; } public void addInventoryItem(InventoryItemBase item)
{
m_log.DebugFormat(
"[MOCK INV DB]: Adding inventory item {0} {1} in {2}", item.Name, item.ID, item.Folder);
m_items[item.ID] = item;
}
public void updateInventoryItem(InventoryItemBase item) { addInventoryItem(item); } public void updateInventoryItem(InventoryItemBase item) { addInventoryItem(item); }