diff options
author | AlexRa | 2010-05-17 15:54:43 +0300 |
---|---|---|
committer | AlexRa | 2010-05-23 11:47:39 +0300 |
commit | 7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a (patch) | |
tree | 8e9893cf02218f72888d5cdb12f8bb8a21cc5698 /OpenSim/Data/Tests/RegionTests.cs | |
parent | Added generic base classes for testing database services (diff) | |
download | opensim-SC-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.zip opensim-SC-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.gz opensim-SC-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.bz2 opensim-SC-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.xz |
All data tests made DBMS-independent
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/Tests/RegionTests.cs (renamed from OpenSim/Data/Tests/BasicRegionTest.cs) | 101 |
1 files changed, 61 insertions, 40 deletions
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/RegionTests.cs index dfbf522..2a97368 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -38,59 +38,80 @@ using OpenSim.Region.Framework.Interfaces; | |||
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using log4net; | 39 | using log4net; |
40 | using System.Reflection; | 40 | using System.Reflection; |
41 | using System.Data.Common; | ||
42 | |||
43 | // DBMS-specific: | ||
44 | using MySql.Data.MySqlClient; | ||
45 | using OpenSim.Data.MySQL; | ||
46 | |||
47 | using System.Data.SqlClient; | ||
48 | using OpenSim.Data.MSSQL; | ||
49 | |||
50 | using Mono.Data.Sqlite; | ||
51 | using OpenSim.Data.SQLite; | ||
41 | 52 | ||
42 | namespace OpenSim.Data.Tests | 53 | namespace OpenSim.Data.Tests |
43 | { | 54 | { |
44 | public class BasicRegionTest | 55 | [TestFixture(typeof(MySqlConnection), typeof(MySqlRegionData), Description = "Region store tests (MySQL)")] |
56 | [TestFixture(typeof(SqlConnection), typeof(MSSQLRegionData), Description = "Region store tests (MS SQL Server)")] | ||
57 | [TestFixture(typeof(SqliteConnection), typeof(SQLiteRegionData), Description = "Region store tests (SQLite)")] | ||
58 | |||
59 | public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> | ||
60 | where TConn : DbConnection, new() | ||
61 | where TRegStore : class, IRegionDataStore, new() | ||
45 | { | 62 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | public IRegionDataStore db; | 63 | public IRegionDataStore db; |
48 | public UUID zero = UUID.Zero; | 64 | public UUID zero = UUID.Zero; |
49 | public UUID region1; | 65 | public UUID region1 = UUID.Random(); |
50 | public UUID region2; | 66 | public UUID region2 = UUID.Random(); |
51 | public UUID region3; | 67 | public UUID region3 = UUID.Random(); |
52 | public UUID region4; | 68 | public UUID region4 = UUID.Random(); |
53 | public UUID prim1; | 69 | public UUID prim1 = UUID.Random(); |
54 | public UUID prim2; | 70 | public UUID prim2 = UUID.Random(); |
55 | public UUID prim3; | 71 | public UUID prim3 = UUID.Random(); |
56 | public UUID prim4; | 72 | public UUID prim4 = UUID.Random(); |
57 | public UUID prim5; | 73 | public UUID prim5 = UUID.Random(); |
58 | public UUID prim6; | 74 | public UUID prim6 = UUID.Random(); |
59 | public UUID item1; | 75 | public UUID item1 = UUID.Random(); |
60 | public UUID item2; | 76 | public UUID item2 = UUID.Random(); |
61 | public UUID item3; | 77 | public UUID item3 = UUID.Random(); |
62 | 78 | ||
63 | public static Random random; | 79 | public static Random random = new Random(); |
64 | 80 | ||
65 | public string itemname1 = "item1"; | 81 | public string itemname1 = "item1"; |
66 | 82 | ||
67 | public uint localID; | 83 | public uint localID = 1; |
68 | 84 | ||
69 | public double height1; | 85 | public double height1 = 20; |
70 | public double height2; | 86 | public double height2 = 100; |
71 | 87 | ||
72 | public void SuperInit() | 88 | |
89 | protected override void InitService(object service) | ||
90 | { | ||
91 | db = (IRegionDataStore)service; | ||
92 | db.Initialise(m_connStr); | ||
93 | ClearDB(); | ||
94 | } | ||
95 | |||
96 | |||
97 | private void ClearDB() | ||
73 | { | 98 | { |
74 | OpenSim.Tests.Common.TestLogging.LogToConsole(); | 99 | // if a new table is added, it has to be dropped here |
75 | 100 | ExecuteSql("delete from migrations where name='RegionStore';"); | |
76 | region1 = UUID.Random(); | 101 | |
77 | region3 = UUID.Random(); | 102 | DropTables( |
78 | region4 = UUID.Random(); | 103 | "prims", |
79 | prim1 = UUID.Random(); | 104 | "primshapes", |
80 | prim2 = UUID.Random(); | 105 | "primitems", |
81 | prim3 = UUID.Random(); | 106 | "terrain", |
82 | prim4 = UUID.Random(); | 107 | "land", |
83 | prim5 = UUID.Random(); | 108 | "landaccesslist", |
84 | prim6 = UUID.Random(); | 109 | "regionban", |
85 | item1 = UUID.Random(); | 110 | "regionsettings" |
86 | item2 = UUID.Random(); | 111 | ); |
87 | item3 = UUID.Random(); | ||
88 | random = new Random(); | ||
89 | localID = 1; | ||
90 | height1 = 20; | ||
91 | height2 = 100; | ||
92 | } | 112 | } |
93 | 113 | ||
114 | |||
94 | // Test Plan | 115 | // Test Plan |
95 | // Prims | 116 | // Prims |
96 | // - empty test - 001 | 117 | // - empty test - 001 |