aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-24 16:50:31 +0100
committerJustin Clark-Casey (justincc)2010-08-24 16:50:31 +0100
commit289c21099cf3ce0a2e3392436541b67d0961d8e8 (patch)
treec6f94eeb0c4f1fc98c2ddef7c855a97dc408c908 /OpenSim/Region/Framework/Scenes
parentAdd system lookup folder fix to the RemoveXInventoryServiceConnector as well ... (diff)
downloadopensim-SC-289c21099cf3ce0a2e3392436541b67d0961d8e8.zip
opensim-SC-289c21099cf3ce0a2e3392436541b67d0961d8e8.tar.gz
opensim-SC-289c21099cf3ce0a2e3392436541b67d0961d8e8.tar.bz2
opensim-SC-289c21099cf3ce0a2e3392436541b67d0961d8e8.tar.xz
Add automated test at the opensim 'api' level to check that a given item goes to the correct directory
Also removes some mono compiler warnings
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs104
2 files changed, 105 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 241e100..fa9653f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.Scenes
106 else 106 else
107 { 107 {
108 m_log.WarnFormat( 108 m_log.WarnFormat(
109 "[AGENT INVENTORY]: Agent {1} could not add item {2} {3}", 109 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
110 AgentID, item.Name, item.ID); 110 AgentID, item.Name, item.ID);
111 111
112 return; 112 return;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
new file mode 100644
index 0000000..f848e80
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -0,0 +1,104 @@
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 OpenSimulator 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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using System.Threading;
33using System.Timers;
34using Timer=System.Timers.Timer;
35using Nini.Config;
36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse;
39using OpenMetaverse.Assets;
40using OpenSim.Framework;
41using OpenSim.Framework.Communications;
42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
45using OpenSim.Region.CoreModules.World.Serialiser;
46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49using OpenSim.Tests.Common.Setup;
50
51namespace OpenSim.Region.Framework.Tests
52{
53 [TestFixture]
54 public class TaskInventoryTests
55 {
56 /// <summary>
57 /// Test MoveTaskInventoryItem where the item has no parent folder assigned.
58 /// </summary>
59 /// This should place it in the most suitable user folder.
60 [Test]
61 public void TestMoveTaskInventoryItemNoParent()
62 {
63 TestHelper.InMethod();
64// log4net.Config.XmlConfigurator.Configure();
65
66 Scene scene = SceneSetupHelpers.SetupScene("inventory");
67
68 // Create user
69 string userFirstName = "Jock";
70 string userLastName = "Stirrup";
71 string userPassword = "troll";
72 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
73 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
74
75 // Create scene object
76 string part1Name = "part1";
77 UUID part1Id = UUID.Parse("10000000-0000-0000-0000-000000000000");
78 SceneObjectPart part1
79 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
80 { Name = part1Name, UUID = part1Id };
81 SceneObjectGroup so = new SceneObjectGroup(part1);
82
83 // Create scene object inventory item
84 AssetNotecard nc = new AssetNotecard("Hello World!");
85 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
86 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
87 AssetBase ncAsset
88 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
89 scene.AssetService.Store(ncAsset);
90 TaskInventoryItem ncItem
91 = new TaskInventoryItem
92 { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid,
93 Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
94 part1.Inventory.AddInventoryItem(ncItem, true);
95
96 // Perform test
97 scene.MoveTaskInventoryItem(userId, UUID.Zero, part1, ncItemUuid);
98
99 InventoryItemBase ncUserItem
100 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userId, "Notecards/ncItem");
101 Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found");
102 }
103 }
104} \ No newline at end of file