aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/Tests/BasicDataServiceTest.cs25
1 files changed, 23 insertions, 2 deletions
diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs
index 4c7cf28..c261126 100644
--- a/OpenSim/Data/Tests/BasicDataServiceTest.cs
+++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs
@@ -27,7 +27,10 @@ namespace OpenSim.Data.Tests
27 private string m_file; 27 private string m_file;
28 28
29 // TODO: Is this in the right place here? 29 // TODO: Is this in the right place here?
30 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 30 // Later: apparently it's not, but does it matter here?
31// protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
32
33 protected ILog m_log; // doesn't matter here that it's not static, init to correct type in instance .ctor
31 34
32 public BasicDataServiceTest() 35 public BasicDataServiceTest()
33 : this("") 36 : this("")
@@ -38,6 +41,7 @@ namespace OpenSim.Data.Tests
38 { 41 {
39 m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); 42 m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn));
40 43
44 m_log = LogManager.GetLogger(this.GetType());
41 OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? 45 OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right?
42 } 46 }
43 47
@@ -72,10 +76,27 @@ namespace OpenSim.Data.Tests
72 if (String.IsNullOrEmpty(m_connStr)) 76 if (String.IsNullOrEmpty(m_connStr))
73 { 77 {
74 string msg = String.Format("Connection string for {0} is not defined, ignoring tests", typeof(TConn).Name); 78 string msg = String.Format("Connection string for {0} is not defined, ignoring tests", typeof(TConn).Name);
75 m_log.Error(msg); 79 m_log.Warn(msg);
76 Assert.Ignore(msg); 80 Assert.Ignore(msg);
77 } 81 }
78 82
83 // Try the connection, ignore tests if Open() fails
84 using (TConn conn = new TConn())
85 {
86 conn.ConnectionString = m_connStr;
87 try
88 {
89 conn.Open();
90 conn.Close();
91 }
92 catch
93 {
94 string msg = String.Format("{0} is unable to connect to the database, ignoring tests", typeof(TConn).Name);
95 m_log.Warn(msg);
96 Assert.Ignore(msg);
97 }
98 }
99
79 // If we manage to connect to the database with the user 100 // If we manage to connect to the database with the user
80 // and password above it is our test database, and run 101 // and password above it is our test database, and run
81 // these tests. If anything goes wrong, ignore these 102 // these tests. If anything goes wrong, ignore these