diff options
author | Melanie | 2013-08-13 22:53:47 +0100 |
---|---|---|
committer | Melanie | 2013-08-13 22:53:47 +0100 |
commit | 4a6eff1ee83f88a188936a1a0d4a2c55924ef1c6 (patch) | |
tree | 245e7c3257c8c6c29356ba5c1eb61ae50a127226 /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into careminster (diff) | |
parent | minor: Eliminate one of the duplicate 'have's in the HG message telling the u... (diff) | |
download | opensim-SC-4a6eff1ee83f88a188936a1a0d4a2c55924ef1c6.zip opensim-SC-4a6eff1ee83f88a188936a1a0d4a2c55924ef1c6.tar.gz opensim-SC-4a6eff1ee83f88a188936a1a0d4a2c55924ef1c6.tar.bz2 opensim-SC-4a6eff1ee83f88a188936a1a0d4a2c55924ef1c6.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 113 |
1 files changed, 112 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 7c8c189..35045b5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -799,7 +799,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
799 | } | 799 | } |
800 | 800 | ||
801 | [Test] | 801 | [Test] |
802 | public void TestSameSimulatorNeighbouringRegionsTeleport() | 802 | public void TestSameSimulatorNeighbouringRegionsTeleportV1() |
803 | { | 803 | { |
804 | TestHelpers.InMethod(); | 804 | TestHelpers.InMethod(); |
805 | // TestHelpers.EnableLogging(); | 805 | // TestHelpers.EnableLogging(); |
@@ -904,5 +904,116 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
904 | // Check events | 904 | // Check events |
905 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); | 905 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); |
906 | } | 906 | } |
907 | |||
908 | [Test] | ||
909 | public void TestSameSimulatorNeighbouringRegionsTeleportV2() | ||
910 | { | ||
911 | TestHelpers.InMethod(); | ||
912 | // TestHelpers.EnableLogging(); | ||
913 | |||
914 | BaseHttpServer httpServer = new BaseHttpServer(99999); | ||
915 | MainServer.AddHttpServer(httpServer); | ||
916 | MainServer.Instance = httpServer; | ||
917 | |||
918 | AttachmentsModule attModA = new AttachmentsModule(); | ||
919 | AttachmentsModule attModB = new AttachmentsModule(); | ||
920 | EntityTransferModule etmA = new EntityTransferModule(); | ||
921 | EntityTransferModule etmB = new EntityTransferModule(); | ||
922 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
923 | |||
924 | IConfigSource config = new IniConfigSource(); | ||
925 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
926 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
927 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
928 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | ||
929 | |||
930 | modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
931 | |||
932 | SceneHelpers sh = new SceneHelpers(); | ||
933 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
934 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); | ||
935 | |||
936 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
937 | SceneHelpers.SetupSceneModules( | ||
938 | sceneA, config, new CapabilitiesModule(), etmA, attModA, new BasicInventoryAccessModule()); | ||
939 | SceneHelpers.SetupSceneModules( | ||
940 | sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); | ||
941 | |||
942 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); | ||
943 | |||
944 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); | ||
945 | TestClient tc = new TestClient(acd, sceneA); | ||
946 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
947 | EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); | ||
948 | |||
949 | ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); | ||
950 | beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); | ||
951 | |||
952 | Assert.That(destinationTestClients.Count, Is.EqualTo(1)); | ||
953 | Assert.That(destinationTestClients[0], Is.Not.Null); | ||
954 | |||
955 | InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20); | ||
956 | |||
957 | sceneA.AttachmentsModule.RezSingleAttachmentFromInventory( | ||
958 | beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest); | ||
959 | |||
960 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
961 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
962 | |||
963 | // Here, we need to make clientA's receipt of SendRegionTeleport trigger clientB's CompleteMovement(). This | ||
964 | // is to operate the teleport V2 mechanism where the EntityTransferModule will first request the client to | ||
965 | // CompleteMovement to the region and then call UpdateAgent to the destination region to confirm the receipt | ||
966 | // Both these operations will occur on different threads and will wait for each other. | ||
967 | // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1 | ||
968 | // test protocol, where we are trying to avoid unpredictable async operations in regression tests. | ||
969 | ((TestClient)beforeTeleportSp.ControllingClient).OnTestClientSendRegionTeleport | ||
970 | += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) | ||
971 | => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null); | ||
972 | |||
973 | m_numberOfAttachEventsFired = 0; | ||
974 | sceneA.RequestTeleportLocation( | ||
975 | beforeTeleportSp.ControllingClient, | ||
976 | sceneB.RegionInfo.RegionHandle, | ||
977 | teleportPosition, | ||
978 | teleportLookAt, | ||
979 | (uint)TeleportFlags.ViaLocation); | ||
980 | |||
981 | // Check attachments have made it into sceneB | ||
982 | ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID); | ||
983 | |||
984 | // This is appearance data, as opposed to actually rezzed attachments | ||
985 | List<AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments(); | ||
986 | Assert.That(sceneBAttachments.Count, Is.EqualTo(1)); | ||
987 | Assert.That(sceneBAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest)); | ||
988 | Assert.That(sceneBAttachments[0].ItemID, Is.EqualTo(attItem.ID)); | ||
989 | Assert.That(sceneBAttachments[0].AssetID, Is.EqualTo(attItem.AssetID)); | ||
990 | Assert.That(afterTeleportSceneBSp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); | ||
991 | |||
992 | // This is the actual attachment | ||
993 | List<SceneObjectGroup> actualSceneBAttachments = afterTeleportSceneBSp.GetAttachments(); | ||
994 | Assert.That(actualSceneBAttachments.Count, Is.EqualTo(1)); | ||
995 | SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0]; | ||
996 | Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name)); | ||
997 | Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); | ||
998 | |||
999 | Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1)); | ||
1000 | |||
1001 | // Check attachments have been removed from sceneA | ||
1002 | ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID); | ||
1003 | |||
1004 | // Since this is appearance data, it is still present on the child avatar! | ||
1005 | List<AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments(); | ||
1006 | Assert.That(sceneAAttachments.Count, Is.EqualTo(1)); | ||
1007 | Assert.That(afterTeleportSceneASp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); | ||
1008 | |||
1009 | // This is the actual attachment, which should no longer exist | ||
1010 | List<SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments(); | ||
1011 | Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0)); | ||
1012 | |||
1013 | Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0)); | ||
1014 | |||
1015 | // Check events | ||
1016 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); | ||
1017 | } | ||
907 | } | 1018 | } |
908 | } | 1019 | } |