* Apply further groups xmlrpc to stop an exception in the exception handler

* Thanks mcortez
0.6.5-rc1
Justin Clarke Casey 2009-04-29 18:52:10 +00:00
parent 517a454086
commit 1bf0bc8bb3
2 changed files with 90 additions and 33 deletions

View File

@ -194,14 +194,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
}
/// <summary>
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// an account exists with the creator name.
/// </summary>
[Test]
public void TestLoadIarV0p1()
public void TestLoadIarV0p1ExistingUsers()
{
Console.WriteLine("Started {0}", MethodBase.GetCurrentMethod());
log4net.Config.XmlConfigurator.Configure();
//log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Mr";
string userLastName = "Tiddles";
@ -256,6 +257,75 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
}
/*
/// <summary>
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// no account exists with the creator name
/// </summary>
[Test]
public void TestLoadIarV0p1TempProfiles()
{
Console.WriteLine("### Started {0} ###", MethodBase.GetCurrentMethod());
log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Dennis";
string userLastName = "Menace";
UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000aaa");
string user2FirstName = "Walter";
string user2LastName = "Mitty";
string itemName = "b.lsl";
string archiveItemName
= string.Format("{0}{1}{2}", itemName, "_", UUID.Random());
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = itemName;
item1.AssetID = UUID.Random();
item1.GroupID = UUID.Random();
item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName);
item1.Owner = UUID.Zero;
string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
tar.Close();
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
Scene scene = SceneSetupHelpers.SetupScene();
IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
userAdminService.AddUser(
userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream);
// Check that a suitable temporary user profile has been created.
UserProfileData user2Profile
= scene.CommsManager.UserService.GetUserProfile(user2FirstName, user2LastName);
Assert.That(user2Profile, Is.Not.Null);
Assert.That(user2Profile.FirstName == user2FirstName);
Assert.That(user2Profile.SurName == user2LastName);
CachedUserInfo userInfo
= scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
Assert.That(foundItem.CreatorId, Is.EqualTo(user2Profile.ID.ToString()));
Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
}
*/
/// <summary>
/// Test replication of an archive path to the user's inventory.

View File

@ -146,9 +146,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
| GroupPowers.VoteOnProposal;
param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();
Hashtable respData = XmlRpcCall("groups.createGroup", param);
if (respData.Contains("error"))
@ -237,7 +234,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
param["Name"] = GroupName.ToString();
}
Hashtable respData = XmlRpcCall("groups.getGroup", param);
if (respData.Contains("error"))
@ -246,7 +242,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
return GroupProfileHashtableToGroupRecord(respData);
}
public GroupProfileData GetMemberGroupProfile(UUID GroupID, UUID AgentID)
@ -254,7 +249,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
Hashtable param = new Hashtable();
param["GroupID"] = GroupID.ToString();
Hashtable respData = XmlRpcCall("groups.getGroup", param);
if (respData.Contains("error"))
@ -270,7 +264,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
return MemberGroupProfile;
}
private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
@ -350,7 +343,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
param["ListInProfile"] = ListInProfile ? "1" : "0";
XmlRpcCall("groups.setAgentGroupInfo", param);
}
public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
@ -362,7 +354,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
param["GroupID"] = groupID.ToString();
XmlRpcCall("groups.addAgentToGroupInvite", param);
}
public GroupInviteInfo GetAgentToGroupInvite(UUID inviteID)
@ -434,7 +425,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
XmlRpcCall("groups.removeAgentFromGroupRole", param);
}
public List<DirGroupsReplyData> FindGroups(string search)
{
Hashtable param = new Hashtable();
@ -495,7 +485,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
return HashTableToGroupMembershipData(respData);
}
public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID)
{
Hashtable param = new Hashtable();
@ -543,8 +532,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
return Roles;
}
public List<GroupRolesData> GetGroupRoles(UUID GroupID)
@ -575,7 +562,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
return Roles;
}
private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
@ -643,7 +629,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
return members;
}
public List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID)
@ -667,6 +652,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
members.Add(data);
}
}
return members;
}
@ -694,9 +680,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
values.Add(data);
}
}
return values;
}
public GroupNoticeInfo GetGroupNotice(UUID noticeID)
{
Hashtable param = new Hashtable();
@ -704,7 +691,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
Hashtable respData = XmlRpcCall("groups.getGroupNotice", param);
if (respData.Contains("error"))
{
return null;
@ -728,6 +714,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
return data;
}
public void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
{
string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
@ -768,14 +755,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
catch (Exception e)
{
m_log.Error("[GROUPS] An error has occured while attempting to access the XmlRpcGroups server");
m_log.ErrorFormat("[GROUPS] {0} ", e.ToString());
m_log.ErrorFormat("[GROUPS]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
m_log.ErrorFormat("[GROUPS]: {0} ", e.ToString());
foreach (KeyValuePair<object, object> kvp in param)
{
m_log.WarnFormat("[GROUPS] {0} :: {1}", kvp.Key.ToString(), kvp.Value.ToString());
m_log.WarnFormat("[GROUPS]: {0} :: {1}", kvp.Key.ToString(), kvp.Value.ToString());
}
Hashtable respData = (Hashtable)resp.Value;
Hashtable respData = new Hashtable();
respData.Add("error", e.ToString());
return respData;
}
@ -791,21 +780,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
return respData;
}
m_log.ErrorFormat("[XmlRpcGroupData] The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString());
m_log.ErrorFormat("[GROUPS]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString());
if (resp.Value is ArrayList)
{
ArrayList al = (ArrayList)resp.Value;
m_log.ErrorFormat("[XmlRpcGroupData] Contains {0} elements", al.Count);
m_log.ErrorFormat("[GROUPS]: Contains {0} elements", al.Count);
foreach (object o in al)
{
m_log.ErrorFormat("[XmlRpcGroupData] {0} :: {1}", o.GetType().ToString(), o.ToString());
m_log.ErrorFormat("[GROUPS]: {0} :: {1}", o.GetType().ToString(), o.ToString());
}
}
else
{
m_log.ErrorFormat("[XmlRpcGroupData] Function returned: {0}", resp.Value.ToString());
m_log.ErrorFormat("[GROUPS]: Function returned: {0}", resp.Value.ToString());
}
Hashtable error = new Hashtable();
@ -815,21 +804,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
private void LogRespDataToConsoleError(Hashtable respData)
{
m_log.Error("[GROUPDATA] Error:");
m_log.Error("[GROUPS]: Error:");
foreach (string key in respData.Keys)
{
m_log.ErrorFormat("[GROUPDATA] Key: {0}", key);
m_log.ErrorFormat("[GROUPS]: Key: {0}", key);
string[] lines = respData[key].ToString().Split(new char[] { '\n' });
foreach (string line in lines)
{
m_log.ErrorFormat("[GROUPDATA] {0}", line);
m_log.ErrorFormat("[GROUPS]: {0}", line);
}
}
}
}
public class GroupNoticeInfo