aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-24 17:04:54 +0100
committerJustin Clark-Casey (justincc)2010-08-24 17:04:54 +0100
commit35f719ae2f9e58cfd46a6c0082238c500a3454f3 (patch)
tree7ab608994b46607ff351b9b0cb3bc632c1600e3f /OpenSim
parentAdd automated test at the opensim 'api' level to check that a given item goes... (diff)
downloadopensim-SC_OLD-35f719ae2f9e58cfd46a6c0082238c500a3454f3.zip
opensim-SC_OLD-35f719ae2f9e58cfd46a6c0082238c500a3454f3.tar.gz
opensim-SC_OLD-35f719ae2f9e58cfd46a6c0082238c500a3454f3.tar.bz2
opensim-SC_OLD-35f719ae2f9e58cfd46a6c0082238c500a3454f3.tar.xz
refactor TestMoveTaskInventoryItemNoParent()
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs61
1 files changed, 37 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index f848e80..ed2f324 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -44,6 +44,7 @@ using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 44using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
45using OpenSim.Region.CoreModules.World.Serialiser; 45using OpenSim.Region.CoreModules.World.Serialiser;
46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
47using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common; 48using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock; 49using OpenSim.Tests.Common.Mock;
49using OpenSim.Tests.Common.Setup; 50using OpenSim.Tests.Common.Setup;
@@ -53,34 +54,27 @@ namespace OpenSim.Region.Framework.Tests
53 [TestFixture] 54 [TestFixture]
54 public class TaskInventoryTests 55 public class TaskInventoryTests
55 { 56 {
56 /// <summary> 57 protected UserAccount CreateUser(Scene scene)
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 { 58 {
63 TestHelper.InMethod();
64// log4net.Config.XmlConfigurator.Configure();
65
66 Scene scene = SceneSetupHelpers.SetupScene("inventory");
67
68 // Create user
69 string userFirstName = "Jock"; 59 string userFirstName = "Jock";
70 string userLastName = "Stirrup"; 60 string userLastName = "Stirrup";
71 string userPassword = "troll"; 61 string userPassword = "troll";
72 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); 62 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
73 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); 63 return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
74 64 }
75 // Create scene object 65
76 string part1Name = "part1"; 66 protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId)
67 {
68 string part1Name = "part1";
77 UUID part1Id = UUID.Parse("10000000-0000-0000-0000-000000000000"); 69 UUID part1Id = UUID.Parse("10000000-0000-0000-0000-000000000000");
78 SceneObjectPart part1 70 SceneObjectPart part1
79 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 71 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
80 { Name = part1Name, UUID = part1Id }; 72 { Name = part1Name, UUID = part1Id };
81 SceneObjectGroup so = new SceneObjectGroup(part1); 73 return new SceneObjectGroup(part1);
82 74 }
83 // Create scene object inventory item 75
76 protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part)
77 {
84 AssetNotecard nc = new AssetNotecard("Hello World!"); 78 AssetNotecard nc = new AssetNotecard("Hello World!");
85 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); 79 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
86 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); 80 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
@@ -91,13 +85,32 @@ namespace OpenSim.Region.Framework.Tests
91 = new TaskInventoryItem 85 = new TaskInventoryItem
92 { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, 86 { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid,
93 Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; 87 Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
94 part1.Inventory.AddInventoryItem(ncItem, true); 88 part.Inventory.AddInventoryItem(ncItem, true);
95 89
96 // Perform test 90 return ncItem;
97 scene.MoveTaskInventoryItem(userId, UUID.Zero, part1, ncItemUuid); 91 }
92
93 /// <summary>
94 /// Test MoveTaskInventoryItem where the item has no parent folder assigned.
95 /// </summary>
96 /// This should place it in the most suitable user folder.
97 [Test]
98 public void TestMoveTaskInventoryItemNoParent()
99 {
100 TestHelper.InMethod();
101// log4net.Config.XmlConfigurator.Configure();
98 102
103 Scene scene = SceneSetupHelpers.SetupScene("inventory");
104 UserAccount user1 = CreateUser(scene);
105 SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
106 SceneObjectPart sop1 = sog1.RootPart;
107 TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1);
108
109 // Perform test
110 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);
111
99 InventoryItemBase ncUserItem 112 InventoryItemBase ncUserItem
100 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userId, "Notecards/ncItem"); 113 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");
101 Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); 114 Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found");
102 } 115 }
103 } 116 }