adapdev-commits Mailing List for Adapdev.NET (Page 25)
Status: Beta
Brought to you by:
intesar66
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(26) |
Apr
(59) |
May
(37) |
Jun
(53) |
Jul
(13) |
Aug
(7) |
Sep
(5) |
Oct
(74) |
Nov
(404) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(10) |
Feb
(26) |
Mar
(64) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sean M. <int...@us...> - 2005-08-01 21:06:44
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev/Transactions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30766/Transactions Log Message: Directory /cvsroot/adapdev/Adapdev/src/Adapdev/Transactions added to the repository |
From: Sean M. <int...@us...> - 2005-08-01 21:04:59
|
Update of /cvsroot/adapdev/Adapdev/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30301/src Modified Files: AdapdevAssemblyInfo.cs Log Message: Added support for local transactions Index: AdapdevAssemblyInfo.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevAssemblyInfo.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AdapdevAssemblyInfo.cs 9 Jun 2005 04:20:24 -0000 1.6 --- AdapdevAssemblyInfo.cs 1 Aug 2005 21:04:47 -0000 1.7 *************** *** 27,31 **** // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.8.2")] // --- 27,31 ---- // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.8.3")] // |
From: Sean M. <int...@us...> - 2005-08-01 21:04:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30301/src/Adapdev.Data Modified Files: AbstractDAO.cs Log Message: Added support for local transactions Index: AbstractDAO.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/AbstractDAO.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractDAO.cs 21 Jul 2005 23:29:21 -0000 1.2 --- AbstractDAO.cs 1 Aug 2005 21:04:45 -0000 1.3 *************** *** 13,17 **** /// Data Access Object. /// </summary> ! public abstract class AbstractDAO : MarshalByRefObject, IDbDataAccessObject, IDbDataSetAccessObject, IDataReaderMapper, IDisposable { private DbProviderType provider = DbProviderType.SQLSERVER; --- 13,18 ---- /// Data Access Object. /// </summary> ! /// ! public abstract class AbstractDAO : IDbDataAccessObject, IDbDataSetAccessObject, IDataReaderMapper { private DbProviderType provider = DbProviderType.SQLSERVER; *************** *** 19,24 **** private string connectionString = ""; private string table = ""; - private bool disposed = false; - #region Constructors --- 20,23 ---- *************** *** 47,50 **** --- 46,50 ---- /// </summary> /// <param name="o"></param> + /// public void Save(object o) { *************** *** 70,73 **** --- 70,86 ---- /// <summary> + /// Saves the specified object to the datastore, using the specified open connection + /// </summary> + /// <param name="o">The object to save</param> + /// <param name="conn">The open connection to use</param> + /// <param name="transaction">The transaction to execute under</param> + /// <remarks>The IDbConnection must already be open</remarks> + public void Save(object o, IDbConnection conn, IDbTransaction transaction) + { + this.ExecuteNonQuery(this.CreateInsertCommand(o), conn, transaction); + this.CustomSave(o, conn, transaction); + } + + /// <summary> /// Deletes the specified object by its id /// </summary> *************** *** 90,93 **** --- 103,118 ---- /// <summary> + /// Deletes the specified object by its id + /// </summary> + /// <param name="id">The id for the object to delete</param> + /// <param name="conn">The open connection to use</param> + /// <param name="transaction">The transaction to execute under</param> + /// <remarks>The IDbConnection must already be open</remarks> + public void Delete(object id, IDbConnection conn, IDbTransaction transaction) + { + this.ExecuteNonQuery(this.CreateDeleteOneCommand(id), conn, transaction); + } + + /// <summary> /// Updates the underlying datastore /// </summary> *************** *** 110,113 **** --- 135,151 ---- /// <summary> + /// Updates the underlying datastore + /// </summary> + /// <param name="o">The object to use for the update</param> + /// <param name="conn">The open connection to use</param> + /// <param name="transaction">The transaction to execute under</param> + /// <remarks>The IDbConnection must already be open</remarks> + public void Update(object o, IDbConnection conn, IDbTransaction transaction) + { + this.ExecuteNonQuery(this.CreateUpdateCommand(o), conn, transaction); + } + + + /// <summary> /// Selects all records in the underlying datastore /// </summary> *************** *** 367,370 **** --- 405,421 ---- /// <summary> + /// Executes the specified command + /// </summary> + /// <param name="cmd">The command to use</param> + /// <param name="conn">The open IDbConnection to use</param> + /// <param name="transaction">The transaction to execute under</param> + public void ExecuteNonQuery(IDbCommand cmd, IDbConnection conn, IDbTransaction transaction) + { + cmd.Connection = conn; + cmd.Transaction = transaction; + cmd.ExecuteNonQuery(); + } + + /// <summary> /// Executes the specified query /// </summary> *************** *** 404,407 **** --- 455,469 ---- } + /// <summary> + /// Executes the specified command + /// </summary> + /// <param name="command">The command to use</param> + /// <param name="connection">The open IDbConnection to use</param> + /// <param name="transaction">The transaction to execute under</param> + public void ExecuteNonQuery(string command, IDbConnection connection, IDbTransaction transaction) + { + this.ExecuteNonQuery(this.CreateCommand(command), connection, transaction); + } + #endregion *************** *** 816,819 **** --- 878,883 ---- protected virtual void CustomSave(object o, IDbConnection connection){} + protected virtual void CustomSave(object o, IDbConnection connection, IDbTransaction transaction){} + #endregion *************** *** 857,895 **** #endregion - #region IDisposable Members - - public void Dispose() - { - Dispose(true); - // Take yourself off the Finalization queue - // to prevent finalization code for this object - // from executing a second time. - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - // Check to see if Dispose has already been called. - if(!this.disposed) - { - // If disposing equals true, dispose all managed - // and unmanaged resources. - if(disposing) - { - // Dispose managed resources. - } - } - disposed = true; - } - - ~AbstractDAO() - { - // Do not re-create Dispose clean-up code here. - // Calling Dispose(false) is optimal in terms of - // readability and maintainability. - Dispose(false); - } - - #endregion } } \ No newline at end of file --- 921,924 ---- |
From: Sean M. <int...@us...> - 2005-08-01 21:04:58
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30301/src/Adapdev Modified Files: Adapdev.csproj Log Message: Added support for local transactions Index: Adapdev.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev/Adapdev.csproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Adapdev.csproj 2 Jun 2005 03:26:01 -0000 1.8 --- Adapdev.csproj 1 Aug 2005 21:04:47 -0000 1.9 *************** *** 100,103 **** --- 100,108 ---- HintPath = "..\..\lib\log4net.dll" /> + <Reference + Name = "System.EnterpriseServices" + AssemblyName = "System.EnterpriseServices" + HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.EnterpriseServices.dll" + /> </References> </Build> *************** *** 561,564 **** --- 566,574 ---- /> <File + RelPath = "Transactions\TransactionScope.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "UID\GuidUIDGenerator.cs" SubType = "Code" |
From: reic0113 <rei...@us...> - 2005-07-25 02:22:26
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24456/src/Adapdev.Data Modified Files: Adapdev.Data.csproj DbProviderFactory.cs Log Message: - benr: initial mysql integration checkin Index: DbProviderFactory.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/DbProviderFactory.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DbProviderFactory.cs 10 Apr 2005 09:59:21 -0000 1.2 --- DbProviderFactory.cs 25 Jul 2005 02:22:15 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- using System.Data.SqlClient; using System.Data.OracleClient; + using MySql.Data.MySqlClient; /// <summary> *************** *** 28,31 **** --- 29,34 ---- case DbProviderType.ORACLE: return new OracleCommand(); + case DbProviderType.MYSQL: + return new MySqlCommand(); default: return new OleDbCommand(); *************** *** 50,53 **** --- 53,58 ---- case DbProviderType.ORACLE: return new OracleConnection(); + case DbProviderType.MYSQL: + return new MySqlConnection(); default: return new OleDbConnection(); *************** *** 73,76 **** --- 78,86 ---- command.Connection = connection; return orada; + case DbProviderType.MYSQL: + MySqlDataAdapter mysqlda = new MySqlDataAdapter(); + mysqlda.SelectCommand = (MySqlCommand) command; + command.Connection = connection; + return mysqlda; default: OleDbDataAdapter oleda = new OleDbDataAdapter(); Index: Adapdev.Data.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Adapdev.Data.csproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Adapdev.Data.csproj 3 Jun 2005 04:26:37 -0000 1.9 --- Adapdev.Data.csproj 25 Jul 2005 02:22:15 -0000 1.10 *************** *** 95,98 **** --- 95,103 ---- HintPath = "..\..\lib\log4net.dll" /> + <Reference + Name = "MySql.Data" + AssemblyName = "MySql.Data" + HintPath = "..\..\lib\MySql.Data.dll" + /> </References> </Build> *************** *** 391,394 **** --- 396,424 ---- /> <File + RelPath = "Sql\MySqlCriteria.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Sql\MySqlDeleteQuery.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Sql\MySqlInsertQuery.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Sql\MySqlSelectQuery.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Sql\MySqlUpdateQuery.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Sql\OracleCriteria.cs" SubType = "Code" |
From: reic0113 <rei...@us...> - 2005-07-25 02:22:25
|
Update of /cvsroot/adapdev/Adapdev/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24456/src Modified Files: AdapdevFramework.suo Log Message: - benr: initial mysql integration checkin Index: AdapdevFramework.suo =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevFramework.suo,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 Binary files /tmp/cvsyo4rLp and /tmp/cvsK0WbIj differ |
From: reic0113 <rei...@us...> - 2005-07-25 02:22:25
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24456/src/Adapdev.Data/Sql Modified Files: CriteriaFactory.cs DialectConstants.cs QueryConstants.cs QueryFactory.cs QueryHelper.cs Added Files: MySqlCriteria.cs MySqlDeleteQuery.cs MySqlInsertQuery.cs MySqlSelectQuery.cs MySqlUpdateQuery.cs Log Message: - benr: initial mysql integration checkin Index: QueryConstants.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/QueryConstants.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QueryConstants.cs 20 May 2005 02:10:53 -0000 1.2 --- QueryConstants.cs 25 Jul 2005 02:22:15 -0000 1.3 *************** *** 19,22 **** --- 19,25 ---- public const char ORACLE_DATE = '\''; + public const char MYSQL_STRING = '\''; + public const char MYSQL_DATE = '\''; + } } \ No newline at end of file Index: QueryHelper.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/QueryHelper.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QueryHelper.cs 20 May 2005 02:10:53 -0000 1.4 --- QueryHelper.cs 25 Jul 2005 02:22:15 -0000 1.5 *************** *** 57,60 **** --- 57,62 ---- case Adapdev.Data.DbType.ORACLE: return DialectConstants.ORACLE_DATE; + case Adapdev.Data.DbType.MYSQL: + return DialectConstants.MYSQL_DATE; default: throw new Exception("DbType " + type + " not supported currently."); *************** *** 77,80 **** --- 79,84 ---- case Adapdev.Data.DbType.ORACLE: return DialectConstants.ORACLE_PREDELIM; + case Adapdev.Data.DbType.MYSQL: + return DialectConstants.MYSQL_PREDELIM; default: throw new Exception("DbType " + type + " not supported currently."); *************** *** 97,100 **** --- 101,106 ---- case Adapdev.Data.DbType.ORACLE: return DialectConstants.ORACLE_POSTDELIM; + case Adapdev.Data.DbType.MYSQL: + return DialectConstants.MYSQL_POSTDELIM; default: throw new Exception("DbType " + type + " not supported currently."); *************** *** 117,120 **** --- 123,128 ---- case Adapdev.Data.DbType.ORACLE: return DialectConstants.ORACLE_STRING; + case Adapdev.Data.DbType.MYSQL: + return DialectConstants.MYSQL_STRING; default: throw new Exception("DbType " + type + " not supported currently."); *************** *** 140,143 **** --- 148,154 ---- case DbProviderType.OLEDB: return "?"; + case DbProviderType.MYSQL: + columnName = StringUtil.RemoveSpaces(columnName); + return "?" + columnName; default: throw new Exception("DbProviderType " + provider + " is not currently supported."); *************** *** 162,165 **** --- 173,183 ---- return s; } + + public static string GetMySqlLastInsertedCommand(string table, string column) + { + string s = "SELECT `" + column + "` FROM `" + table + "` ORDER BY `" + column + "` DESC LIMIT 1"; + Console.WriteLine(s); + return s; + } } } \ No newline at end of file --- NEW FILE: MySqlSelectQuery.cs --- using System; namespace Adapdev.Data.Sql { /// <summary> /// Summary description for MySqlSelectQuery. /// </summary> public class MySqlSelectQuery : SelectQuery { public MySqlSelectQuery():base(DbType.MYSQL, DbProviderType.MYSQL){} public MySqlSelectQuery(string table):base(DbType.MYSQL, DbProviderType.MYSQL, table){} protected override string GetLimit() { if (maxRecords > 0) { return " LIMIT " + maxRecords; } return ""; } public override string GetText() { return "SELECT " + this.GetColumns() + " FROM " + this._table + this._join + this.GetCriteria() + this.GetOrderBy() + this.GetGroupBy() + this.GetLimit(); } } } --- NEW FILE: MySqlUpdateQuery.cs --- using System; namespace Adapdev.Data.Sql { /// <summary> /// Summary description for MySqlUpdateQuery. /// </summary> public class MySqlUpdateQuery : UpdateQuery { public MySqlUpdateQuery():base(DbType.MYSQL, DbProviderType.MYSQL){} public MySqlUpdateQuery(string table):base(DbType.MYSQL, DbProviderType.MYSQL, table){} } } Index: CriteriaFactory.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/CriteriaFactory.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CriteriaFactory.cs 10 Apr 2005 09:59:21 -0000 1.2 --- CriteriaFactory.cs 25 Jul 2005 02:22:15 -0000 1.3 *************** *** 18,21 **** --- 18,23 ---- case DbType.ORACLE: return new OracleCriteria(); + case DbType.MYSQL: + return new MySqlCriteria(); default: throw new Exception("DbType " + type + " not supported currently."); --- NEW FILE: MySqlDeleteQuery.cs --- using System; namespace Adapdev.Data.Sql { /// <summary> /// Summary description for MySqlDeleteQuery. /// </summary> public class MySqlDeleteQuery : DeleteQuery { public MySqlDeleteQuery():base(DbType.MYSQL, DbProviderType.MYSQL){} public MySqlDeleteQuery(string table):base(DbType.MYSQL, DbProviderType.MYSQL, table){} } } Index: QueryFactory.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/QueryFactory.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QueryFactory.cs 10 Apr 2005 09:59:21 -0000 1.2 --- QueryFactory.cs 25 Jul 2005 02:22:15 -0000 1.3 *************** *** 34,37 **** --- 34,39 ---- case DbType.ORACLE: return new OracleUpdateQuery(); + case DbType.MYSQL: + return new MySqlUpdateQuery(); default: throw new System.NotImplementedException("DbType " + db + " not supported currently."); *************** *** 61,64 **** --- 63,68 ---- case DbType.ORACLE: return new OracleSelectQuery(); + case DbType.MYSQL: + return new MySqlSelectQuery(); default: throw new System.NotImplementedException("DbType " + db + " not supported currently."); *************** *** 95,98 **** --- 99,104 ---- case DbType.ORACLE: return new OracleDeleteQuery(); + case DbType.MYSQL: + return new MySqlDeleteQuery(); default: throw new System.NotImplementedException("DbType " + db + " not supported currently."); *************** *** 129,132 **** --- 135,140 ---- case DbType.ORACLE: return new OracleInsertQuery(); + case DbType.MYSQL: + return new MySqlInsertQuery(); default: throw new System.NotImplementedException("DbType " + db + " not supported currently."); --- NEW FILE: MySqlCriteria.cs --- namespace Adapdev.Data.Sql { using System.Collections; using System.Text; using Adapdev.Text; /// <summary> /// Summary description for MySqlCriteria. /// </summary> public class MySqlCriteria : Criteria { public MySqlCriteria() : base(DbType.MYSQL, DbProviderType.MYSQL) { } public MySqlCriteria(string sql) : base(DbType.MYSQL, DbProviderType.MYSQL, sql) { } } } Index: DialectConstants.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/DialectConstants.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DialectConstants.cs 10 Apr 2005 09:59:21 -0000 1.2 --- DialectConstants.cs 25 Jul 2005 02:22:15 -0000 1.3 *************** *** 20,23 **** --- 20,28 ---- public const char ORACLE_DATE = '\''; public const char ORACLE_STRING = '\''; + + public const char MYSQL_PREDELIM = '`'; + public const char MYSQL_POSTDELIM = '`'; + public const char MYSQL_DATE = '\''; + public const char MYSQL_STRING = '\''; } } \ No newline at end of file --- NEW FILE: MySqlInsertQuery.cs --- using System; namespace Adapdev.Data.Sql { /// <summary> /// Summary description for MySqlInsertQuery. /// </summary> public class MySqlInsertQuery : InsertQuery { public MySqlInsertQuery():base(DbType.MYSQL, DbProviderType.MYSQL){} public MySqlInsertQuery(string table):base(DbType.MYSQL, DbProviderType.MYSQL, table){} } } |
From: reic0113 <rei...@us...> - 2005-07-25 02:22:25
|
Update of /cvsroot/adapdev/Adapdev/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24456/lib Added Files: MySQL.Data.pdb MySql.Data.dll Log Message: - benr: initial mysql integration checkin --- NEW FILE: MySql.Data.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: MySQL.Data.pdb --- (This appears to be a binary file; contents omitted.) |
From: reic0113 <rei...@us...> - 2005-07-25 02:22:24
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24456/src/Adapdev.Data/Schema Modified Files: ColumnSchema.cs SchemaBuilder.cs Log Message: - benr: initial mysql integration checkin Index: ColumnSchema.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema/ColumnSchema.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ColumnSchema.cs 25 Mar 2005 02:14:29 -0000 1.3 --- ColumnSchema.cs 25 Jul 2005 02:22:15 -0000 1.4 *************** *** 225,228 **** --- 225,234 ---- } + public string GetMySqlDbTypeName() + { + MySql.Data.MySqlClient.MySqlDbType dbType = (MySql.Data.MySqlClient.MySqlDbType)DataTypeId; + return dbType.ToString(); + } + public override string ToString() { Index: SchemaBuilder.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema/SchemaBuilder.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SchemaBuilder.cs 19 May 2005 03:30:58 -0000 1.8 --- SchemaBuilder.cs 25 Jul 2005 02:22:15 -0000 1.9 *************** *** 7,10 **** --- 7,11 ---- using Adapdev.Data; using Adapdev.Data.Sql; + using MySql.Data.MySqlClient; /// <summary> *************** *** 55,58 **** --- 56,68 ---- public static DatabaseSchema CreateDatabaseSchema(string oledbConnectionString, Adapdev.Data.DbType databaseType, DbProviderType providerType, string schemaFilter, Adapdev.IProgressCallback progress) { + + ///<HACK> + /// benr: this should be done more elegantly + /// </HACK> + if (databaseType == Adapdev.Data.DbType.MYSQL) + { + return CreateMySqlDatabaseSchema(oledbConnectionString); + } + int recordCount = 0; dbProviderType = providerType; *************** *** 211,221 **** public static DataTable GetReaderSchema(string oledbConnectionString, string tableName, Adapdev.Data.DbType databaseType) { ! DataTable schemaTable = null; ! try { ! OleDbConnection cn = new OleDbConnection(); ! OleDbCommand cmd = new OleDbCommand(); ! OleDbDataReader myReader; ! cn.ConnectionString = oledbConnectionString; cn.Open(); --- 221,239 ---- public static DataTable GetReaderSchema(string oledbConnectionString, string tableName, Adapdev.Data.DbType databaseType) { ! switch(databaseType) ! { ! case Adapdev.Data.DbType.MYSQL: ! return GetReaderSchema(new MySqlConnection(), new MySqlCommand(), oledbConnectionString, databaseType, tableName); ! default: ! return GetReaderSchema(new OleDbConnection(), new OleDbCommand(), oledbConnectionString, databaseType, tableName); ! } ! } ! private static DataTable GetReaderSchema(IDbConnection cn, IDbCommand cmd, string connectionString, Adapdev.Data.DbType databaseType, string tableName) ! { ! DataTable schemaTable = null; ! try ! { ! cn.ConnectionString = connectionString; cn.Open(); *************** *** 224,228 **** cmd.Connection = cn; cmd.CommandText = "SELECT * FROM " + QueryHelper.GetPreDelimeter(databaseType) + tableName + QueryHelper.GetPostDelimeter(databaseType); ! myReader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly); schemaTable = myReader.GetSchemaTable(); --- 242,246 ---- cmd.Connection = cn; cmd.CommandText = "SELECT * FROM " + QueryHelper.GetPreDelimeter(databaseType) + tableName + QueryHelper.GetPostDelimeter(databaseType); ! IDataReader myReader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly); schemaTable = myReader.GetSchemaTable(); *************** *** 230,234 **** myReader.Close(); cn.Close(); ! } catch (Exception ex) { schemaTable = null; if (_callback != null) _callback.AddMessage(ProgressMessageTypes.Warning, "Could not load Column information for " + tableName + ". " + ex.Message); --- 248,254 ---- myReader.Close(); cn.Close(); ! } ! catch (Exception ex) ! { schemaTable = null; if (_callback != null) _callback.AddMessage(ProgressMessageTypes.Warning, "Could not load Column information for " + tableName + ". " + ex.Message); *************** *** 237,241 **** } - /// <summary> /// Gets the OLE db schema. --- 257,260 ---- *************** *** 366,369 **** --- 385,477 ---- } + + #region MySql Specific Methods + + private static DatabaseSchema CreateMySqlDatabaseSchema(string connectionString) + { + dbProviderType = DbProviderType.MYSQL; + + DataTable schemaTables = SchemaBuilder.GetMySqlSchema(connectionString); + + DatabaseSchema di = new DatabaseSchema(); + MySqlConnection c = new MySqlConnection(connectionString); + di.Name = c.Database; + c = null; + + foreach (DataRow dr in schemaTables.Rows) + { + TableSchema ti = CreateMySqlTableSchema(dr); + CreateColumnSchemas(ti, connectionString, Adapdev.Data.DbType.MYSQL); + + DataTable columns = SchemaBuilder.GetMySqlColumnSchema(connectionString, ti.Name); + + foreach(DataRow columnRow in columns.Rows) + { + if (columnRow["Key"] + "" == "PRI") + { + ti[columnRow["Field"].ToString()].IsPrimaryKey = true; + } + else if (columnRow["Key"] + "" == "MUL") + { + ti[columnRow["Field"].ToString()].IsForeignKey = true; + } + } + di.AddTable(ti); + } + + return di; + } + + private static TableSchema CreateMySqlTableSchema(DataRow dr) + { + TableSchema ti = new TableSchema(); + ti.Alias = dr[0].ToString(); + ti.Name = ti.Alias; + ti.TableType = TableType.TABLE; + return ti; + } + + private static DataTable GetMySqlColumnSchema(string connectionString, string tableName) + { + DataTable schemaTable = new DataTable(); + MySqlConnection cn = new MySqlConnection(); + MySqlCommand cmd = new MySqlCommand(); + MySqlDataAdapter da = new MySqlDataAdapter(); + + cn.ConnectionString = connectionString; + cn.Open(); + + cmd.Connection = cn; + cmd.CommandText = "SHOW COLUMNS IN " + tableName; + da.SelectCommand = cmd; + da.Fill(schemaTable); + + cn.Close(); + + + return schemaTable; + } + + /// <summary> + /// Gets the OleDbConnection.GetOleDbSchemaTable for a specified connection + /// </summary> + /// <param name="mysqlConnectionString">The connectoin to use</param> + /// <param name="guid"></param> + /// <param name="filter"></param> + /// <returns></returns> + public static DataTable GetMySqlSchema(string mysqlConnectionString) + { + MySqlConnection conn = new MySqlConnection(mysqlConnectionString); + conn.Open(); + MySqlCommand command = new MySqlCommand("SHOW TABLES", conn); + DataTable tbl = new DataTable(); + MySqlDataAdapter da = new MySqlDataAdapter(command); + da.Fill(tbl); + conn.Close(); + return tbl; + } + + #endregion + } } \ No newline at end of file |
From: reic0113 <rei...@us...> - 2005-07-25 02:22:24
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24456/src/Adapdev.Data/Xml Modified Files: ProviderInfo.xml Log Message: - benr: initial mysql integration checkin Index: ProviderInfo.xml =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Xml/ProviderInfo.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ProviderInfo.xml 20 Jun 2005 01:47:49 -0000 1.5 --- ProviderInfo.xml 25 Jul 2005 02:22:16 -0000 1.6 *************** *** 1253,1255 **** --- 1253,1526 ---- </Type> </ProviderInfo> + <ProviderInfo Name="mysql"> + <Type> + <Id>1</Id> + <Name>tinyint</Name> + <Object>Int16</Object> + <Prefix></Prefix> + <Postfix></Postfix> + <Default>0</Default> + <TestDefault>1</TestDefault> + </Type> + <!--<Type> + <Id>1</Id> + <Name>bit</Name> + <Object>Int32</Object> + <Prefix></Prefix> + <Postfix></Postfix> + <Default>0</Default> + <TestDefault>0</TestDefault> + </Type> + <Type> + <Id>1</Id> + <Name>bool</Name> + <Object>Int32</Object> + <Prefix></Prefix> + <Postfix></Postfix> + <Default>0</Default> + <TestDefault>0</TestDefault> + </Type>--> + <Type> + <Id>2</Id> + <Name>smallint</Name> + <Object>Int32</Object> + <Prefix></Prefix> + <Postfix></Postfix> + <Default>0</Default> + <TestDefault>1</TestDefault> + </Type> + <Type> + <Id>9</Id> + <Name>mediumint</Name> + <Object>Int32</Object> + <Prefix></Prefix> + <Postfix></Postfix> + <Default>0</Default> + <TestDefault>0</TestDefault> + </Type> + <Type> + <Id>3</Id> + <Name>int</Name> + <Object>Int32</Object> + <Prefix> + </Prefix> + <Postfix> + </Postfix> + <Default>0</Default> + <TestDefault>2</TestDefault> + </Type> + <!--<Type> + <Id>3</Id> + <Name>integer</Name> + <Object>Int32</Object> + <Prefix> + </Prefix> + <Postfix> + </Postfix> + <Default>0</Default> + <TestDefault>2</TestDefault> + </Type>--> + <Type> + <Id>8</Id> + <Name>bigint</Name> + <Object>Int64</Object> + <Prefix> + </Prefix> + <Postfix> + </Postfix> + <Default>0</Default> + <TestDefault>2</TestDefault> + </Type> + <!--<Type> + <Id>5</Id> + <Name>real</Name> + <Object>Double</Object> + <Prefix> + </Prefix> + <Postfix> + </Postfix> + <Default>0</Default> + <TestDefault>2</TestDefault> + </Type>--> + <Type> + <Id>5</Id> + <Name>double</Name> + <Object>Double</Object> + <Prefix> + </Prefix> + <Postfix> + </Postfix> + <Default>0</Default> + <TestDefault>2</TestDefault> + </Type> + <Type> + <Id>4</Id> + <Name>float</Name> + <Object>Double</Object> + <Prefix> + </Prefix> + <Postfix> + </Postfix> + <Default>0</Default> + <TestDefault>2</TestDefault> + </Type> + <Type> + <Id>0</Id> + <Name>decimal</Name> + <Object>Decimal</Object> + <Prefix> + </Prefix> + <Postfix> + </Postfix> + <Default>0</Default> + <TestDefault>2</TestDefault> + </Type> + <!--<Type> + <Id>0</Id> + <Name>numeric</Name> + <Object>Decimal</Object> + <Prefix> + </Prefix> + <Postfix> + </Postfix> + <Default>0</Default> + <TestDefault>2</TestDefault> + </Type>--> + <!--<Type> + <Id>253</Id> + <Name>char</Name> + <Object>string</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default>""</Default> + <TestDefault>"test"</TestDefault> + </Type>--> + <Type> + <Id>253</Id> + <Name>varchar</Name> + <Object>string</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default>""</Default> + <TestDefault>"test"</TestDefault> + </Type> + <Type> + <Id>10</Id> + <Name>date</Name> + <Object>DateTime</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default>DateTime.Now</Default> + <TestDefault>DateTime.Now</TestDefault> + </Type> + <Type> + <Id>11</Id> + <Name>time</Name> + <Object>DateTime</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default>TimeSpan.Zero</Default> + <TestDefault>TimeSpan.Zero</TestDefault> + </Type> + <Type> + <Id>13</Id> + <Name>year</Name> + <Object>Int32</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default>0</Default> + <TestDefault>2000</TestDefault> + </Type> + <Type> + <Id>7</Id> + <Name>timestamp</Name> + <Object>Int32</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default>DateTime.Now</Default> + <TestDefault>DateTime.Now</TestDefault> + </Type> + <Type> + <Id>12</Id> + <Name>datetime</Name> + <Object>DateTime</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default>DateTime.Now</Default> + <TestDefault>DateTime.Now</TestDefault> + </Type> + <Type> + <Id>252</Id> + <Name>tinyblob</Name> + <Object>Byte[]</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default>null</Default> + <TestDefault>System.Text.Encoding.ASCII.GetBytes("Test String2")</TestDefault> + </Type> + <!--<Type> + <Id>252</Id> + <Name>blob</Name> + <Object>Byte[]</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default></Default> + <TestDefault></TestDefault> + </Type> + <Type> + <Id>252</Id> + <Name>mediumblog</Name> + <Object>Byte[]</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default></Default> + <TestDefault></TestDefault> + </Type> + <Type> + <Id>252</Id> + <Name>longblob</Name> + <Object>Byte[]</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default></Default> + <TestDefault></TestDefault> + </Type> + + <Type> + <Id>252</Id> + <Name>tinytext</Name> + <Object>Byte[]</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default></Default> + <TestDefault></TestDefault> + </Type> + <Type> + <Id>252</Id> + <Name>text</Name> + <Object>Byte[]</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default></Default> + <TestDefault></TestDefault> + </Type> + <Type> + <Id>252</Id> + <Name>mediumtext</Name> + <Object>Byte[]</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default></Default> + <TestDefault></TestDefault> + </Type> + <Type> + <Id>252</Id> + <Name>longtext</Name> + <Object>Byte[]</Object> + <Prefix>'</Prefix> + <Postfix>'</Postfix> + <Default></Default> + <TestDefault></TestDefault> + </Type>--> + </ProviderInfo> </ProvidersInfo> \ No newline at end of file |
From: reic0113 <rei...@us...> - 2005-07-25 02:22:24
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24456/src/Adapdev.Windows.Forms Modified Files: DatabaseWizard.cs Log Message: - benr: initial mysql integration checkin Index: DatabaseWizard.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/DatabaseWizard.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DatabaseWizard.cs 19 May 2005 03:30:58 -0000 1.5 --- DatabaseWizard.cs 25 Jul 2005 02:22:16 -0000 1.6 *************** *** 490,494 **** try { validSelected = TestConnectionType(_connectionProvider.ProviderType, GetConnectionString()); ! validInternal = (_connectionProvider.ProviderType == DbProviderType.OLEDB ? true : TestConnectionType(DbProviderType.OLEDB, this.GetInternalProviderConnectionString())); } catch (Exception ex) { if (!validSelected) { --- 490,499 ---- try { validSelected = TestConnectionType(_connectionProvider.ProviderType, GetConnectionString()); ! // ! // 7/17/2005 benr: ! // changed parameter of TestConnectionType to read from the internal ! // provider as specified in the ProviderConfig.xml file ! // ! validInternal = (_connectionProvider.ProviderType == DbProviderType.OLEDB ? true : TestConnectionType(_connectionProvider.InternalProvider.ProviderType, this.GetInternalProviderConnectionString())); } catch (Exception ex) { if (!validSelected) { |
From: reic0113 <rei...@us...> - 2005-07-25 02:22:24
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.CodeGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24456/src/Adapdev.CodeGen Modified Files: NVelocityTableCodeTemplate.cs Log Message: - benr: initial mysql integration checkin Index: NVelocityTableCodeTemplate.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.CodeGen/NVelocityTableCodeTemplate.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NVelocityTableCodeTemplate.cs 27 May 2005 02:50:28 -0000 1.7 --- NVelocityTableCodeTemplate.cs 25 Jul 2005 02:22:15 -0000 1.8 *************** *** 102,105 **** --- 102,106 ---- context.Put("template", this); context.Put("queryhelper", new QueryHelper()); + context.Put("mysqlprovidertype", Adapdev.Data.DbProviderType.MYSQL); StringWriter writer = new StringWriter(); *************** *** 308,311 **** --- 309,314 ---- else if(d.DatabaseType == Adapdev.Data.DbType.ORACLE) return c.Alias; + else if (d.DatabaseType == Adapdev.Data.DbType.MYSQL) + return c.Alias; else return c.Alias + ".ToOADate()"; |
From: Sean M. <int...@us...> - 2005-07-21 23:29:32
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11796/src/Adapdev.Data/Sql Modified Files: SelectQuery.cs Log Message: Index: SelectQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/SelectQuery.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelectQuery.cs 25 May 2005 05:17:47 -0000 1.2 --- SelectQuery.cs 21 Jul 2005 23:29:21 -0000 1.3 *************** *** 128,132 **** this._join = String.Format(" {0} {1} ON {2}.{3} = {4}.{5} ", this.GetJoinType(type), QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), ! this._table, QueryHelper.GetPreDelimeter(this.type) + firstTableColumn + QueryHelper.GetPostDelimeter(this.type), QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), --- 128,132 ---- this._join = String.Format(" {0} {1} ON {2}.{3} = {4}.{5} ", this.GetJoinType(type), QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), ! QueryHelper.GetPreDelimeter(this.type) + this._table + QueryHelper.GetPostDelimeter(this.type), QueryHelper.GetPreDelimeter(this.type) + firstTableColumn + QueryHelper.GetPostDelimeter(this.type), QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), |
From: Sean M. <int...@us...> - 2005-07-21 23:29:32
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11796/src/Adapdev.Data Modified Files: AbstractDAO.cs Log Message: Index: AbstractDAO.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/AbstractDAO.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AbstractDAO.cs 28 Feb 2005 01:31:45 -0000 1.1.1.1 --- AbstractDAO.cs 21 Jul 2005 23:29:21 -0000 1.2 *************** *** 13,17 **** /// Data Access Object. /// </summary> ! public abstract class AbstractDAO : MarshalByRefObject, IDbDataAccessObject, IDbDataSetAccessObject, IDataReaderMapper { private DbProviderType provider = DbProviderType.SQLSERVER; --- 13,17 ---- /// Data Access Object. /// </summary> ! public abstract class AbstractDAO : MarshalByRefObject, IDbDataAccessObject, IDbDataSetAccessObject, IDataReaderMapper, IDisposable { private DbProviderType provider = DbProviderType.SQLSERVER; *************** *** 19,22 **** --- 19,24 ---- private string connectionString = ""; private string table = ""; + private bool disposed = false; + #region Constructors *************** *** 284,287 **** --- 286,312 ---- /// <param name="id">The id for the record to select</param> /// <returns></returns> + public object SelectById(object id) + { + return this.SelectOne(id); + } + + /// <summary> + /// Selects a specific record, using the passed in id + /// </summary> + /// <param name="id">The id for the record to select</param> + /// <param name="connection">The open IDbConnection to use</param> + /// <returns></returns> + public object SelectById(object id, IDbConnection connection) + { + return this.SelectOne(id, connection); + } + + /// <summary> + /// Selects a specific record, using the passed in id + /// </summary> + /// <param name="id">The id for the record to select</param> + /// <returns></returns> + /// + [Obsolete("Deprecated. Please use SelectById")] public object SelectOne(object id) { *************** *** 301,304 **** --- 326,330 ---- /// <param name="conn">The open IDbConnection to use</param> /// <returns></returns> + [Obsolete("Deprecated. Please use SelectById")] public object SelectOne(object id, IDbConnection conn) { *************** *** 468,471 **** --- 494,518 ---- /// Creates a DataSet using the given command /// </summary> + /// <param name="sql">The sql command to execute</param> + /// <returns></returns> + public DataSet SelectDS(string sql) + { + return this.SelectDS(this.CreateCommand(sql)); + } + + /// <summary> + /// Creates a DataSet using the given command + /// </summary> + /// <param name="sql">The sql command to execute</param> + /// <param name="conn">The open IDbConnection to use</param> + /// <returns></returns> + public DataSet SelectDS(string sql, IDbConnection conn) + { + return this.GetDataSet(this.CreateCommand(sql), conn); + } + + /// <summary> + /// Creates a DataSet using the given command + /// </summary> /// <param name="cmd">The command to execute</param> /// <param name="conn">The open IDbConnection to use</param> *************** *** 481,484 **** --- 528,554 ---- /// <param name="id">The id of the record to select</param> /// <returns></returns> + public DataSet SelectDatasetById(object id) + { + return this.SelectOneDS(id); + } + + /// <summary> + /// Returns one record wrapped in a DataSet + /// </summary> + /// <param name="id">The id of the record to select</param> + /// <param name="conn">The open IDbConnection to use</param> + /// <returns></returns> + public DataSet SelectDatasetById(object id, IDbConnection conn) + { + return this.SelectOneDS(id, conn); + } + + /// <summary> + /// Returns one record wrapped in a DataSet + /// </summary> + /// <param name="id">The id of the record to select</param> + /// <returns></returns> + /// + [Obsolete("Deprecated. Please use SelectDataSetById")] public DataSet SelectOneDS(object id) { *************** *** 492,495 **** --- 562,566 ---- /// <param name="conn">The open IDbConnection to use</param> /// <returns></returns> + [Obsolete("Deprecated. Please use SelectDataSetById")] public DataSet SelectOneDS(object id, IDbConnection conn) { *************** *** 664,667 **** --- 735,748 ---- /// </summary> /// <param name="cmd">The command to execute</param> + /// <returns></returns> + protected DataSet CreateDataSet(string cmd) + { + return DbProviderFactory.CreateDataSet(this.connectionString, this.CreateCommand(cmd), this.provider); + } + + /// <summary> + /// Creates a DataSet, using the given command + /// </summary> + /// <param name="cmd">The command to execute</param> /// <param name="conn">The open connection to use</param> /// <returns></returns> *************** *** 775,778 **** --- 856,895 ---- #endregion + + #region IDisposable Members + + public void Dispose() + { + Dispose(true); + // Take yourself off the Finalization queue + // to prevent finalization code for this object + // from executing a second time. + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + // Check to see if Dispose has already been called. + if(!this.disposed) + { + // If disposing equals true, dispose all managed + // and unmanaged resources. + if(disposing) + { + // Dispose managed resources. + } + } + disposed = true; + } + + ~AbstractDAO() + { + // Do not re-create Dispose clean-up code here. + // Calling Dispose(false) is optimal in terms of + // readability and maintainability. + Dispose(false); + } + + #endregion } } \ No newline at end of file |
From: Sean M. <int...@us...> - 2005-07-01 02:45:34
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev/Text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9426/src/Adapdev/Text Modified Files: StringUtil.cs Log Message: Index: StringUtil.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev/Text/StringUtil.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** StringUtil.cs 28 Feb 2005 01:31:42 -0000 1.1.1.1 --- StringUtil.cs 1 Jul 2005 02:45:25 -0000 1.2 *************** *** 88,92 **** else { ! string firstLetter = s.Substring(0, 1).ToUpper(); revised = firstLetter + s.Substring(1, s.Length - 1); } --- 88,92 ---- else { ! string firstLetter = s.Substring(0, 1).ToUpper(new System.Globalization.CultureInfo("en-US")); revised = firstLetter + s.Substring(1, s.Length - 1); } |
From: Sean M. <int...@us...> - 2005-07-01 02:45:33
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9426/src/Adapdev.Data/Schema Modified Files: TableTypeConverter.cs Log Message: Index: TableTypeConverter.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema/TableTypeConverter.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TableTypeConverter.cs 11 Apr 2005 11:24:04 -0000 1.2 --- TableTypeConverter.cs 1 Jul 2005 02:45:25 -0000 1.3 *************** *** 19,23 **** public static TableType Convert(string tableType) { ! switch (tableType.ToUpper()) { case "SYSTEM TABLE": --- 19,23 ---- public static TableType Convert(string tableType) { ! switch (tableType.ToUpper(new System.Globalization.CultureInfo("en-US"))) { case "SYSTEM TABLE": |
From: Sean M. <int...@us...> - 2005-07-01 02:45:33
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.CodeGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9426/src/Adapdev.CodeGen Modified Files: UnitTestType.cs Log Message: Index: UnitTestType.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.CodeGen/UnitTestType.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** UnitTestType.cs 28 Feb 2005 01:31:45 -0000 1.1.1.1 --- UnitTestType.cs 1 Jul 2005 02:45:25 -0000 1.2 *************** *** 10,14 **** CSUNIT, NUNIT, ! SUPERUNIT } } --- 10,15 ---- CSUNIT, NUNIT, ! ZANEBUG, ! MBUNIT } } |
From: Sean M. <int...@us...> - 2005-06-22 02:59:28
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20624/src/Adapdev.Windows.Forms Modified Files: SmartTreeView.cs Log Message: Index: SmartTreeView.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/SmartTreeView.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SmartTreeView.cs 5 Jun 2005 08:50:33 -0000 1.4 --- SmartTreeView.cs 22 Jun 2005 02:58:48 -0000 1.5 *************** *** 222,225 **** --- 222,226 ---- } node.Checked = this.GetState(node); + this.StateLoaded(node); } *************** *** 232,235 **** --- 233,241 ---- } } + + public virtual void StateLoaded(TreeNode node) + { + + } } } |
From: Sean M. <int...@us...> - 2005-06-22 02:59:01
|
Update of /cvsroot/adapdev/Adapdev/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20624/src Modified Files: AdapdevFramework.suo Log Message: Index: AdapdevFramework.suo =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevFramework.suo,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 Binary files /tmp/cvs3Ri2nD and /tmp/cvsGe53oX differ |
From: Sean M. <int...@us...> - 2005-06-20 01:47:59
|
Update of /cvsroot/adapdev/Adapdev/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7185/src Modified Files: AdapdevFramework.suo Log Message: Index: AdapdevFramework.suo =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevFramework.suo,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 Binary files /tmp/cvsORdje9 and /tmp/cvsnGXWJC differ |
From: Sean M. <int...@us...> - 2005-06-20 01:47:58
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7185/src/Adapdev.Data/Xml Modified Files: ProviderInfo.xml Log Message: Index: ProviderInfo.xml =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Xml/ProviderInfo.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ProviderInfo.xml 13 May 2005 03:51:27 -0000 1.4 --- ProviderInfo.xml 20 Jun 2005 01:47:49 -0000 1.5 *************** *** 597,602 **** <Prefix></Prefix> <Postfix></Postfix> ! <Default></Default> ! <TestDefault></TestDefault> </Type> <Type> --- 597,602 ---- <Prefix></Prefix> <Postfix></Postfix> ! <Default>0</Default> ! <TestDefault>0</TestDefault> </Type> <Type> |
From: Sean M. <int...@us...> - 2005-06-20 01:47:58
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7185/src/Adapdev.Cache Modified Files: AbstractCache.cs CacheManager.cs CacheStats.cs ICache.cs Log Message: Index: AbstractCache.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/AbstractCache.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractCache.cs 2 Jun 2005 03:25:59 -0000 1.2 --- AbstractCache.cs 20 Jun 2005 01:47:49 -0000 1.3 *************** *** 15,19 **** protected ArrayList _timers = new ArrayList(); protected ArrayList _scavengers = new ArrayList(); - protected Timer _timer = new Timer(new TimeSpan(2,0,0).Milliseconds); #region ICache Members --- 15,18 ---- *************** *** 49,57 **** } - public void AddTimedScavenger(IScavenger scavenger) - { - this._scavengers.Add(scavenger); - } - public void Copy(ICache cache) { --- 48,51 ---- *************** *** 59,68 **** } - public double ScavengeInterval - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - public abstract void Add(string key, object o); public abstract void Clear(); --- 53,56 ---- Index: ICache.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/ICache.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ICache.cs 2 Jun 2005 03:25:59 -0000 1.3 --- ICache.cs 20 Jun 2005 01:47:49 -0000 1.4 *************** *** 26,30 **** void Populate(); void Copy(ICache cache); - double ScavengeInterval{get;set;} } } --- 26,29 ---- Index: CacheStats.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/CacheStats.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CacheStats.cs 3 Jun 2005 11:39:28 -0000 1.1 --- CacheStats.cs 20 Jun 2005 01:47:49 -0000 1.2 *************** *** 138,147 **** } - public double ScavengeInterval - { - get{return this._cache.ScavengeInterval;} - set{this._cache.ScavengeInterval = value;} - } - #endregion --- 138,141 ---- Index: CacheManager.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/CacheManager.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CacheManager.cs 25 May 2005 05:17:46 -0000 1.2 --- CacheManager.cs 20 Jun 2005 01:47:49 -0000 1.3 *************** *** 8,14 **** public class CacheManager { ! private static ICache _cache = new ImmutableInMemoryCache(); ! private CacheManager() { } --- 8,14 ---- public class CacheManager { ! private static ICache _cache = null; ! static CacheManager() { } *************** *** 18,21 **** --- 18,22 ---- get { + if(_cache == null) _cache = new ImmutableInMemoryCache(); return _cache; } |
From: Sean M. <int...@us...> - 2005-06-12 14:24:39
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32060/src/Adapdev.UnitTest.Core Modified Files: TestRunner.cs Log Message: Index: TestRunner.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/TestRunner.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TestRunner.cs 9 Jun 2005 04:20:23 -0000 1.6 --- TestRunner.cs 12 Jun 2005 14:24:29 -0000 1.7 *************** *** 163,377 **** { TestFixtureResult testFixtureResult = new TestFixtureResult(tf); - testFixtureResult.TestId = tf.Id; - string assembly = (tf.Parent.OriginalPath); - string classname = tf.Namespace + "." + tf.Class; - object o = new object(); - Assembly a = AssemblyCache.Get(tf.Parent.OriginalPath); - - if(this._debugMode) log.Debug("Running TF " + tf.Name); ! if(_dispatcher != null)_dispatcher.OnTestFixtureStarted(new TestFixtureEventArgs(tf)); ! for (int j = 1; j <= tf.RepeatCount; j++) { ! if (tf.RepeatDelay > 0) Thread.Sleep(tf.RepeatDelay); ! TestFixtureIteration tfi = new TestFixtureIteration(); ! if(_dispatcher != null)this._dispatcher.OnTestFixtureIterationStarted(new TestFixtureEventArgs(tf)); ! ! o = a.CreateInstance(classname); ! Type type = a.GetType(classname, true); ! this.RunTestFixtureSetUps(tf, o, type); ! foreach (Test test in tf.GetTests()) { ! try ! { ! MethodInfo m = type.GetMethod(test.Method); ! TestResult tr = new TestResult(test); ! tr.TestId = test.Id; ! tr.Description = test.Description; ! if(this._debugMode) log.Debug("Running T " + test.Name); ! if (!test.Ignore && test.ShouldRun) { ! if(_dispatcher != null)_dispatcher.OnTestStarted(new TestEventArgs(test)); ! for (int i = 1; i <= test.RepeatCount; i++) ! { ! TextWriter consoleOut = Console.Out; ! TextWriter errorOut = Console.Error; ! StringWriter consoleWriter = new StringWriter(); ! StringWriter errorWriter = new StringWriter(); ! StringWriter debugWriter = new StringWriter(); ! StringWriter traceWriter = new StringWriter(); ! Console.SetOut(consoleWriter); ! Console.SetError(errorWriter); ! TextWriterTraceListener debug = new TextWriterTraceListener(debugWriter); ! TextWriterTraceListener error = new TextWriterTraceListener(traceWriter); ! Debug.Listeners.Add(debug); ! Trace.Listeners.Add(error); ! if (test.RepeatDelay > 0) ! { ! Thread.Sleep(test.RepeatDelay); ! Console.WriteLine("Sleeping..." + test.RepeatDelay); ! } ! TestIteration ti = new TestIteration(); ! ti.Iteration = i; ! ti.Thread = AppDomain.GetCurrentThreadId().ToString(); ! long kStart = 0; ! long kEnd = 0; ! if(_dispatcher != null)this._dispatcher.OnTestIterationStarted(new TestEventArgs(test)); - try - { - this.RunTestSetUps(tf, test.Name, o, type); - kStart = Process.GetCurrentProcess().WorkingSet; - timer.Start(); - m.Invoke(o, null); - timer.Stop(); - ti.Duration = timer.Duration; - kEnd = Process.GetCurrentProcess().WorkingSet; - ti.MemoryUsed = (kEnd - kStart)/1024; ! if (test.MaxKMemory > 0 && test.MaxKMemory < ti.MemoryUsed) ! { ! ti.State = TestState.Fail; ! ti.Result = "Memory usage exceeded MaxK limit of " + test.MaxKMemory; ! } ! else if (test.MinOperationsPerSecond > 0 && ti.GetOpsPerSecond() < test.MinOperationsPerSecond) ! { ! ti.State = TestState.Fail; ! ti.Result = "Ops per second was less than minimum limit of " + test.MinOperationsPerSecond; ! } ! else if (test.ExpectedExceptionType != null && test.ExpectedExceptionType.Length > 0) { ! ti.State = TestState.Fail; ! ti.Result = "ExceptedException type " + test.ExpectedExceptionType + " was not thrown."; } ! else { ! ti.State = TestState.Pass; ! } ! this.RunTestTearDowns(tf, test.Name, o, type); ! } ! catch (Exception e) ! { ! timer.Stop(); ! ti.Duration = timer.Duration; ! kEnd = Process.GetCurrentProcess().WorkingSet; ! if (test.ExpectedExceptionType != null && test.ExpectedExceptionType.Length > 0) { ! Type t = null; ! foreach(Assembly ass in AppDomain.CurrentDomain.GetAssemblies()) { ! try { ! t = ass.GetType(test.ExpectedExceptionType, true, true); ! break; } - catch(Exception){} - } ! if(t == null) throw new TypeLoadException("Unable to locate " + test.ExpectedExceptionType + ". Please make sure it is correct."); ! if (e.InnerException.GetType().IsSubclassOf(t) || e.InnerException.GetType() == t) ! { ! if(test.ExpectedExceptionMessage != null && test.ExpectedExceptionMessage.Length > 0) { ! if(test.ExpectedExceptionMessage.ToLower() == e.InnerException.Message.ToLower()) { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Pass; } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown, but wrong message. Message: " + e.InnerException.Message + " - Expected: " + test.ExpectedExceptionMessage; ! ti.State = TestState.Fail; } } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Pass; } } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was NOT thrown. Message: " + e.InnerException.Message; ti.State = TestState.Fail; } ! ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ! ti.MemoryUsed = (kEnd - kStart)/1024; ! ! } ! // TODO : Fix incrementing of tests in GUI when IgnoreException is thrown ! else if(e.InnerException.GetType() == typeof(IgnoreException) || e.InnerException.GetType() == typeof(IgnoreException)) ! { ! ti.Result = e.InnerException.Message; ! ti.State = TestState.ForcedIgnore; ! ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ! } ! else ! { ! ti.Result = e.InnerException.Message; ! ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ! ti.State = TestState.Fail; } - this.RunTestTearDowns(tf, test.Name, o, type); - } ! ti.ConsoleOutput = consoleWriter.ToString(); ! ti.ConsoleError = errorWriter.ToString(); ! ti.DebugOutput = debugWriter.ToString(); ! ti.TraceOutput = traceWriter.ToString(); ! tr.AddIteration(ti); ! if(_dispatcher != null)_dispatcher.OnTestIterationCompleted(new TestIterationEventArgs(ti)); ! Console.SetOut(consoleOut); ! Console.SetError(errorOut); ! Debug.Listeners.Remove(debug); ! Trace.Listeners.Remove(error); ! debug.Dispose(); ! error.Dispose(); } } ! else { - TestIteration ti = new TestIteration(); - ti.State = TestState.Ignore; - ti.Result = test.IgnoreReason; - tr.AddIteration(ti); } - - if (tf.ShouldShow) tfi.AddTestResult(tr); - if(_dispatcher != null)_dispatcher.OnTestCompleted(new TestResultEventArgs(tr)); - } - catch (Exception e) - { - Console.WriteLine(e.Message + " " + e.StackTrace); - } - finally - { } - } ! this.RunTestFixtureTearDowns(tf, o, type); ! tfi.Iteration = j; ! testFixtureResult.AddIteration(tfi); ! if(_dispatcher != null)_dispatcher.OnTestFixtureIterationCompleted(new TestFixtureIterationEventArgs(tfi)); } - if(_dispatcher != null)_dispatcher.OnTestFixtureCompleted(new TestFixtureResultEventArgs(testFixtureResult)); - return testFixtureResult; } --- 163,384 ---- { TestFixtureResult testFixtureResult = new TestFixtureResult(tf); ! try { ! testFixtureResult.TestId = tf.Id; ! string assembly = (tf.Parent.OriginalPath); ! string classname = tf.Namespace + "." + tf.Class; ! object o = new object(); ! Assembly a = AssemblyCache.Get(tf.Parent.OriginalPath); ! if(this._debugMode) log.Debug("Running TF " + tf.Name); ! if(_dispatcher != null)_dispatcher.OnTestFixtureStarted(new TestFixtureEventArgs(tf)); ! for (int j = 1; j <= tf.RepeatCount; j++) { ! if (tf.RepeatDelay > 0) Thread.Sleep(tf.RepeatDelay); ! TestFixtureIteration tfi = new TestFixtureIteration(); ! if(_dispatcher != null)this._dispatcher.OnTestFixtureIterationStarted(new TestFixtureEventArgs(tf)); ! o = a.CreateInstance(classname); ! Type type = a.GetType(classname, true); ! this.RunTestFixtureSetUps(tf, o, type); ! ! foreach (Test test in tf.GetTests()) ! { ! try { + MethodInfo m = type.GetMethod(test.Method); + TestResult tr = new TestResult(test); + tr.TestId = test.Id; + tr.Description = test.Description; ! if(this._debugMode) log.Debug("Running T " + test.Name); ! if (!test.Ignore && test.ShouldRun) ! { ! if(_dispatcher != null)_dispatcher.OnTestStarted(new TestEventArgs(test)); ! for (int i = 1; i <= test.RepeatCount; i++) ! { + TextWriter consoleOut = Console.Out; + TextWriter errorOut = Console.Error; + StringWriter consoleWriter = new StringWriter(); + StringWriter errorWriter = new StringWriter(); + StringWriter debugWriter = new StringWriter(); + StringWriter traceWriter = new StringWriter(); ! Console.SetOut(consoleWriter); ! Console.SetError(errorWriter); ! TextWriterTraceListener debug = new TextWriterTraceListener(debugWriter); ! TextWriterTraceListener error = new TextWriterTraceListener(traceWriter); ! Debug.Listeners.Add(debug); ! Trace.Listeners.Add(error); ! if (test.RepeatDelay > 0) { ! Thread.Sleep(test.RepeatDelay); ! Console.WriteLine("Sleeping..." + test.RepeatDelay); } ! TestIteration ti = new TestIteration(); ! ti.Iteration = i; ! ti.Thread = AppDomain.GetCurrentThreadId().ToString(); ! long kStart = 0; ! long kEnd = 0; ! if(_dispatcher != null)this._dispatcher.OnTestIterationStarted(new TestEventArgs(test)); ! ! try { ! this.RunTestSetUps(tf, test.Name, o, type); ! kStart = Process.GetCurrentProcess().WorkingSet; ! timer.Start(); ! m.Invoke(o, null); ! timer.Stop(); ! ti.Duration = timer.Duration; ! kEnd = Process.GetCurrentProcess().WorkingSet; ! ti.MemoryUsed = (kEnd - kStart)/1024; ! if (test.MaxKMemory > 0 && test.MaxKMemory < ti.MemoryUsed) ! { ! ti.State = TestState.Fail; ! ti.Result = "Memory usage exceeded MaxK limit of " + test.MaxKMemory; ! } ! else if (test.MinOperationsPerSecond > 0 && ti.GetOpsPerSecond() < test.MinOperationsPerSecond) ! { ! ti.State = TestState.Fail; ! ti.Result = "Ops per second was less than minimum limit of " + test.MinOperationsPerSecond; ! } ! else if (test.ExpectedExceptionType != null && test.ExpectedExceptionType.Length > 0) ! { ! ti.State = TestState.Fail; ! ti.Result = "ExceptedException type " + test.ExpectedExceptionType + " was not thrown."; ! } ! else ! { ! ti.State = TestState.Pass; ! } ! ! this.RunTestTearDowns(tf, test.Name, o, type); ! } ! catch (Exception e) { ! timer.Stop(); ! ti.Duration = timer.Duration; ! kEnd = Process.GetCurrentProcess().WorkingSet; ! if (test.ExpectedExceptionType != null && test.ExpectedExceptionType.Length > 0) { ! Type t = null; ! foreach(Assembly ass in AppDomain.CurrentDomain.GetAssemblies()) { ! try ! { ! t = ass.GetType(test.ExpectedExceptionType, true, true); ! break; ! } ! catch(Exception){} } ! if(t == null) throw new TypeLoadException("Unable to locate " + test.ExpectedExceptionType + ". Please make sure it is correct."); ! if (e.InnerException.GetType().IsSubclassOf(t) || e.InnerException.GetType() == t) { ! if(test.ExpectedExceptionMessage != null && test.ExpectedExceptionMessage.Length > 0) { ! if(test.ExpectedExceptionMessage.ToLower() == e.InnerException.Message.ToLower()) ! { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Pass; ! } ! else ! { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown, but wrong message. Message: " + e.InnerException.Message + " - Expected: " + test.ExpectedExceptionMessage; ! ti.State = TestState.Fail; ! } } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Pass; } } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was NOT thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Fail; } + ti.ExceptionType = e.InnerException.GetType().FullName; + ti.FullStackTrace = e.InnerException.StackTrace; + ti.MemoryUsed = (kEnd - kStart)/1024; + + } + // TODO : Fix incrementing of tests in GUI when IgnoreException is thrown + else if(e.InnerException.GetType() == typeof(IgnoreException) || e.InnerException.GetType() == typeof(IgnoreException)) + { + ti.Result = e.InnerException.Message; + ti.State = TestState.ForcedIgnore; + ti.ExceptionType = e.InnerException.GetType().FullName; + ti.FullStackTrace = e.InnerException.StackTrace; } else { ! ti.Result = e.InnerException.Message; ! ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ti.State = TestState.Fail; } ! this.RunTestTearDowns(tf, test.Name, o, type); } ! ti.ConsoleOutput = consoleWriter.ToString(); ! ti.ConsoleError = errorWriter.ToString(); ! ti.DebugOutput = debugWriter.ToString(); ! ti.TraceOutput = traceWriter.ToString(); ! tr.AddIteration(ti); ! if(_dispatcher != null)_dispatcher.OnTestIterationCompleted(new TestIterationEventArgs(ti)); ! Console.SetOut(consoleOut); ! Console.SetError(errorOut); ! Debug.Listeners.Remove(debug); ! Trace.Listeners.Remove(error); ! debug.Dispose(); ! error.Dispose(); ! } ! ! } ! else ! { ! TestIteration ti = new TestIteration(); ! ti.State = TestState.Ignore; ! ti.Result = test.IgnoreReason; ! tr.AddIteration(ti); } + if (tf.ShouldShow) tfi.AddTestResult(tr); + if(_dispatcher != null)_dispatcher.OnTestCompleted(new TestResultEventArgs(tr)); } ! catch (Exception e) ! { ! Console.WriteLine(e.Message + " " + e.StackTrace); ! } ! finally { } } ! this.RunTestFixtureTearDowns(tf, o, type); ! tfi.Iteration = j; ! testFixtureResult.AddIteration(tfi); ! if(_dispatcher != null)_dispatcher.OnTestFixtureIterationCompleted(new TestFixtureIterationEventArgs(tfi)); ! } ! if(_dispatcher != null)_dispatcher.OnTestFixtureCompleted(new TestFixtureResultEventArgs(testFixtureResult)); ! } ! catch (Exception e) ! { ! Console.Write(e); } return testFixtureResult; } *************** *** 394,400 **** foreach (BaseTestHelper t in tf.GetFixtureSetUps()) { ! if(_dispatcher != null)_dispatcher.OnBaseTestHelperStarted(new BaseTestHelperEventArgs(t)); ! MethodInfo m = type.GetMethod(t.Method); ! m.Invoke(instance, null); } } --- 401,414 ---- foreach (BaseTestHelper t in tf.GetFixtureSetUps()) { ! try ! { ! if(_dispatcher != null)_dispatcher.OnBaseTestHelperStarted(new BaseTestHelperEventArgs(t)); ! MethodInfo m = type.GetMethod(t.Method); ! m.Invoke(instance, null); ! } ! catch (Exception e) ! { ! Console.Write(e); ! } } } *************** *** 404,410 **** foreach (BaseTestHelper t in tf.GetFixtureTearDowns()) { ! if(_dispatcher != null)_dispatcher.OnBaseTestHelperStarted(new BaseTestHelperEventArgs(t)); ! MethodInfo m = type.GetMethod(t.Method); ! m.Invoke(instance, null); } } --- 418,431 ---- foreach (BaseTestHelper t in tf.GetFixtureTearDowns()) { ! try ! { ! if(_dispatcher != null)_dispatcher.OnBaseTestHelperStarted(new BaseTestHelperEventArgs(t)); ! MethodInfo m = type.GetMethod(t.Method); ! m.Invoke(instance, null); ! } ! catch (Exception e) ! { ! Console.Write(e); ! } } } *************** *** 414,423 **** foreach (TestHelper t in tf.GetTestSetUps()) { ! // Console.WriteLine(t.Method); ! if (t.Test.Length < 1 || t.Test.ToLower().Equals(name.ToLower())) { ! if(_dispatcher != null)_dispatcher.OnBaseTestHelperStarted(new BaseTestHelperEventArgs(t)); ! MethodInfo m = type.GetMethod(t.Method); ! m.Invoke(instance, null); } } --- 435,451 ---- foreach (TestHelper t in tf.GetTestSetUps()) { ! try { ! // Console.WriteLine(t.Method); ! if (t.Test.Length < 1 || t.Test.ToLower().Equals(name.ToLower())) ! { ! if(_dispatcher != null)_dispatcher.OnBaseTestHelperStarted(new BaseTestHelperEventArgs(t)); ! MethodInfo m = type.GetMethod(t.Method); ! m.Invoke(instance, null); ! } ! } ! catch (Exception e) ! { ! Console.Write(e); } } *************** *** 428,436 **** foreach (TestHelper t in tf.GetTestTearDowns()) { ! if (t.Test.Length < 1 || t.Test.ToLower().Equals(name.ToLower())) { ! if(_dispatcher != null)_dispatcher.OnBaseTestHelperStarted(new BaseTestHelperEventArgs(t)); ! MethodInfo m = type.GetMethod(t.Method); ! m.Invoke(instance, null); } } --- 456,471 ---- foreach (TestHelper t in tf.GetTestTearDowns()) { ! try { ! if (t.Test.Length < 1 || t.Test.ToLower().Equals(name.ToLower())) ! { ! if(_dispatcher != null)_dispatcher.OnBaseTestHelperStarted(new BaseTestHelperEventArgs(t)); ! MethodInfo m = type.GetMethod(t.Method); ! m.Invoke(instance, null); ! } ! } ! catch (Exception e) ! { ! Console.Write(e); } } |
From: Sean M. <int...@us...> - 2005-06-09 04:21:11
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11294/src/Adapdev.UnitTest.Core Modified Files: TestRunner.cs TestSuite.cs TestSummary.cs TextFormatter.cs Log Message: Index: TestSummary.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/TestSummary.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TestSummary.cs 28 Feb 2005 01:32:23 -0000 1.1.1.1 --- TestSummary.cs 9 Jun 2005 04:20:23 -0000 1.2 *************** *** 74,77 **** --- 74,91 ---- get{return 1 - this.PercentPassed;} } + + public double TotalDuration + { + get + { + double duration = 0; + foreach(TestAssemblyResult t in this.tar) + { + duration += t.GetTotalDuration(); + } + return duration; + } + + } } } Index: TestRunner.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/TestRunner.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TestRunner.cs 5 Jun 2005 08:50:32 -0000 1.5 --- TestRunner.cs 9 Jun 2005 04:20:23 -0000 1.6 *************** *** 44,47 **** --- 44,48 ---- using Adapdev.Diagnostics; using log4net; + using NUnit.Framework; public delegate double ThreadedTestHandler(MethodInfo method, object o); *************** *** 184,358 **** foreach (Test test in tf.GetTests()) { ! MethodInfo m = type.GetMethod(test.Method); ! TestResult tr = new TestResult(test); ! tr.TestId = test.Id; ! tr.Description = test.Description; ! ! if(this._debugMode) log.Debug("Running T " + test.Name); ! ! if (!test.Ignore && test.ShouldRun) { ! if(_dispatcher != null)_dispatcher.OnTestStarted(new TestEventArgs(test)); ! for (int i = 1; i <= test.RepeatCount; i++) ! { ! TextWriter consoleOut = Console.Out; ! TextWriter errorOut = Console.Error; ! StringWriter consoleWriter = new StringWriter(); ! StringWriter errorWriter = new StringWriter(); ! StringWriter debugWriter = new StringWriter(); ! StringWriter traceWriter = new StringWriter(); ! System.Console.SetOut(consoleWriter); ! System.Console.SetError(errorWriter); ! TextWriterTraceListener debug = new TextWriterTraceListener(debugWriter); ! TextWriterTraceListener error = new TextWriterTraceListener(traceWriter); ! Debug.Listeners.Add(debug); ! Trace.Listeners.Add(error); ! if (test.RepeatDelay > 0) ! { ! Thread.Sleep(test.RepeatDelay); ! Console.WriteLine("Sleeping..." + test.RepeatDelay); ! } ! TestIteration ti = new TestIteration(); ! ti.Iteration = i; ! ti.Thread = AppDomain.GetCurrentThreadId().ToString(); ! long kStart = 0; ! long kEnd = 0; ! if(_dispatcher != null)this._dispatcher.OnTestIterationStarted(new TestEventArgs(test)); - try - { - this.RunTestSetUps(tf, test.Name, o, type); - kStart = Process.GetCurrentProcess().WorkingSet; - timer.Start(); - m.Invoke(o, null); - timer.Stop(); - ti.Duration = timer.Duration; - kEnd = Process.GetCurrentProcess().WorkingSet; - ti.MemoryUsed = (kEnd - kStart)/1024; ! if (test.MaxKMemory > 0 && test.MaxKMemory < ti.MemoryUsed) ! { ! ti.State = TestState.Fail; ! ti.Result = "Memory usage exceeded MaxK limit of " + test.MaxKMemory; ! } ! else if (test.MinOperationsPerSecond > 0 && ti.GetOpsPerSecond() < test.MinOperationsPerSecond) ! { ! ti.State = TestState.Fail; ! ti.Result = "Ops per second was less than minimum limit of " + test.MinOperationsPerSecond; ! } ! else if (test.ExpectedExceptionType != null && test.ExpectedExceptionType.Length > 0) { ! ti.State = TestState.Fail; ! ti.Result = "ExceptedException type " + test.ExpectedExceptionType + " was not thrown."; } ! else { ! ti.State = TestState.Pass; ! } ! this.RunTestTearDowns(tf, test.Name, o, type); ! } ! catch (Exception e) ! { ! timer.Stop(); ! ti.Duration = timer.Duration; ! kEnd = Process.GetCurrentProcess().WorkingSet; ! if (test.ExpectedExceptionType != null && test.ExpectedExceptionType.Length > 0) { ! Type t = null; ! foreach(Assembly ass in AppDomain.CurrentDomain.GetAssemblies()) { ! try { ! t = ass.GetType(test.ExpectedExceptionType, true, true); ! break; } - catch(Exception){} - } ! if(t == null) throw new TypeLoadException("Unable to locate " + test.ExpectedExceptionType + ". Please make sure it is correct."); ! if (e.InnerException.GetType().IsSubclassOf(t) || e.InnerException.GetType() == t) ! { ! if(test.ExpectedExceptionMessage.Length > 0) { ! if(test.ExpectedExceptionMessage.ToLower() == e.InnerException.Message.ToLower()) { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Pass; } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown, but wrong message. Message: " + e.InnerException.Message + " - Expected: " + test.ExpectedExceptionMessage; ! ti.State = TestState.Fail; } } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Pass; } } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was NOT thrown. Message: " + e.InnerException.Message; ti.State = TestState.Fail; } ! ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ! ti.MemoryUsed = (kEnd - kStart)/1024; ! ! } ! // TODO : Fix incrementing of tests in GUI when IgnoreException is thrown ! else if(e.InnerException.GetType() == typeof(Adapdev.UnitTest.IgnoreException) || e.InnerException.GetType() == typeof(NUnit.Framework.IgnoreException)) ! { ! ti.Result = e.InnerException.Message; ! ti.State = TestState.ForcedIgnore; ! ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ! } ! else ! { ! ti.Result = e.InnerException.Message; ! ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ! ti.State = TestState.Fail; } - this.RunTestTearDowns(tf, test.Name, o, type); - } ! ti.ConsoleOutput = consoleWriter.ToString(); ! ti.ConsoleError = errorWriter.ToString(); ! ti.DebugOutput = debugWriter.ToString(); ! ti.TraceOutput = traceWriter.ToString(); ! tr.AddIteration(ti); ! if(_dispatcher != null)_dispatcher.OnTestIterationCompleted(new TestIterationEventArgs(ti)); ! Console.SetOut(consoleOut); ! Console.SetError(errorOut); ! Debug.Listeners.Remove(debug); ! Trace.Listeners.Remove(error); ! debug.Dispose(); ! error.Dispose(); } } ! else { - TestIteration ti = new TestIteration(); - ti.State = TestState.Ignore; - ti.Result = test.IgnoreReason; - tr.AddIteration(ti); } - - if (tf.ShouldShow) tfi.AddTestResult(tr); - if(_dispatcher != null)_dispatcher.OnTestCompleted(new TestResultEventArgs(tr)); - } --- 185,368 ---- foreach (Test test in tf.GetTests()) { ! try { + MethodInfo m = type.GetMethod(test.Method); + TestResult tr = new TestResult(test); + tr.TestId = test.Id; + tr.Description = test.Description; ! if(this._debugMode) log.Debug("Running T " + test.Name); ! if (!test.Ignore && test.ShouldRun) ! { ! if(_dispatcher != null)_dispatcher.OnTestStarted(new TestEventArgs(test)); ! for (int i = 1; i <= test.RepeatCount; i++) ! { + TextWriter consoleOut = Console.Out; + TextWriter errorOut = Console.Error; + StringWriter consoleWriter = new StringWriter(); + StringWriter errorWriter = new StringWriter(); + StringWriter debugWriter = new StringWriter(); + StringWriter traceWriter = new StringWriter(); ! Console.SetOut(consoleWriter); ! Console.SetError(errorWriter); ! TextWriterTraceListener debug = new TextWriterTraceListener(debugWriter); ! TextWriterTraceListener error = new TextWriterTraceListener(traceWriter); ! Debug.Listeners.Add(debug); ! Trace.Listeners.Add(error); ! if (test.RepeatDelay > 0) { ! Thread.Sleep(test.RepeatDelay); ! Console.WriteLine("Sleeping..." + test.RepeatDelay); } ! TestIteration ti = new TestIteration(); ! ti.Iteration = i; ! ti.Thread = AppDomain.GetCurrentThreadId().ToString(); ! long kStart = 0; ! long kEnd = 0; ! if(_dispatcher != null)this._dispatcher.OnTestIterationStarted(new TestEventArgs(test)); ! ! try { ! this.RunTestSetUps(tf, test.Name, o, type); ! kStart = Process.GetCurrentProcess().WorkingSet; ! timer.Start(); ! m.Invoke(o, null); ! timer.Stop(); ! ti.Duration = timer.Duration; ! kEnd = Process.GetCurrentProcess().WorkingSet; ! ti.MemoryUsed = (kEnd - kStart)/1024; ! if (test.MaxKMemory > 0 && test.MaxKMemory < ti.MemoryUsed) ! { ! ti.State = TestState.Fail; ! ti.Result = "Memory usage exceeded MaxK limit of " + test.MaxKMemory; ! } ! else if (test.MinOperationsPerSecond > 0 && ti.GetOpsPerSecond() < test.MinOperationsPerSecond) ! { ! ti.State = TestState.Fail; ! ti.Result = "Ops per second was less than minimum limit of " + test.MinOperationsPerSecond; ! } ! else if (test.ExpectedExceptionType != null && test.ExpectedExceptionType.Length > 0) ! { ! ti.State = TestState.Fail; ! ti.Result = "ExceptedException type " + test.ExpectedExceptionType + " was not thrown."; ! } ! else ! { ! ti.State = TestState.Pass; ! } ! ! this.RunTestTearDowns(tf, test.Name, o, type); ! } ! catch (Exception e) { ! timer.Stop(); ! ti.Duration = timer.Duration; ! kEnd = Process.GetCurrentProcess().WorkingSet; ! if (test.ExpectedExceptionType != null && test.ExpectedExceptionType.Length > 0) { ! Type t = null; ! foreach(Assembly ass in AppDomain.CurrentDomain.GetAssemblies()) { ! try ! { ! t = ass.GetType(test.ExpectedExceptionType, true, true); ! break; ! } ! catch(Exception){} } ! if(t == null) throw new TypeLoadException("Unable to locate " + test.ExpectedExceptionType + ". Please make sure it is correct."); ! if (e.InnerException.GetType().IsSubclassOf(t) || e.InnerException.GetType() == t) { ! if(test.ExpectedExceptionMessage != null && test.ExpectedExceptionMessage.Length > 0) { ! if(test.ExpectedExceptionMessage.ToLower() == e.InnerException.Message.ToLower()) ! { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Pass; ! } ! else ! { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown, but wrong message. Message: " + e.InnerException.Message + " - Expected: " + test.ExpectedExceptionMessage; ! ti.State = TestState.Fail; ! } } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Pass; } } else { ! ti.Result = "Expected Exception: " + test.ExpectedExceptionType + " was NOT thrown. Message: " + e.InnerException.Message; ! ti.State = TestState.Fail; } + ti.ExceptionType = e.InnerException.GetType().FullName; + ti.FullStackTrace = e.InnerException.StackTrace; + ti.MemoryUsed = (kEnd - kStart)/1024; + + } + // TODO : Fix incrementing of tests in GUI when IgnoreException is thrown + else if(e.InnerException.GetType() == typeof(IgnoreException) || e.InnerException.GetType() == typeof(IgnoreException)) + { + ti.Result = e.InnerException.Message; + ti.State = TestState.ForcedIgnore; + ti.ExceptionType = e.InnerException.GetType().FullName; + ti.FullStackTrace = e.InnerException.StackTrace; } else { ! ti.Result = e.InnerException.Message; ! ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ti.State = TestState.Fail; } ! this.RunTestTearDowns(tf, test.Name, o, type); } ! ti.ConsoleOutput = consoleWriter.ToString(); ! ti.ConsoleError = errorWriter.ToString(); ! ti.DebugOutput = debugWriter.ToString(); ! ti.TraceOutput = traceWriter.ToString(); ! tr.AddIteration(ti); ! if(_dispatcher != null)_dispatcher.OnTestIterationCompleted(new TestIterationEventArgs(ti)); ! Console.SetOut(consoleOut); ! Console.SetError(errorOut); ! Debug.Listeners.Remove(debug); ! Trace.Listeners.Remove(error); ! debug.Dispose(); ! error.Dispose(); ! } ! ! } ! else ! { ! TestIteration ti = new TestIteration(); ! ti.State = TestState.Ignore; ! ti.Result = test.IgnoreReason; ! tr.AddIteration(ti); } + if (tf.ShouldShow) tfi.AddTestResult(tr); + if(_dispatcher != null)_dispatcher.OnTestCompleted(new TestResultEventArgs(tr)); } ! catch (Exception e) ! { ! Console.WriteLine(e.Message + " " + e.StackTrace); ! } ! finally { } } Index: TestSuite.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/TestSuite.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TestSuite.cs 28 Feb 2005 01:32:23 -0000 1.1.1.1 --- TestSuite.cs 9 Jun 2005 04:20:23 -0000 1.2 *************** *** 50,53 **** --- 50,54 ---- protected int passedTestCount = 0; protected int ignoredTestCount = 0; + protected double _duration = 0; public TestSuite(){} *************** *** 109,112 **** --- 110,114 ---- } } + } } \ No newline at end of file Index: TextFormatter.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/TextFormatter.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TextFormatter.cs 24 Apr 2005 04:59:08 -0000 1.4 --- TextFormatter.cs 9 Jun 2005 04:20:23 -0000 1.5 *************** *** 65,74 **** sb.Append("SUMMARY\r\n"); sb.Append("========================================\r\n"); ! return String.Format("P\t\tF\t\tI\r\n{0}\t\t{1}\t\t{2}\r\n" + ! "Percent Passed: {3}\r\n", ts.TotalPassed, ts.TotalFailed, ts.TotalIgnored, ! ts.PercentPassed.ToString("P")); } --- 65,74 ---- sb.Append("SUMMARY\r\n"); sb.Append("========================================\r\n"); ! return String.Format("Passed: {0}\t\tFailed: {1}\t\tIgnored: {2}\r\nPercent Passed: {3}\t\r\nTime:{4}s\r\n", ts.TotalPassed, ts.TotalFailed, ts.TotalIgnored, ! ts.PercentPassed.ToString("P"), ! ts.TotalDuration); } *************** *** 86,90 **** { if(tar.Iterations.Count > 1) sb.Append(this.GetNesting(nesting) + "Iteration: " + ati.Iteration + "\r\n"); ! sb.AppendFormat(this.GetNesting(nesting + 1) + this.GetMarker(tar) + "{0} - {1}\r\n", tar.Name, tar.State); if((tar is TestResult) && ((tar as TestResult).Description.Length > 0)) sb.AppendFormat(this.GetNesting(nesting + 2) + "Description: {0}\r\n", (tar as TestResult).Description); --- 86,90 ---- { if(tar.Iterations.Count > 1) sb.Append(this.GetNesting(nesting) + "Iteration: " + ati.Iteration + "\r\n"); ! sb.AppendFormat(this.GetNesting(nesting + 1) + this.GetMarker(tar) + "{0} - {1}\t\t\tTime: {2}s\r\n", tar.Name, tar.State, tar.GetAverageDuration()); if((tar is TestResult) && ((tar as TestResult).Description.Length > 0)) sb.AppendFormat(this.GetNesting(nesting + 2) + "Description: {0}\r\n", (tar as TestResult).Description); |
From: Sean M. <int...@us...> - 2005-06-09 04:20:45
|
Update of /cvsroot/adapdev/Adapdev/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11294/src Modified Files: AdapdevAssemblyInfo.cs AdapdevFramework.suo Log Message: Index: AdapdevAssemblyInfo.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevAssemblyInfo.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AdapdevAssemblyInfo.cs 25 May 2005 05:17:48 -0000 1.5 --- AdapdevAssemblyInfo.cs 9 Jun 2005 04:20:24 -0000 1.6 *************** *** 27,31 **** // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.8.1.*")] // --- 27,31 ---- // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.8.2")] // Index: AdapdevFramework.suo =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevFramework.suo,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 Binary files /tmp/cvsZhmYpg and /tmp/cvsfn3cPI differ |