Add method to get all items with the same name from a particular prim
Extend load oar test to check loading of a sound itemmysql-performance
parent
536a6bac72
commit
ae2174d8f5
|
@ -237,6 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
SceneObjectGroup object1 = new SceneObjectGroup(part1);
|
SceneObjectGroup object1 = new SceneObjectGroup(part1);
|
||||||
|
|
||||||
// Let's put some inventory items into our object
|
// Let's put some inventory items into our object
|
||||||
|
string soundItemName = "sound-item1";
|
||||||
UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
|
UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
|
||||||
Type type = GetType();
|
Type type = GetType();
|
||||||
Assembly assembly = type.Assembly;
|
Assembly assembly = type.Assembly;
|
||||||
|
@ -269,7 +270,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
|
asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TaskInventoryItem item1 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid };
|
TaskInventoryItem item1
|
||||||
|
= new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName };
|
||||||
part1.Inventory.AddInventoryItem(item1, true);
|
part1.Inventory.AddInventoryItem(item1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,14 +307,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
Assert.That(
|
Assert.That(
|
||||||
object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal");
|
object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal");
|
||||||
|
|
||||||
// Need to implement a method to get the task inventory item by name (since the uuid will have changed on load)
|
TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
|
||||||
/*
|
|
||||||
TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItem(soundItemUuid);
|
|
||||||
Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
|
Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
|
||||||
AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
|
AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
|
||||||
Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
|
Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
|
||||||
Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
|
Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
|
||||||
*/
|
|
||||||
|
|
||||||
// Temporary
|
// Temporary
|
||||||
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
|
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
|
||||||
|
|
|
@ -71,7 +71,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start all the scripts contained in this entity's inventory
|
/// Start all the scripts contained in this entity's inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
|
void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
|
||||||
|
|
||||||
ArrayList GetScriptErrors(UUID itemID);
|
ArrayList GetScriptErrors(UUID itemID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -142,6 +143,16 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <returns>null if the item does not exist</returns>
|
/// <returns>null if the item does not exist</returns>
|
||||||
TaskInventoryItem GetInventoryItem(UUID itemId);
|
TaskInventoryItem GetInventoryItem(UUID itemId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get inventory items by name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns>
|
||||||
|
/// A list of inventory items with that name.
|
||||||
|
/// If no inventory item has that name then an empty list is returned.
|
||||||
|
/// </returns>
|
||||||
|
IList<TaskInventoryItem> GetInventoryItems(string name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an existing inventory item.
|
/// Update an existing inventory item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -556,6 +556,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get inventory items by name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns>
|
||||||
|
/// A list of inventory items with that name.
|
||||||
|
/// If no inventory item has that name then an empty list is returned.
|
||||||
|
/// </returns>
|
||||||
|
public IList<TaskInventoryItem> GetInventoryItems(string name)
|
||||||
|
{
|
||||||
|
IList<TaskInventoryItem> items = new List<TaskInventoryItem>();
|
||||||
|
|
||||||
|
lock (m_items)
|
||||||
|
{
|
||||||
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
|
{
|
||||||
|
if (item.Name == name)
|
||||||
|
items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an existing inventory item.
|
/// Update an existing inventory item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue