From fa04937a825144b0b9d82f823b429a0436a61f5d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 29 May 2009 16:11:33 +0000 Subject: * Add xml2 load test --- .../World/Archiver/Tests/ArchiverTests.cs | 2 - .../World/Serialiser/Tests/SerialiserTests.cs | 143 +++++++++++++++++++++ OpenSim/Tests/Common/TestHelper.cs | 8 +- 3 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 7e86ec1..984b942 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -194,8 +194,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Assert.That(gotObject2File, Is.True, "No object2 file in archive"); // TODO: Test presence of more files and contents of files. - // Temporary - Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); } /// diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs new file mode 100644 index 0000000..3d8fb44 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -0,0 +1,143 @@ +/* + * 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 OpenSim 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 log4net.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.CoreModules.World.Serialiser.Tests +{ + [TestFixture] + public class SerialiserTests + { + private string xml2 = @" + + + b46ef588-411e-4a8b-a284-d7dcfe8e74ef + 9be68fdd-f740-4a0f-9675-dfbbb536b946 + 0 + + 0 + 9be68fdd-f740-4a0f-9675-dfbbb536b946 + 720005 + PrimFun + 0 + 1099511628032000 + 0 + 153.9854121.490862.21781 + 000 + 0001 + 000 + 000 + 000 + 000 + + + + + + 0 + 0 + + 0 + 16 + 0 + 0 + 0 + 200 + 200 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 9 + 0 + 0 + 0 + 1.2831315.9038584.266288 + 0 + Circle + Same + 0 + iVVnRyTLQ+2SC0fK7RVGXwJ6yc/SU4RDA5nhJbLUw3R1AAAAAAAAaOw8QQOhPSRAAKE9JEAAAAAAAAAAAAAAAAAAAAA= + AA== + + 1.2831315.9038584.266288 + 0 + 0001 + 000 + 000 + 0010 + 0 + 1216066902 + 0 + 0 + 0 + 0 + 00000000-0000-0000-0000-000000000000 + b46ef588-411e-4a8b-a284-d7dcfe8e74ef + b46ef588-411e-4a8b-a284-d7dcfe8e74ef + 2147483647 + 2147483647 + 0 + 0 + 2147483647 + None + 00000000-0000-0000-0000-000000000000 + + + "; + + [Test] + public void TestLoadXml2() + { + TestHelper.InMethod(); + //log4net.Config.XmlConfigurator.Configure(); + + SerialiserModule serialiserModule = new SerialiserModule(); + + Scene scene = SceneSetupHelpers.SetupScene(false); + SceneSetupHelpers.SetupSceneModules(scene, serialiserModule); + + SceneObjectGroup so = serialiserModule.DeserializeGroupFromXml2(xml2); + SceneObjectPart rootPart = so.RootPart; + + Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); + Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef"))); + Assert.That(rootPart.Name, Is.EqualTo("PrimFun")); + + // TODO: Check other properties + } + } +} \ No newline at end of file diff --git a/OpenSim/Tests/Common/TestHelper.cs b/OpenSim/Tests/Common/TestHelper.cs index 21c2875..588c9fa 100644 --- a/OpenSim/Tests/Common/TestHelper.cs +++ b/OpenSim/Tests/Common/TestHelper.cs @@ -47,12 +47,14 @@ namespace OpenSim.Tests.Common return false; } - - // A debugging method that can be used to print out which test method you are in + + /// + /// A debugging method that can be used to print out which test method you are in + /// public static void InMethod() { StackTrace stackTrace = new StackTrace(); - Console.WriteLine("In Test Method : {0}", stackTrace.GetFrame(1).GetMethod().Name); + Console.WriteLine("==> In Test Method : {0}", stackTrace.GetFrame(1).GetMethod().Name); } } } -- cgit v1.1