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 | ||||
-rw-r--r-- | OpenSim/Data/Tests/RegionTests.cs | 12 |
3 files changed, 67 insertions, 13 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; |
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 29bf5a3..a081462 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests | |||
61 | #else | 61 | #else |
62 | 62 | ||
63 | [TestFixture(Description = "Region store tests (SQLite)")] | 63 | [TestFixture(Description = "Region store tests (SQLite)")] |
64 | public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteRegionData> | 64 | public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData> |
65 | { | 65 | { |
66 | } | 66 | } |
67 | 67 | ||
68 | [TestFixture(Description = "Region store tests (MySQL)")] | 68 | [TestFixture(Description = "Region store tests (MySQL)")] |
69 | public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLDataStore> | 69 | public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLSimulationData> |
70 | { | 70 | { |
71 | } | 71 | } |
72 | 72 | ||
73 | [TestFixture(Description = "Region store tests (MS SQL Server)")] | 73 | [TestFixture(Description = "Region store tests (MS SQL Server)")] |
74 | public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLRegionDataStore> | 74 | public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLSimulationData> |
75 | { | 75 | { |
76 | } | 76 | } |
77 | 77 | ||
@@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests | |||
79 | 79 | ||
80 | public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> | 80 | public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> |
81 | where TConn : DbConnection, new() | 81 | where TConn : DbConnection, new() |
82 | where TRegStore : class, IRegionDataStore, new() | 82 | where TRegStore : class, ISimulationDataStore, new() |
83 | { | 83 | { |
84 | bool m_rebuildDB; | 84 | bool m_rebuildDB; |
85 | 85 | ||
86 | public IRegionDataStore db; | 86 | public ISimulationDataStore db; |
87 | public UUID zero = UUID.Zero; | 87 | public UUID zero = UUID.Zero; |
88 | public UUID region1 = UUID.Random(); | 88 | public UUID region1 = UUID.Random(); |
89 | public UUID region2 = UUID.Random(); | 89 | public UUID region2 = UUID.Random(); |
@@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests | |||
122 | protected override void InitService(object service) | 122 | protected override void InitService(object service) |
123 | { | 123 | { |
124 | ClearDB(); | 124 | ClearDB(); |
125 | db = (IRegionDataStore)service; | 125 | db = (ISimulationDataStore)service; |
126 | db.Initialise(m_connStr); | 126 | db.Initialise(m_connStr); |
127 | } | 127 | } |
128 | 128 | ||