* test: Add a wodge of code in order to be able to slightly extend a test to deliver a taken object to a user inventory folder without throwing an exception

* test doesn't actually double check for the presence of the item yet
0.6.1-post-fixes
Justin Clarke Casey 2008-11-28 19:39:46 +00:00
parent abfb7bd2cf
commit 71e05a5707
10 changed files with 145 additions and 55 deletions

View File

@ -214,7 +214,6 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="inventoryCollection"></param> /// <param name="inventoryCollection"></param>
public void InventoryReceive(ICollection<InventoryFolderImpl> folders, ICollection<InventoryItemBase> items) public void InventoryReceive(ICollection<InventoryFolderImpl> folders, ICollection<InventoryItemBase> items)
{ {
// FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these
// are simply being swallowed // are simply being swallowed

View File

@ -41,8 +41,7 @@ namespace OpenSim.Framework
void Initialise(string connect); void Initialise(string connect);
/// <summary> /// <summary>
/// Returns all child folders in the hierarchy from the parent folder and down. /// Returns all descendent folders of this folder. Does not return the parent folder itself.
/// Does not return the parent folder itself.
/// </summary> /// </summary>
/// <param name="parentID">The folder to get subfolders for</param> /// <param name="parentID">The folder to get subfolders for</param>
/// <returns>A list of inventory folders</returns> /// <returns>A list of inventory folders</returns>

View File

@ -1074,7 +1074,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary> /// <summary>
/// Loads the World heightmap /// Loads the World heightmap
/// </summary> /// </summary>
///
public override void LoadWorldMap() public override void LoadWorldMap()
{ {
try try
@ -1095,7 +1094,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[terrain]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString()); m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString());
} }
} }
@ -2269,6 +2268,7 @@ namespace OpenSim.Region.Environment.Scenes
CreateAndAddScenePresence(client, child); CreateAndAddScenePresence(client, child);
} }
m_LastLogin = System.Environment.TickCount; m_LastLogin = System.Environment.TickCount;
EventManager.TriggerOnNewClient(client); EventManager.TriggerOnNewClient(client);
} }

View File

@ -44,20 +44,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
/// </summary> /// </summary>
[TestFixture] [TestFixture]
public class EntityListTests public class EntityListTests
{ {
[SetUp]
public void Init()
{
try
{
log4net.Config.XmlConfigurator.Configure();
}
catch
{
// I don't care, just leave log4net off
}
}
static public Random random; static public Random random;
SceneObjectGroup found; SceneObjectGroup found;
Scene scene = SceneTestUtils.SetupScene(); Scene scene = SceneTestUtils.SetupScene();

View File

@ -45,15 +45,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
{ {
[SetUp] [SetUp]
public void Init() public void Init()
{ {
try
{
log4net.Config.XmlConfigurator.Configure();
}
catch
{
// I don't care, just leave log4net off
}
} }
/// <summary> /// <summary>
@ -118,6 +110,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests
[Test] [Test]
public void TestDeleteSceneObjectAsyncToUserInventory() public void TestDeleteSceneObjectAsyncToUserInventory()
{ {
log4net.Config.XmlConfigurator.Configure();
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
TestScene scene = SceneTestUtils.SetupScene(); TestScene scene = SceneTestUtils.SetupScene();
@ -132,12 +126,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests
Is.EqualTo(agentId)); Is.EqualTo(agentId));
IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.TakeCopy, client);
CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);
Assert.That(userInfo, Is.Not.Null); Assert.That(userInfo, Is.Not.Null);
Assert.That(userInfo.RootFolder, Is.Not.Null);
SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.TakeCopy, userInfo.RootFolder.ID, client);
// TODO: test that the object actually made it successfully into inventory // TODO: test that the object actually made it successfully into inventory
log4net.LogManager.Shutdown();
} }
} }
} }

View File

@ -38,20 +38,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
/// </summary> /// </summary>
[TestFixture] [TestFixture]
public class ScenePresenceTests public class ScenePresenceTests
{ {
[SetUp]
public void Init()
{
try
{
log4net.Config.XmlConfigurator.Configure();
}
catch
{
// I don't care, just leave log4net off
}
}
/// <summary> /// <summary>
/// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
/// </summary> /// </summary>

View File

@ -29,6 +29,7 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
@ -52,15 +53,20 @@ namespace OpenSim.Region.Environment.Scenes.Tests
AgentCircuitManager acm = new AgentCircuitManager(); AgentCircuitManager acm = new AgentCircuitManager();
CommunicationsManager cm = new TestCommunicationsManager(); CommunicationsManager cm = new TestCommunicationsManager();
SceneCommunicationService scs = new SceneCommunicationService(cm); SceneCommunicationService scs = new SceneCommunicationService(cm);
SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin());
AssetCache ac = new AssetCache(assetService);
StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", ""); StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", "");
BaseHttpServer httpServer = new BaseHttpServer(666); BaseHttpServer httpServer = new BaseHttpServer(666);
IConfigSource configSource = new IniConfigSource(); IConfigSource configSource = new IniConfigSource();
TestScene testScene = new TestScene( TestScene testScene = new TestScene(
regInfo, acm, cm, scs, null, sm, httpServer, null, false, false, false, configSource, null); regInfo, acm, cm, scs, ac, sm, httpServer, null, false, false, false, configSource, null);
testScene.LandChannel = new TestLandChannel(); testScene.LandChannel = new TestLandChannel();
testScene.LoadWorldMap();
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
@ -93,7 +99,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests
scene.NewUserConnection(agent); scene.NewUserConnection(agent);
IClientAPI client = new TestClient(agent); IClientAPI client = new TestClient(agent);
scene.AddNewClient(client, false); scene.AddNewClient(client, true);
scene.AgentCrossing(agent.AgentID, new Vector3(90, 90, 90), false);
return client; return client;
} }
@ -123,15 +130,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests
/// <param name="scene"></param> /// <param name="scene"></param>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="action"></param> /// <param name="action"></param>
/// <param name="destinationId"></param>
/// <param name="client"></param> /// <param name="client"></param>
public static void DeleteSceneObjectAsync( public static void DeleteSceneObjectAsync(
TestScene scene, SceneObjectPart part, DeRezAction action, IClientAPI client) TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client)
{ {
// Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false; sogd.Enabled = false;
scene.DeRezObject(client, part.LocalId, UUID.Zero, action, UUID.Zero); scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId);
sogd.InventoryDeQueueAndDelete(); sogd.InventoryDeQueueAndDelete();
} }
} }

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
namespace OpenSim.Region.Environment.Scenes.Tests
{
/// <summary>
/// In memory asset data plugin for test purposes. Could be another dll when properly filled out and when the
/// mono addin plugin system starts co-operating with the unit test system. Currently no locking since unit
/// tests are single threaded.
/// </summary>
public class TestAssetDataPlugin : IAssetProviderPlugin
{
public string Version { get { return "0"; } }
public string Name { get { return "TestAssetDataPlugin"; } }
public void Initialise() {}
public void Dispose() {}
public AssetBase FetchAsset(UUID uuid) { return null; }
public void CreateAsset(AssetBase asset) {}
public void UpdateAsset(AssetBase asset) {}
public bool ExistsAsset(UUID uuid) { return false; }
public void Initialise(string connect) {}
}
}

View File

@ -32,8 +32,23 @@ using OpenSim.Framework;
namespace OpenSim.Region.Environment.Scenes.Tests namespace OpenSim.Region.Environment.Scenes.Tests
{ {
/// <summary>
/// In memory inventory data plugin for test purposes. Could be another dll when properly filled out and when the
/// mono addin plugin system starts co-operating with the unit test system. Currently no locking since unit
/// tests are single threaded.
/// </summary>
public class TestInventoryDataPlugin : IInventoryDataPlugin public class TestInventoryDataPlugin : IInventoryDataPlugin
{ {
/// <value>
/// Known inventory folders
/// </value>
private Dictionary<UUID, InventoryFolderBase> m_folders = new Dictionary<UUID, InventoryFolderBase>();
/// <value>
/// User root folders
/// </value>
private Dictionary<UUID, InventoryFolderBase> m_rootFolders = new Dictionary<UUID, InventoryFolderBase>();
public string Version { get { return "0"; } } public string Version { get { return "0"; } }
public string Name { get { return "TestInventoryDataPlugin"; } } public string Name { get { return "TestInventoryDataPlugin"; } }
@ -41,17 +56,60 @@ namespace OpenSim.Region.Environment.Scenes.Tests
public void Initialise(string connect) {} public void Initialise(string connect) {}
public void Dispose() {} public void Dispose() {}
public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return null; } public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
public List<InventoryItemBase> getInventoryInFolder(UUID folderID) { return null; } {
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
foreach (InventoryFolderBase folder in m_folders.Values)
{
if (folder.ParentID == parentID)
{
folders.AddRange(getFolderHierarchy(folder.ID));
folders.Add(folder);
}
}
return folders;
}
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
{
return new List<InventoryItemBase>();
}
public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; } public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; }
public InventoryFolderBase getUserRootFolder(UUID user) { return null; }
public InventoryFolderBase getUserRootFolder(UUID user)
{
InventoryFolderBase folder = null;
m_rootFolders.TryGetValue(user, out folder);
return folder;
}
public List<InventoryFolderBase> getInventoryFolders(UUID parentID) { return null; } public List<InventoryFolderBase> getInventoryFolders(UUID parentID) { return null; }
public InventoryItemBase getInventoryItem(UUID item) { return null; } public InventoryItemBase getInventoryItem(UUID item) { return null; }
public InventoryFolderBase getInventoryFolder(UUID folder) { return null; }
public InventoryFolderBase getInventoryFolder(UUID folderId)
{
InventoryFolderBase folder = null;
m_folders.TryGetValue(folderId, out folder);
return folder;
}
public void addInventoryItem(InventoryItemBase item) {} public void addInventoryItem(InventoryItemBase item) {}
public void updateInventoryItem(InventoryItemBase item) {} public void updateInventoryItem(InventoryItemBase item) {}
public void deleteInventoryItem(UUID item) {} public void deleteInventoryItem(UUID item) {}
public void addInventoryFolder(InventoryFolderBase folder) {}
public void addInventoryFolder(InventoryFolderBase folder)
{
m_folders[folder.ID] = folder;
if (folder.ParentID == UUID.Zero)
m_rootFolders[folder.Owner] = folder;
}
public void updateInventoryFolder(InventoryFolderBase folder) {} public void updateInventoryFolder(InventoryFolderBase folder) {}
public void moveInventoryFolder(InventoryFolderBase folder) {} public void moveInventoryFolder(InventoryFolderBase folder) {}
public void deleteInventoryFolder(UUID folder) {} public void deleteInventoryFolder(UUID folder) {}

View File

@ -34,7 +34,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests
{ {
/// <summary> /// <summary>
/// In memory user data provider. Might be quite useful as a proper user data plugin, though getting mono addins /// In memory user data provider. Might be quite useful as a proper user data plugin, though getting mono addins
/// to load any plugins when running unit tests has proven impossible so far /// to load any plugins when running unit tests has proven impossible so far. Currently no locking since unit
/// tests are single threaded.
/// </summary> /// </summary>
public class TestUserDataPlugin : IUserDataPlugin public class TestUserDataPlugin : IUserDataPlugin
{ {