diff options
author | Justin Clarke Casey | 2008-11-28 19:39:46 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-28 19:39:46 +0000 |
commit | 71e05a5707f1eaed098592dc1c3feb3389731634 (patch) | |
tree | 40ec2c07c2dbca6ff32a27c3e216ece22746f30d /OpenSim/Region/Environment/Scenes/Tests | |
parent | * test: Separate out async deletion methods to test delete and take copy sepa... (diff) | |
download | opensim-SC_OLD-71e05a5707f1eaed098592dc1c3feb3389731634.zip opensim-SC_OLD-71e05a5707f1eaed098592dc1c3feb3389731634.tar.gz opensim-SC_OLD-71e05a5707f1eaed098592dc1c3feb3389731634.tar.bz2 opensim-SC_OLD-71e05a5707f1eaed098592dc1c3feb3389731634.tar.xz |
* 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
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Tests')
7 files changed, 142 insertions, 50 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Tests/EntityListTests.cs b/OpenSim/Region/Environment/Scenes/Tests/EntityListTests.cs index 7628a88..c8f86f3 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/EntityListTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/EntityListTests.cs | |||
@@ -44,20 +44,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
44 | /// </summary> | 44 | /// </summary> |
45 | [TestFixture] | 45 | [TestFixture] |
46 | public class EntityListTests | 46 | public class EntityListTests |
47 | { | 47 | { |
48 | [SetUp] | ||
49 | public void Init() | ||
50 | { | ||
51 | try | ||
52 | { | ||
53 | log4net.Config.XmlConfigurator.Configure(); | ||
54 | } | ||
55 | catch | ||
56 | { | ||
57 | // I don't care, just leave log4net off | ||
58 | } | ||
59 | } | ||
60 | |||
61 | static public Random random; | 48 | static public Random random; |
62 | SceneObjectGroup found; | 49 | SceneObjectGroup found; |
63 | Scene scene = SceneTestUtils.SetupScene(); | 50 | Scene scene = SceneTestUtils.SetupScene(); |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index a6e4d4e..500512e 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs | |||
@@ -45,15 +45,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
45 | { | 45 | { |
46 | [SetUp] | 46 | [SetUp] |
47 | public void Init() | 47 | public void Init() |
48 | { | 48 | { |
49 | try | ||
50 | { | ||
51 | log4net.Config.XmlConfigurator.Configure(); | ||
52 | } | ||
53 | catch | ||
54 | { | ||
55 | // I don't care, just leave log4net off | ||
56 | } | ||
57 | } | 49 | } |
58 | 50 | ||
59 | /// <summary> | 51 | /// <summary> |
@@ -118,6 +110,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
118 | [Test] | 110 | [Test] |
119 | public void TestDeleteSceneObjectAsyncToUserInventory() | 111 | public void TestDeleteSceneObjectAsyncToUserInventory() |
120 | { | 112 | { |
113 | log4net.Config.XmlConfigurator.Configure(); | ||
114 | |||
121 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 115 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
122 | 116 | ||
123 | TestScene scene = SceneTestUtils.SetupScene(); | 117 | TestScene scene = SceneTestUtils.SetupScene(); |
@@ -132,12 +126,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
132 | Is.EqualTo(agentId)); | 126 | Is.EqualTo(agentId)); |
133 | 127 | ||
134 | IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); | 128 | IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); |
135 | SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.TakeCopy, client); | 129 | |
136 | |||
137 | CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); | 130 | CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); |
138 | Assert.That(userInfo, Is.Not.Null); | 131 | Assert.That(userInfo, Is.Not.Null); |
132 | Assert.That(userInfo.RootFolder, Is.Not.Null); | ||
133 | |||
134 | SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.TakeCopy, userInfo.RootFolder.ID, client); | ||
139 | 135 | ||
140 | // TODO: test that the object actually made it successfully into inventory | 136 | // TODO: test that the object actually made it successfully into inventory |
137 | |||
138 | log4net.LogManager.Shutdown(); | ||
141 | } | 139 | } |
142 | } | 140 | } |
143 | } \ No newline at end of file | 141 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs index 587d288..a16c26a 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -38,20 +38,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
38 | /// </summary> | 38 | /// </summary> |
39 | [TestFixture] | 39 | [TestFixture] |
40 | public class ScenePresenceTests | 40 | public class ScenePresenceTests |
41 | { | 41 | { |
42 | [SetUp] | ||
43 | public void Init() | ||
44 | { | ||
45 | try | ||
46 | { | ||
47 | log4net.Config.XmlConfigurator.Configure(); | ||
48 | } | ||
49 | catch | ||
50 | { | ||
51 | // I don't care, just leave log4net off | ||
52 | } | ||
53 | } | ||
54 | |||
55 | /// <summary> | 42 | /// <summary> |
56 | /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. | 43 | /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. |
57 | /// </summary> | 44 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index 51be872..468a4ad 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs | |||
@@ -29,6 +29,7 @@ using Nini.Config; | |||
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Communications; | 31 | using OpenSim.Framework.Communications; |
32 | using OpenSim.Framework.Communications.Cache; | ||
32 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
33 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Region.Physics.Manager; |
34 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
@@ -52,15 +53,20 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
52 | 53 | ||
53 | AgentCircuitManager acm = new AgentCircuitManager(); | 54 | AgentCircuitManager acm = new AgentCircuitManager(); |
54 | CommunicationsManager cm = new TestCommunicationsManager(); | 55 | CommunicationsManager cm = new TestCommunicationsManager(); |
55 | SceneCommunicationService scs = new SceneCommunicationService(cm); | 56 | SceneCommunicationService scs = new SceneCommunicationService(cm); |
57 | |||
58 | SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); | ||
59 | AssetCache ac = new AssetCache(assetService); | ||
60 | |||
56 | StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", ""); | 61 | StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", ""); |
57 | BaseHttpServer httpServer = new BaseHttpServer(666); | 62 | BaseHttpServer httpServer = new BaseHttpServer(666); |
58 | IConfigSource configSource = new IniConfigSource(); | 63 | IConfigSource configSource = new IniConfigSource(); |
59 | 64 | ||
60 | TestScene testScene = new TestScene( | 65 | TestScene testScene = new TestScene( |
61 | regInfo, acm, cm, scs, null, sm, httpServer, null, false, false, false, configSource, null); | 66 | regInfo, acm, cm, scs, ac, sm, httpServer, null, false, false, false, configSource, null); |
62 | 67 | ||
63 | testScene.LandChannel = new TestLandChannel(); | 68 | testScene.LandChannel = new TestLandChannel(); |
69 | testScene.LoadWorldMap(); | ||
64 | 70 | ||
65 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | 71 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); |
66 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | 72 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); |
@@ -93,7 +99,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
93 | 99 | ||
94 | scene.NewUserConnection(agent); | 100 | scene.NewUserConnection(agent); |
95 | IClientAPI client = new TestClient(agent); | 101 | IClientAPI client = new TestClient(agent); |
96 | scene.AddNewClient(client, false); | 102 | scene.AddNewClient(client, true); |
103 | scene.AgentCrossing(agent.AgentID, new Vector3(90, 90, 90), false); | ||
97 | 104 | ||
98 | return client; | 105 | return client; |
99 | } | 106 | } |
@@ -123,15 +130,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
123 | /// <param name="scene"></param> | 130 | /// <param name="scene"></param> |
124 | /// <param name="part"></param> | 131 | /// <param name="part"></param> |
125 | /// <param name="action"></param> | 132 | /// <param name="action"></param> |
133 | /// <param name="destinationId"></param> | ||
126 | /// <param name="client"></param> | 134 | /// <param name="client"></param> |
127 | public static void DeleteSceneObjectAsync( | 135 | public static void DeleteSceneObjectAsync( |
128 | TestScene scene, SceneObjectPart part, DeRezAction action, IClientAPI client) | 136 | TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client) |
129 | { | 137 | { |
130 | // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test | 138 | // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test |
131 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 139 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
132 | sogd.Enabled = false; | 140 | sogd.Enabled = false; |
133 | 141 | ||
134 | scene.DeRezObject(client, part.LocalId, UUID.Zero, action, UUID.Zero); | 142 | scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId); |
135 | sogd.InventoryDeQueueAndDelete(); | 143 | sogd.InventoryDeQueueAndDelete(); |
136 | } | 144 | } |
137 | } | 145 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/TestAssetDataPlugin.cs b/OpenSim/Region/Environment/Scenes/Tests/TestAssetDataPlugin.cs new file mode 100644 index 0000000..9aeb5fa --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Tests/TestAssetDataPlugin.cs | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenSim.Framework.Communications; | ||
31 | |||
32 | namespace OpenSim.Region.Environment.Scenes.Tests | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// In memory asset data plugin for test purposes. Could be another dll when properly filled out and when the | ||
36 | /// mono addin plugin system starts co-operating with the unit test system. Currently no locking since unit | ||
37 | /// tests are single threaded. | ||
38 | /// </summary> | ||
39 | public class TestAssetDataPlugin : IAssetProviderPlugin | ||
40 | { | ||
41 | public string Version { get { return "0"; } } | ||
42 | public string Name { get { return "TestAssetDataPlugin"; } } | ||
43 | |||
44 | public void Initialise() {} | ||
45 | public void Dispose() {} | ||
46 | |||
47 | public AssetBase FetchAsset(UUID uuid) { return null; } | ||
48 | public void CreateAsset(AssetBase asset) {} | ||
49 | public void UpdateAsset(AssetBase asset) {} | ||
50 | public bool ExistsAsset(UUID uuid) { return false; } | ||
51 | public void Initialise(string connect) {} | ||
52 | } | ||
53 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Tests/TestInventoryDataPlugin.cs b/OpenSim/Region/Environment/Scenes/Tests/TestInventoryDataPlugin.cs index 2d4edd6..45fc36e 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/TestInventoryDataPlugin.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/TestInventoryDataPlugin.cs | |||
@@ -32,8 +32,23 @@ using OpenSim.Framework; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Scenes.Tests | 33 | namespace OpenSim.Region.Environment.Scenes.Tests |
34 | { | 34 | { |
35 | /// <summary> | ||
36 | /// In memory inventory data plugin for test purposes. Could be another dll when properly filled out and when the | ||
37 | /// mono addin plugin system starts co-operating with the unit test system. Currently no locking since unit | ||
38 | /// tests are single threaded. | ||
39 | /// </summary> | ||
35 | public class TestInventoryDataPlugin : IInventoryDataPlugin | 40 | public class TestInventoryDataPlugin : IInventoryDataPlugin |
36 | { | 41 | { |
42 | /// <value> | ||
43 | /// Known inventory folders | ||
44 | /// </value> | ||
45 | private Dictionary<UUID, InventoryFolderBase> m_folders = new Dictionary<UUID, InventoryFolderBase>(); | ||
46 | |||
47 | /// <value> | ||
48 | /// User root folders | ||
49 | /// </value> | ||
50 | private Dictionary<UUID, InventoryFolderBase> m_rootFolders = new Dictionary<UUID, InventoryFolderBase>(); | ||
51 | |||
37 | public string Version { get { return "0"; } } | 52 | public string Version { get { return "0"; } } |
38 | public string Name { get { return "TestInventoryDataPlugin"; } } | 53 | public string Name { get { return "TestInventoryDataPlugin"; } } |
39 | 54 | ||
@@ -41,17 +56,60 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
41 | public void Initialise(string connect) {} | 56 | public void Initialise(string connect) {} |
42 | public void Dispose() {} | 57 | public void Dispose() {} |
43 | 58 | ||
44 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return null; } | 59 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) |
45 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) { return null; } | 60 | { |
61 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
62 | |||
63 | foreach (InventoryFolderBase folder in m_folders.Values) | ||
64 | { | ||
65 | if (folder.ParentID == parentID) | ||
66 | { | ||
67 | folders.AddRange(getFolderHierarchy(folder.ID)); | ||
68 | folders.Add(folder); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | return folders; | ||
73 | } | ||
74 | |||
75 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) | ||
76 | { | ||
77 | return new List<InventoryItemBase>(); | ||
78 | } | ||
79 | |||
46 | public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; } | 80 | public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; } |
47 | public InventoryFolderBase getUserRootFolder(UUID user) { return null; } | 81 | |
82 | public InventoryFolderBase getUserRootFolder(UUID user) | ||
83 | { | ||
84 | InventoryFolderBase folder = null; | ||
85 | m_rootFolders.TryGetValue(user, out folder); | ||
86 | |||
87 | return folder; | ||
88 | } | ||
89 | |||
48 | public List<InventoryFolderBase> getInventoryFolders(UUID parentID) { return null; } | 90 | public List<InventoryFolderBase> getInventoryFolders(UUID parentID) { return null; } |
49 | public InventoryItemBase getInventoryItem(UUID item) { return null; } | 91 | public InventoryItemBase getInventoryItem(UUID item) { return null; } |
50 | public InventoryFolderBase getInventoryFolder(UUID folder) { return null; } | 92 | |
93 | public InventoryFolderBase getInventoryFolder(UUID folderId) | ||
94 | { | ||
95 | InventoryFolderBase folder = null; | ||
96 | m_folders.TryGetValue(folderId, out folder); | ||
97 | |||
98 | return folder; | ||
99 | } | ||
100 | |||
51 | public void addInventoryItem(InventoryItemBase item) {} | 101 | public void addInventoryItem(InventoryItemBase item) {} |
52 | public void updateInventoryItem(InventoryItemBase item) {} | 102 | public void updateInventoryItem(InventoryItemBase item) {} |
53 | public void deleteInventoryItem(UUID item) {} | 103 | public void deleteInventoryItem(UUID item) {} |
54 | public void addInventoryFolder(InventoryFolderBase folder) {} | 104 | |
105 | public void addInventoryFolder(InventoryFolderBase folder) | ||
106 | { | ||
107 | m_folders[folder.ID] = folder; | ||
108 | |||
109 | if (folder.ParentID == UUID.Zero) | ||
110 | m_rootFolders[folder.Owner] = folder; | ||
111 | } | ||
112 | |||
55 | public void updateInventoryFolder(InventoryFolderBase folder) {} | 113 | public void updateInventoryFolder(InventoryFolderBase folder) {} |
56 | public void moveInventoryFolder(InventoryFolderBase folder) {} | 114 | public void moveInventoryFolder(InventoryFolderBase folder) {} |
57 | public void deleteInventoryFolder(UUID folder) {} | 115 | public void deleteInventoryFolder(UUID folder) {} |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/TestUserDataPlugin.cs b/OpenSim/Region/Environment/Scenes/Tests/TestUserDataPlugin.cs index 85fa1f5..224c7c3 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/TestUserDataPlugin.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/TestUserDataPlugin.cs | |||
@@ -34,7 +34,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// In memory user data provider. Might be quite useful as a proper user data plugin, though getting mono addins | 36 | /// In memory user data provider. Might be quite useful as a proper user data plugin, though getting mono addins |
37 | /// to load any plugins when running unit tests has proven impossible so far | 37 | /// to load any plugins when running unit tests has proven impossible so far. Currently no locking since unit |
38 | /// tests are single threaded. | ||
38 | /// </summary> | 39 | /// </summary> |
39 | public class TestUserDataPlugin : IUserDataPlugin | 40 | public class TestUserDataPlugin : IUserDataPlugin |
40 | { | 41 | { |