diff options
Diffstat (limited to 'OpenSim/Data/Tests')
-rw-r--r-- | OpenSim/Data/Tests/BasicDataServiceTest.cs | 39 | ||||
-rw-r--r-- | OpenSim/Data/Tests/DefaultTestConns.cs | 29 |
2 files changed, 61 insertions, 7 deletions
diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index c261126..7d85f0c 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.IO; | 29 | using System.IO; |
3 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
4 | using log4net.Config; | 31 | using log4net.Config; |
@@ -41,13 +68,13 @@ namespace OpenSim.Data.Tests | |||
41 | { | 68 | { |
42 | m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); | 69 | m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); |
43 | 70 | ||
44 | m_log = LogManager.GetLogger(this.GetType()); | 71 | m_log = LogManager.GetLogger(this.GetType()); |
45 | OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? | 72 | OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? |
46 | } | 73 | } |
47 | 74 | ||
48 | /// <summary> | 75 | /// <summary> |
49 | /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it. | 76 | /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it. |
50 | /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. | 77 | /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. |
51 | /// This framework takes care of disposing it, if it's disposable. | 78 | /// This framework takes care of disposing it, if it's disposable. |
52 | /// </summary> | 79 | /// </summary> |
53 | /// <param name="service">The service being tested</param> | 80 | /// <param name="service">The service being tested</param> |
@@ -118,12 +145,12 @@ namespace OpenSim.Data.Tests | |||
118 | { | 145 | { |
119 | if (m_service != null) | 146 | if (m_service != null) |
120 | { | 147 | { |
121 | if( m_service is IDisposable) | 148 | if (m_service is IDisposable) |
122 | ((IDisposable)m_service).Dispose(); | 149 | ((IDisposable)m_service).Dispose(); |
123 | m_service = null; | 150 | m_service = null; |
124 | } | 151 | } |
125 | 152 | ||
126 | if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) ) | 153 | if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file)) |
127 | File.Delete(m_file); | 154 | File.Delete(m_file); |
128 | } | 155 | } |
129 | 156 | ||
@@ -204,7 +231,7 @@ namespace OpenSim.Data.Tests | |||
204 | lst += ", " + s; | 231 | lst += ", " + s; |
205 | } | 232 | } |
206 | 233 | ||
207 | string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); | 234 | string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); |
208 | try | 235 | try |
209 | { | 236 | { |
210 | ExecuteSql("DELETE FROM migrations where name " + sCond); | 237 | ExecuteSql("DELETE FROM migrations where name " + sCond); |
diff --git a/OpenSim/Data/Tests/DefaultTestConns.cs b/OpenSim/Data/Tests/DefaultTestConns.cs index 7b52af5..7c47bdd 100644 --- a/OpenSim/Data/Tests/DefaultTestConns.cs +++ b/OpenSim/Data/Tests/DefaultTestConns.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using System.Linq; | 30 | using System.Linq; |
4 | using System.Text; | 31 | using System.Text; |