aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs
diff options
context:
space:
mode:
authorJohn Hurliman2010-02-22 14:10:19 -0800
committerJohn Hurliman2010-02-22 14:10:19 -0800
commit71c6559a91a58d93588dcdd8c74b5fce0c1a3780 (patch)
treecca5b1ea88ad4b29156767afdd77e37ec072c8a7 /OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs
parent* Adds CreatorID to asset metadata. This is just the plumbing to support Crea... (diff)
parentMerge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff)
downloadopensim-SC_OLD-71c6559a91a58d93588dcdd8c74b5fce0c1a3780.zip
opensim-SC_OLD-71c6559a91a58d93588dcdd8c74b5fce0c1a3780.tar.gz
opensim-SC_OLD-71c6559a91a58d93588dcdd8c74b5fce0c1a3780.tar.bz2
opensim-SC_OLD-71c6559a91a58d93588dcdd8c74b5fce0c1a3780.tar.xz
Merge branch 'presence-refactor' of ssh://opensimulator.org/var/git/opensim into presence-refactor
Diffstat (limited to 'OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs')
-rw-r--r--OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs53
1 files changed, 32 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs b/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs
index 0dc8b7d..e7e57e4 100644
--- a/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs
+++ b/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs
@@ -31,6 +31,7 @@ using OpenSim.Data.Tests;
31using log4net; 31using log4net;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Tests.Common; 33using OpenSim.Tests.Common;
34using MySql.Data.MySqlClient;
34 35
35namespace OpenSim.Data.MySQL.Tests 36namespace OpenSim.Data.MySQL.Tests
36{ 37{
@@ -39,7 +40,6 @@ namespace OpenSim.Data.MySQL.Tests
39 { 40 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 public string file; 42 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;"; 43 public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
44 44
45 [TestFixtureSetUp] 45 [TestFixtureSetUp]
@@ -52,9 +52,8 @@ namespace OpenSim.Data.MySQL.Tests
52 // tests. 52 // tests.
53 try 53 try
54 { 54 {
55 database = new MySQLManager(connect);
56 // this is important in case a previous run ended badly 55 // this is important in case a previous run ended badly
57 ClearDB(database); 56 ClearDB();
58 57
59 db = new MySQLDataStore(); 58 db = new MySQLDataStore();
60 db.Initialise(connect); 59 db.Initialise(connect);
@@ -73,28 +72,40 @@ namespace OpenSim.Data.MySQL.Tests
73 { 72 {
74 db.Dispose(); 73 db.Dispose();
75 } 74 }
76 ClearDB(database); 75 ClearDB();
77 } 76 }
78 77
79 private void ClearDB(MySQLManager manager) 78 private void ClearDB()
80 { 79 {
81 if (manager != null) 80 ExecuteSql("drop table if exists migrations");
81 ExecuteSql("drop table if exists prims");
82 ExecuteSql("drop table if exists primshapes");
83 ExecuteSql("drop table if exists primitems");
84 ExecuteSql("drop table if exists terrain");
85 ExecuteSql("drop table if exists land");
86 ExecuteSql("drop table if exists landaccesslist");
87 ExecuteSql("drop table if exists regionban");
88 ExecuteSql("drop table if exists regionsettings");
89 ExecuteSql("drop table if exists estate_managers");
90 ExecuteSql("drop table if exists estate_groups");
91 ExecuteSql("drop table if exists estate_users");
92 ExecuteSql("drop table if exists estateban");
93 ExecuteSql("drop table if exists estate_settings");
94 ExecuteSql("drop table if exists estate_map");
95 }
96
97 /// <summary>
98 /// Execute a MySqlCommand
99 /// </summary>
100 /// <param name="sql">sql string to execute</param>
101 private void ExecuteSql(string sql)
102 {
103 using (MySqlConnection dbcon = new MySqlConnection(connect))
82 { 104 {
83 manager.ExecuteSql("drop table if exists migrations"); 105 dbcon.Open();
84 manager.ExecuteSql("drop table if exists prims"); 106
85 manager.ExecuteSql("drop table if exists primshapes"); 107 MySqlCommand cmd = new MySqlCommand(sql, dbcon);
86 manager.ExecuteSql("drop table if exists primitems"); 108 cmd.ExecuteNonQuery();
87 manager.ExecuteSql("drop table if exists terrain");
88 manager.ExecuteSql("drop table if exists land");
89 manager.ExecuteSql("drop table if exists landaccesslist");
90 manager.ExecuteSql("drop table if exists regionban");
91 manager.ExecuteSql("drop table if exists regionsettings");
92 manager.ExecuteSql("drop table if exists estate_managers");
93 manager.ExecuteSql("drop table if exists estate_groups");
94 manager.ExecuteSql("drop table if exists estate_users");
95 manager.ExecuteSql("drop table if exists estateban");
96 manager.ExecuteSql("drop table if exists estate_settings");
97 manager.ExecuteSql("drop table if exists estate_map");
98 } 109 }
99 } 110 }
100 } 111 }