From 6461243e7c780d79244184a8d4b100303f4cda27 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 17 Sep 2009 23:55:06 +0100 Subject: Remove the methods for full inventory fetch from the connector. Remove tests for the old, removed asset handlers --- .../Common/Setup/BaseRequestHandlerTestHelper.cs | 12 +- .../Setup/GetAssetStreamHandlerTestHelpers.cs | 122 --------------------- 2 files changed, 1 insertion(+), 133 deletions(-) delete mode 100644 OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs b/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs index e858371..eaf8b39 100644 --- a/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs +++ b/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs @@ -72,15 +72,5 @@ namespace OpenSim.Tests.Common.Setup public static byte[] EmptyByteArray = new byte[] {}; - public static void BaseTestHandleNoParams(BaseGetAssetStreamHandler handler, string assetsPath) - { - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath, null, null, null), "Failed on empty params."); - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/", null, null, null), "Failed on single slash."); - } - - public static void BaseTestHandleMalformedGuid(BaseGetAssetStreamHandler handler, string assetsPath) - { - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/badGuid", null, null, null), "Failed on bad guid."); - } } -} \ No newline at end of file +} diff --git a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs b/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs deleted file mode 100644 index ffa7283..0000000 --- a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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.IO; -using System.Net; -using System.Text; -using System.Xml; -using System.Xml.Serialization; -using NUnit.Framework; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Server.Base; -using OpenSim.Tests.Common.Mock; - -namespace OpenSim.Tests.Common.Setup -{ - public class GetAssetStreamHandlerTestHelpers - { - private const string EXPECTED_CONTENT_TYPE = "application/x-metaverse-callingcard"; - - public static void BaseFetchExistingAssetXmlTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - byte[] expected = BaseGetAssetStreamHandler.GetXml(asset); - - byte[] actual = handler.Handle("/assets/" + asset.ID , null, null, response); - - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml without trailing slash."); - Assert.AreEqual(expected, actual, "Failed on fetching xml without trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - - actual = handler.Handle("/assets/" + asset.ID + "/", null, null, response); - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml with trailing slash."); - Assert.AreEqual(expected, actual, "Failed on fetching xml with trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - - actual = handler.Handle("/assets/" + asset.ID + "/badData", null, null, response); - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml with bad trailing data."); - Assert.AreEqual(expected, actual, "Failed on fetching xml with bad trailing trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - } - - public static void BaseFetchExistingAssetDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data", null, null, response), "Failed on fetching data without trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on first fetch."); - - Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data/", null, null, response), "Failed on fetching data with trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on second fetch."); - } - - public static void BaseFetchExistingAssetMetaDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - XmlSerializer xs = new XmlSerializer(typeof(AssetMetadata)); - - byte[] expected = ServerUtils.SerializeResult(xs, asset.Metadata); - - Assert.AreEqual(expected, handler.Handle("/assets/" + asset.ID + "/metadata", null, null, response), "Failed on fetching data without trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on first fetch."); - - Assert.AreEqual(expected, handler.Handle("/assets/" + asset.ID + "/metadata/", null, null, response), "Failed on fetching data with trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on second fetch."); - } - - public static AssetBase CreateCommonTestResources(out OSHttpResponse response) - { - AssetBase asset = CreateTestAsset(); - response = new TestOSHttpResponse(); - return asset; - } - - public static AssetBase CreateTestAsset() - { - byte[] expected = new byte[] { 1,2,3 }; - AssetBase asset = new AssetBase(); - asset.ID = Guid.NewGuid().ToString(); - asset.Data = expected; - asset.Type = 2; - - return asset; - } - - public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - Assert.AreEqual( - BaseRequestHandlerTestHelper.EmptyByteArray, - handler.Handle("/assets/" + Guid.NewGuid(), null, null, response), "Failed on bad guid."); - Assert.AreEqual((int)HttpStatusCode.NotFound, response.StatusCode, "Response code wrong in BaseFetchMissingAsset"); - } - } -} -- cgit v1.1 From dd3d52ae1faefbca85e2fe8d8cea67f7db4005ac Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 13:33:58 -0700 Subject: Added test GridClient, which allowed me to remove a few bugs out of the new code. --- OpenSim/Tests/Clients/Grid/GridClient.cs | 102 +++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 OpenSim/Tests/Clients/Grid/GridClient.cs (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs new file mode 100644 index 0000000..0b84f9b --- /dev/null +++ b/OpenSim/Tests/Clients/Grid/GridClient.cs @@ -0,0 +1,102 @@ +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:8002"; + 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 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"); + + + } + + 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"), 0); + + return region; + } + } +} -- cgit v1.1 From 1faaa0a43a851c44af40336336ddbe3a7dbe83af Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 15:30:00 -0700 Subject: GridServerPostHandler finished. GridClient tests all work. More guards on getting parameters and replies over the wire. --- OpenSim/Tests/Clients/Grid/GridClient.cs | 64 +++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 6 deletions(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs index 0b84f9b..155f38e 100644 --- a/OpenSim/Tests/Clients/Grid/GridClient.cs +++ b/OpenSim/Tests/Clients/Grid/GridClient.cs @@ -35,21 +35,21 @@ namespace OpenSim.Tests.Clients.GridClient GridRegion r2 = CreateRegion("Test Region 2", 1001, 1000); GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000); - Console.WriteLine("[GRID CLIENT]: Registering region 1"); + 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"); + 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"); + Console.WriteLine("[GRID CLIENT]: *** Registering region 3"); success = m_Connector.RegisterRegion(UUID.Zero, r3); if (success) Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); @@ -57,20 +57,20 @@ namespace OpenSim.Tests.Clients.GridClient Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); - Console.WriteLine("[GRID CLIENT]: Deregistering region 3"); + 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"); + 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"); + Console.WriteLine("[GRID CLIENT]: *** GetNeighbours of region 1"); List regions = m_Connector.GetNeighbours(UUID.Zero, r1.RegionID); if (regions == null) Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 failed"); @@ -85,6 +85,58 @@ namespace OpenSim.Tests.Clients.GridClient 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"); + } private static GridRegion CreateRegion(string name, uint xcell, uint ycell) -- cgit v1.1 From eb0aa6a7f4d170a7f773686fb3993ca9d50c9294 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 18:48:38 -0700 Subject: Make the grid client deregister the test regions at the end, so that they don't stay in the DB. --- OpenSim/Tests/Clients/Grid/GridClient.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs index 155f38e..c56ebc3 100644 --- a/OpenSim/Tests/Clients/Grid/GridClient.cs +++ b/OpenSim/Tests/Clients/Grid/GridClient.cs @@ -137,6 +137,26 @@ namespace OpenSim.Tests.Clients.GridClient else Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions"); + // 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) -- cgit v1.1 From 52e477b41f137ff2a0775722dcbaaa64fa5f3bc3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 25 Sep 2009 06:02:41 -0700 Subject: Better guards on RegisterRegion in GridService. Added serverPort to the fields that get stored (I think this is the UDP port). --- OpenSim/Tests/Clients/Grid/GridClient.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs index c56ebc3..941406e 100644 --- a/OpenSim/Tests/Clients/Grid/GridClient.cs +++ b/OpenSim/Tests/Clients/Grid/GridClient.cs @@ -137,6 +137,9 @@ namespace OpenSim.Tests.Clients.GridClient 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); @@ -166,7 +169,7 @@ namespace OpenSim.Tests.Clients.GridClient 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"), 0); + region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 9000); return region; } -- cgit v1.1 From b2772b3a2ded5149db6cd31dab745c2369d74075 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 25 Sep 2009 07:38:05 -0700 Subject: Added GridForm.html in Tests/Clients/Grid that shows how to interact with a grid server via regular Web forms. May be good for developing administrative tools. --- OpenSim/Tests/Clients/Grid/GridForm.html | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 OpenSim/Tests/Clients/Grid/GridForm.html (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Clients/Grid/GridForm.html b/OpenSim/Tests/Clients/Grid/GridForm.html new file mode 100644 index 0000000..252920f --- /dev/null +++ b/OpenSim/Tests/Clients/Grid/GridForm.html @@ -0,0 +1,11 @@ + + +
+xmin: +xmax: +ymin: +ymax: + + +
+ -- cgit v1.1 From 368ae02dc9f7786545342d7bffae5de28678e85f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 26 Sep 2009 10:18:22 -0700 Subject: Corrected the port number to 8001 in the test client and grid ini. --- OpenSim/Tests/Clients/Grid/GridClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs index 941406e..ccda661 100644 --- a/OpenSim/Tests/Clients/Grid/GridClient.cs +++ b/OpenSim/Tests/Clients/Grid/GridClient.cs @@ -28,7 +28,7 @@ namespace OpenSim.Tests.Clients.GridClient new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"); log4net.Config.BasicConfigurator.Configure(consoleAppender); - string serverURI = "http://127.0.0.1:8002"; + string serverURI = "http://127.0.0.1:8001"; GridServicesConnector m_Connector = new GridServicesConnector(serverURI); GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000); -- cgit v1.1 From 68e40a87cafcab580ab484956f187068c098e84e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 26 Sep 2009 21:29:54 -0700 Subject: Poof! on LocalBackend. CommsManager.GridServices deleted. --- OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs index 4313c96..de73663 100644 --- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs +++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs @@ -65,8 +65,6 @@ namespace OpenSim.Tests.Common.Mock m_userService = lus; m_userAdminService = lus; - LocalBackEndServices gs = new LocalBackEndServices(); - m_gridService = gs; } } } -- cgit v1.1 From f00126dc2dfc9e23aa50227f02ee9adbe1efdfa6 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 29 Sep 2009 08:32:59 +0900 Subject: Add copyright header. Formatting cleanup. --- OpenSim/Tests/Clients/Grid/GridClient.cs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs index ccda661..8798c5e 100644 --- a/OpenSim/Tests/Clients/Grid/GridClient.cs +++ b/OpenSim/Tests/Clients/Grid/GridClient.cs @@ -1,4 +1,31 @@ -using System; +/* + * 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; -- cgit v1.1 From 4eca59ec13bb48309120fea24890341c65157c65 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Sep 2009 17:33:34 -0700 Subject: Improved the Local grid connector to fetch data from the DB when it doesn't find it in the cache. Commented out the Standalone teleport test because it's failing, and the scene setup is very confusing. I suspect it may be wrong -- the connectors-as-ISharedRegionModules are being instantiated several times when there are several scenes. --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 0d8baad..95f5e3c 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -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; /// @@ -110,6 +112,7 @@ namespace OpenSim.Tests.Common.Setup return SetupScene(name, id, x, y, cm, ""); } + /// /// 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,26 @@ namespace OpenSim.Tests.Common.Setup m_inventoryService = inventoryService; } + private static void StartGridService(Scene testScene, bool real) + { + ISharedRegionModule gridService = new LocalGridServicesConnector(); + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.AddConfig("GridService"); + config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); + if (real) + config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); + //else + // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); + config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); + gridService.Initialise(config); + gridService.AddRegion(testScene); + gridService.RegionLoaded(testScene); + testScene.AddRegionModule(gridService.Name, gridService); + m_gridService = gridService; + } + + /// /// Setup modules for a scene using their default settings. /// -- cgit v1.1 From a60ed0562ca403b5881e221ccbdd8366ff053a27 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Sep 2009 17:42:35 -0700 Subject: I think I have fixed something that was broken in the scene setup (tests) and that needs to be reflected in all other services setups. But the teleport test still doesn't work. Commenting it for now. --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 95f5e3c..53f24d9 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -249,21 +249,24 @@ namespace OpenSim.Tests.Common.Setup private static void StartGridService(Scene testScene, bool real) { - ISharedRegionModule gridService = new LocalGridServicesConnector(); 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"); - config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); - gridService.Initialise(config); - gridService.AddRegion(testScene); - gridService.RegionLoaded(testScene); - testScene.AddRegionModule(gridService.Name, gridService); - m_gridService = gridService; + m_gridService.AddRegion(testScene); + m_gridService.RegionLoaded(testScene); + //testScene.AddRegionModule(m_gridService.Name, m_gridService); } -- cgit v1.1 From ee205e7e812e170f670e690a4e0fa9caa652f226 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 Oct 2009 01:00:09 +0900 Subject: Formatting cleanup. --- OpenSim/Tests/Common/LongRunningAttribute.cs | 2 +- OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs | 4 ++-- OpenSim/Tests/Common/Mock/TestAssetService.cs | 4 ++-- OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs | 2 +- OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs | 6 +++--- OpenSim/Tests/Common/Mock/TestLandChannel.cs | 4 ++-- OpenSim/Tests/Common/Mock/TestScene.cs | 6 +++--- OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs | 8 ++++---- OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 14 +++++++------- 9 files changed, 25 insertions(+), 25 deletions(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Common/LongRunningAttribute.cs b/OpenSim/Tests/Common/LongRunningAttribute.cs index 37cbbcd..9831ea8 100644 --- a/OpenSim/Tests/Common/LongRunningAttribute.cs +++ b/OpenSim/Tests/Common/LongRunningAttribute.cs @@ -43,7 +43,7 @@ namespace OpenSim.Tests.Common } protected LongRunningAttribute(string category) : base(category) - { + { } } } diff --git a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs index 3981fe9..20ea18f 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs @@ -39,7 +39,7 @@ namespace OpenSim.Tests.Common.Mock /// tests are single threaded. /// 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 FetchAssetMetadataSet(int start, int count) { return new List(count); } + public List FetchAssetMetadataSet(int start, int count) { return new List(count); } } } \ No newline at end of file diff --git a/OpenSim/Tests/Common/Mock/TestAssetService.cs b/OpenSim/Tests/Common/Mock/TestAssetService.cs index 81f123a..317ec06 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetService.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetService.cs @@ -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; diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs index de73663..013462e 100644 --- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs +++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs @@ -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()); diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs index daef38b..0c7ebca 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs @@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common.Mock //// /// Inventory items /// - private Dictionary m_items = new Dictionary(); + private Dictionary m_items = new Dictionary(); /// /// 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 fetchActiveGestures(UUID avatarID) { return null; } } diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index f7eda68..01b5203 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -31,7 +31,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Tests.Common.Mock -{ +{ /// /// Land channel for test purposes /// @@ -40,7 +40,7 @@ namespace OpenSim.Tests.Common.Mock public List ParcelsNearPoint(Vector3 position) { return null; } public List 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; } diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 3fc22ba..22cfa2c 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -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 { diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs index 3528072..7e0c567 100644 --- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs @@ -31,10 +31,10 @@ using OpenSim.Framework; using OpenSim.Services.Interfaces; namespace OpenSim.Tests.Common -{ +{ /// /// Utility functions for carrying out user inventory related tests. - /// + /// public static class UserInventoryTestUtils { public static readonly string PATH_DELIMITER = "/"; @@ -78,7 +78,7 @@ namespace OpenSim.Tests.Common /// /// /// The folder created. If the path contains multiple folders then the last one created is returned. - /// + /// 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; } } } \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs index 4ad9926..3ca44a1 100644 --- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs @@ -31,12 +31,12 @@ using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Communications.Local; namespace OpenSim.Tests.Common.Setup -{ +{ /// /// Utility functions for carrying out user profile related tests. /// public static class UserProfileTestUtils - { + { /// /// Create a test user with a standard inventory /// @@ -51,7 +51,7 @@ namespace OpenSim.Tests.Common.Setup { UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); return CreateUserWithInventory(commsManager, userId, callback); - } + } /// /// Create a test user with a standard inventory @@ -65,7 +65,7 @@ namespace OpenSim.Tests.Common.Setup /// 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; - } + } } } -- cgit v1.1