aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-04-29 18:52:10 +0000
committerJustin Clarke Casey2009-04-29 18:52:10 +0000
commit1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3 (patch)
tree163b606708688dfcd147cf47494e976cd125e968 /OpenSim
parent* Apply http://opensimulator.org/mantis/view.php?id=3557 (diff)
downloadopensim-SC_OLD-1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3.zip
opensim-SC_OLD-1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3.tar.gz
opensim-SC_OLD-1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3.tar.bz2
opensim-SC_OLD-1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3.tar.xz
* Apply further groups xmlrpc to stop an exception in the exception handler
* Thanks mcortez
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs76
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs47
2 files changed, 90 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 20d4e47..9bec7ed 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -194,14 +194,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
194 } 194 }
195 195
196 /// <summary> 196 /// <summary>
197 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). 197 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
198 /// an account exists with the creator name.
198 /// </summary> 199 /// </summary>
199 [Test] 200 [Test]
200 public void TestLoadIarV0p1() 201 public void TestLoadIarV0p1ExistingUsers()
201 { 202 {
202 Console.WriteLine("Started {0}", MethodBase.GetCurrentMethod()); 203 Console.WriteLine("Started {0}", MethodBase.GetCurrentMethod());
203 204
204 log4net.Config.XmlConfigurator.Configure(); 205 //log4net.Config.XmlConfigurator.Configure();
205 206
206 string userFirstName = "Mr"; 207 string userFirstName = "Mr";
207 string userLastName = "Tiddles"; 208 string userLastName = "Tiddles";
@@ -256,6 +257,75 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
256 257
257 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); 258 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
258 } 259 }
260
261 /*
262 /// <summary>
263 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
264 /// no account exists with the creator name
265 /// </summary>
266 [Test]
267 public void TestLoadIarV0p1TempProfiles()
268 {
269 Console.WriteLine("### Started {0} ###", MethodBase.GetCurrentMethod());
270
271 log4net.Config.XmlConfigurator.Configure();
272
273 string userFirstName = "Dennis";
274 string userLastName = "Menace";
275 UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000aaa");
276 string user2FirstName = "Walter";
277 string user2LastName = "Mitty";
278
279 string itemName = "b.lsl";
280 string archiveItemName
281 = string.Format("{0}{1}{2}", itemName, "_", UUID.Random());
282
283 MemoryStream archiveWriteStream = new MemoryStream();
284 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
285
286 InventoryItemBase item1 = new InventoryItemBase();
287 item1.Name = itemName;
288 item1.AssetID = UUID.Random();
289 item1.GroupID = UUID.Random();
290 item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName);
291 item1.Owner = UUID.Zero;
292
293 string item1FileName
294 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
295 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
296 tar.Close();
297
298 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
299 SerialiserModule serialiserModule = new SerialiserModule();
300 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
301
302 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
303 Scene scene = SceneSetupHelpers.SetupScene();
304 IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
305
306 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
307 userAdminService.AddUser(
308 userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
309
310 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream);
311
312 // Check that a suitable temporary user profile has been created.
313 UserProfileData user2Profile
314 = scene.CommsManager.UserService.GetUserProfile(user2FirstName, user2LastName);
315 Assert.That(user2Profile, Is.Not.Null);
316 Assert.That(user2Profile.FirstName == user2FirstName);
317 Assert.That(user2Profile.SurName == user2LastName);
318
319 CachedUserInfo userInfo
320 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
321 InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
322
323 Assert.That(foundItem.CreatorId, Is.EqualTo(user2Profile.ID.ToString()));
324 Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
325
326 Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
327 }
328 */
259 329
260 /// <summary> 330 /// <summary>
261 /// Test replication of an archive path to the user's inventory. 331 /// Test replication of an archive path to the user's inventory.
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs
index e913543..25ce093 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs
@@ -146,9 +146,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
146 | GroupPowers.VoteOnProposal; 146 | GroupPowers.VoteOnProposal;
147 param["OwnersPowers"] = ((ulong)OwnerPowers).ToString(); 147 param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();
148 148
149
150
151
152 Hashtable respData = XmlRpcCall("groups.createGroup", param); 149 Hashtable respData = XmlRpcCall("groups.createGroup", param);
153 150
154 if (respData.Contains("error")) 151 if (respData.Contains("error"))
@@ -237,7 +234,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
237 param["Name"] = GroupName.ToString(); 234 param["Name"] = GroupName.ToString();
238 } 235 }
239 236
240
241 Hashtable respData = XmlRpcCall("groups.getGroup", param); 237 Hashtable respData = XmlRpcCall("groups.getGroup", param);
242 238
243 if (respData.Contains("error")) 239 if (respData.Contains("error"))
@@ -246,7 +242,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
246 } 242 }
247 243
248 return GroupProfileHashtableToGroupRecord(respData); 244 return GroupProfileHashtableToGroupRecord(respData);
249
250 } 245 }
251 246
252 public GroupProfileData GetMemberGroupProfile(UUID GroupID, UUID AgentID) 247 public GroupProfileData GetMemberGroupProfile(UUID GroupID, UUID AgentID)
@@ -254,7 +249,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
254 Hashtable param = new Hashtable(); 249 Hashtable param = new Hashtable();
255 param["GroupID"] = GroupID.ToString(); 250 param["GroupID"] = GroupID.ToString();
256 251
257
258 Hashtable respData = XmlRpcCall("groups.getGroup", param); 252 Hashtable respData = XmlRpcCall("groups.getGroup", param);
259 253
260 if (respData.Contains("error")) 254 if (respData.Contains("error"))
@@ -270,7 +264,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
270 MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; 264 MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
271 265
272 return MemberGroupProfile; 266 return MemberGroupProfile;
273
274 } 267 }
275 268
276 private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) 269 private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
@@ -350,7 +343,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
350 param["ListInProfile"] = ListInProfile ? "1" : "0"; 343 param["ListInProfile"] = ListInProfile ? "1" : "0";
351 344
352 XmlRpcCall("groups.setAgentGroupInfo", param); 345 XmlRpcCall("groups.setAgentGroupInfo", param);
353
354 } 346 }
355 347
356 public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID) 348 public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
@@ -362,7 +354,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
362 param["GroupID"] = groupID.ToString(); 354 param["GroupID"] = groupID.ToString();
363 355
364 XmlRpcCall("groups.addAgentToGroupInvite", param); 356 XmlRpcCall("groups.addAgentToGroupInvite", param);
365
366 } 357 }
367 358
368 public GroupInviteInfo GetAgentToGroupInvite(UUID inviteID) 359 public GroupInviteInfo GetAgentToGroupInvite(UUID inviteID)
@@ -434,7 +425,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
434 XmlRpcCall("groups.removeAgentFromGroupRole", param); 425 XmlRpcCall("groups.removeAgentFromGroupRole", param);
435 } 426 }
436 427
437
438 public List<DirGroupsReplyData> FindGroups(string search) 428 public List<DirGroupsReplyData> FindGroups(string search)
439 { 429 {
440 Hashtable param = new Hashtable(); 430 Hashtable param = new Hashtable();
@@ -495,7 +485,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
495 return HashTableToGroupMembershipData(respData); 485 return HashTableToGroupMembershipData(respData);
496 } 486 }
497 487
498
499 public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID) 488 public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID)
500 { 489 {
501 Hashtable param = new Hashtable(); 490 Hashtable param = new Hashtable();
@@ -543,8 +532,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
543 } 532 }
544 533
545 return Roles; 534 return Roles;
546
547
548 } 535 }
549 536
550 public List<GroupRolesData> GetGroupRoles(UUID GroupID) 537 public List<GroupRolesData> GetGroupRoles(UUID GroupID)
@@ -575,7 +562,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
575 } 562 }
576 563
577 return Roles; 564 return Roles;
578
579 } 565 }
580 566
581 private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) 567 private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
@@ -643,7 +629,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
643 } 629 }
644 630
645 return members; 631 return members;
646
647 } 632 }
648 633
649 public List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID) 634 public List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID)
@@ -667,6 +652,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
667 members.Add(data); 652 members.Add(data);
668 } 653 }
669 } 654 }
655
670 return members; 656 return members;
671 } 657 }
672 658
@@ -694,9 +680,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
694 values.Add(data); 680 values.Add(data);
695 } 681 }
696 } 682 }
683
697 return values; 684 return values;
698
699 } 685 }
686
700 public GroupNoticeInfo GetGroupNotice(UUID noticeID) 687 public GroupNoticeInfo GetGroupNotice(UUID noticeID)
701 { 688 {
702 Hashtable param = new Hashtable(); 689 Hashtable param = new Hashtable();
@@ -704,7 +691,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
704 691
705 Hashtable respData = XmlRpcCall("groups.getGroupNotice", param); 692 Hashtable respData = XmlRpcCall("groups.getGroupNotice", param);
706 693
707
708 if (respData.Contains("error")) 694 if (respData.Contains("error"))
709 { 695 {
710 return null; 696 return null;
@@ -728,6 +714,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
728 714
729 return data; 715 return data;
730 } 716 }
717
731 public void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) 718 public void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
732 { 719 {
733 string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); 720 string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
@@ -768,14 +755,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
768 } 755 }
769 catch (Exception e) 756 catch (Exception e)
770 { 757 {
771 m_log.Error("[GROUPS] An error has occured while attempting to access the XmlRpcGroups server"); 758 m_log.ErrorFormat("[GROUPS]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
772 m_log.ErrorFormat("[GROUPS] {0} ", e.ToString()); 759 m_log.ErrorFormat("[GROUPS]: {0} ", e.ToString());
773 760
774 foreach (KeyValuePair<object, object> kvp in param) 761 foreach (KeyValuePair<object, object> kvp in param)
775 { 762 {
776 m_log.WarnFormat("[GROUPS] {0} :: {1}", kvp.Key.ToString(), kvp.Value.ToString()); 763 m_log.WarnFormat("[GROUPS]: {0} :: {1}", kvp.Key.ToString(), kvp.Value.ToString());
777 } 764 }
778 Hashtable respData = (Hashtable)resp.Value; 765
766
767 Hashtable respData = new Hashtable();
779 respData.Add("error", e.ToString()); 768 respData.Add("error", e.ToString());
780 return respData; 769 return respData;
781 } 770 }
@@ -791,21 +780,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
791 return respData; 780 return respData;
792 } 781 }
793 782
794 m_log.ErrorFormat("[XmlRpcGroupData] The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString()); 783 m_log.ErrorFormat("[GROUPS]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString());
795 784
796 if (resp.Value is ArrayList) 785 if (resp.Value is ArrayList)
797 { 786 {
798 ArrayList al = (ArrayList)resp.Value; 787 ArrayList al = (ArrayList)resp.Value;
799 m_log.ErrorFormat("[XmlRpcGroupData] Contains {0} elements", al.Count); 788 m_log.ErrorFormat("[GROUPS]: Contains {0} elements", al.Count);
800 789
801 foreach (object o in al) 790 foreach (object o in al)
802 { 791 {
803 m_log.ErrorFormat("[XmlRpcGroupData] {0} :: {1}", o.GetType().ToString(), o.ToString()); 792 m_log.ErrorFormat("[GROUPS]: {0} :: {1}", o.GetType().ToString(), o.ToString());
804 } 793 }
805 } 794 }
806 else 795 else
807 { 796 {
808 m_log.ErrorFormat("[XmlRpcGroupData] Function returned: {0}", resp.Value.ToString()); 797 m_log.ErrorFormat("[GROUPS]: Function returned: {0}", resp.Value.ToString());
809 } 798 }
810 799
811 Hashtable error = new Hashtable(); 800 Hashtable error = new Hashtable();
@@ -815,21 +804,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
815 804
816 private void LogRespDataToConsoleError(Hashtable respData) 805 private void LogRespDataToConsoleError(Hashtable respData)
817 { 806 {
818 m_log.Error("[GROUPDATA] Error:"); 807 m_log.Error("[GROUPS]: Error:");
819 808
820 foreach (string key in respData.Keys) 809 foreach (string key in respData.Keys)
821 { 810 {
822 m_log.ErrorFormat("[GROUPDATA] Key: {0}", key); 811 m_log.ErrorFormat("[GROUPS]: Key: {0}", key);
823 812
824 string[] lines = respData[key].ToString().Split(new char[] { '\n' }); 813 string[] lines = respData[key].ToString().Split(new char[] { '\n' });
825 foreach (string line in lines) 814 foreach (string line in lines)
826 { 815 {
827 m_log.ErrorFormat("[GROUPDATA] {0}", line); 816 m_log.ErrorFormat("[GROUPS]: {0}", line);
828 } 817 }
829
830 } 818 }
831 } 819 }
832
833 } 820 }
834 821
835 public class GroupNoticeInfo 822 public class GroupNoticeInfo