From f97059719431c81d8526ecbfa8ed9de0700fff28 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 10 Sep 2008 17:49:41 +0000 Subject: [PATCH] added the first couple of sqlite tests. we'll see how bamboo handles them. --- .nant/bamboo.build | 2 + .nant/local.include | 2 + OpenSim/Data/SQLite/SQLiteRegionData.cs | 2 +- OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs | 53 ++++++++++++++++++- 4 files changed, 57 insertions(+), 2 deletions(-) diff --git a/.nant/bamboo.build b/.nant/bamboo.build index 7e4a9fcbd5..3b2ec1a39f 100644 --- a/.nant/bamboo.build +++ b/.nant/bamboo.build @@ -40,6 +40,8 @@ + + diff --git a/.nant/local.include b/.nant/local.include index 1612358433..df27359d9d 100644 --- a/.nant/local.include +++ b/.nant/local.include @@ -1,3 +1,5 @@ + + diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 986687c65e..8fbc80d202 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -211,7 +211,7 @@ namespace OpenSim.Data.SQLite && (prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Temporary) == 0 && (prim.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) == 0) { - //m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); + m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); addPrim(prim, obj.UUID, regionUUID); } else if (prim.Stopped) diff --git a/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs b/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs index 725573ee29..af3bfae032 100644 --- a/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs +++ b/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs @@ -26,8 +26,12 @@ */ using System; +using System.Collections.Generic; using NUnit.Framework; +using OpenSim.Framework; using OpenSim.Data.SQLite; +using OpenSim.Region.Environment.Scenes; +using OpenMetaverse; namespace OpenSim.Data.SQLite.Tests { @@ -37,13 +41,60 @@ namespace OpenSim.Data.SQLite.Tests public string file = "regiontest.db"; public string connect; public SQLiteRegionData db; + public UUID region = UUID.Zero; - [SetUp] + [TestFixtureSetUp] public void Init() { + log4net.Config.XmlConfigurator.Configure(); + System.Console.WriteLine("Entering Init"); connect = "URI=file:" + file + ",version=3"; db = new SQLiteRegionData(); db.Initialise(connect); } + + [TestFixtureTearDown] + public void Cleanup() + { + System.IO.File.Delete(file); + } + + [Test] + public void T001_LoadEmpty() + { + System.Console.WriteLine("Entering T001"); + List objs = db.LoadObjects(region); + Assert.AreEqual(0, objs.Count); + } + + [Test] + public void T010_StoreObject() + { + System.Console.WriteLine("Entering T010"); + SceneObjectGroup sog = NewSOG(); + + db.StoreObject(sog, region); + + List objs = db.LoadObjects(region); + Assert.AreEqual(1, objs.Count); + } + + private SceneObjectGroup NewSOG() + { + SceneObjectGroup sog = new SceneObjectGroup(); + SceneObjectPart sop = new SceneObjectPart(); + sop.LocalId = 1; + sop.Name = ""; + sop.Description = ""; + sop.Text = ""; + sop.SitName = ""; + sop.TouchName = ""; + sop.UUID = UUID.Random(); + sop.Shape = PrimitiveBaseShape.Default; + sog.AddPart(sop); + sog.RootPart = sop; + return sog; + } + } } \ No newline at end of file