diff options
author | Charles Krinke | 2009-01-11 18:24:16 +0000 |
---|---|---|
committer | Charles Krinke | 2009-01-11 18:24:16 +0000 |
commit | 40f34aeffd64e2aa81cecb2e861f60d6e8886198 (patch) | |
tree | 5d0059eb7aa70799c8239bb273efc997138cabb5 /OpenSim/Data/Tests/BasicRegionTest.cs | |
parent | Thank you kindly, Tlaukkan (Tommil) for a patch that: (diff) | |
download | opensim-SC_OLD-40f34aeffd64e2aa81cecb2e861f60d6e8886198.zip opensim-SC_OLD-40f34aeffd64e2aa81cecb2e861f60d6e8886198.tar.gz opensim-SC_OLD-40f34aeffd64e2aa81cecb2e861f60d6e8886198.tar.bz2 opensim-SC_OLD-40f34aeffd64e2aa81cecb2e861f60d6e8886198.tar.xz |
Thank you kindly, Tlaukkan (Tommil) for a patch that:
Fixed all NHibernate unit tests by implementing missing persistency
methods, tables, columns and fixing bugs in the existing implementation.
Two minor changes to classes outside NHibernate module: Added Scene
instantiation for SceneObjectGroup in OpenSim.Data.Tests.BasicRegionTest
as this was required by the NHibernate persistency. In the process added
also mock constructor to Scene which only populates RegionInfo in the scene
which is used by ScenePart.RegionUUID. NHibernate module is still in
experimental state and has not been tested at opensim region or ugaim runtime
configuration. Adding unit tests to build is not yet advisable nor using
NHibernate module in any production setup.
Diffstat (limited to 'OpenSim/Data/Tests/BasicRegionTest.cs')
-rw-r--r-- | OpenSim/Data/Tests/BasicRegionTest.cs | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index e5c6132..a0591fa 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs | |||
@@ -130,8 +130,8 @@ namespace OpenSim.Data.Tests | |||
130 | [Test] | 130 | [Test] |
131 | public void T010_StoreSimpleObject() | 131 | public void T010_StoreSimpleObject() |
132 | { | 132 | { |
133 | SceneObjectGroup sog = NewSOG("object1", prim1); | 133 | SceneObjectGroup sog = NewSOG("object1", prim1, region1); |
134 | SceneObjectGroup sog2 = NewSOG("object2", prim2); | 134 | SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); |
135 | 135 | ||
136 | // in case the objects don't store | 136 | // in case the objects don't store |
137 | try | 137 | try |
@@ -183,7 +183,7 @@ namespace OpenSim.Data.Tests | |||
183 | SceneObjectPart p1 = NewSOP("SoP 1",tmp1); | 183 | SceneObjectPart p1 = NewSOP("SoP 1",tmp1); |
184 | SceneObjectPart p2 = NewSOP("SoP 2",tmp2); | 184 | SceneObjectPart p2 = NewSOP("SoP 2",tmp2); |
185 | SceneObjectPart p3 = NewSOP("SoP 3",tmp3); | 185 | SceneObjectPart p3 = NewSOP("SoP 3",tmp3); |
186 | SceneObjectGroup sog = NewSOG("Sop 0",tmp0); | 186 | SceneObjectGroup sog = NewSOG("Sop 0", tmp0, newregion); |
187 | sog.AddPart(p1); | 187 | sog.AddPart(p1); |
188 | sog.AddPart(p2); | 188 | sog.AddPart(p2); |
189 | sog.AddPart(p3); | 189 | sog.AddPart(p3); |
@@ -246,7 +246,14 @@ namespace OpenSim.Data.Tests | |||
246 | pbshap = PrimitiveBaseShape.Default; | 246 | pbshap = PrimitiveBaseShape.Default; |
247 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); | 247 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); |
248 | byte updatef = (byte) random.Next(127); | 248 | byte updatef = (byte) random.Next(127); |
249 | 249 | ||
250 | RegionInfo regionInfo = new RegionInfo(); | ||
251 | regionInfo.RegionID = region3; | ||
252 | regionInfo.RegionLocX = 0; | ||
253 | regionInfo.RegionLocY = 0; | ||
254 | |||
255 | Scene scene = new Scene(regionInfo); | ||
256 | |||
250 | SceneObjectPart sop = new SceneObjectPart(); | 257 | SceneObjectPart sop = new SceneObjectPart(); |
251 | sop.RegionHandle = regionh; | 258 | sop.RegionHandle = regionh; |
252 | sop.UUID = uuid; | 259 | sop.UUID = uuid; |
@@ -313,9 +320,10 @@ namespace OpenSim.Data.Tests | |||
313 | Assert.That(updatef,Is.EqualTo(sop.UpdateFlag)); | 320 | Assert.That(updatef,Is.EqualTo(sop.UpdateFlag)); |
314 | 321 | ||
315 | // This is necessary or object will not be inserted in DB | 322 | // This is necessary or object will not be inserted in DB |
316 | sop.ObjectFlags = 0; | 323 | sop.ObjectFlags = 0; |
317 | 324 | ||
318 | SceneObjectGroup sog = new SceneObjectGroup(); | 325 | SceneObjectGroup sog = new SceneObjectGroup(); |
326 | sog.SetScene(scene); // Reguired by nhibernate database module. | ||
319 | sog.SetRootPart(sop); | 327 | sog.SetRootPart(sop); |
320 | 328 | ||
321 | // Inserts group in DB | 329 | // Inserts group in DB |
@@ -365,7 +373,6 @@ namespace OpenSim.Data.Tests | |||
365 | [Test] | 373 | [Test] |
366 | public void T014_UpdateObject() | 374 | public void T014_UpdateObject() |
367 | { | 375 | { |
368 | |||
369 | string text1 = "object1 text"; | 376 | string text1 = "object1 text"; |
370 | SceneObjectGroup sog = FindSOG("object1", region1); | 377 | SceneObjectGroup sog = FindSOG("object1", region1); |
371 | sog.RootPart.Text = text1; | 378 | sog.RootPart.Text = text1; |
@@ -373,8 +380,7 @@ namespace OpenSim.Data.Tests | |||
373 | 380 | ||
374 | sog = FindSOG("object1", region1); | 381 | sog = FindSOG("object1", region1); |
375 | Assert.That(text1, Is.EqualTo(sog.RootPart.Text)); | 382 | Assert.That(text1, Is.EqualTo(sog.RootPart.Text)); |
376 | 383 | ||
377 | |||
378 | // Creates random values | 384 | // Creates random values |
379 | UUID creator = new UUID(); | 385 | UUID creator = new UUID(); |
380 | creator = UUID.Random(); | 386 | creator = UUID.Random(); |
@@ -474,7 +480,7 @@ namespace OpenSim.Data.Tests | |||
474 | { | 480 | { |
475 | UUID id = UUID.Random(); | 481 | UUID id = UUID.Random(); |
476 | Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); | 482 | Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); |
477 | SceneObjectGroup sog = NewSOG("Test SOG",id); | 483 | SceneObjectGroup sog = NewSOG("Test SOG", id, region4); |
478 | mydic.Add(sog.RootPart.UUID,sog.RootPart); | 484 | mydic.Add(sog.RootPart.UUID,sog.RootPart); |
479 | for (int i=0;i<30;i++) | 485 | for (int i=0;i<30;i++) |
480 | { | 486 | { |
@@ -888,9 +894,18 @@ namespace OpenSim.Data.Tests | |||
888 | { | 894 | { |
889 | SceneObjectPart p = sog.RootPart; | 895 | SceneObjectPart p = sog.RootPart; |
890 | if (p.Name == name) { | 896 | if (p.Name == name) { |
897 | RegionInfo regionInfo = new RegionInfo(); | ||
898 | regionInfo.RegionID = r; | ||
899 | regionInfo.RegionLocX = 0; | ||
900 | regionInfo.RegionLocY = 0; | ||
901 | |||
902 | Scene scene = new Scene(regionInfo); | ||
903 | sog.SetScene(scene); | ||
904 | |||
891 | return sog; | 905 | return sog; |
892 | } | 906 | } |
893 | } | 907 | } |
908 | |||
894 | return null; | 909 | return null; |
895 | } | 910 | } |
896 | 911 | ||
@@ -906,8 +921,15 @@ namespace OpenSim.Data.Tests | |||
906 | // causes the application to crash at the database layer because of null values | 921 | // causes the application to crash at the database layer because of null values |
907 | // in NOT NULL fields | 922 | // in NOT NULL fields |
908 | // | 923 | // |
909 | private SceneObjectGroup NewSOG(string name, UUID uuid) | 924 | private SceneObjectGroup NewSOG(string name, UUID uuid, UUID regionId) |
910 | { | 925 | { |
926 | RegionInfo regionInfo = new RegionInfo(); | ||
927 | regionInfo.RegionID = regionId; | ||
928 | regionInfo.RegionLocX = 0; | ||
929 | regionInfo.RegionLocY = 0; | ||
930 | |||
931 | Scene scene = new Scene(regionInfo); | ||
932 | |||
911 | SceneObjectPart sop = new SceneObjectPart(); | 933 | SceneObjectPart sop = new SceneObjectPart(); |
912 | sop.Name = name; | 934 | sop.Name = name; |
913 | sop.Description = name; | 935 | sop.Description = name; |
@@ -916,9 +938,11 @@ namespace OpenSim.Data.Tests | |||
916 | sop.TouchName = RandomName(); | 938 | sop.TouchName = RandomName(); |
917 | sop.UUID = uuid; | 939 | sop.UUID = uuid; |
918 | sop.Shape = PrimitiveBaseShape.Default; | 940 | sop.Shape = PrimitiveBaseShape.Default; |
919 | 941 | ||
920 | SceneObjectGroup sog = new SceneObjectGroup(); | 942 | SceneObjectGroup sog = new SceneObjectGroup(); |
943 | sog.SetScene(scene); | ||
921 | sog.SetRootPart(sop); | 944 | sog.SetRootPart(sop); |
945 | |||
922 | return sog; | 946 | return sog; |
923 | } | 947 | } |
924 | 948 | ||