aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/BasicGridTest.cs
diff options
context:
space:
mode:
authorDiva Canto2009-08-17 05:55:38 -0700
committerDiva Canto2009-08-17 05:55:38 -0700
commitfa8a94577a2f38145da0c8a1f6d1c72c4f339ed9 (patch)
tree7bee741b06e6732fae848bef3c6b7f808ab3349a /OpenSim/Data/Tests/BasicGridTest.cs
parentBumped up grid services interface number. (diff)
parentAdd System.Xml reference to the console project (diff)
downloadopensim-SC_OLD-fa8a94577a2f38145da0c8a1f6d1c72c4f339ed9.zip
opensim-SC_OLD-fa8a94577a2f38145da0c8a1f6d1c72c4f339ed9.tar.gz
opensim-SC_OLD-fa8a94577a2f38145da0c8a1f6d1c72c4f339ed9.tar.bz2
opensim-SC_OLD-fa8a94577a2f38145da0c8a1f6d1c72c4f339ed9.tar.xz
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Data/Tests/BasicGridTest.cs')
-rw-r--r--OpenSim/Data/Tests/BasicGridTest.cs97
1 files changed, 17 insertions, 80 deletions
diff --git a/OpenSim/Data/Tests/BasicGridTest.cs b/OpenSim/Data/Tests/BasicGridTest.cs
index 85273c5..de8fb48 100644
--- a/OpenSim/Data/Tests/BasicGridTest.cs
+++ b/OpenSim/Data/Tests/BasicGridTest.cs
@@ -28,81 +28,47 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using log4net.Config;
32using NUnit.Framework; 31using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers; 32using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 33using OpenMetaverse;
35using log4net;
36using System.Reflection;
37 34
38namespace OpenSim.Data.Tests 35namespace OpenSim.Data.Tests
39{ 36{
40 public class BasicGridTest 37 public class BasicGridTest
41 { 38 {
42 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 public IGridDataPlugin db;
43 public GridDataBase db;
44 public UUID region1, region2, region3; 40 public UUID region1, region2, region3;
45 public UUID zero = UUID.Zero; 41 public UUID zero = UUID.Zero;
46 public static Random random; 42 public static Random random = new Random();
47 43
48 [TearDown] 44 [TearDown]
49 public void removeAllRegions() 45 public void removeAllRegions()
50 { 46 {
51 // Clean up all the regions. 47 // Clean up all the regions.
52 foreach (RegionProfileData region in db.GetRegionsByName("", 100)) 48 List<RegionProfileData> regions = db.GetRegionsByName("", 100);
49 if (regions != null)
53 { 50 {
54 db.DeleteProfile(region.Uuid.ToString()); 51 foreach (RegionProfileData region in regions)
52 {
53 db.DeleteProfile(region.Uuid.ToString());
54 }
55 } 55 }
56 } 56 }
57 57
58 public void SuperInit() 58 public void SuperInit()
59 { 59 {
60 try 60 OpenSim.Tests.Common.TestLogging.LogToConsole();
61 {
62 XmlConfigurator.Configure();
63 }
64 catch (Exception)
65 {
66 // I don't care, just leave log4net off
67 }
68 region1 = UUID.Random(); 61 region1 = UUID.Random();
69 region2 = UUID.Random(); 62 region2 = UUID.Random();
70 region3 = UUID.Random(); 63 region3 = UUID.Random();
71 random = new Random();
72 } 64 }
73 65
74 protected RegionProfileData createRegion(UUID regionUUID, string regionName) 66 protected RegionProfileData createRegion(UUID regionUUID, string regionName)
75 { 67 {
76 RegionProfileData reg = new RegionProfileData(); 68 RegionProfileData reg = new RegionProfileData();
69 new PropertyScrambler<RegionProfileData>().Scramble(reg);
77 reg.Uuid = regionUUID; 70 reg.Uuid = regionUUID;
78 reg.RegionName = regionName; 71 reg.RegionName = regionName;
79 reg.RegionHandle = (ulong) random.Next();
80 reg.RegionLocX = (uint) random.Next();
81 reg.RegionLocY = (uint) random.Next();
82 reg.RegionLocZ = (uint) random.Next();
83 reg.RegionSendKey = RandomName();
84 reg.RegionRecvKey = RandomName();
85 reg.RegionSecret = RandomName();
86 reg.RegionOnline = false;
87 reg.ServerIP = RandomName();
88 reg.ServerPort = (uint) random.Next();
89 reg.ServerURI = RandomName();
90 reg.ServerHttpPort = (uint) random.Next();
91 reg.ServerRemotingPort = (uint) random.Next();
92 reg.NorthOverrideHandle = (ulong) random.Next();
93 reg.SouthOverrideHandle = (ulong) random.Next();
94 reg.EastOverrideHandle = (ulong) random.Next();
95 reg.WestOverrideHandle = (ulong) random.Next();
96 reg.RegionDataURI = RandomName();
97 reg.RegionAssetURI = RandomName();
98 reg.RegionAssetSendKey = RandomName();
99 reg.RegionAssetRecvKey = RandomName();
100 reg.RegionUserURI = RandomName();
101 reg.RegionUserSendKey = RandomName();
102 reg.RegionUserRecvKey = RandomName();
103 reg.RegionMapTextureID = UUID.Random();
104 reg.Owner_uuid = UUID.Random();
105 reg.OriginUUID = UUID.Random();
106 72
107 db.AddProfile(reg); 73 db.AddProfile(reg);
108 74
@@ -119,47 +85,12 @@ namespace OpenSim.Data.Tests
119 } 85 }
120 86
121 [Test] 87 [Test]
122 public void T999_StillNull()
123 {
124 Assert.That(db.GetProfileByUUID(zero),Is.Null);
125 }
126
127 [Test]
128 public void T011_AddRetrieveCompleteTest() 88 public void T011_AddRetrieveCompleteTest()
129 { 89 {
130 RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|"); 90 RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|");
131 RegionProfileData retreg = db.GetProfileByUUID(region2); 91 RegionProfileData retreg = db.GetProfileByUUID(region2);
132 92
133 Assert.That(retreg.RegionName, Is.EqualTo(newreg.RegionName), "Assert.That(retreg.RegionName, Is.EqualTo(newreg.RegionName))"); 93 Assert.That(retreg, Constraints.PropertyCompareConstraint(newreg).IgnoreProperty(x => x.RegionOnline));
134 Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))");
135 Assert.That(retreg.RegionHandle, Is.EqualTo(newreg.RegionHandle), "Assert.That(retreg.RegionHandle, Is.EqualTo(newreg.RegionHandle))");
136 Assert.That(retreg.RegionLocX, Is.EqualTo(newreg.RegionLocX), "Assert.That(retreg.RegionLocX, Is.EqualTo(newreg.RegionLocX))");
137 Assert.That(retreg.RegionLocY, Is.EqualTo(newreg.RegionLocY), "Assert.That(retreg.RegionLocY, Is.EqualTo(newreg.RegionLocY))");
138 Assert.That(retreg.RegionLocZ, Is.EqualTo(newreg.RegionLocZ), "Assert.That(retreg.RegionLocZ, Is.EqualTo(newreg.RegionLocZ))");
139 Assert.That(retreg.RegionSendKey, Is.EqualTo(newreg.RegionSendKey), "Assert.That(retreg.RegionSendKey, Is.EqualTo(newreg.RegionSendKey))");
140 Assert.That(retreg.RegionRecvKey, Is.EqualTo(newreg.RegionRecvKey), "Assert.That(retreg.RegionRecvKey, Is.EqualTo(newreg.RegionRecvKey))");
141 Assert.That(retreg.RegionSecret, Is.EqualTo(newreg.RegionSecret), "Assert.That(retreg.RegionSecret, Is.EqualTo(newreg.RegionSecret))");
142 Assert.That(retreg.RegionOnline, Is.EqualTo(newreg.RegionOnline), "Assert.That(retreg.RegionOnline, Is.EqualTo(newreg.RegionOnline))");
143 Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID), "Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID))");
144 Assert.That(retreg.ServerIP, Is.EqualTo(newreg.ServerIP), "Assert.That(retreg.ServerIP, Is.EqualTo(newreg.ServerIP))");
145 Assert.That(retreg.ServerPort, Is.EqualTo(newreg.ServerPort), "Assert.That(retreg.ServerPort, Is.EqualTo(newreg.ServerPort))");
146 Assert.That(retreg.ServerURI, Is.EqualTo(newreg.ServerURI), "Assert.That(retreg.ServerURI, Is.EqualTo(newreg.ServerURI))");
147 Assert.That(retreg.ServerHttpPort, Is.EqualTo(newreg.ServerHttpPort), "Assert.That(retreg.ServerHttpPort, Is.EqualTo(newreg.ServerHttpPort))");
148 Assert.That(retreg.ServerRemotingPort, Is.EqualTo(newreg.ServerRemotingPort), "Assert.That(retreg.ServerRemotingPort, Is.EqualTo(newreg.ServerRemotingPort))");
149 Assert.That(retreg.NorthOverrideHandle, Is.EqualTo(newreg.NorthOverrideHandle), "Assert.That(retreg.NorthOverrideHandle, Is.EqualTo(newreg.NorthOverrideHandle))");
150 Assert.That(retreg.SouthOverrideHandle, Is.EqualTo(newreg.SouthOverrideHandle), "Assert.That(retreg.SouthOverrideHandle, Is.EqualTo(newreg.SouthOverrideHandle))");
151 Assert.That(retreg.EastOverrideHandle, Is.EqualTo(newreg.EastOverrideHandle), "Assert.That(retreg.EastOverrideHandle, Is.EqualTo(newreg.EastOverrideHandle))");
152 Assert.That(retreg.WestOverrideHandle, Is.EqualTo(newreg.WestOverrideHandle), "Assert.That(retreg.WestOverrideHandle, Is.EqualTo(newreg.WestOverrideHandle))");
153 Assert.That(retreg.RegionDataURI, Is.EqualTo(newreg.RegionDataURI), "Assert.That(retreg.RegionDataURI, Is.EqualTo(newreg.RegionDataURI))");
154 Assert.That(retreg.RegionAssetURI, Is.EqualTo(newreg.RegionAssetURI), "Assert.That(retreg.RegionAssetURI, Is.EqualTo(newreg.RegionAssetURI))");
155 Assert.That(retreg.RegionAssetSendKey, Is.EqualTo(newreg.RegionAssetSendKey), "Assert.That(retreg.RegionAssetSendKey, Is.EqualTo(newreg.RegionAssetSendKey))");
156 Assert.That(retreg.RegionAssetRecvKey, Is.EqualTo(newreg.RegionAssetRecvKey), "Assert.That(retreg.RegionAssetRecvKey, Is.EqualTo(newreg.RegionAssetRecvKey))");
157 Assert.That(retreg.RegionUserURI, Is.EqualTo(newreg.RegionUserURI), "Assert.That(retreg.RegionUserURI, Is.EqualTo(newreg.RegionUserURI))");
158 Assert.That(retreg.RegionUserSendKey, Is.EqualTo(newreg.RegionUserSendKey), "Assert.That(retreg.RegionUserSendKey, Is.EqualTo(newreg.RegionUserSendKey))");
159 Assert.That(retreg.RegionUserRecvKey, Is.EqualTo(newreg.RegionUserRecvKey), "Assert.That(retreg.RegionUserRecvKey, Is.EqualTo(newreg.RegionUserRecvKey))");
160 Assert.That(retreg.RegionMapTextureID, Is.EqualTo(newreg.RegionMapTextureID), "Assert.That(retreg.RegionMapTextureID, Is.EqualTo(newreg.RegionMapTextureID))");
161 Assert.That(retreg.Owner_uuid, Is.EqualTo(newreg.Owner_uuid), "Assert.That(retreg.Owner_uuid, Is.EqualTo(newreg.Owner_uuid))");
162 Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID), "Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID))");
163 94
164 retreg = db.GetProfileByHandle(newreg.RegionHandle); 95 retreg = db.GetProfileByHandle(newreg.RegionHandle);
165 Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))"); 96 Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))");
@@ -220,6 +151,12 @@ namespace OpenSim.Data.Tests
220 Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))"); 151 Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))");
221 } 152 }
222 153
154 [Test]
155 public void T999_StillNull()
156 {
157 Assert.That(db.GetProfileByUUID(zero), Is.Null);
158 }
159
223 protected static string RandomName() 160 protected static string RandomName()
224 { 161 {
225 StringBuilder name = new StringBuilder(); 162 StringBuilder name = new StringBuilder();