Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-07-14 19:53:15 +01:00
commit 0b74662ce2
7 changed files with 147 additions and 23 deletions

View File

@ -781,7 +781,7 @@ namespace OpenSim.Data.Tests
// Ownership changes when you drop an object into an object
// owned by someone else
Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))");
Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 16), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
// Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 16), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))");
Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))");
}

View File

@ -182,7 +182,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
if (part.Inventory.UpdateInventoryItem(item))
{
remoteClient.SendAgentAlertMessage("Notecard saved", false);
if ((InventoryType)item.InvType == InventoryType.Notecard)
remoteClient.SendAgentAlertMessage("Notecard saved", false);
else if ((InventoryType)item.InvType == InventoryType.LSL)
remoteClient.SendAgentAlertMessage("Script saved", false);
else
remoteClient.SendAgentAlertMessage("Item saved", false);
part.GetProperties(remoteClient);
}
}

View File

@ -206,11 +206,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (components.Length == 1)
{
// m_log.DebugFormat("FOUND SINGLE COMPONENT [{0}]", components[0]);
// m_log.DebugFormat(
// "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}",
// components[0], startFolder.Name, startFolder.ID);
List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID);
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count);
foreach (InventoryItemBase item in items)
{
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID);
if (item.Name == components[0])
return item;
}

View File

@ -63,13 +63,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
}
/// <summary>
/// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
/// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
/// (subject to change since there is no fixed format yet).
/// </summary>
// Commenting for now! The mock inventory service needs more beef, at least for
// GetFolderForType
// REFACTORING PROBLEM. This needs to be rewritten.
[Test]
public void TestSaveIarV0_1()
public void TestSavePathToIarV0_1()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
@ -174,6 +172,123 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
}
}
// Assert.That(gotControlFile, Is.True, "No control file in archive");
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
// TODO: Test presence of more files and contents of files.
}
/// <summary>
/// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
/// (subject to change since there is no fixed format yet).
/// </summary>
[Test]
public void TestSaveItemToIarV0_1()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
// Create asset
SceneObjectGroup object1;
SceneObjectPart part1;
{
string partName = "My Little Dog Object";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
Vector3 offsetPosition = new Vector3(5, 10, 15);
part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
scene.AddNewSceneObject(object1, false);
}
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
scene.AssetService.Store(asset1);
// Create item
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
string item1Name = "My Little Dog";
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = item1Name;
item1.AssetID = asset1.FullID;
item1.ID = item1Id;
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(userId, item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
mre.Reset();
archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
mre.WaitOne(60000, false);
byte[] archive = archiveWriteStream.ToArray();
MemoryStream archiveReadStream = new MemoryStream(archive);
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
//bool gotControlFile = false;
bool gotObject1File = false;
//bool gotObject2File = false;
string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
string expectedObject1FilePath = string.Format(
"{0}{1}",
ArchiveConstants.INVENTORY_PATH,
expectedObject1FileName);
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
// Console.WriteLine("Reading archive");
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
{
Console.WriteLine("Got {0}", filePath);
// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
// {
// gotControlFile = true;
// }
if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
{
// string fileName = filePath.Remove(0, "Objects/".Length);
//
// if (fileName.StartsWith(part1.Name))
// {
Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
gotObject1File = true;
// }
// else if (fileName.StartsWith(part2.Name))
// {
// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
// gotObject2File = true;
// }
}
}
// Assert.That(gotControlFile, Is.True, "No control file in archive");
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");

View File

@ -1362,7 +1362,13 @@ namespace OpenSim.Region.Framework.Scenes
}
if (part.Inventory.UpdateInventoryItem(itemInfo))
{
// remoteClient.SendAgentAlertMessage("Notecard saved", false);
if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
remoteClient.SendAgentAlertMessage("Notecard saved", false);
else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
remoteClient.SendAgentAlertMessage("Script saved", false);
else
remoteClient.SendAgentAlertMessage("Item saved", false);
part.GetProperties(remoteClient);
}
}

View File

@ -259,13 +259,15 @@ namespace OpenSim.Services.InventoryService
public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
{
// m_log.DebugFormat("[XINVENTORY]: Fetch items for folder {0}", folderID);
// Since we probably don't get a valid principal here, either ...
//
List<InventoryItemBase> invItems = new List<InventoryItemBase>();
XInventoryItem[] items = m_Database.GetItems(
new string[] { "parentFolderID"},
new string[] { UUID.Zero.ToString() });
new string[] { "parentFolderID" },
new string[] { folderID.ToString() });
foreach (XInventoryItem i in items)
invItems.Add(ConvertToOpenSim(i));

View File

@ -288,9 +288,6 @@
; if not defined - default machine name is being used
; (on Windows this mean NETBIOS name - useably only inside local network)
; ExternalHostNameForLSL=127.0.0.1
; Uncomment below to enable llRemoteData/remote channels
; remoteDataPort = 20800
; What is reported as the "X-Secondlife-Shard"
; Defaults to the user server url if not set
@ -1319,12 +1316,3 @@ UseSafetyCommit = true
;XmlRpcRouterModule = "XmlRpcRouterModule"
;XmlRpcPort = 20800
[Friends]
; The port the friendslist interregion comms will listen on
; Defaults to the simulator's TCP port
;Port = 0
; Uncomment one of the lines below. Use FriendsService for local
; operation, Connectors for remote operation
;Connector = "OpenSim.Services.FriendsService.dll"
Connector = "OpenSim.Services.Connectors.dll"