Merge branch 'master' into careminster-presence-refactor

This commit is contained in:
Melanie
2011-06-09 02:05:04 +01:00
119 changed files with 6471 additions and 4318 deletions

View File

@@ -0,0 +1,75 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using OpenMetaverse;
using log4net;
using log4net.Appender;
using log4net.Layout;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors.InstantMessage;
namespace OpenSim.Tests.Clients.InstantMessage
{
public class IMClient
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
public static void Main(string[] args)
{
ConsoleAppender consoleAppender = new ConsoleAppender();
consoleAppender.Layout =
new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
log4net.Config.BasicConfigurator.Configure(consoleAppender);
string serverURI = "http://127.0.0.1:8002";
GridInstantMessage im = new GridInstantMessage();
im.fromAgentID = new Guid();
im.toAgentID = new Guid();
im.message = "Hello";
im.imSessionID = new Guid();
bool success = InstantMessageServiceConnector.SendInstantMessage(serverURI, im);
if (success)
m_log.InfoFormat("[IM CLIENT]: Successfully IMed {0}", serverURI);
else
m_log.InfoFormat("[IM CLIENT]: failed to IM {0}", serverURI);
System.Console.WriteLine("\n");
}
}
}

View File

@@ -117,17 +117,20 @@ namespace OpenSim.Tests.Common
// }
public static UserAccount CreateUserWithInventory(Scene scene)
{
return CreateUserWithInventory(scene, 99);
}
public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail)
{
return CreateUserWithInventory(
scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll");
}
public static UserAccount CreateUserWithInventory(
Scene scene, string firstName, string lastName, UUID userId, string pw)
{
UserAccount ua
= new UserAccount(userId)
{ FirstName = firstName, LastName = lastName };
UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
CreateUserWithInventory(scene, ua, pw);
return ua;
}

View File

@@ -26,8 +26,10 @@
*/
using System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
@@ -40,18 +42,41 @@ namespace OpenSim.Tests.Common
{
public static readonly string PATH_DELIMITER = "/";
public static InventoryItemBase CreateInventoryItem(
Scene scene, string itemName, UUID itemId, string folderPath, UUID userId)
/// <summary>
/// Creates a notecard in the objects folder and specify an item id.
/// </summary>
/// <param name="scene"></param>
/// <param name="itemName"></param>
/// <param name="itemId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId)
{
return CreateInventoryItem(scene, itemName, UUID.Random(), userId);
}
/// <summary>
/// Creates a notecard in the objects folder and specify an item id.
/// </summary>
/// <param name="scene"></param>
/// <param name="itemName"></param>
/// <param name="itemId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId)
{
AssetBase asset = AssetHelpers.CreateAsset(scene, userId);
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID;
item.AssetID = asset.FullID;
item.ID = itemId;
item.Owner = userId;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Notecard;
InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
// Really quite bad since the objs folder could be moved in the future and confuse the tests
InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
item.Folder = objsFolder.ID;
item.Folder = folder.ID;
scene.AddInventoryItem(item);
return item;
@@ -111,5 +136,60 @@ namespace OpenSim.Tests.Common
else
return newFolder;
}
/// <summary>
/// Get the inventory folder that matches the path name. If there are multiple folders then only the first
/// is returned.
/// </summary>
/// <param name="inventoryService"></param>
/// <param name="userId"></param>
/// <param name="path"></param>
/// <returns>null if no folder matching the path was found</returns>
public static InventoryFolderBase GetInventoryFolder(IInventoryService inventoryService, UUID userId, string path)
{
List<InventoryFolderBase> folders = GetInventoryFolders(inventoryService, userId, path);
if (folders.Count != 0)
return folders[0];
else
return null;
}
/// <summary>
/// Get the inventory folders that match the path name.
/// </summary>
/// <param name="inventoryService"></param>
/// <param name="userId"></param>
/// <param name="path"></param>
/// <returns>An empty list if no matching folders were found</returns>
public static List<InventoryFolderBase> GetInventoryFolders(IInventoryService inventoryService, UUID userId, string path)
{
return InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path);
}
/// <summary>
/// Get the inventory item that matches the path name. If there are multiple items then only the first
/// is returned.
/// </summary>
/// <param name="inventoryService"></param>
/// <param name="userId"></param>
/// <param name="path"></param>
/// <returns>null if no item matching the path was found</returns>
public static InventoryItemBase GetInventoryItem(IInventoryService inventoryService, UUID userId, string path)
{
return InventoryArchiveUtils.FindItemByPath(inventoryService, userId, path);
}
/// <summary>
/// Get the inventory items that match the path name.
/// </summary>
/// <param name="inventoryService"></param>
/// <param name="userId"></param>
/// <param name="path"></param>
/// <returns>An empty list if no matching items were found.</returns>
public static List<InventoryItemBase> GetInventoryItems(IInventoryService inventoryService, UUID userId, string path)
{
return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path);
}
}
}

View File

@@ -637,7 +637,7 @@ namespace OpenSim.Tests.Common.Mock
{
}
public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
public virtual void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
{
}