aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-05-29 16:11:33 +0000
committerJustin Clarke Casey2009-05-29 16:11:33 +0000
commitfa04937a825144b0b9d82f823b429a0436a61f5d (patch)
treec64973f55300942741c3779a7a26e781e58ba012 /OpenSim
parentsome clean up of sculpt map caching code (diff)
downloadopensim-SC_OLD-fa04937a825144b0b9d82f823b429a0436a61f5d.zip
opensim-SC_OLD-fa04937a825144b0b9d82f823b429a0436a61f5d.tar.gz
opensim-SC_OLD-fa04937a825144b0b9d82f823b429a0436a61f5d.tar.bz2
opensim-SC_OLD-fa04937a825144b0b9d82f823b429a0436a61f5d.tar.xz
* Add xml2 load test
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs143
-rw-r--r--OpenSim/Tests/Common/TestHelper.cs8
3 files changed, 148 insertions, 5 deletions
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
194 Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 194 Assert.That(gotObject2File, Is.True, "No object2 file in archive");
195 195
196 // TODO: Test presence of more files and contents of files. 196 // TODO: Test presence of more files and contents of files.
197 // Temporary
198 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
199 } 197 }
200 198
201 /// <summary> 199 /// <summary>
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net.Config;
29using NUnit.Framework;
30using NUnit.Framework.SyntaxHelpers;
31using OpenMetaverse;
32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Tests.Common;
34using OpenSim.Tests.Common.Setup;
35
36namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
37{
38 [TestFixture]
39 public class SerialiserTests
40 {
41 private string xml2 = @"
42 <SceneObjectGroup>
43 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
44 <CreatorID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></CreatorID>
45 <FolderID><UUID>9be68fdd-f740-4a0f-9675-dfbbb536b946</UUID></FolderID>
46 <InventorySerial>0</InventorySerial>
47 <TaskInventory />
48 <ObjectFlags>0</ObjectFlags>
49 <UUID><UUID>9be68fdd-f740-4a0f-9675-dfbbb536b946</UUID></UUID>
50 <LocalId>720005</LocalId>
51 <Name>PrimFun</Name>
52 <Material>0</Material>
53 <RegionHandle>1099511628032000</RegionHandle>
54 <ScriptAccessPin>0</ScriptAccessPin>
55 <GroupPosition><X>153.9854</X><Y>121.4908</Y><Z>62.21781</Z></GroupPosition>
56 <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition>
57 <RotationOffset><X>0</X><Y>0</Y><Z>0</Z><W>1</W></RotationOffset>
58 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
59 <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity>
60 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
61 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
62 <Description />
63 <Color />
64 <Text />
65 <SitName />
66 <TouchName />
67 <LinkNum>0</LinkNum>
68 <ClickAction>0</ClickAction>
69 <Shape>
70 <PathBegin>0</PathBegin>
71 <PathCurve>16</PathCurve>
72 <PathEnd>0</PathEnd>
73 <PathRadiusOffset>0</PathRadiusOffset>
74 <PathRevolutions>0</PathRevolutions>
75 <PathScaleX>200</PathScaleX>
76 <PathScaleY>200</PathScaleY>
77 <PathShearX>0</PathShearX>
78 <PathShearY>0</PathShearY>
79 <PathSkew>0</PathSkew>
80 <PathTaperX>0</PathTaperX>
81 <PathTaperY>0</PathTaperY>
82 <PathTwist>0</PathTwist>
83 <PathTwistBegin>0</PathTwistBegin>
84 <PCode>9</PCode>
85 <ProfileBegin>0</ProfileBegin>
86 <ProfileEnd>0</ProfileEnd>
87 <ProfileHollow>0</ProfileHollow>
88 <Scale><X>1.283131</X><Y>5.903858</Y><Z>4.266288</Z></Scale>
89 <State>0</State>
90 <ProfileShape>Circle</ProfileShape>
91 <HollowShape>Same</HollowShape>
92 <ProfileCurve>0</ProfileCurve>
93 <TextureEntry>iVVnRyTLQ+2SC0fK7RVGXwJ6yc/SU4RDA5nhJbLUw3R1AAAAAAAAaOw8QQOhPSRAAKE9JEAAAAAAAAAAAAAAAAAAAAA=</TextureEntry>
94 <ExtraParams>AA==</ExtraParams>
95 </Shape>
96 <Scale><X>1.283131</X><Y>5.903858</Y><Z>4.266288</Z></Scale>
97 <UpdateFlag>0</UpdateFlag>
98 <SitTargetOrientation><w>0</w><x>0</x><y>0</y><z>1</z></SitTargetOrientation>
99 <SitTargetPosition><x>0</x><y>0</y><z>0</z></SitTargetPosition>
100 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
101 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>1</Z><W>0</W></SitTargetOrientationLL>
102 <ParentID>0</ParentID>
103 <CreationDate>1216066902</CreationDate>
104 <Category>0</Category>
105 <SalePrice>0</SalePrice>
106 <ObjectSaleType>0</ObjectSaleType>
107 <OwnershipCost>0</OwnershipCost>
108 <GroupID><UUID>00000000-0000-0000-0000-000000000000</UUID></GroupID>
109 <OwnerID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></OwnerID>
110 <LastOwnerID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></LastOwnerID>
111 <BaseMask>2147483647</BaseMask>
112 <OwnerMask>2147483647</OwnerMask>
113 <GroupMask>0</GroupMask>
114 <EveryoneMask>0</EveryoneMask>
115 <NextOwnerMask>2147483647</NextOwnerMask>
116 <Flags>None</Flags>
117 <SitTargetAvatar><UUID>00000000-0000-0000-0000-000000000000</UUID></SitTargetAvatar>
118 </SceneObjectPart>
119 <OtherParts />
120 </SceneObjectGroup>";
121
122 [Test]
123 public void TestLoadXml2()
124 {
125 TestHelper.InMethod();
126 //log4net.Config.XmlConfigurator.Configure();
127
128 SerialiserModule serialiserModule = new SerialiserModule();
129
130 Scene scene = SceneSetupHelpers.SetupScene(false);
131 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule);
132
133 SceneObjectGroup so = serialiserModule.DeserializeGroupFromXml2(xml2);
134 SceneObjectPart rootPart = so.RootPart;
135
136 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946")));
137 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef")));
138 Assert.That(rootPart.Name, Is.EqualTo("PrimFun"));
139
140 // TODO: Check other properties
141 }
142 }
143} \ 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
47 47
48 return false; 48 return false;
49 } 49 }
50 50
51 // A debugging method that can be used to print out which test method you are in 51 /// <summary>
52 /// A debugging method that can be used to print out which test method you are in
53 /// </summary>
52 public static void InMethod() 54 public static void InMethod()
53 { 55 {
54 StackTrace stackTrace = new StackTrace(); 56 StackTrace stackTrace = new StackTrace();
55 Console.WriteLine("In Test Method : {0}", stackTrace.GetFrame(1).GetMethod().Name); 57 Console.WriteLine("==> In Test Method : {0}", stackTrace.GetFrame(1).GetMethod().Name);
56 } 58 }
57 } 59 }
58} 60}