Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSureshkumar T <suresh@mono-cvs.ximian.com>2005-09-01 15:50:04 +0400
committerSureshkumar T <suresh@mono-cvs.ximian.com>2005-09-01 15:50:04 +0400
commitcce8383f1edb8312d8170eb0a48e25857bec63cc (patch)
tree7838db379045aa5dbb4d56d79e8628f0919308ec /mcs/class/System.Data/Test/ProviderTests/sql
parent311746b41cf500aef15a68bf4a37bddcbba86ef4 (diff)
added a new framework for testing data providers using nunit and mono.data's provider
factory. Moved few stand-alone tests from Test/ to this framework. In Test: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * ProviderTests: Added a new framework for testing Data Providers. This framework is based on nunit category tests and also the provider factory provided by Mono.Data. In Test/System.Data.SqlClient: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * SqlDataReaderTest.cs: moved to ProviderTests and integrated with connected mode tests * SqlCommandTest.cs: -- do -- * SqlConnectionTest.cs: -- do -- * SqlTransactionTest.cs: -- do -- * SqlDataAdapterTest.cs: -- do -- In Test/System.Data.Odbc: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * OdbcDataAdapterTest.cs: moved to ProviderTests and integrated with connected more framework. * OdbcCommandTest.cs: -- do --. * OdbcParameterCollectionTest.cs: Removed ParameterLengthTrimTest to ProviderTests. In Test/ProviderTests/sql: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * SCHEMA: schema specification. * sqlserver.sql: sql script file to create test schema for mssql database. added. * mysql.sql: sql script file to create test schema for mysql database. added. In Test/ProviderTests/System.Data.Odbc: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * OdbcCommandBuilderTest.cs: Added tests for OdbcCommandBuilder.cs * OdbcCommandTest.cs: pulled from Test/System.Data.Odbc * OdbcDataAdapterTest.cs: pulled from Test/System.Data.Odbc * OdbcDataReaderTest.cs: pulled from Test/System.Data.Odbc * OdbcParameterCollectionTest.cs: pulled from Test/System.Data.Odbc In Test/ProviderTests/ProviderIndependant: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * IDbCommandTest.cs: Added. Provider independent Command tests. * DataReaderTest.cs: Added. Provider independent DataReader tests. In Test/ProviderTests: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * System.Data.Connected.Tests.dll.sources: source files. * app-default.config: * app-net_2_0.config: configuration files for profiles and lists the assembly informations for the Provider factory. * odbc.config: * sqlserver.config: connection string info for respective databases. * README: initial. pulled connected mode test-cases around Test/* directory into this new framework. This framework is based on nunit category based test-cases and uses Provider Factories provided in Mono.Data.dll to write provider independent code. In Test/ProviderTests/Common: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * DBHelper.cs: Added. Class to provide helper methods for other tests. * ConnectionManager.cs: Added. Class to manage connections In Test/ProviderTests/System.Data.SqlClient: 2005-09-01 Sureshkumar T <tsureshkumar@novell.com> * SqlCommandBuilderTest.cs: added tests for SqlCommandBuilder * SqlCommandTest.cs: pulled from Test/System.Data.SqlClient * SqlConnectionStringBuilderTest.cs: pulled from Test/System.Data.SqlClient * SqlConnectionTest.cs: pulled from Test/System.Data.SqlClient * SqlDataAdapterTest.cs: pulled from Test/System.Data.SqlClient * SqlDataReaderTest.cs: pulled from Test/System.Data.SqlClient * SqlTransactionTest.cs: pulled from Test/System.Data.SqlClient Added attribute Category ("sqlserver") to all these test fixtures. svn path=/trunk/mcs/; revision=49260
Diffstat (limited to 'mcs/class/System.Data/Test/ProviderTests/sql')
-rw-r--r--mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog10
-rw-r--r--mcs/class/System.Data/Test/ProviderTests/sql/SCHEMA90
-rw-r--r--mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql105
-rw-r--r--mcs/class/System.Data/Test/ProviderTests/sql/sqlserver.sql119
4 files changed, 324 insertions, 0 deletions
diff --git a/mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog b/mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog
new file mode 100644
index 00000000000..f560dfcf536
--- /dev/null
+++ b/mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog
@@ -0,0 +1,10 @@
+2005-09-01 Sureshkumar T <tsureshkumar@novell.com>
+
+ * SCHEMA: schema specification.
+
+ * sqlserver.sql: sql script file to create test schema for mssql
+ database. added.
+
+ * mysql.sql: sql script file to create test schema for mysql
+ database. added.
+
diff --git a/mcs/class/System.Data/Test/ProviderTests/sql/SCHEMA b/mcs/class/System.Data/Test/ProviderTests/sql/SCHEMA
new file mode 100644
index 00000000000..a23cff686f4
--- /dev/null
+++ b/mcs/class/System.Data/Test/ProviderTests/sql/SCHEMA
@@ -0,0 +1,90 @@
+DATABASE: monotest
+
+
+========================== TABLE : numeric_family ==================================
+TABLE: numeric_family
+ id int PRIMARY KEY NOT NULL
+ type_bit bit NULL
+ type_tinyint tinyint NULL
+ type_smallint smallint NULL
+ type_int int NULL
+ type_bigint bigint NULL
+ type_decimal decimal (38, 0) NULL
+ type_numeric numeric (38, 0) NULL
+ type_money money NULL
+ type_smallmoney smallmoney NULL
+
+DATA:
+
+insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647);
+insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648);
+insert into numeric_family values (3,0,0,0,0,0,0,0,0,0);
+insert into numeric_family values (4,null,null,null,null,null,null,null,null,null);
+go
+
+========================== END TABLE : numeric_family ===============================
+
+
+========================== TABLE : binary_family ====================================
+TABLE: binary_family
+
+ id int PRIMARY KEY NOT NULL
+ type_binary binary NULL
+ type_varbinary varbinary (255) NULL
+ type_blob image NULL
+ type_tinyblob image NULL
+ type_mediumblob image NULL
+ type_longblob_image image NULL
+
+
+
+insert into binary_family values (1, convert (image, '555555'), convert (image, '0123456789012345678901234567890123456789012345678901234567890123456789'),
+ convert (image, '66666666'), convert (image, '777777'),
+ convert (image, '888888'), convert (image, '999999'));
+--insert into binary_family values (2,
+--insert into binary_family values (3,
+insert into binary_family values (4,null,null,null,null,null,null);
+
+========================== END TABLE : binary_family ================================
+
+
+=================================== TABLE: EMPLOYEE ================================
+TABLE : employee
+
+ id int PRIMARY KEY NOT NULL
+ fname varchar (50) NOT NULL
+ lname varchar (50) NULL
+ dob datetime NOT NULL
+ doj datetime NOT NULL
+ email varchar (50) NULL
+
+
+insert into employee values (1, 'suresh', 'kumar', '1978-08-22', '2001-03-12', 'suresh@gmail.com');
+insert into employee values (2, 'ramesh', 'rajendran', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
+insert into employee values (3, 'venkat', 'ramakrishnan', '1977-06-12', '2003-12-11', 'ramesh@yahoo.com');
+insert into employee values (4, 'ramu', 'dhasarath', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
+
+=============================== END TABLE: EMPLOYEE ================================
+
+
+=============================== STORED PROCEDURE : sp_clean_employee_table =========
+SP : sp_clean_employee_table
+
+NAME: sp_clean_employee_table
+
+PROCESS:
+ delete from employee where id > 6000;
+
+============================ END STORED PROCEDURE : sp_clean_employee_table =========
+
+
+============================ STORED PROCEDURE : sp_get_age ==========================
+NAME: procedure sp_get_age
+PARAMETER :
+ NAME : fname TYPE: varchar (50) DIRECTION : in
+ NAME : age TYPE: int DIRECTION : out
+PROCESS:
+ select age = datediff (day, dob, getdate ()) from employee where fname like fname;
+ return age;
+
+ =================================== END PROCEDURE : sp_get_age ===================== \ No newline at end of file
diff --git a/mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql b/mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql
new file mode 100644
index 00000000000..4b1723f30bd
--- /dev/null
+++ b/mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql
@@ -0,0 +1,105 @@
+delimiter //
+use monotest
+//
+
+-- =================================== OBJECT NUMERIC_FAMILY =========================
+-- TABLE : INT_FAMILY
+-- data with id > 6000 is not gaurenteed to be read-only.
+drop table if exists numeric_family;
+//
+
+create table numeric_family (
+ id int PRIMARY KEY NOT NULL,
+ type_bit bit NULL,
+ type_tinyint tinyint NULL,
+ type_smallint smallint NULL,
+ type_int int NULL,
+ type_bigint bigint NULL,
+ type_decimal decimal (38, 0) NULL,
+ type_numeric numeric (38, 0) NULL,
+ type_money numeric (38,0) NULL,
+ type_smallmoney numeric (12,0) NULL);
+-- does not have money & smallmoney types
+//
+
+insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647);
+insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648);
+insert into numeric_family values (3,0,0,0,0,0,0,0,0,0);
+insert into numeric_family values (4,null,null,null,null,null,null,null,null,null);
+//
+
+-- =================================== END OBJECT NUMERIC_FAMILY ========================
+
+-- =================================== OBJECT BINARY_FAMILY =========================
+-- TABLE : INT_FAMILY
+-- data with id > 6000 is not gaurenteed to be read-only.
+drop table if exists binary_family;
+//
+
+create table binary_family (
+ id int PRIMARY KEY NOT NULL,
+ type_binary binary NULL,
+ type_varbinary varbinary (255) NULL,
+ type_blob blob NULL,
+ type_tinyblob tinyblob NULL,
+ type_mediumblob mediumblob NULL,
+ type_longblob_image longblob NULL);
+//
+
+insert into binary_family values (1, '555555', '0123456789012345678901234567890123456789012345678901234567890123456789', '66666666', '777777', '888888', '999999');
+--insert into binary_family values (2,
+--insert into binary_family values (3,
+insert into binary_family values (4,null,null,null,null,null,null);
+//
+
+-- =================================== END OBJECT BINARY_FAMILY ========================
+
+
+-- =================================== OBJECT EMPLOYEE ============================
+-- TABLE : EMPLOYEE
+-- data with id above 6000 is not gaurenteed to be read-only.
+drop table if exists employee;
+//
+
+create table employee (
+ id int PRIMARY KEY NOT NULL,
+ fname varchar (50) NOT NULL,
+ lname varchar (50),
+ dob datetime NOT NULL,
+ doj datetime NOT NULL,
+ email varchar (50));
+
+grant all privileges on employee to monotester;
+
+insert into employee values (1, 'suresh', 'kumar', '1978-08-22', '2001-03-12', 'suresh@gmail.com');
+insert into employee values (2, 'ramesh', 'rajendran', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
+insert into employee values (3, 'venkat', 'ramakrishnan', '1977-06-12', '2003-12-11', 'ramesh@yahoo.com');
+insert into employee values (4, 'ramu', 'dhasarath', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
+//
+
+-- STORED PROCEDURES
+-- SP : sp_clean_person_table
+drop procedure if exists sp_clean_employee_table;
+//
+
+create procedure sp_clean_employee_table ()
+begin
+ delete from employee where id > 6000;
+end
+//
+
+-- SP : sp_get_age
+drop procedure if exists sp_get_age;
+//
+
+create procedure sp_get_age (
+ fname varchar (50),
+ OUT age int)
+as
+begin
+ select age = datediff (day, dob, getdate ()) from employee where fname like fname;
+ return age;
+end
+//
+
+-- =================================== END OBJECT EMPLOYEE ============================ \ No newline at end of file
diff --git a/mcs/class/System.Data/Test/ProviderTests/sql/sqlserver.sql b/mcs/class/System.Data/Test/ProviderTests/sql/sqlserver.sql
new file mode 100644
index 00000000000..b56e1cf7ce2
--- /dev/null
+++ b/mcs/class/System.Data/Test/ProviderTests/sql/sqlserver.sql
@@ -0,0 +1,119 @@
+use monotest
+go
+
+-- =================================== OBJECT EMPLOYEE ============================
+-- TABLE : INT_FAMILY
+-- data with id > 6000 is not gaurenteed to be read-only.
+if exists (select name from sysobjects where
+ name = 'numeric_family' and type = 'U')
+ drop table numeric_family;
+go
+
+create table numeric_family (
+ id int PRIMARY KEY NOT NULL,
+ type_bit bit NULL,
+ type_tinyint tinyint NULL,
+ type_smallint smallint NULL,
+ type_int int NULL,
+ type_bigint bigint NULL,
+ type_decimal decimal (38, 0) NULL,
+ type_numeric numeric (38, 0) NULL,
+ type_money money NULL,
+ type_smallmoney smallmoney NULL);
+go
+
+insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647);
+insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648);
+insert into numeric_family values (3,0,0,0,0,0,0,0,0,0);
+insert into numeric_family values (4,null,null,null,null,null,null,null,null,null);
+go
+
+-- =================================== END OBJECT EMPLOYEE ========================
+
+-- =================================== OBJECT BINARY_FAMILY =========================
+-- TABLE : INT_FAMILY
+-- data with id > 6000 is not gaurenteed to be read-only.
+if exists (select name from sysobjects where
+ name = 'employee' and type = 'U')
+ drop table binary_family;
+go
+
+create table binary_family (
+ id int PRIMARY KEY NOT NULL,
+ type_binary binary NULL,
+ type_varbinary varbinary (255) NULL,
+ type_blob image NULL,
+ type_tinyblob image NULL,
+ type_mediumblob image NULL,
+ type_longblob_image image NULL);
+go
+
+insert into binary_family values (1, convert (image, '555555'), convert (image, '0123456789012345678901234567890123456789012345678901234567890123456789'),
+ convert (image, '66666666'), convert (image, '777777'),
+ convert (image, '888888'), convert (image, '999999'));
+--insert into binary_family values (2,
+--insert into binary_family values (3,
+insert into binary_family values (4,null,null,null,null,null,null);
+go
+
+-- =================================== END OBJECT BINARY_FAMILY ========================
+
+
+-- =================================== OBJECT EMPLOYEE ============================
+-- TABLE : EMPLOYEE
+-- data with id above 6000 is not gaurenteed to be read-only.
+if exists (select name from sysobjects where
+ name = 'employee' and type = 'U')
+ drop table employee;
+go
+
+create table employee (
+ id int PRIMARY KEY NOT NULL,
+ fname varchar (50) NOT NULL,
+ lname varchar (50) NULL,
+ dob datetime NOT NULL,
+ doj datetime NOT NULL,
+ email varchar (50) NULL);
+
+grant all privileges on employee to monotester;
+
+insert into employee values (1, 'suresh', 'kumar', '1978-08-22', '2001-03-12', 'suresh@gmail.com');
+insert into employee values (2, 'ramesh', 'rajendran', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
+insert into employee values (3, 'venkat', 'ramakrishnan', '1977-06-12', '2003-12-11', 'ramesh@yahoo.com');
+insert into employee values (4, 'ramu', 'dhasarath', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
+go
+
+-- STORED PROCEDURES
+-- SP : sp_clean_person_table
+if exists (select name from sysobjects where
+ name = 'sp_clean_employee_table' and type = 'P')
+ drop procedure sp_clean_employee_table;
+go
+
+create procedure sp_clean_employee_table
+as
+begin
+ delete from employee where id > 6000;
+end
+go
+
+
+-- SP : sp_get_age
+if exists (select name from sysobjects where
+ name = 'sp_get_age' and type = 'P')
+ drop procedure sp_get_age;
+go
+
+create procedure sp_get_age (
+ @fname varchar (50),
+ @age int output)
+as
+begin
+ select @age = datediff (day, dob, getdate ()) from employee where fname like @fname;
+ return @age;
+end
+go
+
+
+
+-- =================================== END OBJECT EMPLOYEE ============================ \ No newline at end of file