DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Deveel.Data.Sql.CreateTableTests Class Reference
Inheritance diagram for Deveel.Data.Sql.CreateTableTests:
Deveel.Data.ContextBasedTest

Public Member Functions

void CreateSimpleTableAsAdmin_NewSession ()
 
void CreateSimple_RegularUser ()
 
- Public Member Functions inherited from Deveel.Data.ContextBasedTest
void TestSetUp ()
 
void TestFixtureSetUp ()
 
void TestTearDown ()
 
void TestFixtureTearDown ()
 

Protected Member Functions

override ISession CreateAdminSession (IDatabase database)
 
- Protected Member Functions inherited from Deveel.Data.ContextBasedTest
virtual void RegisterServices (ServiceContainer container)
 
virtual ISystem CreateSystem ()
 
virtual IDatabase CreateDatabase (ISystem system, IConfiguration configuration)
 
virtual IQuery CreateQuery (ISession session)
 
ISession CreateUserSession (string userName, string password)
 
virtual void OnSetUp (string testName)
 
virtual void OnTearDown ()
 

Private Attributes

const string TestUserName = "test"
 
const string TestPassword = "abc1234"
 

Additional Inherited Members

- Protected Attributes inherited from Deveel.Data.ContextBasedTest
const string AdminUserName = "SA"
 
const string AdminPassword = "1234567890"
 
const string DatabaseName = "testdb"
 
- Properties inherited from Deveel.Data.ContextBasedTest
virtual bool SingleContext [get]
 
IQuery Query [get, private set]
 
ISystem System [get, private set]
 
IDatabase Database [get, private set]
 
ISession Session [get, private set]
 

Detailed Description

Definition at line 25 of file CreateTableTests.cs.

Member Function Documentation

override ISession Deveel.Data.Sql.CreateTableTests.CreateAdminSession ( IDatabase  database)
inlineprotectedvirtual

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 29 of file CreateTableTests.cs.

29  {
30  using (var session = database.CreateUserSession(AdminUserName, AdminPassword)) {
31  using (var query = session.CreateQuery()) {
32  if (TestContext.CurrentContext.Test.Name.Equals("CreateSimple_RegularUser")) {
33  var user = query.CreateUser(TestUserName, TestPassword);
34  //queryContext.GrantHostAccessToUser(TestUserName, KnownConnectionProtocols.Local, "%");
35  query.GrantToUserOnSchema("APP", user.Name, Privileges.Create);
36  query.Commit();
37  }
38  }
39  }
40 
41  return base.CreateAdminSession(database);
42  }
void Deveel.Data.Sql.CreateTableTests.CreateSimple_RegularUser ( )
inline

Definition at line 68 of file CreateTableTests.cs.

68  {
69  var tableName = ObjectName.Parse("APP.test_table");
70  var tableInfo = new TableInfo(tableName);
71  tableInfo.AddColumn("a", PrimitiveTypes.Integer(), true);
72  tableInfo.AddColumn("b", PrimitiveTypes.String());
73 
74  using (var session = CreateUserSession(TestUserName, TestPassword)) {
75  using (var query = session.CreateQuery()) {
76  Assert.DoesNotThrow(() => query.CreateTable(tableInfo));
77  }
78  }
79  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
ISession CreateUserSession(string userName, string password)
Defines the metadata properties of a table existing within a database.
Definition: TableInfo.cs:41
void Deveel.Data.Sql.CreateTableTests.CreateSimpleTableAsAdmin_NewSession ( )
inline

Definition at line 45 of file CreateTableTests.cs.

45  {
46  var tableName = ObjectName.Parse("APP.test_table");
47  var tableInfo = new TableInfo(tableName);
48  tableInfo.AddColumn("a", PrimitiveTypes.Integer(), true);
49  tableInfo.AddColumn("b", PrimitiveTypes.String());
50 
51  using (var session = CreateUserSession(AdminUserName, AdminPassword)) {
52  using (var query = session.CreateQuery()) {
53  Assert.DoesNotThrow(() => query.CreateTable(tableInfo));
54  Assert.DoesNotThrow(() => query.Commit());
55  }
56  }
57 
58  using (var session = CreateUserSession(AdminUserName, AdminPassword)) {
59  using (var query = session.CreateQuery()) {
60  bool exists = false;
61  Assert.DoesNotThrow(() => exists = query.TableExists(tableName));
62  Assert.IsTrue(exists);
63  }
64  }
65  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
ISession CreateUserSession(string userName, string password)
Defines the metadata properties of a table existing within a database.
Definition: TableInfo.cs:41

Member Data Documentation

const string Deveel.Data.Sql.CreateTableTests.TestPassword = "abc1234"
private

Definition at line 27 of file CreateTableTests.cs.

const string Deveel.Data.Sql.CreateTableTests.TestUserName = "test"
private

Definition at line 26 of file CreateTableTests.cs.


The documentation for this class was generated from the following file: