From eb9b16d2849de438f20bb269ef3ea93e33f4d18d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 10 May 2015 21:49:24 -0700 Subject: Added simple test for IM in Robust too. Changed Inventory data to use the mock one in Common Tests. (but still not inventory tests) --- .../HypergridService/HGInstantMessageService.cs | 9 ++- OpenSim/Tests/Clients/InstantMessage/IMClient.cs | 75 ---------------------- .../Robust/Clients/InstantMessage/IMClient.cs | 58 +++++++++++++++++ bin/Robust.Tests.ini | 58 +++++------------ 4 files changed, 81 insertions(+), 119 deletions(-) delete mode 100644 OpenSim/Tests/Clients/InstantMessage/IMClient.cs create mode 100644 OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index 9b7b278..dde0e6c 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -101,7 +101,14 @@ namespace OpenSim.Services.HypergridService Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin(gridService, args); m_PresenceService = ServerUtils.LoadPlugin(presenceService, args); - m_UserAgentService = ServerUtils.LoadPlugin(userAgentService, args); + try + { + m_UserAgentService = ServerUtils.LoadPlugin(userAgentService, args); + } + catch (Exception e) + { + m_log.WarnFormat("[HG IM SERVICE]: Unable to create User Agent Service. Missing config var in [HGInstantMessageService]?"); + } m_RegionCache = new ExpiringCache(); diff --git a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs deleted file mode 100644 index e7304a2..0000000 --- a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs +++ /dev/null @@ -1,75 +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.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"); - } - - } -} diff --git a/OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs b/OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs new file mode 100644 index 0000000..8f312eb --- /dev/null +++ b/OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs @@ -0,0 +1,58 @@ +/* + * 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 OpenMetaverse; +using NUnit.Framework; + +using OpenSim.Framework; +using OpenSim.Services.Interfaces; +using OpenSim.Services.Connectors.InstantMessage; + +namespace Robust.Tests +{ + [TestFixture] + public class IMClient + { + [Test] + public void HGIM_001() + { + GridInstantMessage im = new GridInstantMessage(); + im.fromAgentID = new Guid(); + im.toAgentID = new Guid(); + im.message = "Hello"; + im.imSessionID = new Guid(); + + bool success = InstantMessageServiceConnector.SendInstantMessage(DemonServer.Address, im); + Assert.IsFalse(success, "Sending of IM succeeded, but it should have failed"); + } + + } +} diff --git a/bin/Robust.Tests.ini b/bin/Robust.Tests.ini index fc405f9..e2568df 100644 --- a/bin/Robust.Tests.ini +++ b/bin/Robust.Tests.ini @@ -53,10 +53,12 @@ [ServiceList] GridServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:GridServiceConnector" PresenceServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:PresenceServiceConnector" + InstantMessageServerConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:InstantMessageServerConnector" - ;InventoryInConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:XInventoryInConnector" ;UserAccountServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:UserAccountServiceConnector" + InventoryInConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:XInventoryInConnector" + ;; Uncomment as more tests are added ;AssetServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:AssetServiceConnector" ;GridInfoServerInConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:GridInfoServerInConnector" @@ -151,6 +153,9 @@ [InventoryService] LocalServiceModule = "OpenSim.Services.InventoryService.dll:XInventoryService" + StorageProvider = "OpenSim.Tests.Common.dll" + ConnectionString = "" + ; Will calls to purge folders (empty trash) and immediately delete/update items or folders (not move to trash first) succeed? ; If this is set to false then some other arrangement must be made to perform these operations if necessary. AllowDelete = true @@ -194,41 +199,6 @@ ExportSupported = true -; * This is the configuration for the freeswitch server in grid mode -[FreeswitchService] - LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" - - ;; The IP address of your FreeSWITCH server. - ;; This address must be reachable by viewers. - ; ServerAddress = 127.0.0.1 - - ;; The following configuration parameters are optional - - ;; By default, this is the same as the ServerAddress - ; Realm = 127.0.0.1 - - ;; By default, this is the same as the ServerAddress on port 5060 - ; SIPProxy = 127.0.0.1:5060 - - ;; Default is 5000ms - ; DefaultTimeout = 5000 - - ;; The dial plan context. Default is "default" - ; Context = default - - ;; Currently unused - ; UserName = freeswitch - - ;; Currently unused - ; Password = password - - ;; The following parameters are for STUN = Simple Traversal of UDP through NATs - ;; See http://wiki.freeswitch.org/wiki/NAT_Traversal - ;; stun.freeswitch.org is not guaranteed to be running so use it in - ;; production at your own risk - ; EchoServer = 127.0.0.1 - ; EchoPort = 50505 - ; AttemptSTUN = false ; * This is the new style authentication service. Currently, only MySQL @@ -251,12 +221,6 @@ ; AllowSetPassword = false -[OpenIdService] - ; for the server connector - AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" - UserAccountServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" - - ; * This is the new style authentication service. Currently, only MySQL ; * is implemented. "Realm" is the table that is used for user lookup. ; * It defaults to "useraccounts", which uses the new style. @@ -436,7 +400,7 @@ [Messaging] ; OfflineIM - OfflineIMService = "OpenSim.Addons.OfflineIM.dll:OfflineIMService" + OfflineIMService = "" [GridInfoService] @@ -493,3 +457,11 @@ LocalServiceModule = "OpenSim.Server.Handlers.dll:XBakes" ;; This directory must be writable by the user ROBUST runs as. It will be created automatically. BaseDirectory = "./bakes" + +[HGInstantMessageService] + LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInstantMessageService" + GridService = "OpenSim.Services.GridService.dll:GridService" + PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" + UserAgentService = "" + ; This should always be true in the Robust config + InGatekeeper = True -- cgit v1.1