diff options
author | Melanie | 2010-05-26 10:38:46 +0100 |
---|---|---|
committer | Melanie | 2010-05-26 10:56:24 +0100 |
commit | 1c7f60ab493dffe44ab0517e4a6101fe5d909e28 (patch) | |
tree | 72b6a478d32d968ad7f5f3d6d11955bee9662926 /OpenSim/Data/Tests/InventoryTests.cs | |
parent | Change the way alpha is interpreted on prim text. Manris #4723 (diff) | |
parent | Minor correction to AssetTests.cs (diff) | |
download | opensim-SC-1c7f60ab493dffe44ab0517e4a6101fe5d909e28.zip opensim-SC-1c7f60ab493dffe44ab0517e4a6101fe5d909e28.tar.gz opensim-SC-1c7f60ab493dffe44ab0517e4a6101fe5d909e28.tar.bz2 opensim-SC-1c7f60ab493dffe44ab0517e4a6101fe5d909e28.tar.xz |
Merge branch 'unitests'
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/Tests/InventoryTests.cs (renamed from OpenSim/Data/Tests/BasicInventoryTest.cs) | 127 |
1 files changed, 82 insertions, 45 deletions
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/InventoryTests.cs index 900186b..c22e26c 100644 --- a/OpenSim/Data/Tests/BasicInventoryTest.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs | |||
@@ -25,6 +25,8 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | // #define NUNIT25 | ||
29 | |||
28 | using System; | 30 | using System; |
29 | using log4net.Config; | 31 | using log4net.Config; |
30 | using NUnit.Framework; | 32 | using NUnit.Framework; |
@@ -33,62 +35,95 @@ using OpenMetaverse; | |||
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
34 | using log4net; | 36 | using log4net; |
35 | using System.Reflection; | 37 | using System.Reflection; |
38 | using System.Data.Common; | ||
39 | |||
40 | #if !NUNIT25 | ||
41 | using NUnit.Framework.SyntaxHelpers; | ||
42 | #endif | ||
43 | |||
44 | // DBMS-specific: | ||
45 | using MySql.Data.MySqlClient; | ||
46 | using OpenSim.Data.MySQL; | ||
47 | |||
48 | using System.Data.SqlClient; | ||
49 | using OpenSim.Data.MSSQL; | ||
50 | |||
51 | using Mono.Data.Sqlite; | ||
52 | using OpenSim.Data.SQLite; | ||
36 | 53 | ||
37 | namespace OpenSim.Data.Tests | 54 | namespace OpenSim.Data.Tests |
38 | { | 55 | { |
39 | public class BasicInventoryTest | 56 | #if NUNIT25 |
57 | |||
58 | [TestFixture(typeof(SqliteConnection), typeof(SQLiteInventoryStore), Description = "Inventory store tests (SQLite)")] | ||
59 | [TestFixture(typeof(MySqlConnection), typeof(MySQLInventoryData), Description = "Inventory store tests (MySQL)")] | ||
60 | [TestFixture(typeof(SqlConnection), typeof(MSSQLInventoryData), Description = "Inventory store tests (MS SQL Server)")] | ||
61 | |||
62 | #else | ||
63 | |||
64 | [TestFixture(Description = "Inventory store tests (SQLite)")] | ||
65 | public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore> | ||
66 | { | ||
67 | } | ||
68 | |||
69 | [TestFixture(Description = "Inventory store tests (MySQL)")] | ||
70 | public class MySqlInventoryTests : InventoryTests<MySqlConnection, MySQLInventoryData> | ||
71 | { | ||
72 | } | ||
73 | |||
74 | [TestFixture(Description = "Inventory store tests (MS SQL Server)")] | ||
75 | public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData> | ||
76 | { | ||
77 | } | ||
78 | #endif | ||
79 | |||
80 | public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> | ||
81 | where TConn : DbConnection, new() | ||
82 | where TInvStore : class, IInventoryDataPlugin, new() | ||
40 | { | 83 | { |
41 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | public IInventoryDataPlugin db; | 84 | public IInventoryDataPlugin db; |
85 | |||
43 | public UUID zero = UUID.Zero; | 86 | public UUID zero = UUID.Zero; |
44 | 87 | ||
45 | public UUID folder1; | 88 | public UUID folder1 = UUID.Random(); |
46 | public UUID folder2; | 89 | public UUID folder2 = UUID.Random(); |
47 | public UUID folder3; | 90 | public UUID folder3 = UUID.Random(); |
48 | public UUID owner1; | 91 | public UUID owner1 = UUID.Random(); |
49 | public UUID owner2; | 92 | public UUID owner2 = UUID.Random(); |
50 | public UUID owner3; | 93 | public UUID owner3 = UUID.Random(); |
51 | 94 | ||
52 | public UUID item1; | 95 | public UUID item1 = UUID.Random(); |
53 | public UUID item2; | 96 | public UUID item2 = UUID.Random(); |
54 | public UUID item3; | 97 | public UUID item3 = UUID.Random(); |
55 | public UUID asset1; | 98 | public UUID asset1 = UUID.Random(); |
56 | public UUID asset2; | 99 | public UUID asset2 = UUID.Random(); |
57 | public UUID asset3; | 100 | public UUID asset3 = UUID.Random(); |
58 | 101 | ||
59 | public string name1; | 102 | public string name1; |
60 | public string name2; | 103 | public string name2 = "First Level folder"; |
61 | public string name3; | 104 | public string name3 = "First Level folder 2"; |
62 | public string niname1; | 105 | public string niname1 = "My Shirt"; |
63 | public string iname1; | 106 | public string iname1 = "Shirt"; |
64 | public string iname2; | 107 | public string iname2 = "Text Board"; |
65 | public string iname3; | 108 | public string iname3 = "No Pants Barrel"; |
66 | 109 | ||
67 | public void SuperInit() | 110 | public InventoryTests(string conn) : base(conn) |
68 | { | 111 | { |
69 | OpenSim.Tests.Common.TestLogging.LogToConsole(); | ||
70 | |||
71 | folder1 = UUID.Random(); | ||
72 | folder2 = UUID.Random(); | ||
73 | folder3 = UUID.Random(); | ||
74 | owner1 = UUID.Random(); | ||
75 | owner2 = UUID.Random(); | ||
76 | owner3 = UUID.Random(); | ||
77 | item1 = UUID.Random(); | ||
78 | item2 = UUID.Random(); | ||
79 | item3 = UUID.Random(); | ||
80 | asset1 = UUID.Random(); | ||
81 | asset2 = UUID.Random(); | ||
82 | asset3 = UUID.Random(); | ||
83 | |||
84 | name1 = "Root Folder for " + owner1.ToString(); | 112 | name1 = "Root Folder for " + owner1.ToString(); |
85 | name2 = "First Level folder"; | 113 | } |
86 | name3 = "First Level folder 2"; | 114 | public InventoryTests() : this("") { } |
87 | niname1 = "My Shirt"; | ||
88 | iname1 = "Shirt"; | ||
89 | iname2 = "Text Board"; | ||
90 | iname3 = "No Pants Barrel"; | ||
91 | 115 | ||
116 | protected override void InitService(object service) | ||
117 | { | ||
118 | ClearDB(); | ||
119 | db = (IInventoryDataPlugin)service; | ||
120 | db.Initialise(m_connStr); | ||
121 | } | ||
122 | |||
123 | private void ClearDB() | ||
124 | { | ||
125 | DropTables("inventoryitems", "inventoryfolders"); | ||
126 | ResetMigrations("InventoryStore"); | ||
92 | } | 127 | } |
93 | 128 | ||
94 | [Test] | 129 | [Test] |
@@ -159,8 +194,10 @@ namespace OpenSim.Data.Tests | |||
159 | [Test] | 194 | [Test] |
160 | public void T013_FolderHierarchy() | 195 | public void T013_FolderHierarchy() |
161 | { | 196 | { |
162 | Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); | 197 | int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) |
163 | Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); | 198 | Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); |
199 | n = db.getFolderHierarchy(folder1).Count; | ||
200 | Assert.That(n, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); | ||
164 | Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); | 201 | Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); |
165 | Assert.That(db.getFolderHierarchy(folder3).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder3).Count, Is.EqualTo(0))"); | 202 | Assert.That(db.getFolderHierarchy(folder3).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder3).Count, Is.EqualTo(0))"); |
166 | Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0))"); | 203 | Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0))"); |