diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAvatarData.cs (renamed from OpenSim/Data/SQLite/Tests/SQLiteUserTest.cs) | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/OpenSim/Data/SQLite/Tests/SQLiteUserTest.cs b/OpenSim/Data/SQLite/SQLiteAvatarData.cs index c9953c5..d0b82de 100644 --- a/OpenSim/Data/SQLite/Tests/SQLiteUserTest.cs +++ b/OpenSim/Data/SQLite/SQLiteAvatarData.cs | |||
@@ -25,40 +25,50 @@ | |||
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 | using System.IO; | 28 | using System; |
29 | using NUnit.Framework; | 29 | using System.Collections.Generic; |
30 | using OpenSim.Data.Tests; | 30 | using System.Data; |
31 | using OpenSim.Tests.Common; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using Mono.Data.SqliteClient; | ||
32 | 37 | ||
33 | namespace OpenSim.Data.SQLite.Tests | 38 | namespace OpenSim.Data.SQLite |
34 | { | 39 | { |
35 | [TestFixture, DatabaseTest] | 40 | /// <summary> |
36 | public class SQLiteUserTest : BasicUserTest | 41 | /// A MySQL Interface for the Grid Server |
42 | /// </summary> | ||
43 | public class SQLiteAvatarData : SQLiteGenericTableHandler<AvatarBaseData>, | ||
44 | IAvatarData | ||
37 | { | 45 | { |
38 | public string file; | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
39 | public string connect; | ||
40 | |||
41 | [TestFixtureSetUp] | ||
42 | public void Init() | ||
43 | { | ||
44 | // SQLite doesn't work on power or z linux | ||
45 | if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd")) | ||
46 | { | ||
47 | Assert.Ignore(); | ||
48 | } | ||
49 | 47 | ||
50 | SuperInit(); | 48 | public SQLiteAvatarData(string connectionString, string realm) : |
51 | file = Path.GetTempFileName() + ".db"; | 49 | base(connectionString, realm, "Avatar") |
52 | connect = "URI=file:" + file + ",version=3"; | 50 | { |
53 | db = new SQLiteUserData(); | ||
54 | db.Initialise(connect); | ||
55 | } | 51 | } |
56 | 52 | ||
57 | [TestFixtureTearDown] | 53 | public bool Delete(UUID principalID, string name) |
58 | public void Cleanup() | ||
59 | { | 54 | { |
60 | db.Dispose(); | 55 | SqliteCommand cmd = new SqliteCommand(); |
61 | File.Delete(file); | 56 | |
57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); | ||
58 | cmd.Parameters.Add(":PrincipalID", principalID.ToString()); | ||
59 | cmd.Parameters.Add(":Name", name); | ||
60 | |||
61 | try | ||
62 | { | ||
63 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
64 | return true; | ||
65 | |||
66 | return false; | ||
67 | } | ||
68 | finally | ||
69 | { | ||
70 | CloseCommand(cmd); | ||
71 | } | ||
62 | } | 72 | } |
63 | } | 73 | } |
64 | } | 74 | } |