public void TestGetUserDetails() { TestHelper.InMethod(); UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000002"); string firstName = "Bill"; string lastName = "Bailey"; CachedUserInfo nonExistingUserInfo; TestCommunicationsManager commsManager = new TestCommunicationsManager(); Scene myScene = SceneSetupHelpers.SetupScene(commsManager, ""); // Check we can't retrieve info before it exists by uuid nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); Assert.That(nonExistingUserInfo, Is.Null, "User info found by uuid before user creation"); // Check we can't retrieve info before it exists by name nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); Assert.That(nonExistingUserInfo, Is.Null, "User info found by name before user creation"); LocalUserServices lus = (LocalUserServices)commsManager.UserService; lus.AddUser(firstName, lastName, "troll", "*****@*****.**", 1000, 1000, userId); CachedUserInfo existingUserInfo; // Check we can retrieve info by uuid existingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); Assert.That(existingUserInfo, Is.Not.Null, "User info not found by uuid"); // Check we can retrieve info by name existingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); Assert.That(existingUserInfo, Is.Not.Null, "User info not found by name"); }
public void Init() { cm = new TestCommunicationsManager(); scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000, cm); scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000, cm); scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000, cm); ISharedRegionModule interregionComms = new RESTInterregionComms(); interregionComms.Initialise(new IniConfigSource()); interregionComms.PostInitialise(); SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); agent2 = UUID.Random(); agent3 = UUID.Random(); random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); sog3 = NewSOG(UUID.Random(), scene, agent1); //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); region1 = scene.RegionInfo.RegionHandle; region2 = scene2.RegionInfo.RegionHandle; region3 = scene3.RegionInfo.RegionHandle; }
public void TestSimpleNotNeighboursTeleport() { TestHelper.InMethod(); // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); log4net.Config.XmlConfigurator.Configure(); UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); TestCommunicationsManager cm = new TestCommunicationsManager(); // shared module ISharedRegionModule interregionComms = new RESTInterregionComms(); Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); sceneA.RegisterRegionWithGrid(); Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); sceneB.RegisterRegionWithGrid(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); Assert.That( sceneACapsModule.GetCapsPath(agentId), Is.EqualTo(client.CapsSeedUrl), "Incorrect caps object path set up in sceneA"); // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. client.TeleportTargetScene = sceneB; client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>(); // Temporary assertion - caps url construction should at least be doable through a method. Assert.That( "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", Is.EqualTo(client.CapsSeedUrl), "Incorrect caps object path set up in sceneB"); // This assertion will currently fail since we don't remove the caps paths when no longer needed //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); // TODO: Check that more of everything is as it should be // TODO: test what happens if we try to teleport to a region that doesn't exist }
public void SetUpLoginEnviroment() { m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); m_regionConnector = new TestLoginToRegionConnector(); m_testScene = SceneSetupHelpers.SetupScene(m_commsManager, ""); m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); //IInventoryService m_inventoryService = new TestInventoryService(); m_localUserServices = (LocalUserServices) m_commsManager.UserService; m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","*****@*****.**",42,43); m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_testScene.InventoryService, m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); }
/// <summary> /// Set up a test scene /// </summary> /// /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> /// <returns></returns> public static TestScene SetupScene(TestCommunicationsManager cm, String realServices) { return SetupScene( "Unit test region", UUID.Random(), 1000, 1000, 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. /// </summary> /// <param name="name">Name of the region</param> /// <param name="id">ID of the region</param> /// <param name="x">X co-ordinate of the region</param> /// <param name="y">Y co-ordinate of the region</param> /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> /// <returns></returns> public static TestScene SetupScene( string name, UUID id, uint x, uint y, TestCommunicationsManager cm, String realServices) { bool newScene = false; Console.WriteLine("Setting up test scene {0}", name); // If cm is the same as our last commsManager used, this means the tester wants to link // regions. In this case, don't use the sameshared region modules and dont initialize them again. // Also, no need to start another MainServer and MainConsole instance. if (cm == null || cm != commsManager) { System.Console.WriteLine("Starting a brand new scene"); newScene = true; MainConsole.Instance = new LocalConsole("TEST PROMPT"); MainServer.Instance = new BaseHttpServer(980); commsManager = cm; } // We must set up a console otherwise setup of some modules may fail RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; regInfo.RegionID = id; AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(cm); StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); IConfigSource configSource = new IniConfigSource(); TestScene testScene = new TestScene( regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null); INonSharedRegionModule capsModule = new CapabilitiesModule(); capsModule.Initialise(new IniConfigSource()); testScene.AddRegionModule(capsModule.Name, capsModule); capsModule.AddRegion(testScene); IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); // IConfigSource config = new IniConfigSource(); // If we have a brand new scene, need to initialize shared region modules if ((m_assetService == null && m_inventoryService == null) || newScene) { if (realServices.Contains("asset")) StartAssetService(testScene, true); else StartAssetService(testScene, false); if (realServices.Contains("inventory")) 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 { m_assetService.AddRegion(testScene); m_assetService.RegionLoaded(testScene); m_inventoryService.AddRegion(testScene); m_inventoryService.RegionLoaded(testScene); } m_inventoryService.PostInitialise(); m_assetService.PostInitialise(); testScene.CommsManager.UserService.SetInventoryService(testScene.InventoryService); testScene.SetModuleInterfaces(); testScene.LandChannel = new TestLandChannel(testScene); testScene.LoadWorldMap(); PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); return testScene; }
/// <summary> /// Set up a test scene /// </summary> /// <param name="name">Name of the region</param> /// <param name="id">ID of the region</param> /// <param name="x">X co-ordinate of the region</param> /// <param name="y">Y co-ordinate of the region</param> /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> /// <returns></returns> public static TestScene SetupScene(string name, UUID id, uint x, uint y, TestCommunicationsManager cm) { return SetupScene(name, id, x, y, cm, ""); }
/// <summary> /// Set up a test scene /// </summary> /// <param name="name">Name of the region</param> /// <param name="id">ID of the region</param> /// <param name="x">X co-ordinate of the region</param> /// <param name="y">Y co-ordinate of the region</param> /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> /// <param name="startServices">Start associated threads for the services used by the scene</param> /// <returns></returns> public static TestScene SetupScene( string name, UUID id, uint x, uint y, TestCommunicationsManager cm, bool startServices) { Console.WriteLine("Setting up test scene {0}", name); MainServer.Instance = new BaseHttpServer(980); RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; regInfo.RegionID = id; AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(cm); StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); IConfigSource configSource = new IniConfigSource(); TestScene testScene = new TestScene( regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null); INonSharedRegionModule capsModule = new CapabilitiesModule(); capsModule.Initialise(new IniConfigSource()); testScene.AddRegionModule(capsModule.Name, capsModule); capsModule.AddRegion(testScene); IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); ISharedRegionModule assetService = new LocalAssetServicesConnector(); IniConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("AssetService"); config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); assetService.Initialise(config); assetService.AddRegion(testScene); assetService.RegionLoaded(testScene); testScene.AddRegionModule(assetService.Name, assetService); assetService.PostInitialise(); ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("InventoryService"); config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); inventoryService.Initialise(config); inventoryService.AddRegion(testScene); inventoryService.RegionLoaded(testScene); testScene.AddRegionModule(inventoryService.Name, inventoryService); inventoryService.PostInitialise(); testScene.SetModuleInterfaces(); testScene.LandChannel = new TestLandChannel(); testScene.LoadWorldMap(); PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); return testScene; }
public void TestReplicateArchivePathToUserInventory() { TestHelper.InMethod(); CommunicationsManager commsManager = new TestCommunicationsManager(); CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); Dictionary <string, InventoryFolderImpl> foldersCreated = new Dictionary<string, InventoryFolderImpl>(); List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); string folder1Name = "a"; string folder2Name = "b"; string itemName = "c.lsl"; string folder1ArchiveName = string.Format( "{0}{1}{2}", folder1Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random()); string folder2ArchiveName = string.Format( "{0}{1}{2}", folder2Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random()); string itemArchivePath = string.Format( "{0}{1}/{2}/{3}", ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName); new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null) .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); Assert.That(folder1, Is.Not.Null, "Could not find folder a"); InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); Assert.That(folder2, Is.Not.Null, "Could not find folder b"); }