DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
JournaledFileStoreTests.cs
Go to the documentation of this file.
1 using System;
2 using System.IO;
3 
5 using Deveel.Data.Sql.Compile;
6 
7 using NUnit.Framework;
8 
9 namespace Deveel.Data.Store.Journaled {
10  [TestFixture]
14 
15  private const string DatabaseName = "test_db";
16  private const string TestAdminUser = "SA";
17  private const string TestAdminPass = "abc1234";
18 
20  var dbConfig = new Configuration.Configuration();
21  dbConfig.SetValue("database.name", DatabaseName);
22  dbConfig.SetValue("database.storageSystem", DefaultStorageSystemNames.Journaled);
23  dbConfig.SetValue("database.basePath", Environment.CurrentDirectory);
24  return dbConfig;
25  }
26 
27  private void OnSetUp(string testName) {
28  var systemBuilder = new SystemBuilder();
29  systemContext = systemBuilder.BuildSystem();
30 
31  var dbConfig = CreateDatabaseConfig();
32 
33  if (testName != "CreateNewDatabase") {
34  database = systemContext.CreateDatabase(dbConfig, TestAdminUser, TestAdminPass);
35  }
36  }
37 
38  [SetUp]
39  public void SetUp() {
40  var test = TestContext.CurrentContext.Test;
41 
42  OnSetUp(test.Name);
43  }
44 
45  [TearDown]
46  public void TearDown() {
47  if (database != null) {
48  database.Close();
49  database.Dispose();
50  }
51 
52  var dirName = Path.Combine(Environment.CurrentDirectory, DatabaseName);
53  if (Directory.Exists(dirName))
54  Directory.Delete(dirName);
55  }
56 
57  //[Test]
58  //public void CreateNewDatabase() {
59  // var dbConfig = CreateDatabaseConfig();
60  // database = systemContext.CreateDatabase(dbConfig, TestAdminUser, TestAdminPass);
61  //}
62  }
63 }
void Close()
Closes the database making it not accessible to connections.
IDatabase CreateDatabase(IConfiguration configuration, string adminUser, string adminPassword)
The representation of a single database in the system.
Definition: IDatabase.cs:40
Defines the contract for the configuration node of a component within the system or of the system its...
Configuration(bool isRoot)
Constructs the Configuration.