aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/InventoryTests.cs
diff options
context:
space:
mode:
authorMelanie2010-05-26 10:38:46 +0100
committerMelanie2010-05-26 10:56:24 +0100
commit1c7f60ab493dffe44ab0517e4a6101fe5d909e28 (patch)
tree72b6a478d32d968ad7f5f3d6d11955bee9662926 /OpenSim/Data/Tests/InventoryTests.cs
parentChange the way alpha is interpreted on prim text. Manris #4723 (diff)
parentMinor correction to AssetTests.cs (diff)
downloadopensim-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
28using System; 30using System;
29using log4net.Config; 31using log4net.Config;
30using NUnit.Framework; 32using NUnit.Framework;
@@ -33,62 +35,95 @@ using OpenMetaverse;
33using OpenSim.Framework; 35using OpenSim.Framework;
34using log4net; 36using log4net;
35using System.Reflection; 37using System.Reflection;
38using System.Data.Common;
39
40#if !NUNIT25
41using NUnit.Framework.SyntaxHelpers;
42#endif
43
44// DBMS-specific:
45using MySql.Data.MySqlClient;
46using OpenSim.Data.MySQL;
47
48using System.Data.SqlClient;
49using OpenSim.Data.MSSQL;
50
51using Mono.Data.Sqlite;
52using OpenSim.Data.SQLite;
36 53
37namespace OpenSim.Data.Tests 54namespace 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))");