Create a very basic initial test which just creates an 'npc' and tests that the scene presence exists
parent
ed12e38480
commit
513d63455e
|
@ -28,7 +28,7 @@
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.NPC
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
public interface INPCModule
|
public interface INPCModule
|
||||||
{
|
{
|
|
@ -34,7 +34,6 @@ using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.CoreModules.Avatar.NPC;
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Timer=System.Timers.Timer;
|
using Timer=System.Timers.Timer;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
@ -70,7 +69,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return new AvatarAppearance();
|
return new AvatarAppearance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
|
public UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom)
|
||||||
{
|
{
|
||||||
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene);
|
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene);
|
||||||
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
|
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* 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.Reflection;
|
||||||
|
using Nini.Config;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Communications;
|
||||||
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Services.AvatarService;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using OpenSim.Tests.Common.Mock;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class NPCModuleTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestCreate()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
IConfigSource config = new IniConfigSource();
|
||||||
|
|
||||||
|
config.AddConfig("Modules");
|
||||||
|
config.Configs["Modules"].Set("AvatarServices", "LocalAvatarServicesConnector");
|
||||||
|
config.AddConfig("AvatarService");
|
||||||
|
config.Configs["AvatarService"].Set("LocalServiceModule", "OpenSim.Services.AvatarService.dll:AvatarService");
|
||||||
|
config.Configs["AvatarService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
|
||||||
|
|
||||||
|
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||||
|
SceneSetupHelpers.SetupSceneModules(scene, config, new NPCModule(), new LocalAvatarServicesConnector());
|
||||||
|
|
||||||
|
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||||
|
UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, UUID.Zero);
|
||||||
|
|
||||||
|
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||||
|
Assert.That(npc, Is.Not.Null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,7 +38,6 @@ using OpenSim;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Region.CoreModules.Avatar.NPC;
|
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.ScriptEngine.Shared;
|
using OpenSim.Region.ScriptEngine.Shared;
|
||||||
|
|
|
@ -2997,6 +2997,7 @@
|
||||||
<Reference name="OpenSim.Region.CoreModules"/>
|
<Reference name="OpenSim.Region.CoreModules"/>
|
||||||
<Reference name="OpenSim.Region.OptionalModules"/>
|
<Reference name="OpenSim.Region.OptionalModules"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
|
<Reference name="OpenSim.Services.AvatarService"/>
|
||||||
<Reference name="OpenSim.Services.Interfaces"/>
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
|
|
||||||
<!-- Unit tests -->
|
<!-- Unit tests -->
|
||||||
|
@ -3020,6 +3021,7 @@
|
||||||
<Files>
|
<Files>
|
||||||
<!-- SADLY the way this works means you need to keep adding these paths -->
|
<!-- SADLY the way this works means you need to keep adding these paths -->
|
||||||
<Match path="Avatar/XmlRpcGroups/Tests" pattern="*.cs" recurse="true"/>
|
<Match path="Avatar/XmlRpcGroups/Tests" pattern="*.cs" recurse="true"/>
|
||||||
|
<Match path="World/NPC/Tests" pattern="*.cs" recurse="true"/>
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue