diff options
Diffstat (limited to '')
6 files changed, 69 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index ebb5bd2..4dbc5e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
261 | false, false, remoteClient.AgentId, true); | 261 | false, false, remoteClient.AgentId, true); |
262 | 262 | ||
263 | // m_log.DebugFormat( | 263 | // m_log.DebugFormat( |
264 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | 264 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", |
265 | // objatt.Name, remoteClient.Name, AttachmentPt); | 265 | // objatt.Name, remoteClient.Name, AttachmentPt); |
266 | 266 | ||
267 | if (objatt != null) | 267 | if (objatt != null) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 7f25864..8c79ab4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -38,6 +38,7 @@ using OpenMetaverse; | |||
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Region.CoreModules.Avatar.Attachments; | 40 | using OpenSim.Region.CoreModules.Avatar.Attachments; |
41 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | ||
41 | using OpenSim.Region.CoreModules.World.Serialiser; | 42 | using OpenSim.Region.CoreModules.World.Serialiser; |
42 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
43 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
@@ -65,8 +66,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
65 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | 66 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. |
66 | Util.FireAndForgetMethod = FireAndForgetMethod.None; | 67 | Util.FireAndForgetMethod = FireAndForgetMethod.None; |
67 | 68 | ||
68 | scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); | 69 | IConfigSource config = new IniConfigSource(); |
69 | SceneHelpers.SetupSceneModules(scene, new AttachmentsModule()); | 70 | config.AddConfig("Modules"); |
71 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
72 | |||
73 | scene = SceneHelpers.SetupScene(); | ||
74 | SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule()); | ||
70 | 75 | ||
71 | agent1 = UUID.Random(); | 76 | agent1 = UUID.Random(); |
72 | random = new Random(); | 77 | random = new Random(); |
@@ -114,16 +119,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
114 | TestHelpers.InMethod(); | 119 | TestHelpers.InMethod(); |
115 | // log4net.Config.XmlConfigurator.Configure(); | 120 | // log4net.Config.XmlConfigurator.Configure(); |
116 | 121 | ||
117 | UUID spId = TestHelpers.ParseTail(0x1); | 122 | UUID userId = TestHelpers.ParseTail(0x1); |
118 | UUID attItemId = TestHelpers.ParseTail(0x2); | 123 | UUID attItemId = TestHelpers.ParseTail(0x2); |
119 | UUID attAssetId = TestHelpers.ParseTail(0x3); | 124 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
120 | 125 | ||
121 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(spId); | 126 | UserAccountHelpers.CreateUserWithInventory(scene, userId); |
127 | InventoryItemBase attItem | ||
128 | = UserInventoryHelpers.CreateInventoryItem( | ||
129 | scene, "att", attItemId, attAssetId, userId, InventoryType.Object); | ||
130 | |||
131 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | ||
122 | acd.Appearance = new AvatarAppearance(); | 132 | acd.Appearance = new AvatarAppearance(); |
123 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItemId, attAssetId); | 133 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); |
124 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); | 134 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); |
125 | 135 | ||
126 | // Assert.That(presence.HasAttachments(), Is.True); | 136 | Assert.That(presence.HasAttachments(), Is.True); |
127 | } | 137 | } |
128 | 138 | ||
129 | // I'm commenting this test because scene setup NEEDS InventoryService to | 139 | // I'm commenting this test because scene setup NEEDS InventoryService to |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 4933147..65ba87b 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -964,8 +964,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
964 | } | 964 | } |
965 | } | 965 | } |
966 | } | 966 | } |
967 | else | ||
968 | { | ||
969 | m_log.WarnFormat( | ||
970 | "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", item.AssetID, item.Name, item.ID, remoteClient.Name); | ||
971 | } | ||
972 | |||
967 | return group; | 973 | return group; |
968 | } | 974 | } |
975 | else | ||
976 | { | ||
977 | m_log.WarnFormat( | ||
978 | "[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()", | ||
979 | itemID, remoteClient.Name); | ||
980 | } | ||
969 | 981 | ||
970 | return null; | 982 | return null; |
971 | } | 983 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 50b1a48..55fc1e7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests | |||
59 | // log4net.Config.XmlConfigurator.Configure(); | 59 | // log4net.Config.XmlConfigurator.Configure(); |
60 | 60 | ||
61 | Scene scene = SceneHelpers.SetupScene(); | 61 | Scene scene = SceneHelpers.SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); | 62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
63 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); | 63 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
64 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); | 64 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); |
65 | 65 | ||
66 | scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); | 66 | scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); |
@@ -86,8 +86,8 @@ namespace OpenSim.Region.Framework.Tests | |||
86 | // log4net.Config.XmlConfigurator.Configure(); | 86 | // log4net.Config.XmlConfigurator.Configure(); |
87 | 87 | ||
88 | Scene scene = SceneHelpers.SetupScene(); | 88 | Scene scene = SceneHelpers.SetupScene(); |
89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); | 89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
90 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); | 90 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
91 | InventoryFolderBase folder1 | 91 | InventoryFolderBase folder1 |
92 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); | 92 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); |
93 | 93 | ||
diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs index d924ecd..b73df2c 100644 --- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs | |||
@@ -118,13 +118,12 @@ namespace OpenSim.Tests.Common | |||
118 | 118 | ||
119 | public static UserAccount CreateUserWithInventory(Scene scene) | 119 | public static UserAccount CreateUserWithInventory(Scene scene) |
120 | { | 120 | { |
121 | return CreateUserWithInventory(scene, 99); | 121 | return CreateUserWithInventory(scene, TestHelpers.ParseTail(99)); |
122 | } | 122 | } |
123 | 123 | ||
124 | public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail) | 124 | public static UserAccount CreateUserWithInventory(Scene scene, UUID userId) |
125 | { | 125 | { |
126 | return CreateUserWithInventory( | 126 | return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll"); |
127 | scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll"); | ||
128 | } | 127 | } |
129 | 128 | ||
130 | public static UserAccount CreateUserWithInventory( | 129 | public static UserAccount CreateUserWithInventory( |
@@ -139,7 +138,6 @@ namespace OpenSim.Tests.Common | |||
139 | { | 138 | { |
140 | // FIXME: This should really be set up by UserAccount itself | 139 | // FIXME: This should really be set up by UserAccount itself |
141 | ua.ServiceURLs = new Dictionary<string, object>(); | 140 | ua.ServiceURLs = new Dictionary<string, object>(); |
142 | |||
143 | scene.UserAccountService.StoreUserAccount(ua); | 141 | scene.UserAccountService.StoreUserAccount(ua); |
144 | scene.InventoryService.CreateUserInventory(ua.PrincipalID); | 142 | scene.InventoryService.CreateUserInventory(ua.PrincipalID); |
145 | scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); | 143 | scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); |
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 1703597..4e60ca9 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | |||
@@ -52,7 +52,22 @@ namespace OpenSim.Tests.Common | |||
52 | /// <returns></returns> | 52 | /// <returns></returns> |
53 | public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) | 53 | public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) |
54 | { | 54 | { |
55 | return CreateInventoryItem(scene, itemName, UUID.Random(), userId); | 55 | return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, InventoryType.Notecard); |
56 | } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Creates an item of the given type with an accompanying asset. | ||
60 | /// </summary> | ||
61 | /// <param name="scene"></param> | ||
62 | /// <param name="itemName"></param> | ||
63 | /// <param name="itemId"></param> | ||
64 | /// <param name="userId"></param> | ||
65 | /// <param name="type">Type of item to create</param> | ||
66 | /// <returns></returns> | ||
67 | public static InventoryItemBase CreateInventoryItem( | ||
68 | Scene scene, string itemName, UUID userId, InventoryType type) | ||
69 | { | ||
70 | return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, type); | ||
56 | } | 71 | } |
57 | 72 | ||
58 | /// <summary> | 73 | /// <summary> |
@@ -61,18 +76,32 @@ namespace OpenSim.Tests.Common | |||
61 | /// <param name="scene"></param> | 76 | /// <param name="scene"></param> |
62 | /// <param name="itemName"></param> | 77 | /// <param name="itemName"></param> |
63 | /// <param name="itemId"></param> | 78 | /// <param name="itemId"></param> |
79 | /// <param name="assetId"></param> | ||
64 | /// <param name="userId"></param> | 80 | /// <param name="userId"></param> |
81 | /// <param name="type">Type of item to create</param> | ||
65 | /// <returns></returns> | 82 | /// <returns></returns> |
66 | public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) | 83 | public static InventoryItemBase CreateInventoryItem( |
84 | Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type) | ||
67 | { | 85 | { |
68 | AssetBase asset = AssetHelpers.CreateAsset(scene, userId); | 86 | AssetBase asset = null; |
87 | |||
88 | if (type == InventoryType.Notecard) | ||
89 | asset = AssetHelpers.CreateAsset(scene, userId); | ||
90 | else if (type == InventoryType.Object) | ||
91 | asset | ||
92 | = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId)); | ||
93 | else | ||
94 | throw new Exception(string.Format("Inventory type {0} not supported", type)); | ||
95 | |||
96 | scene.AssetService.Store(asset); | ||
97 | |||
69 | InventoryItemBase item = new InventoryItemBase(); | 98 | InventoryItemBase item = new InventoryItemBase(); |
70 | item.Name = itemName; | 99 | item.Name = itemName; |
71 | item.AssetID = asset.FullID; | 100 | item.AssetID = asset.FullID; |
72 | item.ID = itemId; | 101 | item.ID = itemId; |
73 | item.Owner = userId; | 102 | item.Owner = userId; |
74 | item.AssetType = asset.Type; | 103 | item.AssetType = asset.Type; |
75 | item.InvType = (int)InventoryType.Notecard; | 104 | item.InvType = (int)type; |
76 | 105 | ||
77 | InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); | 106 | InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); |
78 | 107 | ||