123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Reflection;
- using log4net;
- using Nini.Config;
- using NUnit.Framework;
- using OpenMetaverse;
- using OpenSim.Framework;
- using OpenSim.Framework.Communications;
- using OpenSim.Region.CoreModules.Avatar.Attachments;
- using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
- using OpenSim.Region.CoreModules.Framework.InventoryAccess;
- using OpenSim.Region.CoreModules.Framework.UserManagement;
- using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar;
- using OpenSim.Region.Framework.Interfaces;
- using OpenSim.Region.Framework.Scenes;
- using OpenSim.Region.OptionalModules.World.NPC;
- using OpenSim.Services.AvatarService;
- using OpenSim.Tests.Common;
- namespace OpenSim.Tests.Performance
- {
-
-
-
-
-
-
-
-
- [TestFixture]
- public class NPCPerformanceTests : OpenSimTestCase
- {
- private TestScene scene;
- private AvatarFactoryModule afm;
- private UserManagementModule umm;
- private AttachmentsModule am;
- [TestFixtureSetUp]
- public void FixtureInit()
- {
-
- Util.FireAndForgetMethod = FireAndForgetMethod.None;
- }
- [TestFixtureTearDown]
- public void TearDown()
- {
- scene.Close();
- scene = null;
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
-
- Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
- }
- [SetUp]
- public void Init()
- {
- IConfigSource config = new IniConfigSource();
- config.AddConfig("NPC");
- config.Configs["NPC"].Set("Enabled", "true");
- config.AddConfig("Modules");
- config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
- afm = new AvatarFactoryModule();
- umm = new UserManagementModule();
- am = new AttachmentsModule();
- scene = new SceneHelpers().SetupScene();
- SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule());
- }
- [Test]
- public void Test_0001_AddRemove100NPCs()
- {
- TestHelpers.InMethod();
- TestAddRemoveNPCs(100);
- }
- [Test]
- public void Test_0002_AddRemove1000NPCs()
- {
- TestHelpers.InMethod();
- TestAddRemoveNPCs(1000);
- }
- [Test]
- public void Test_0003_AddRemove2000NPCs()
- {
- TestHelpers.InMethod();
- TestAddRemoveNPCs(2000);
- }
- private void TestAddRemoveNPCs(int numberOfNpcs)
- {
- ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
-
- UUID originalFace8TextureId = TestHelpers.ParseTail(0x10);
- Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero);
- Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8);
- originalTef.TextureID = originalFace8TextureId;
-
-
- scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
- }
- }
- }
|