diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/Tests/MySQLEstateTest.cs | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/Tests/MySQLEstateTest.cs b/OpenSim/Data/MySQL/Tests/MySQLEstateTest.cs index 48486b1..01afcae 100644 --- a/OpenSim/Data/MySQL/Tests/MySQLEstateTest.cs +++ b/OpenSim/Data/MySQL/Tests/MySQLEstateTest.cs | |||
@@ -31,6 +31,8 @@ using OpenSim.Data.Tests; | |||
31 | using log4net; | 31 | using log4net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Tests.Common; | 33 | using OpenSim.Tests.Common; |
34 | using MySql.Data.MySqlClient; | ||
35 | |||
34 | 36 | ||
35 | namespace OpenSim.Data.MySQL.Tests | 37 | namespace OpenSim.Data.MySQL.Tests |
36 | { | 38 | { |
@@ -39,7 +41,6 @@ namespace OpenSim.Data.MySQL.Tests | |||
39 | { | 41 | { |
40 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | public string file; | 43 | public string file; |
42 | public MySQLManager database; | ||
43 | public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;"; | 44 | public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;"; |
44 | 45 | ||
45 | [TestFixtureSetUp] | 46 | [TestFixtureSetUp] |
@@ -52,9 +53,8 @@ namespace OpenSim.Data.MySQL.Tests | |||
52 | // tests. | 53 | // tests. |
53 | try | 54 | try |
54 | { | 55 | { |
55 | database = new MySQLManager(connect); | ||
56 | // clear db incase to ensure we are in a clean state | 56 | // clear db incase to ensure we are in a clean state |
57 | ClearDB(database); | 57 | ClearDB(); |
58 | 58 | ||
59 | regionDb = new MySQLDataStore(); | 59 | regionDb = new MySQLDataStore(); |
60 | regionDb.Initialise(connect); | 60 | regionDb.Initialise(connect); |
@@ -75,29 +75,41 @@ namespace OpenSim.Data.MySQL.Tests | |||
75 | { | 75 | { |
76 | regionDb.Dispose(); | 76 | regionDb.Dispose(); |
77 | } | 77 | } |
78 | ClearDB(database); | 78 | ClearDB(); |
79 | } | 79 | } |
80 | 80 | ||
81 | private void ClearDB(MySQLManager manager) | 81 | private void ClearDB() |
82 | { | 82 | { |
83 | // if a new table is added, it has to be dropped here | 83 | // if a new table is added, it has to be dropped here |
84 | if (manager != null) | 84 | ExecuteSql("drop table if exists migrations"); |
85 | ExecuteSql("drop table if exists prims"); | ||
86 | ExecuteSql("drop table if exists primshapes"); | ||
87 | ExecuteSql("drop table if exists primitems"); | ||
88 | ExecuteSql("drop table if exists terrain"); | ||
89 | ExecuteSql("drop table if exists land"); | ||
90 | ExecuteSql("drop table if exists landaccesslist"); | ||
91 | ExecuteSql("drop table if exists regionban"); | ||
92 | ExecuteSql("drop table if exists regionsettings"); | ||
93 | ExecuteSql("drop table if exists estate_managers"); | ||
94 | ExecuteSql("drop table if exists estate_groups"); | ||
95 | ExecuteSql("drop table if exists estate_users"); | ||
96 | ExecuteSql("drop table if exists estateban"); | ||
97 | ExecuteSql("drop table if exists estate_settings"); | ||
98 | ExecuteSql("drop table if exists estate_map"); | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// Execute a MySqlCommand | ||
103 | /// </summary> | ||
104 | /// <param name="sql">sql string to execute</param> | ||
105 | private void ExecuteSql(string sql) | ||
106 | { | ||
107 | using (MySqlConnection dbcon = new MySqlConnection(connect)) | ||
85 | { | 108 | { |
86 | manager.ExecuteSql("drop table if exists migrations"); | 109 | dbcon.Open(); |
87 | manager.ExecuteSql("drop table if exists prims"); | 110 | |
88 | manager.ExecuteSql("drop table if exists primshapes"); | 111 | MySqlCommand cmd = new MySqlCommand(sql, dbcon); |
89 | manager.ExecuteSql("drop table if exists primitems"); | 112 | cmd.ExecuteNonQuery(); |
90 | manager.ExecuteSql("drop table if exists terrain"); | ||
91 | manager.ExecuteSql("drop table if exists land"); | ||
92 | manager.ExecuteSql("drop table if exists landaccesslist"); | ||
93 | manager.ExecuteSql("drop table if exists regionban"); | ||
94 | manager.ExecuteSql("drop table if exists regionsettings"); | ||
95 | manager.ExecuteSql("drop table if exists estate_managers"); | ||
96 | manager.ExecuteSql("drop table if exists estate_groups"); | ||
97 | manager.ExecuteSql("drop table if exists estate_users"); | ||
98 | manager.ExecuteSql("drop table if exists estateban"); | ||
99 | manager.ExecuteSql("drop table if exists estate_settings"); | ||
100 | manager.ExecuteSql("drop table if exists estate_map"); | ||
101 | } | 113 | } |
102 | } | 114 | } |
103 | } | 115 | } |