aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/EstateTests.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/Tests/EstateTests.cs (renamed from OpenSim/Data/Tests/BasicEstateTest.cs)98
1 files changed, 66 insertions, 32 deletions
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/EstateTests.cs
index d14d405..d6eed3d 100644
--- a/OpenSim/Data/Tests/BasicEstateTest.cs
+++ b/OpenSim/Data/Tests/EstateTests.cs
@@ -35,13 +35,57 @@ using OpenSim.Region.Framework.Interfaces;
35using System.Text; 35using System.Text;
36using log4net; 36using log4net;
37using System.Reflection; 37using System.Reflection;
38using System.Data.Common;
39
40#if !NUNIT25
41using NUnit.Framework.SyntaxHelpers;
42#endif
43
44
45// DBMS-specific:
46using MySql.Data.MySqlClient;
47using OpenSim.Data.MySQL;
48
49using System.Data.SqlClient;
50using OpenSim.Data.MSSQL;
51
52using Mono.Data.Sqlite;
53using OpenSim.Data.SQLite;
54
38 55
39namespace OpenSim.Data.Tests 56namespace OpenSim.Data.Tests
40{ 57{
41 public class BasicEstateTest 58
59#if NUNIT25
60
61 [TestFixture(typeof(MySqlConnection), typeof(MySQLEstateStore), Description = "Estate store tests (MySQL)")]
62 [TestFixture(typeof(SqlConnection), typeof(MSSQLEstateStore), Description = "Estate store tests (MS SQL Server)")]
63 [TestFixture(typeof(SqliteConnection), typeof(SQLiteEstateStore), Description = "Estate store tests (SQLite)")]
64
65#else
66
67 [TestFixture(Description = "Estate store tests (SQLite)")]
68 public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore>
69 {
70 }
71
72 [TestFixture(Description = "Estate store tests (MySQL)")]
73 public class MySqlEstateTests : EstateTests<MySqlConnection, MySQLEstateStore>
74 {
75 }
76
77 [TestFixture(Description = "Estate store tests (MS SQL Server)")]
78 public class MSSQLEstateTests : EstateTests<SqlConnection, MSSQLEstateStore>
79 {
80 }
81
82#endif
83
84 public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore>
85 where TConn : DbConnection, new()
86 where TEstateStore : class, IEstateDataStore, new()
42 { 87 {
43 public IEstateDataStore db; 88 public IEstateDataStore db;
44 public IRegionDataStore regionDb;
45 89
46 public static UUID REGION_ID = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7"); 90 public static UUID REGION_ID = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7");
47 91
@@ -54,9 +98,25 @@ namespace OpenSim.Data.Tests
54 public static UUID GROUP_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed5"); 98 public static UUID GROUP_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed5");
55 public static UUID GROUP_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed6"); 99 public static UUID GROUP_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed6");
56 100
57 public void SuperInit() 101 protected override void InitService(object service)
102 {
103 ClearDB();
104 db = (IEstateDataStore)service;
105 db.Initialise(m_connStr);
106 }
107
108 private void ClearDB()
58 { 109 {
59 OpenSim.Tests.Common.TestLogging.LogToConsole(); 110 // if a new table is added, it has to be dropped here
111 DropTables(
112 "estate_managers",
113 "estate_groups",
114 "estate_users",
115 "estateban",
116 "estate_settings",
117 "estate_map"
118 );
119 ResetMigrations("EstateStore");
60 } 120 }
61 121
62 #region 0Tests 122 #region 0Tests
@@ -292,8 +352,7 @@ namespace OpenSim.Data.Tests
292 // Letting estate store generate rows to database for us 352 // Letting estate store generate rows to database for us
293 EstateSettings originalSettings = db.LoadEstateSettings(regionId, true); 353 EstateSettings originalSettings = db.LoadEstateSettings(regionId, true);
294 354
295 SetEstateSettings( 355 SetEstateSettings(originalSettings,
296 originalSettings,
297 estateName, 356 estateName,
298 parentEstateID, 357 parentEstateID,
299 billableFactor, 358 billableFactor,
@@ -319,30 +378,6 @@ namespace OpenSim.Data.Tests
319 estateOwner 378 estateOwner
320 ); 379 );
321 380
322 originalSettings.EstateName = estateName;
323 originalSettings.ParentEstateID = parentEstateID;
324 originalSettings.BillableFactor = billableFactor;
325 originalSettings.PricePerMeter = pricePerMeter;
326 originalSettings.RedirectGridX = redirectGridX;
327 originalSettings.RedirectGridY = redirectGridY;
328 originalSettings.UseGlobalTime = useGlobalTime;
329 originalSettings.FixedSun = fixedSun;
330 originalSettings.SunPosition = sunPosition;
331 originalSettings.AllowVoice = allowVoice;
332 originalSettings.AllowDirectTeleport = allowDirectTeleport;
333 originalSettings.ResetHomeOnTeleport = resetHomeOnTeleport;
334 originalSettings.DenyAnonymous = denyAnonymous;
335 originalSettings.DenyIdentified = denyIdentified;
336 originalSettings.DenyTransacted = denyTransacted;
337 originalSettings.DenyMinors = denyMinors;
338 originalSettings.AbuseEmailToEstateOwner = abuseEmailToEstateOwner;
339 originalSettings.BlockDwell = blockDwell;
340 originalSettings.EstateSkipScripts = estateSkipScripts;
341 originalSettings.TaxFree = taxFree;
342 originalSettings.PublicAccess = publicAccess;
343 originalSettings.AbuseEmail = abuseEmail;
344 originalSettings.EstateOwner = estateOwner;
345
346 // Saving settings. 381 // Saving settings.
347 db.StoreEstateSettings(originalSettings); 382 db.StoreEstateSettings(originalSettings);
348 383
@@ -350,8 +385,7 @@ namespace OpenSim.Data.Tests
350 EstateSettings loadedSettings = db.LoadEstateSettings(regionId, true); 385 EstateSettings loadedSettings = db.LoadEstateSettings(regionId, true);
351 386
352 // Checking that loaded values are correct. 387 // Checking that loaded values are correct.
353 ValidateEstateSettings( 388 ValidateEstateSettings(loadedSettings,
354 loadedSettings,
355 estateName, 389 estateName,
356 parentEstateID, 390 parentEstateID,
357 billableFactor, 391 billableFactor,