aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-04-13 17:46:36 +0100
committerJustin Clark-Casey (justincc)2011-04-13 17:46:36 +0100
commit6613daa82a3bf0d45b0be1b2941646042f9008f4 (patch)
treeaa5d87d431f54ca87edf03d878c59e1c6bf73e41 /OpenSim/Region/CoreModules/Framework
parentforce mesh proxy for simple box prims with path cut (diff)
downloadopensim-SC-6613daa82a3bf0d45b0be1b2941646042f9008f4.zip
opensim-SC-6613daa82a3bf0d45b0be1b2941646042f9008f4.tar.gz
opensim-SC-6613daa82a3bf0d45b0be1b2941646042f9008f4.tar.bz2
opensim-SC-6613daa82a3bf0d45b0be1b2941646042f9008f4.tar.xz
Add a regression test for rezzing a single object into a scene from user inventory
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs133
1 files changed, 133 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
new file mode 100644
index 0000000..ecf70ac
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -0,0 +1,133 @@
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.IO;
31using System.Reflection;
32using System.Threading;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenSim.Data;
37using OpenSim.Framework;
38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External;
40using OpenSim.Framework.Communications;
41using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
42using OpenSim.Region.CoreModules.Framework.InventoryAccess;
43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48using OpenSim.Tests.Common.Setup;
49
50namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
51{
52 [TestFixture]
53 public class InventoryAccessModuleTests
54 {
55 protected TestScene m_scene;
56 protected BasicInventoryAccessModule m_iam;
57
58 [SetUp]
59 public void SetUp()
60 {
61 m_iam = new BasicInventoryAccessModule();
62
63 IConfigSource config = new IniConfigSource();
64 config.AddConfig("Modules");
65 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
66
67 m_scene = SceneSetupHelpers.SetupScene("Inventory");
68 SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam);
69 }
70
71 [Test]
72 public void TestRezObject()
73 {
74 TestHelper.InMethod();
75 log4net.Config.XmlConfigurator.Configure();
76
77 // Create user
78 string userFirstName = "Jock";
79 string userLastName = "Stirrup";
80 string userPassword = "troll";
81 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
82 UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
83
84 // Create asset
85 SceneObjectGroup object1;
86 SceneObjectPart part1;
87 {
88 string partName = "My Little Dog Object";
89 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
90 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
91 Vector3 groupPosition = new Vector3(10, 20, 30);
92 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
93 Vector3 offsetPosition = new Vector3(5, 10, 15);
94
95 part1
96 = new SceneObjectPart(
97 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
98 part1.Name = partName;
99
100 object1 = new SceneObjectGroup(part1);
101 }
102
103 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
104 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
105 m_scene.AssetService.Store(asset1);
106
107 // Create item
108 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
109 string item1Name = "My Little Dog";
110 InventoryItemBase item1 = new InventoryItemBase();
111 item1.Name = item1Name;
112 item1.AssetID = asset1.FullID;
113 item1.ID = item1Id;
114 InventoryFolderBase objsFolder
115 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, userId, "Objects")[0];
116 item1.Folder = objsFolder.ID;
117 m_scene.AddInventoryItem(item1);
118
119 AgentCircuitData acd = new AgentCircuitData();
120 acd.AgentID = userId;
121 TestClient tc = new TestClient(acd, m_scene);
122
123 SceneObjectGroup so
124 = m_iam.RezObject(
125 tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
126
127 Assert.That(so, Is.Not.Null);
128
129 SceneObjectPart retrievedPart = m_scene.GetSceneObjectPart(so.UUID);
130 Assert.That(retrievedPart, Is.Not.Null);
131 }
132 }
133} \ No newline at end of file