diff --git a/Spring.Net.2008.sln b/Spring.Net.2008.sln index 67f2d6b8..44242b7c 100644 --- a/Spring.Net.2008.sln +++ b/Spring.Net.2008.sln @@ -30,8 +30,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Testing.NUnit.2008", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate.2008", "src\Spring\Spring.Data.NHibernate\Spring.Data.NHibernate.2008.csproj", "{130E1609-45A7-4F65-B112-105F2DD3E2CE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate.Integration.Tests.2008", "test\Spring\Spring.Data.NHibernate.Integration.Tests\Spring.Data.NHibernate.Integration.Tests.2008.csproj", "{4A07E150-ED90-407C-8CAD-4760444DDFD9}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate12.2008", "src\Spring\Spring.Data.NHibernate12\Spring.Data.NHibernate12.2008.csproj", "{90F2D070-6F98-4926-A626-BD7A6071D6D9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate.Tests.2008", "test\Spring\Spring.Data.NHibernate.Tests\Spring.Data.NHibernate.Tests.2008.csproj", "{94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}" @@ -52,6 +50,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Messaging.2008", "sr EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Messaging.Tests.2008", "test\Spring\Spring.Messaging.Tests\Spring.Messaging.Tests.2008.csproj", "{41BC3AEA-7EB3-48BF-B1EC-84119376AC98}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate20.Tests.2008", "test\Spring\Spring.Data.NHibernate20.Tests\Spring.Data.NHibernate20.Tests.2008.csproj", "{EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate21.Tests.2008", "test\Spring\Spring.Data.NHibernate21.Tests\Spring.Data.NHibernate21.Tests.2008.csproj", "{90FEE979-7367-4542-BCCB-BF634E04A9D3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -230,18 +232,6 @@ Global {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Release|Any CPU.Build.0 = Release|Any CPU {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|.NET.ActiveCfg = Debug|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|.NET.Build.0 = Debug|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|.NET.ActiveCfg = Release|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|.NET.Build.0 = Release|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Any CPU.Build.0 = Release|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Mixed Platforms.Build.0 = Release|Any CPU {90F2D070-6F98-4926-A626-BD7A6071D6D9}.Debug|.NET.ActiveCfg = Debug|Any CPU {90F2D070-6F98-4926-A626-BD7A6071D6D9}.Debug|.NET.Build.0 = Debug|Any CPU {90F2D070-6F98-4926-A626-BD7A6071D6D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -348,6 +338,26 @@ Global {41BC3AEA-7EB3-48BF-B1EC-84119376AC98}.Release|Any CPU.Build.0 = Release|Any CPU {41BC3AEA-7EB3-48BF-B1EC-84119376AC98}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {41BC3AEA-7EB3-48BF-B1EC-84119376AC98}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Debug|.NET.ActiveCfg = Debug|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Release|.NET.ActiveCfg = Release|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Release|Any CPU.Build.0 = Release|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Debug|.NET.ActiveCfg = Debug|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Release|.NET.ActiveCfg = Release|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Release|Any CPU.Build.0 = Release|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {90FEE979-7367-4542-BCCB-BF634E04A9D3}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/lib/Net/1.0/Common.Logging.Log4Net.dll b/lib/Net/1.0/Common.Logging.Log4Net.dll deleted file mode 100644 index 04f74816..00000000 Binary files a/lib/Net/1.0/Common.Logging.Log4Net.dll and /dev/null differ diff --git a/lib/Net/1.1/Common.Logging.Log4Net.dll b/lib/Net/1.1/Common.Logging.Log4Net.dll deleted file mode 100644 index f334f6de..00000000 Binary files a/lib/Net/1.1/Common.Logging.Log4Net.dll and /dev/null differ diff --git a/lib/Net/2.0/Common.Logging.Log4Net.dll b/lib/Net/2.0/Common.Logging.Log4Net.dll deleted file mode 100644 index 3900bb87..00000000 Binary files a/lib/Net/2.0/Common.Logging.Log4Net.dll and /dev/null differ diff --git a/lib/Net/2.0/log4net.dll b/lib/Net/2.0/log4net.dll deleted file mode 100644 index ffc57e11..00000000 Binary files a/lib/Net/2.0/log4net.dll and /dev/null differ diff --git a/lib/Net/2.0/log4net.license.txt b/lib/Net/2.0/log4net.license.txt deleted file mode 100644 index 29f81d81..00000000 --- a/lib/Net/2.0/log4net.license.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Exception/CaptureOutputLogger.cs b/test/Spring/Spring.Aop.Tests/Aspects/Exception/CaptureOutputLogger.cs index 724afaa1..d3ba84ac 100644 --- a/test/Spring/Spring.Aop.Tests/Aspects/Exception/CaptureOutputLogger.cs +++ b/test/Spring/Spring.Aop.Tests/Aspects/Exception/CaptureOutputLogger.cs @@ -5,206 +5,211 @@ using System.Collections; using System.Globalization; using System.Text; using Common.Logging; +using Common.Logging.Simple; namespace Spring.Aspects.Exceptions { - public class CaptureOutputLogger : ILog + public class CaptureOutputLogger : TraceLogger { + public static readonly string NAME = "capturingLogger"; - private LogLevel _currentLogLevel = LogLevel.All; + public CaptureOutputLogger() + : base(NAME, LogLevel.All, false, false, null) + {} - private IList logMessages = new ArrayList(); - - - public IList LogMessages - { - get { return logMessages; } - set { logMessages = value; } - } - - /// - /// Do the actual logging by constructing the log message using a then - /// sending the output to . - /// - /// The of the message. - /// The log message. - /// An optional associated with the message. - private void Write(LogLevel level, object message, Exception e) - { - // Use a StringBuilder for better performance - StringBuilder sb = new StringBuilder(); - // Append date-time if so configured - // Append a readable representation of the log level - sb.Append(("[" + level.ToString().ToUpper() + "]").PadRight(8)); - - // Append the message - sb.Append(message); - - // Append stack trace if not null - if (e != null) - { - sb.Append(Environment.NewLine).Append(e.ToString()); - } - - // Print to the appropriate destination - logMessages.Add(sb.ToString()); - } - - /// - /// Determines if the given log level is currently enabled. - /// - /// - /// - private bool IsLevelEnabled(LogLevel level) - { - int iLevel = (int)level; - int iCurrentLogLevel = (int)_currentLogLevel; - - // return iLevel.CompareTo(iCurrentLogLevel); better ??? - return (iLevel >= iCurrentLogLevel); - } - - #region ILog Members - - public void Trace(object message) - { - Trace(message, null); - } - - public void Trace(object message, Exception e) - { - if (IsLevelEnabled(LogLevel.Trace)) - { - Write(LogLevel.Trace, message, e); - } - } - - public void Debug(object message) - { - Debug(message, null); - } - - public void Debug(object message, Exception e) - { - if (IsLevelEnabled(LogLevel.Debug)) - { - Write(LogLevel.Debug, message, e); - } - } - - public void Error(object message) - { - Error(message, null); - } - - public void Error(object message, Exception e) - { - if (IsLevelEnabled(LogLevel.Error)) - { - Write(LogLevel.Error, message, e); - } - } - - public void Fatal(object message) - { - Fatal(message, null); - } - - public void Fatal(object message, Exception e) - { - if (IsLevelEnabled(LogLevel.Fatal)) - { - Write(LogLevel.Fatal, message, e); - } - } - - public void Info(object message) - { - Info(message, null); - } - - public void Info(object message, Exception e) - { - if (IsLevelEnabled(LogLevel.Info)) - { - Write(LogLevel.Info, message, e); - } - } - - public void Warn(object message) - { - Warn(message, null); - } - - public void Warn(object message, Exception e) - { - if (IsLevelEnabled(LogLevel.Warn)) - { - Write(LogLevel.Warn, message, e); - } - } - - /// - /// Returns if the current is greater than or - /// equal to . If it is, all messages will be sent to . - /// - public bool IsTraceEnabled - { - get { return IsLevelEnabled(LogLevel.Trace); } - } - - /// - /// Returns if the current is greater than or - /// equal to . If it is, all messages will be sent to . - /// - public bool IsDebugEnabled - { - get { return IsLevelEnabled(LogLevel.Debug); } - } - - /// - /// Returns if the current is greater than or - /// equal to . If it is, only messages with a of - /// and will be sent to . - /// - public bool IsErrorEnabled - { - get { return IsLevelEnabled(LogLevel.Error); } - } - - /// - /// Returns if the current is greater than or - /// equal to . If it is, only messages with a of - /// will be sent to . - /// - public bool IsFatalEnabled - { - get { return IsLevelEnabled(LogLevel.Fatal); } - } - - /// - /// Returns if the current is greater than or - /// equal to . If it is, only messages with a of - /// , , , and - /// will be sent to . - /// - public bool IsInfoEnabled - { - get { return IsLevelEnabled(LogLevel.Info); } - } - - - /// - /// Returns if the current is greater than or - /// equal to . If it is, only messages with a of - /// , , and - /// will be sent to . - /// - public bool IsWarnEnabled - { - get { return IsLevelEnabled(LogLevel.Warn); } - } - - #endregion +// private LogLevel _currentLogLevel = LogLevel.All; +// +// private IList logMessages = new ArrayList(); +// +// public IList LogMessages +// { +// get { return logMessages; } +// set { logMessages = value; } +// } +// +// /// +// /// Do the actual logging by constructing the log message using a then +// /// sending the output to . +// /// +// /// The of the message. +// /// The log message. +// /// An optional associated with the message. +// private void Write(LogLevel level, object message, Exception e) +// { +// // Use a StringBuilder for better performance +// StringBuilder sb = new StringBuilder(); +// // Append date-time if so configured +// // Append a readable representation of the log level +// sb.Append(("[" + level.ToString().ToUpper() + "]").PadRight(8)); +// +// // Append the message +// sb.Append(message); +// +// // Append stack trace if not null +// if (e != null) +// { +// sb.Append(Environment.NewLine).Append(e.ToString()); +// } +// +// // Print to the appropriate destination +// logMessages.Add(sb.ToString()); +// } +// +// /// +// /// Determines if the given log level is currently enabled. +// /// +// /// +// /// +// private bool IsLevelEnabled(LogLevel level) +// { +// int iLevel = (int)level; +// int iCurrentLogLevel = (int)_currentLogLevel; +// +// // return iLevel.CompareTo(iCurrentLogLevel); better ??? +// return (iLevel >= iCurrentLogLevel); +// } +// +// #region ILog Members +// +// public void Trace(object message) +// { +// Trace(message, null); +// } +// +// public void Trace(object message, Exception e) +// { +// if (IsLevelEnabled(LogLevel.Trace)) +// { +// Write(LogLevel.Trace, message, e); +// } +// } +// +// public void Debug(object message) +// { +// Debug(message, null); +// } +// +// public void Debug(object message, Exception e) +// { +// if (IsLevelEnabled(LogLevel.Debug)) +// { +// Write(LogLevel.Debug, message, e); +// } +// } +// +// public void Error(object message) +// { +// Error(message, null); +// } +// +// public void Error(object message, Exception e) +// { +// if (IsLevelEnabled(LogLevel.Error)) +// { +// Write(LogLevel.Error, message, e); +// } +// } +// +// public void Fatal(object message) +// { +// Fatal(message, null); +// } +// +// public void Fatal(object message, Exception e) +// { +// if (IsLevelEnabled(LogLevel.Fatal)) +// { +// Write(LogLevel.Fatal, message, e); +// } +// } +// +// public void Info(object message) +// { +// Info(message, null); +// } +// +// public void Info(object message, Exception e) +// { +// if (IsLevelEnabled(LogLevel.Info)) +// { +// Write(LogLevel.Info, message, e); +// } +// } +// +// public void Warn(object message) +// { +// Warn(message, null); +// } +// +// public void Warn(object message, Exception e) +// { +// if (IsLevelEnabled(LogLevel.Warn)) +// { +// Write(LogLevel.Warn, message, e); +// } +// } +// +// /// +// /// Returns if the current is greater than or +// /// equal to . If it is, all messages will be sent to . +// /// +// public bool IsTraceEnabled +// { +// get { return IsLevelEnabled(LogLevel.Trace); } +// } +// +// /// +// /// Returns if the current is greater than or +// /// equal to . If it is, all messages will be sent to . +// /// +// public bool IsDebugEnabled +// { +// get { return IsLevelEnabled(LogLevel.Debug); } +// } +// +// /// +// /// Returns if the current is greater than or +// /// equal to . If it is, only messages with a of +// /// and will be sent to . +// /// +// public bool IsErrorEnabled +// { +// get { return IsLevelEnabled(LogLevel.Error); } +// } +// +// /// +// /// Returns if the current is greater than or +// /// equal to . If it is, only messages with a of +// /// will be sent to . +// /// +// public bool IsFatalEnabled +// { +// get { return IsLevelEnabled(LogLevel.Fatal); } +// } +// +// /// +// /// Returns if the current is greater than or +// /// equal to . If it is, only messages with a of +// /// , , , and +// /// will be sent to . +// /// +// public bool IsInfoEnabled +// { +// get { return IsLevelEnabled(LogLevel.Info); } +// } +// +// +// /// +// /// Returns if the current is greater than or +// /// equal to . If it is, only messages with a of +// /// , , and +// /// will be sent to . +// /// +// public bool IsWarnEnabled +// { +// get { return IsLevelEnabled(LogLevel.Warn); } +// } +// +// #endregion } } \ No newline at end of file diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Exception/CaptureOutputLoggerFactoryAdapter.cs b/test/Spring/Spring.Aop.Tests/Aspects/Exception/CaptureOutputLoggerFactoryAdapter.cs index d6bd5993..a3e999af 100644 --- a/test/Spring/Spring.Aop.Tests/Aspects/Exception/CaptureOutputLoggerFactoryAdapter.cs +++ b/test/Spring/Spring.Aop.Tests/Aspects/Exception/CaptureOutputLoggerFactoryAdapter.cs @@ -1,27 +1,55 @@ using System; +using System.Collections; using System.Collections.Specialized; +using System.Diagnostics; using Common.Logging; +using Common.Logging.Simple; namespace Spring.Aspects.Exceptions { - public class CaptureOutputLoggerFactoryAdapter : ILoggerFactoryAdapter + public class CaptureOutputLoggerFactoryAdapter : ILoggerFactoryAdapter, IDisposable { - private CaptureOutputLogger adviceLogger; + private class CapturingTraceListener : TraceListener + { + private readonly CaptureOutputLoggerFactoryAdapter adapter; + + public CapturingTraceListener(CaptureOutputLoggerFactoryAdapter adapter) + { + this.adapter = adapter; + } + + public override void Write(string message) + { + adapter.LogMessages.Add(message); + } + + public override void WriteLine(string message) + { + this.Write(message); + } + } + + private readonly CapturingTraceListener listener; public CaptureOutputLoggerFactoryAdapter() { + listener = new CapturingTraceListener(this); + System.Diagnostics.Trace.Listeners.Add(listener); } - public CaptureOutputLoggerFactoryAdapter(NameValueCollection properties) + public void Dispose() { + System.Diagnostics.Trace.Listeners.Remove(listener); } + private IList logMessages = new ArrayList(); - public CaptureOutputLogger AdviceLogger + public IList LogMessages { - get { return adviceLogger; } + get { return logMessages; } + set { logMessages = value; } } #region ILoggerFactoryAdapter Members @@ -33,13 +61,13 @@ namespace Spring.Aspects.Exceptions public ILog GetLogger(string name) { - CaptureOutputLogger logger = new CaptureOutputLogger(); if (name.Equals("adviceHandler") || name.IndexOf("LogExceptionHandler") >= 0) { - adviceLogger = logger; + CaptureOutputLogger logger = new CaptureOutputLogger(); + return logger; } - - return logger; + + return new NoOpLogger(); } #endregion diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs b/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs index b7bf57d6..8f90e0a8 100644 --- a/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs +++ b/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs @@ -47,20 +47,23 @@ namespace Spring.Aspects.Exceptions private CaptureOutputLoggerFactoryAdapter loggerFactoryAdapter; private ILoggerFactoryAdapter originalAdapter; private static bool spelActionExecuted = false; + [SetUp] public void Setup() { originalAdapter = LogManager.Adapter; loggerFactoryAdapter = new CaptureOutputLoggerFactoryAdapter(); LogManager.Adapter = loggerFactoryAdapter; - exceptionHandlerAdvice = new ExceptionHandlerAdvice(); + exceptionHandlerAdvice = new ExceptionHandlerAdvice(); } + [TearDown] public void TearDown() { - loggerFactoryAdapter.AdviceLogger.LogMessages.Clear(); + // loggerFactoryAdapter.LogMessages.Clear(); //reset so other tests can produce some output if needed. + loggerFactoryAdapter.Dispose(); LogManager.Adapter = originalAdapter; } @@ -89,33 +92,30 @@ namespace Spring.Aspects.Exceptions [Test] public void LoggingTest() { - CaptureOutputLoggerFactoryAdapter loggerFactoryAdapter = new CaptureOutputLoggerFactoryAdapter(); - LogManager.Adapter = loggerFactoryAdapter; - LogExceptionHandler logHandler = new LogExceptionHandler(); logHandler.LogName = "adviceHandler"; - string testText = @"'Hello World, exception message = ' + #e.Message + ', target method = ' + #method.Name"; + string testText = + @"'Hello World, exception message = ' + #e.Message + ', target method = ' + #method.Name"; logHandler.SourceExceptionNames.Add("ArithmeticException"); logHandler.ActionExpressionText = testText; exceptionHandlerAdvice.ExceptionHandlers.Add(logHandler); - + exceptionHandlerAdvice.AfterPropertiesSet(); - + ProxyFactory pf = new ProxyFactory(new TestObject()); pf.AddAdvice(exceptionHandlerAdvice); - ITestObject to = (ITestObject) pf.GetProxy(); + ITestObject to = (ITestObject)pf.GetProxy(); try { to.Exceptional(new ArithmeticException()); Assert.Fail("Should have thrown exception when only logging"); - } catch (ArithmeticException) + } + catch (ArithmeticException) { - - bool found = false; - foreach (string message in loggerFactoryAdapter.AdviceLogger.LogMessages) + foreach (string message in loggerFactoryAdapter.LogMessages) { if (message.IndexOf("Hello World") >= 0) { @@ -124,7 +124,6 @@ namespace Spring.Aspects.Exceptions } Assert.IsTrue(found, "did not find logging output"); } - } [Test] @@ -165,7 +164,7 @@ namespace Spring.Aspects.Exceptions [Test] public void LoggingTestWithConstraintExpressionWithKeyedExceptionHandler() { - LogExceptionHandler exHandler = new LogExceptionHandler(); + LogExceptionHandler exHandler = new LogExceptionHandler(); ExecuteLoggingHandlerWithKeyedLogHandler(exHandler, @"on exception (#e is T(System.ArithmeticException)) log 'Request Timeout occured'", "Request Timeout"); } @@ -184,7 +183,7 @@ namespace Spring.Aspects.Exceptions { string logHandlerText = "on exception (#e is System.FooBar) log 'My Message, Method Name ' + #method.Name"; - ExecuteLoggingHandler(logHandlerText, "[WARN] Was not able to evaluate constraint expression [#e is System.FooBar]"); + ExecuteLoggingHandler(logHandlerText, "[WARN] Was not able to evaluate constraint expression [#e is System.FooBar]"); } @@ -381,10 +380,11 @@ namespace Spring.Aspects.Exceptions ITestObject to = CreateTestObjectProxy(returnHandlerText); try { - to.Exceptional(new ArithmeticException("Bad Math")); - } catch (Exception e) + to.Exceptional(new ArithmeticException("Bad Math")); + } + catch (Exception e) { - Assert.Fail("Should not have thrown exception" + e); + Assert.Fail("Should not have thrown exception" + e); } } @@ -487,7 +487,7 @@ namespace Spring.Aspects.Exceptions private void AssertSearchString(string searchString) { bool found = false; - foreach (string message in loggerFactoryAdapter.AdviceLogger.LogMessages) + foreach (string message in loggerFactoryAdapter.LogMessages) { if (message.IndexOf(searchString) >= 0) { @@ -495,7 +495,7 @@ namespace Spring.Aspects.Exceptions } } Assert.IsTrue(found, "did not find logging output [" + searchString + "] Logging values = " - + StringUtils.CollectionToCommaDelimitedString(loggerFactoryAdapter.AdviceLogger.LogMessages)); + + StringUtils.CollectionToCommaDelimitedString(loggerFactoryAdapter.LogMessages)); } } } \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate20.Tests/Spring.Data.NHibernate20.Tests.2008.csproj b/test/Spring/Spring.Data.NHibernate20.Tests/Spring.Data.NHibernate20.Tests.2008.csproj index 9e2a2f4d..dd289be1 100644 --- a/test/Spring/Spring.Data.NHibernate20.Tests/Spring.Data.NHibernate20.Tests.2008.csproj +++ b/test/Spring/Spring.Data.NHibernate20.Tests/Spring.Data.NHibernate20.Tests.2008.csproj @@ -2,9 +2,9 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 - {94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048} + {EACD4B0B-06F9-4A0C-B8E8-EBE6BB0A167F} Library Properties Spring @@ -28,9 +28,9 @@ 4 - + False - ..\..\..\lib\NHibernate20\net\2.0\Castle.DynamicProxy.dll + ..\..\..\lib\NHibernate20\net\2.0\Castle.DynamicProxy2.dll False diff --git a/test/Spring/Spring.Data.NHibernate21.Tests/Spring.Data.NHibernate21.Tests.2008.csproj b/test/Spring/Spring.Data.NHibernate21.Tests/Spring.Data.NHibernate21.Tests.2008.csproj index 2975e5e2..8d36d4bb 100644 --- a/test/Spring/Spring.Data.NHibernate21.Tests/Spring.Data.NHibernate21.Tests.2008.csproj +++ b/test/Spring/Spring.Data.NHibernate21.Tests/Spring.Data.NHibernate21.Tests.2008.csproj @@ -4,7 +4,7 @@ AnyCPU 9.0.30729 2.0 - {94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048} + {90FEE979-7367-4542-BCCB-BF634E04A9D3} Library Properties Spring @@ -28,9 +28,9 @@ 4 - + False - ..\..\..\lib\NHibernate21\net\2.0\Castle.DynamicProxy.dll + ..\..\..\lib\NHibernate21\net\2.0\Castle.DynamicProxy2.dll False @@ -126,13 +126,9 @@ Spring.Data.Tests.2008 - - - Data\NHibernate\Config\AopConfigurationTxPointcut.xml - - +