* extend inventory archive save test to check for the presence of the item file in the saved archive
parent
d347b59ca4
commit
d205cb5260
|
@ -30,12 +30,14 @@ using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NUnit.Framework.SyntaxHelpers;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
||||||
|
using OpenSim.Region.CoreModules.World.Archiver;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Tests.Common.Setup;
|
using OpenSim.Tests.Common.Setup;
|
||||||
|
|
||||||
|
@ -101,9 +103,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
cm.AssetCache.AddAsset(asset1);
|
cm.AssetCache.AddAsset(asset1);
|
||||||
|
|
||||||
// Create item
|
// Create item
|
||||||
|
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
||||||
InventoryItemBase item1 = new InventoryItemBase();
|
InventoryItemBase item1 = new InventoryItemBase();
|
||||||
item1.Name = "My Little Dog";
|
item1.Name = "My Little Dog";
|
||||||
item1.AssetID = asset1.FullID;
|
item1.AssetID = asset1.FullID;
|
||||||
|
item1.ID = item1Id;
|
||||||
item1.Folder = userInfo.RootFolder.FindFolderByPath("Objects").ID;
|
item1.Folder = userInfo.RootFolder.FindFolderByPath("Objects").ID;
|
||||||
scene.AddInventoryItem(userId, item1);
|
scene.AddInventoryItem(userId, item1);
|
||||||
|
|
||||||
|
@ -118,57 +122,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
Monitor.Wait(this, 60000);
|
Monitor.Wait(this, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
byte[] archive = archiveWriteStream.ToArray();
|
byte[] archive = archiveWriteStream.ToArray();
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||||
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
||||||
|
|
||||||
bool gotControlFile = false;
|
//bool gotControlFile = false;
|
||||||
bool gotObject1File = false;
|
bool gotObject1File = false;
|
||||||
bool gotObject2File = false;
|
//bool gotObject2File = false;
|
||||||
string expectedObject1FileName = string.Format(
|
string expectedObject1FilePath = string.Format(
|
||||||
"{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
|
"{0}{1}_{2}.xml",
|
||||||
part1.Name,
|
"Objects/",
|
||||||
Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z),
|
item1.Name,
|
||||||
part1.UUID);
|
item1Id);
|
||||||
|
/*
|
||||||
string expectedObject2FileName = string.Format(
|
string expectedObject2FileName = string.Format(
|
||||||
"{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
|
"{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
|
||||||
part2.Name,
|
part2.Name,
|
||||||
Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z),
|
Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z),
|
||||||
part2.UUID);
|
part2.UUID);
|
||||||
|
*/
|
||||||
|
|
||||||
string filePath;
|
string filePath;
|
||||||
TarArchiveReader.TarEntryType tarEntryType;
|
TarArchiveReader.TarEntryType tarEntryType;
|
||||||
|
|
||||||
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
|
if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
|
||||||
{
|
{
|
||||||
gotControlFile = true;
|
gotControlFile = true;
|
||||||
}
|
}
|
||||||
else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
|
*/
|
||||||
|
if (filePath.StartsWith("Objects/") && filePath.EndsWith(".xml"))
|
||||||
{
|
{
|
||||||
string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length);
|
//string fileName = filePath.Remove(0, "Objects/".Length);
|
||||||
|
|
||||||
if (fileName.StartsWith(part1.Name))
|
//if (fileName.StartsWith(part1.Name))
|
||||||
{
|
//{
|
||||||
Assert.That(fileName, Is.EqualTo(expectedObject1FileName));
|
Assert.That(filePath, Is.EqualTo(expectedObject1FilePath));
|
||||||
gotObject1File = true;
|
gotObject1File = true;
|
||||||
}
|
//}
|
||||||
else if (fileName.StartsWith(part2.Name))
|
//else if (fileName.StartsWith(part2.Name))
|
||||||
{
|
//{
|
||||||
Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
|
// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
|
||||||
gotObject2File = true;
|
// gotObject2File = true;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.That(gotControlFile, Is.True, "No control file in archive");
|
//Assert.That(gotControlFile, Is.True, "No control file in archive");
|
||||||
Assert.That(gotObject1File, Is.True, "No object1 file in archive");
|
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
|
||||||
Assert.That(gotObject2File, Is.True, "No object2 file in archive");
|
//Assert.That(gotObject2File, Is.True, "No object2 file in archive");
|
||||||
|
|
||||||
// TODO: Test presence of more files and contents of files.
|
// TODO: Test presence of more files and contents of files.
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue