Merge branch 'master' into diva-textures

This commit is contained in:
Melanie
2009-10-02 08:23:38 +01:00
356 changed files with 8423 additions and 5997 deletions

View File

@@ -0,0 +1,204 @@
/*
* 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 GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Services.Connectors;
namespace OpenSim.Tests.Clients.GridClient
{
public class GridClient
{
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:8001";
GridServicesConnector m_Connector = new GridServicesConnector(serverURI);
GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000);
GridRegion r2 = CreateRegion("Test Region 2", 1001, 1000);
GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000);
Console.WriteLine("[GRID CLIENT]: *** Registering region 1");
bool success = m_Connector.RegisterRegion(UUID.Zero, r1);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 1");
else
Console.WriteLine("[GRID CLIENT]: region 1 failed to register");
Console.WriteLine("[GRID CLIENT]: *** Registering region 2");
success = m_Connector.RegisterRegion(UUID.Zero, r2);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 2");
else
Console.WriteLine("[GRID CLIENT]: region 2 failed to register");
Console.WriteLine("[GRID CLIENT]: *** Registering region 3");
success = m_Connector.RegisterRegion(UUID.Zero, r3);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
else
Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
success = m_Connector.DeregisterRegion(r3.RegionID);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 3");
else
Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again");
success = m_Connector.RegisterRegion(UUID.Zero, r3);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
else
Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
Console.WriteLine("[GRID CLIENT]: *** GetNeighbours of region 1");
List<GridRegion> regions = m_Connector.GetNeighbours(UUID.Zero, r1.RegionID);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 failed");
else if (regions.Count > 0)
{
if (regions.Count != 1)
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned more neighbours than expected: " + regions.Count);
else
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned the right neighbour " + regions[0].RegionName);
}
else
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned 0 neighbours");
Console.WriteLine("[GRID CLIENT]: *** GetRegionByUUID of region 2 (this should succeed)");
GridRegion region = m_Connector.GetRegionByUUID(UUID.Zero, r2.RegionID);
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByUUID of non-existent region (this should fail)");
region = m_Connector.GetRegionByUUID(UUID.Zero, UUID.Random());
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByName of region 3 (this should succeed)");
region = m_Connector.GetRegionByName(UUID.Zero, r3.RegionName);
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByName of non-existent region (this should fail)");
region = m_Connector.GetRegionByName(UUID.Zero, "Foo");
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionsByName (this should return 3 regions)");
regions = m_Connector.GetRegionsByName(UUID.Zero, "Test", 10);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionsByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionsByName returned " + regions.Count + " regions");
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
regions = m_Connector.GetRegionRange(UUID.Zero,
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize,
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
regions = m_Connector.GetRegionRange(UUID.Zero,
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize,
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
Console.Write("Proceed to deregister? Press enter...");
Console.ReadLine();
// Deregister them all
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 1");
success = m_Connector.DeregisterRegion(r1.RegionID);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 1");
else
Console.WriteLine("[GRID CLIENT]: region 1 failed to deregister");
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 2");
success = m_Connector.DeregisterRegion(r2.RegionID);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 2");
else
Console.WriteLine("[GRID CLIENT]: region 2 failed to deregister");
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
success = m_Connector.DeregisterRegion(r3.RegionID);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 3");
else
Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
}
private static GridRegion CreateRegion(string name, uint xcell, uint ycell)
{
GridRegion region = new GridRegion(xcell, ycell);
region.RegionName = name;
region.RegionID = UUID.Random();
region.ExternalHostName = "127.0.0.1";
region.HttpPort = 9000;
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 9000);
return region;
}
}
}

View File

@@ -0,0 +1,11 @@
<html>
<form name="input" action="http://127.0.0.1:8002/grid" method="post">
xmin:<input type="text" name="XMIN" value="0">
xmax:<input type="text" name="XMAX" value="0">
ymin:<input type="text" name="YMIN" value="0">
ymax:<input type="text" name="YMAX" value="0">
<input type="hidden" name="METHOD" value="get_region_range">
<input type="submit" value="Submit" />
</form>
</html>

View File

@@ -43,7 +43,7 @@ namespace OpenSim.Tests.Common
}
protected LongRunningAttribute(string category) : base(category)
{
{
}
}
}

View File

@@ -39,7 +39,7 @@ namespace OpenSim.Tests.Common.Mock
/// tests are single threaded.
/// </summary>
public class TestAssetDataPlugin : BaseAssetRepository, IAssetDataPlugin
{
{
public string Version { get { return "0"; } }
public string Name { get { return "TestAssetDataPlugin"; } }
@@ -59,6 +59,6 @@ namespace OpenSim.Tests.Common.Mock
assets.Add(asset);
}
public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); }
public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); }
}
}

View File

@@ -49,7 +49,7 @@ namespace OpenSim.Tests.Common.Mock
if (Assets.ContainsKey(id))
asset = Assets[id];
else
asset = null;
asset = null;
return asset;
}
@@ -65,7 +65,7 @@ namespace OpenSim.Tests.Common.Mock
}
public bool Get(string id, object sender, AssetRetrieved handler)
{
{
handler(id, sender, Get(id));
return true;

View File

@@ -56,7 +56,7 @@ namespace OpenSim.Tests.Common.Mock
public TestCommunicationsManager(NetworkServersInfo serversInfo)
: base(serversInfo, null)
{
{
LocalUserServices lus = new LocalUserServices(991, 992, this);
lus.AddPlugin(new TemporaryUserProfilePlugin());
@@ -65,8 +65,6 @@ namespace OpenSim.Tests.Common.Mock
m_userService = lus;
m_userAdminService = lus;
LocalBackEndServices gs = new LocalBackEndServices();
m_gridService = gs;
}
}
}

View File

@@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common.Mock
//// <value>
/// Inventory items
/// </value>
private Dictionary<UUID, InventoryItemBase> m_items = new Dictionary<UUID, InventoryItemBase>();
private Dictionary<UUID, InventoryItemBase> m_items = new Dictionary<UUID, InventoryItemBase>();
/// <value>
/// User root folders
@@ -120,7 +120,7 @@ namespace OpenSim.Tests.Common.Mock
}
return folders;
}
}
public InventoryFolderBase getInventoryFolder(UUID folderId)
{
@@ -191,7 +191,7 @@ namespace OpenSim.Tests.Common.Mock
public InventoryItemBase queryInventoryItem(UUID item)
{
return null;
}
}
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) { return null; }
}

View File

@@ -31,7 +31,7 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Tests.Common.Mock
{
{
/// <summary>
/// Land channel for test purposes
/// </summary>
@@ -40,7 +40,7 @@ namespace OpenSim.Tests.Common.Mock
public List<ILandObject> ParcelsNearPoint(Vector3 position) { return null; }
public List<ILandObject> AllParcels() { return null; }
public ILandObject GetLandObject(int x, int y) { return null; }
public ILandObject GetLandObject(int localID) { return null; }
public ILandObject GetLandObject(int localID) { return null; }
public ILandObject GetLandObject(float x, float y) { return null; }
public bool IsLandPrimCountTainted() { return false; }
public bool IsForcefulBansAllowed() { return false; }

View File

@@ -35,9 +35,9 @@ using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Tests.Common.Mock
{
{
public class TestScene : Scene
{
{
public TestScene(
RegionInfo regInfo, AgentCircuitManager authen,
CommunicationsManager commsMan, SceneCommunicationService sceneGridService, StorageManager storeManager,
@@ -60,7 +60,7 @@ namespace OpenSim.Tests.Common.Mock
{
reason = String.Empty;
return true;
}
}
public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter
{

View File

@@ -0,0 +1,76 @@
/*
* 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 NUnit.Framework;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Tests.Common.Setup
{
public class BaseRequestHandlerTestHelper
{
private static string[] m_emptyStringArray = new string[] { };
public static void BaseTestGetParams(BaseRequestHandler handler, string assetsPath)
{
Assert.AreEqual(String.Empty, handler.GetParam(null), "Failed on null path.");
Assert.AreEqual(String.Empty, handler.GetParam(""), "Failed on empty path.");
Assert.AreEqual(String.Empty, handler.GetParam("s"), "Failed on short url.");
Assert.AreEqual(String.Empty, handler.GetParam("corruptUrl"), "Failed on corruptUrl.");
Assert.AreEqual(String.Empty, handler.GetParam(assetsPath));
Assert.AreEqual("/", handler.GetParam(assetsPath + "/"));
Assert.AreEqual("/a", handler.GetParam(assetsPath + "/a"));
Assert.AreEqual("/b/", handler.GetParam(assetsPath + "/b/"));
Assert.AreEqual("/c/d", handler.GetParam(assetsPath + "/c/d"));
Assert.AreEqual("/e/f/", handler.GetParam(assetsPath + "/e/f/"));
}
public static void BaseTestSplitParams(BaseRequestHandler handler, string assetsPath)
{
Assert.AreEqual(m_emptyStringArray, handler.SplitParams(null), "Failed on null.");
Assert.AreEqual(m_emptyStringArray, handler.SplitParams(""), "Failed on empty path.");
Assert.AreEqual(m_emptyStringArray, handler.SplitParams("corruptUrl"), "Failed on corrupt url.");
Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath), "Failed on empty params.");
Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath + "/"), "Failed on single slash.");
Assert.AreEqual(new string[] { "a" }, handler.SplitParams(assetsPath + "/a"), "Failed on first segment.");
Assert.AreEqual(new string[] { "b" }, handler.SplitParams(assetsPath + "/b/"), "Failed on second slash.");
Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams(assetsPath + "/c/d"), "Failed on second segment.");
Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams(assetsPath + "/e/f/"), "Failed on trailing slash.");
}
public static byte[] EmptyByteArray = new byte[] {};
}
}

View File

@@ -44,6 +44,7 @@ using OpenSim.Region.CoreModules.Agent.Capabilities;
using OpenSim.Region.CoreModules.Avatar.Gods;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common.Mock;
@@ -58,6 +59,7 @@ namespace OpenSim.Tests.Common.Setup
// CommunicationsManager.
private static ISharedRegionModule m_assetService = null;
private static ISharedRegionModule m_inventoryService = null;
private static ISharedRegionModule m_gridService = null;
private static TestCommunicationsManager commsManager = null;
/// <summary>
@@ -110,6 +112,7 @@ namespace OpenSim.Tests.Common.Setup
return SetupScene(name, id, x, y, cm, "");
}
/// <summary>
/// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions
/// or a different, to get a brand new scene with new shared region modules.
@@ -176,6 +179,9 @@ namespace OpenSim.Tests.Common.Setup
StartInventoryService(testScene, true);
else
StartInventoryService(testScene, false);
if (realServices.Contains("grid"))
StartGridService(testScene, true);
}
// If not, make sure the shared module gets references to this new scene
else
@@ -241,6 +247,29 @@ namespace OpenSim.Tests.Common.Setup
m_inventoryService = inventoryService;
}
private static void StartGridService(Scene testScene, bool real)
{
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.AddConfig("GridService");
config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
if (real)
config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
if (m_gridService == null)
{
ISharedRegionModule gridService = new LocalGridServicesConnector();
gridService.Initialise(config);
m_gridService = gridService;
}
//else
// config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
m_gridService.AddRegion(testScene);
m_gridService.RegionLoaded(testScene);
//testScene.AddRegionModule(m_gridService.Name, m_gridService);
}
/// <summary>
/// Setup modules for a scene using their default settings.
/// </summary>

View File

@@ -31,10 +31,10 @@ using OpenSim.Framework;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common
{
{
/// <summary>
/// Utility functions for carrying out user inventory related tests.
/// </summary>
/// </summary>
public static class UserInventoryTestUtils
{
public static readonly string PATH_DELIMITER = "/";
@@ -78,7 +78,7 @@ namespace OpenSim.Tests.Common
/// </param>
/// <returns>
/// The folder created. If the path contains multiple folders then the last one created is returned.
/// </returns>
/// </returns>
public static InventoryFolderBase CreateInventoryFolder(
IInventoryService inventoryService, InventoryFolderBase parentFolder, string path)
{
@@ -91,7 +91,7 @@ namespace OpenSim.Tests.Common
if (components.Length > 1)
return CreateInventoryFolder(inventoryService, newFolder, components[1]);
else
return newFolder;
return newFolder;
}
}
}

View File

@@ -31,12 +31,12 @@ using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Communications.Local;
namespace OpenSim.Tests.Common.Setup
{
{
/// <summary>
/// Utility functions for carrying out user profile related tests.
/// </summary>
public static class UserProfileTestUtils
{
{
/// <summary>
/// Create a test user with a standard inventory
/// </summary>
@@ -51,7 +51,7 @@ namespace OpenSim.Tests.Common.Setup
{
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
return CreateUserWithInventory(commsManager, userId, callback);
}
}
/// <summary>
/// Create a test user with a standard inventory
@@ -65,7 +65,7 @@ namespace OpenSim.Tests.Common.Setup
/// <returns></returns>
public static CachedUserInfo CreateUserWithInventory(
CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
{
{
return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
}
@@ -84,8 +84,8 @@ namespace OpenSim.Tests.Common.Setup
public static CachedUserInfo CreateUserWithInventory(
CommunicationsManager commsManager, string firstName, string lastName,
UUID userId, OnInventoryReceivedDelegate callback)
{
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
{
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
lus.AddUser(firstName, lastName, "troll", "bill@bailey.com", 1000, 1000, userId);
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
@@ -93,6 +93,6 @@ namespace OpenSim.Tests.Common.Setup
userInfo.FetchInventory();
return userInfo;
}
}
}
}