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

Public Member Functions

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

Protected Member Functions

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

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 24 of file GrantTests.cs.

Member Function Documentation

override IQuery Deveel.Data.Sql.Statements.GrantTests.CreateQuery ( ISession  session)
inlineprotectedvirtual

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 25 of file GrantTests.cs.

25  {
26  var query = base.CreateQuery(session);
27  query.CreateUser("test_user", "12345");
28  return query;
29  }
void Deveel.Data.Sql.Statements.GrantTests.ParseGrantRolesToOneUser ( )
inline

Definition at line 50 of file GrantTests.cs.

50  {
51  const string sql = "GRANT admin, data_reader TO test_user";
52 
53  var statements = SqlStatement.Parse(sql);
54  Assert.IsNotNull(statements);
55  Assert.IsNotEmpty(statements);
56  Assert.AreEqual(2, statements.Count());
57  Assert.IsInstanceOf<GrantRoleStatement>(statements.ElementAt(0));
58  Assert.IsInstanceOf<GrantRoleStatement>(statements.ElementAt(1));
59 
60  var first = (GrantRoleStatement) statements.ElementAt(0);
61  Assert.AreEqual("admin", first.Role);
62  Assert.AreEqual("test_user", first.UserName);
63  }
void Deveel.Data.Sql.Statements.GrantTests.ParseGrantToOneUserToOneTable ( )
inline

Definition at line 32 of file GrantTests.cs.

32  {
33  const string sql = "GRANT SELECT, DELETE, UPDATE PRIVILEGE ON test_table TO test_user";
34 
35  var statements = SqlStatement.Parse(sql);
36  Assert.IsNotNull(statements);
37  Assert.IsNotEmpty(statements);
38  Assert.AreEqual(3, statements.Count());
39  Assert.IsInstanceOf<GrantPrivilegesStatement>(statements.ElementAt(0));
40  Assert.IsInstanceOf<GrantPrivilegesStatement>(statements.ElementAt(1));
41  Assert.IsInstanceOf<GrantPrivilegesStatement>(statements.ElementAt(2));
42 
43  var first = (GrantPrivilegesStatement) statements.ElementAt(0);
44  Assert.AreEqual(Privileges.Select, first.Privilege);
45  Assert.AreEqual("test_user", first.Grantee);
46  Assert.AreEqual("test_table", first.ObjectName.ToString());
47  }

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