From 1b733688269db3f9a0476440e5b64f9e2e0d9c05 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Tue, 3 Dec 2013 19:09:19 +0200 Subject: [PATCH] SPRNET-1563 Make code as ClsCompliant as possible --- BreakingChanges.txt | 6 + Spring.Net.2010.sln | 24 - Spring.Net.2010.sln.DotSettings | 19 + Spring.include | 4 +- common-project.include | 2 +- src/Spring/CommonAssemblyInfo.cs | 3 +- .../Aop/Framework/AbstractMethodInvocation.cs | 51 +- .../Aop/Framework/DynamicMethodInvocation.cs | 22 +- .../Framework/ReflectiveMethodInvocation.cs | 24 +- src/Spring/Spring.Aop/Spring.Aop.2010.csproj | 2 +- .../Context/Attributes/AssemblyTypeScanner.cs | 11 +- .../Context/Attributes/DependsOnAttribute.cs | 9 +- .../Context/Attributes/ImportAttribute.cs | 7 + .../Spring.Core/Expressions/BinaryOperator.cs | 1 + .../Expressions/Parser/antlr/BaseAST.cs | 1230 ++++++++--------- .../Spring.Core/Expressions/SpringAST.cs | 298 ++-- .../AutowiredAttributeObjectPostProcessor.cs | 6 +- .../Factory/Attributes/InjectionMetadata.cs | 7 +- .../Config/ConfigurableVariableSource.cs | 2 +- .../Factory/Config/VariableAccessor.cs | 6 + .../Factory/Support/AbstractObjectFactory.cs | 3 +- .../Spring.Core/Spring.Core.2010.csproj | 7 +- .../Spring.Data/Data/Core/AdoAccessor.cs | 2 +- .../Spring.Data/Data/Core/AdoTemplate.cs | 2 +- .../Spring.Data/Data/Generic/AdoTemplate.cs | 7 +- .../Data/Objects/AbstractAdoOperation.cs | 3 +- .../Spring.Data/Data/Objects/AdoOperation.cs | 55 +- .../Data/Objects/Generic/AdoOperation.cs | 48 +- .../Spring.Data/Spring.Data.2010.csproj | 2 +- .../Spring.Messaging.Ems.2010.csproj | 1 + .../Messaging/Nms/Core/NmsTemplate.cs | 2 +- .../Core/MessageQueueGatewaySupport.cs | 8 +- .../Core/MessageQueueMetadataCache.cs | 28 +- .../Messaging/Core/MessageQueueTemplate.cs | 17 +- .../Listener/MessageListenerAdapter.cs | 5 + .../Spring.Messaging.2010.csproj | 2 +- .../AssemblyInfo.cs | 42 + .../Scheduling/Quartz/SchedulerAccessor.cs | 13 +- .../Quartz/SchedulerFactoryObject.cs | 14 +- .../Spring.Scheduling.Quartz21.2010.csproj | 6 + .../Activation/ServiceHostFactoryObject.cs | 3 +- .../ServiceModel/ServiceExporter.cs | 6 +- .../Spring.Services.2010.csproj | 4 +- .../Spring.Template.Velocity/AssemblyInfo.cs | 42 + .../Spring.Template.Velocity.2010.csproj | 4 + .../Velocity/CommonsLoggingLogSystem.cs | 10 +- .../Template/Velocity/SpringResourceLoader.cs | 1 + .../Velocity/VelocityEngineFactory.cs | 24 +- .../Velocity/VelocityEngineFactoryObject.cs | 3 +- .../Template/Velocity/VelocityEngineUtils.cs | 4 +- ...ansactionalDbProviderSpringContextTests.cs | 33 +- ...AbstractTransactionalSpringContextTests.cs | 42 +- .../Spring.Testing.NUnit.2010.csproj | 1 + ...ansactionalDbProviderSpringContextTests.cs | 3 +- ...AbstractTransactionalSpringContextTests.cs | 22 +- ....Web.Conversation.NHibernate32.2010.csproj | 4 +- ....Web.Conversation.NHibernate33.2010.csproj | 4 +- .../Spring.Web.Extensions.2010.csproj | 2 + .../Spring.Web.Mvc3.2010.csproj | 3 +- .../Spring.Web.Mvc4.2010.csproj | 3 +- .../SpringMvcDependencyResolver.cs | 4 +- .../Spring.Web.Mvc5.2010.csproj | 3 +- src/Spring/Spring.Web/Spring.Web.2010.csproj | 10 +- .../Web/Services/WebServiceExporter.cs | 10 +- .../Data/OracleAdoTemplateTests.cs | 3 - .../SerializeConversationTestModule.cs | 7 - .../CircularDependenceTest.aspx.cs | 16 +- .../ConnectionReleaseModeIssue.aspx.cs | 52 +- .../EndConversationTestBegin.aspx.cs | 11 +- .../EndConversationTestEnd.aspx.cs | 11 +- .../SPCSwitchConversationSameRequest.aspx.cs | 11 +- .../Spring.Web.Tests/Util/WebUtilsTests.cs | 20 +- 72 files changed, 1271 insertions(+), 1106 deletions(-) create mode 100644 src/Spring/Spring.Scheduling.Quartz21/AssemblyInfo.cs create mode 100644 src/Spring/Spring.Template.Velocity/AssemblyInfo.cs diff --git a/BreakingChanges.txt b/BreakingChanges.txt index 3d1ddf4f..aa650162 100644 --- a/BreakingChanges.txt +++ b/BreakingChanges.txt @@ -1,3 +1,9 @@ +Changes (1.3.2 to 2.0) +======================== + +Protected fields were changed to private. Access is now allowed via public/protected property member. + + Changes (1.3.1 to 1.3.2) ======================== diff --git a/Spring.Net.2010.sln b/Spring.Net.2010.sln index 77feb567..88d67760 100644 --- a/Spring.Net.2010.sln +++ b/Spring.Net.2010.sln @@ -99,10 +99,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.Conversation.NHi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.Conversation.NHibernate33.Tests.2010", "test\Spring\Spring.Web.Conversation.NHibernate33.Tests\Spring.Web.Conversation.NHibernate33.Tests.2010.csproj", "{C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.Mvc5.2010", "src\Spring\Spring.Web.Mvc5\Spring.Web.Mvc5.2010.csproj", "{39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.Mvc5.Tests.2010", "test\Spring\Spring.Web.Mvc5.Tests\Spring.Web.Mvc5.Tests.2010.csproj", "{B9590252-6D58-4587-950C-475AB61FDBCF}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{79F495DF-83D6-435E-A20E-47800F6F8FE7}" ProjectSection(SolutionItems) = preProject .nuget\NuGet.Config = .nuget\NuGet.Config @@ -560,26 +556,6 @@ Global {C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Release|Any CPU.Build.0 = Release|Any CPU {C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Debug|.NET.ActiveCfg = Debug|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Release|.NET.ActiveCfg = Release|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Release|Any CPU.Build.0 = Release|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {39AAD7EA-2ED0-4E50-8D4D-C666EA9CBFE4}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Debug|.NET.ActiveCfg = Debug|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Release|.NET.ActiveCfg = Release|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Release|Any CPU.Build.0 = Release|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {B9590252-6D58-4587-950C-475AB61FDBCF}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Spring.Net.2010.sln.DotSettings b/Spring.Net.2010.sln.DotSettings index 666c9c7d..0eda6705 100644 --- a/Spring.Net.2010.sln.DotSettings +++ b/Spring.Net.2010.sln.DotSettings @@ -3,6 +3,24 @@ 1 1 False + License + +/* + * Copyright 2002-$CURRENT_YEAR$ the original author or authors. + * + * 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. + */ + True @@ -11,6 +29,7 @@ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> True SOLUTION + True True ALWAYS_ADD ALWAYS_ADD diff --git a/Spring.include b/Spring.include index 43dd85a0..9cfc1f9f 100644 --- a/Spring.include +++ b/Spring.include @@ -237,7 +237,7 @@ - + --> @@ -273,7 +273,7 @@ - + diff --git a/common-project.include b/common-project.include index 268da5cb..cf13ef51 100644 --- a/common-project.include +++ b/common-project.include @@ -53,7 +53,7 @@ ${current.bin.dir}: the binary directory to output the assembly + app.config to --> - + diff --git a/src/Spring/CommonAssemblyInfo.cs b/src/Spring/CommonAssemblyInfo.cs index 25237c50..90709a9a 100644 --- a/src/Spring/CommonAssemblyInfo.cs +++ b/src/Spring/CommonAssemblyInfo.cs @@ -1,6 +1,7 @@ using System; using System.Reflection; -[assembly: CLSCompliant(false)] + +[assembly: CLSCompliant(true)] // // General Information about an assembly is controlled through the following diff --git a/src/Spring/Spring.Aop/Aop/Framework/AbstractMethodInvocation.cs b/src/Spring/Spring.Aop/Aop/Framework/AbstractMethodInvocation.cs index 17bc760b..2ea9aaad 100644 --- a/src/Spring/Spring.Aop/Aop/Framework/AbstractMethodInvocation.cs +++ b/src/Spring/Spring.Aop/Aop/Framework/AbstractMethodInvocation.cs @@ -55,39 +55,39 @@ namespace Spring.Aop.Framework /// The arguments (if any = may be ) to the method /// that is to be invoked. /// - protected object[] arguments; + private object[] arguments; /// /// The target object that the method is to be invoked on. /// - protected object target; + private readonly object target; /// /// The AOP proxy for the target object. /// - protected object proxy; + private object proxy; /// /// The method invocation that is to be invoked. /// - protected MethodInfo method; + private MethodInfo method; /// /// The list of and /// /// that need dynamic checks. /// - protected IList interceptors; + private IList interceptors; /// /// The declaring type of the method that is to be invoked. /// - protected Type targetType; + private Type targetType; /// /// The index from 0 of the current interceptor we're invoking. /// - protected int currentInterceptorIndex; + private int currentInterceptorIndex; /// /// Creates a new instance of the @@ -128,16 +128,11 @@ namespace Spring.Aop.Framework protected AbstractMethodInvocation(object proxy, object target, MethodInfo method, object[] arguments, Type targetType, IList interceptors) { - #region Sanity Check - - // EE: There is not necessarily always a target - e.g. for DynamicEntities + // EE: There is not necessarily always a target - e.g. for DynamicEntities // moved this check to InvokeJoinpoint() -// AssertUtils.ArgumentNotNull(target, "target"); AssertUtils.ArgumentNotNull(method, "method"); - #endregion - - this.proxy = proxy; + this.proxy = proxy; this.target = target; this.method = method; this.targetType = targetType; @@ -157,10 +152,11 @@ namespace Spring.Aop.Framework /// public virtual MethodInfo Method { - get { return method; } - } + get { return method; } + protected set { method = value; } + } - /// + /// /// Gets the static part of this joinpoint. /// /// @@ -181,6 +177,7 @@ namespace Spring.Aop.Framework public virtual object Proxy { get { return this.proxy; } + protected set { this.proxy = value; } } /// /// Gets the target object for the invocation. @@ -200,7 +197,8 @@ namespace Spring.Aop.Framework /// public virtual Type TargetType { - get { return this.targetType; } + get { return this.targetType; } + protected set { this.targetType = value; } } /// @@ -240,7 +238,16 @@ namespace Spring.Aop.Framework get { return this.target; } } - /// + /// + /// The index from 0 of the current interceptor we're invoking. + /// + protected int CurrentInterceptorIndex + { + get { return currentInterceptorIndex; } + set { currentInterceptorIndex = value; } + } + + /// /// Proceeds to the next interceptor in the chain. /// /// @@ -357,15 +364,15 @@ namespace Spring.Aop.Framework { StringBuilder buffer = new StringBuilder("Invocation: method '"); buffer.Append(Method.Name).Append("', ").Append("arguments "); - buffer.Append(this.arguments != null ? StringUtils.CollectionToCommaDelimitedString(this.arguments) : "[none]"); + buffer.Append(Arguments != null ? StringUtils.CollectionToCommaDelimitedString(Arguments) : "[none]"); buffer.Append("; "); - if (this.target == null) + if (Target == null) { buffer.Append("target is null."); } else { - buffer.Append("target is of Type [").Append(this.targetType.FullName).Append(']'); + buffer.Append("target is of Type [").Append(TargetType.FullName).Append(']'); } return buffer.ToString(); } diff --git a/src/Spring/Spring.Aop/Aop/Framework/DynamicMethodInvocation.cs b/src/Spring/Spring.Aop/Aop/Framework/DynamicMethodInvocation.cs index 36b19034..4cfd3c65 100644 --- a/src/Spring/Spring.Aop/Aop/Framework/DynamicMethodInvocation.cs +++ b/src/Spring/Spring.Aop/Aop/Framework/DynamicMethodInvocation.cs @@ -44,7 +44,7 @@ namespace Spring.Aop.Framework /// /// The method invocation that is to be invoked on the proxy. /// - protected MethodInfo proxyMethod; + private MethodInfo proxyMethod; /// /// Creates a new instance of the @@ -73,6 +73,15 @@ namespace Spring.Aop.Framework this.proxyMethod = proxyMethod; } + /// + /// The method invocation that is to be invoked on the proxy. + /// + protected MethodInfo ProxyMethod + { + get { return proxyMethod; } + set { proxyMethod = value; } + } + /// /// Invokes the joinpoint using dynamic reflection. /// @@ -90,14 +99,14 @@ namespace Spring.Aop.Framework /// protected override object InvokeJoinpoint() { - MethodInfo targetMethodInfo = ((this.proxyMethod == null)) ? method : this.proxyMethod; + MethodInfo targetMethodInfo = this.proxyMethod ?? Method; IDynamicMethod targetMethod = new SafeMethod(targetMethodInfo); try { - AssertUtils.Understands(target, "target", targetMethodInfo); - return targetMethod.Invoke(target, arguments); + AssertUtils.Understands(Target, "target", targetMethodInfo); + return targetMethod.Invoke(Target, Arguments); } // Only happens if fallback to standard reflection. catch (TargetInvocationException ex) @@ -119,9 +128,8 @@ namespace Spring.Aop.Framework /// protected override IMethodInvocation PrepareMethodInvocationForProceed(IMethodInvocation invocation) { - DynamicMethodInvocation rmi = new DynamicMethodInvocation( - this.proxy, this.target, this.method, this.proxyMethod, this.arguments, this.targetType, this.interceptors); - rmi.currentInterceptorIndex = this.currentInterceptorIndex + 1; + var rmi = new DynamicMethodInvocation(Proxy, Target, Method, ProxyMethod, Arguments, TargetType, Interceptors); + rmi.CurrentInterceptorIndex = CurrentInterceptorIndex + 1; return rmi; } diff --git a/src/Spring/Spring.Aop/Aop/Framework/ReflectiveMethodInvocation.cs b/src/Spring/Spring.Aop/Aop/Framework/ReflectiveMethodInvocation.cs index 5f06d76e..16d02018 100644 --- a/src/Spring/Spring.Aop/Aop/Framework/ReflectiveMethodInvocation.cs +++ b/src/Spring/Spring.Aop/Aop/Framework/ReflectiveMethodInvocation.cs @@ -44,7 +44,7 @@ namespace Spring.Aop.Framework /// /// The method invocation that is to be invoked on the proxy. /// - protected MethodInfo proxyMethod; + private MethodInfo proxyMethod; /// /// Creates a new instance of the @@ -73,7 +73,16 @@ namespace Spring.Aop.Framework this.proxyMethod = proxyMethod; } - /// + /// + /// The method invocation that is to be invoked on the proxy. + /// + protected MethodInfo ProxyMethod + { + get { return proxyMethod; } + set { proxyMethod = value; } + } + + /// /// Invokes the joinpoint using standard reflection. /// /// @@ -92,10 +101,10 @@ namespace Spring.Aop.Framework { try { - MethodInfo targetMethodInfo = ((this.proxyMethod == null)) ? method : this.proxyMethod; + MethodInfo targetMethodInfo = ProxyMethod ?? Method; - AssertUtils.Understands(target, "target", targetMethodInfo); - return targetMethodInfo.Invoke(target, arguments); + AssertUtils.Understands(Target, "target", targetMethodInfo); + return targetMethodInfo.Invoke(Target, Arguments); } catch (TargetInvocationException ex) { @@ -116,9 +125,8 @@ namespace Spring.Aop.Framework /// protected override IMethodInvocation PrepareMethodInvocationForProceed(IMethodInvocation invocation) { - ReflectiveMethodInvocation rmi = new ReflectiveMethodInvocation( - this.proxy, this.target, this.method, this.proxyMethod, this.arguments, this.targetType, this.interceptors); - rmi.currentInterceptorIndex = this.currentInterceptorIndex + 1; + var rmi = new ReflectiveMethodInvocation(Proxy, Target, Method, ProxyMethod, Arguments, TargetType, Interceptors); + rmi.CurrentInterceptorIndex = CurrentInterceptorIndex + 1; return rmi; } diff --git a/src/Spring/Spring.Aop/Spring.Aop.2010.csproj b/src/Spring/Spring.Aop/Spring.Aop.2010.csproj index 994d43e9..619de4ee 100644 --- a/src/Spring/Spring.Aop/Spring.Aop.2010.csproj +++ b/src/Spring/Spring.Aop/Spring.Aop.2010.csproj @@ -85,7 +85,7 @@ true false false - false + true 4 none prompt diff --git a/src/Spring/Spring.Core/Context/Attributes/AssemblyTypeScanner.cs b/src/Spring/Spring.Core/Context/Attributes/AssemblyTypeScanner.cs index 30a4d62e..869804b1 100644 --- a/src/Spring/Spring.Core/Context/Attributes/AssemblyTypeScanner.cs +++ b/src/Spring/Spring.Core/Context/Attributes/AssemblyTypeScanner.cs @@ -84,16 +84,19 @@ namespace Spring.Context.Attributes /// /// Stores the object default definitons defined in the XML configuration documnet /// - protected DocumentDefaultsDefinition _defaults; + private DocumentDefaultsDefinition _defaults; - - protected string _scanStartFolderPath; + private string _scanStartFolderPath; /// /// Stores the object default definitons defined in the XML configuration documnet /// - public DocumentDefaultsDefinition Defaults { get { return _defaults; } set { _defaults = value; } } + public DocumentDefaultsDefinition Defaults + { + get { return _defaults; } + set { _defaults = value; } + } public string ScanStartFolderPath { diff --git a/src/Spring/Spring.Core/Context/Attributes/DependsOnAttribute.cs b/src/Spring/Spring.Core/Context/Attributes/DependsOnAttribute.cs index 9c4f5613..749750e9 100644 --- a/src/Spring/Spring.Core/Context/Attributes/DependsOnAttribute.cs +++ b/src/Spring/Spring.Core/Context/Attributes/DependsOnAttribute.cs @@ -44,7 +44,14 @@ namespace Spring.Context.Attributes /// /// Initializes a new instance of the DependsOn class. /// - /// + public DependsOnAttribute(string name) + : this(new[] { name }) + { + } + + /// + /// Initializes a new instance of the DependsOn class. + /// public DependsOnAttribute(params string[] name) { _name = name; diff --git a/src/Spring/Spring.Core/Context/Attributes/ImportAttribute.cs b/src/Spring/Spring.Core/Context/Attributes/ImportAttribute.cs index 791f735b..b4ad6cdc 100644 --- a/src/Spring/Spring.Core/Context/Attributes/ImportAttribute.cs +++ b/src/Spring/Spring.Core/Context/Attributes/ImportAttribute.cs @@ -37,6 +37,13 @@ namespace Spring.Context.Attributes public class ImportAttribute : Attribute { private Type[] _types; + + /// + /// Initializes a new instance of the Import class. + /// + public ImportAttribute(Type type) : this(new []{ type }) + { + } /// /// Initializes a new instance of the Import class. diff --git a/src/Spring/Spring.Core/Expressions/BinaryOperator.cs b/src/Spring/Spring.Core/Expressions/BinaryOperator.cs index 4ace28ce..0abe9185 100644 --- a/src/Spring/Spring.Core/Expressions/BinaryOperator.cs +++ b/src/Spring/Spring.Core/Expressions/BinaryOperator.cs @@ -74,6 +74,7 @@ namespace Spring.Expressions /// Gets the right operand. /// /// The right operand. + [CLSCompliant(false)] public BaseNode Right { get { return (BaseNode) this.getFirstChild().getNextSibling(); } diff --git a/src/Spring/Spring.Core/Expressions/Parser/antlr/BaseAST.cs b/src/Spring/Spring.Core/Expressions/Parser/antlr/BaseAST.cs index 698649bd..34cf55ab 100644 --- a/src/Spring/Spring.Core/Expressions/Parser/antlr/BaseAST.cs +++ b/src/Spring/Spring.Core/Expressions/Parser/antlr/BaseAST.cs @@ -1,617 +1,617 @@ -using System; +using System; using Spring.Expressions.Parser.antlr.collections; -using StringBuilder = System.Text.StringBuilder; -using ISerializable = System.Runtime.Serialization.ISerializable; -using TextWriter = System.IO.TextWriter; -using ArrayList = System.Collections.ArrayList; -using IEnumerator = System.Collections.IEnumerator; - -using AST = Spring.Expressions.Parser.antlr.collections.AST; - -namespace Spring.Expressions.Parser.antlr -{ - /*ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - - // - // ANTLR C# Code Generator by Micheal Jordan - // Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com - // Anthony Oguntimehin - // - // With many thanks to Eric V. Smith from the ANTLR list. - // - - /* - * A Child-Sibling Tree. - * - * A tree with PLUS at the root and with two children 3 and 4 is - * structured as: - * - * PLUS - * | - * 3 -- 4 - * - * and can be specified easily in LISP notation as - * - * (PLUS 3 4) - * - * where every '(' starts a new subtree. - * - * These trees are particular useful for translators because of - * the flexibility of the children lists. They are also very easy - * to walk automatically, whereas trees with specific children - * reference fields can't easily be walked automatically. - * - * This class contains the basic support for an AST. - * Most people will create ASTs that are subclasses of - * BaseAST or of CommonAST. - */ - [Serializable()] - public abstract class BaseAST : AST - { - protected internal BaseAST down; - protected internal BaseAST right; - - private static bool verboseStringConversion = false; - private static string[] tokenNames = null; - - /*Add a node to the end of the child list for this node */ - public virtual void addChild(AST node) - { - if (node == null) - return ; - BaseAST t = this.down; - if (t != null) - { - while (t.right != null) - { - t = t.right; - } - t.right = (BaseAST) node; - } - else - { - this.down = (BaseAST) node; - } - } - - private void doWorkForFindAll(ArrayList v, AST target, bool partialMatch) - { - AST sibling; - - // Start walking sibling lists, looking for matches. -//siblingWalk: - for (sibling = this; sibling != null; sibling = sibling.getNextSibling()) - { - if ((partialMatch && sibling.EqualsTreePartial(target)) || (!partialMatch && sibling.EqualsTree(target))) - { - v.Add(sibling); - } - // regardless of match or not, check any children for matches - if (sibling.getFirstChild() != null) - { - ((BaseAST) sibling.getFirstChild()).doWorkForFindAll(v, target, partialMatch); - } - } - } - - public override bool Equals(object obj) - { - if (obj == null) - return false; - if (this.GetType() != obj.GetType()) - return false; - return Equals((AST)obj); - } - - /*Is node t equal to this in terms of token type and text? */ - public virtual bool Equals(AST t) - { - if (t == null) - return false; - - return (Object.Equals(this.getText(), t.getText())) && - (this.Type == t.Type); - } - - /*Is t an exact structural and equals() match of this tree. The - * 'this' reference is considered the start of a sibling list. - */ - public virtual bool EqualsList(AST t) - { - AST sibling; - - // the empty tree is not a match of any non-null tree. - if (t == null) - { - return false; - } - - // Otherwise, start walking sibling lists. First mismatch, return false. - for (sibling = this; sibling != null && t != null; sibling = sibling.getNextSibling(), t = t.getNextSibling()) - { - // as a quick optimization, check roots first. - if (!sibling.Equals(t)) - { - return false; - } - // if roots match, do full list match test on children. - if (sibling.getFirstChild() != null) - { - if (!sibling.getFirstChild().EqualsList(t.getFirstChild())) - { - return false; - } - } - else if (t.getFirstChild() != null) - { - return false; - } - } - if (sibling == null && t == null) - { - return true; - } - // one sibling list has more than the other - return false; - } - - /*Is 'sub' a subtree of this list? - * The siblings of the root are NOT ignored. - */ - public virtual bool EqualsListPartial(AST sub) - { - AST sibling; - - // the empty tree is always a subset of any tree. - if (sub == null) - { - return true; - } - - // Otherwise, start walking sibling lists. First mismatch, return false. - for (sibling = this; sibling != null && sub != null; sibling = sibling.getNextSibling(), sub = sub.getNextSibling()) - { - // as a quick optimization, check roots first. - if (!sibling.Equals(sub)) - return false; - // if roots match, do partial list match test on children. - if (sibling.getFirstChild() != null) - { - if (!sibling.getFirstChild().EqualsListPartial(sub.getFirstChild())) - return false; - } - } - if (sibling == null && sub != null) - { - // nothing left to match in this tree, but subtree has more - return false; - } - // either both are null or sibling has more, but subtree doesn't - return true; - } - - /*Is tree rooted at 'this' equal to 't'? The siblings - * of 'this' are ignored. - */ - public virtual bool EqualsTree(AST t) - { - // check roots first. - if (!this.Equals(t)) - return false; - // if roots match, do full list match test on children. - if (this.getFirstChild() != null) - { - if (!this.getFirstChild().EqualsList(t.getFirstChild())) - return false; - } - else if (t.getFirstChild() != null) - { - return false; - } - return true; - } - - /*Is 't' a subtree of the tree rooted at 'this'? The siblings - * of 'this' are ignored. - */ - public virtual bool EqualsTreePartial(AST sub) - { - // the empty tree is always a subset of any tree. - if (sub == null) - { - return true; - } - - // check roots first. - if (!this.Equals(sub)) - return false; - // if roots match, do full list partial match test on children. - if (this.getFirstChild() != null) - { - if (!this.getFirstChild().EqualsListPartial(sub.getFirstChild())) - return false; - } - return true; - } - - /*Walk the tree looking for all exact subtree matches. Return - * an IEnumerator that lets the caller walk the list - * of subtree roots found herein. - */ - public virtual IEnumerator findAll(AST target) - { - ArrayList roots = new ArrayList(10); - //AST sibling; - - // the empty tree cannot result in an enumeration - if (target == null) - { - return null; - } - - doWorkForFindAll(roots, target, false); // find all matches recursively - - return roots.GetEnumerator(); - } - - /*Walk the tree looking for all subtrees. Return - * an IEnumerator that lets the caller walk the list - * of subtree roots found herein. - */ - public virtual IEnumerator findAllPartial(AST sub) - { - ArrayList roots = new ArrayList(10); - //AST sibling; - - // the empty tree cannot result in an enumeration - if (sub == null) - { - return null; - } - - doWorkForFindAll(roots, sub, true); // find all matches recursively - - return roots.GetEnumerator(); - } - - /*Get the first child of this node; null if not children */ - public virtual AST getFirstChild() - { - return down; - } - - /*Get the next sibling in line after this one */ - public virtual AST getNextSibling() - { - return right; - } - - /*Get the token text for this node */ - public virtual string getText() - { - return ""; - } - - /*Get the token type for this node */ - public virtual int Type - { - get { return 0; } - set { ; } - } - - /// - /// Get number of children of this node; if leaf, returns 0 - /// - /// Number of children - public int getNumberOfChildren() - { - BaseAST t = this.down; - int n = 0; - if (t != null) - { - n = 1; - while (t.right != null) - { - t = t.right; - n++; - } - } - return n; - } - - public abstract void initialize(int t, string txt); - - public abstract void initialize(AST t); - - public abstract void initialize(IToken t); - - /*Remove all children */ - public virtual void removeChildren() - { - down = null; - } - - public virtual void setFirstChild(AST c) - { - down = (BaseAST) c; - } - - public virtual void setNextSibling(AST n) - { - right = (BaseAST) n; - } - - /*Set the token text for this node */ - public virtual void setText(string text) - { - ; - } - - /*Set the token type for this node */ - public virtual void setType(int ttype) - { - this.Type = ttype; - } - - public static void setVerboseStringConversion(bool verbose, string[] names) - { - verboseStringConversion = verbose; - tokenNames = names; - } - - override public string ToString() - { - StringBuilder b = new StringBuilder(); - // if verbose and type name not same as text (keyword probably) - if (verboseStringConversion && - (0 != String.Compare(getText(), (tokenNames[Type]), true)) && - (0 != String.Compare(getText(), StringUtils.stripFrontBack(tokenNames[Type], @"""", @""""), true))) - { - b.Append('['); - b.Append(getText()); - b.Append(",<"); - b.Append(tokenNames[Type]); - b.Append(">]"); - return b.ToString(); - } - return getText(); - } - - /*Print out a child-sibling tree in LISP notation */ - public virtual string ToStringList() - { - AST t = this; - string ts = ""; - if (t.getFirstChild() != null) - ts += " ("; - ts += " " + this.ToString(); - if (t.getFirstChild() != null) - { - ts += ((BaseAST) t.getFirstChild()).ToStringList(); - } - if (t.getFirstChild() != null) - ts += " )"; - if (t.getNextSibling() != null) - { - ts += ((BaseAST) t.getNextSibling()).ToStringList(); - } - return ts; - } - - public virtual string ToStringTree() - { - AST t = this; - string ts = ""; - if (t.getFirstChild() != null) - { - ts += " ("; - } - ts += " " + this.ToString(); - if (t.getFirstChild() != null) - { - ts += ((BaseAST) t.getFirstChild()).ToStringList(); - } - if (t.getFirstChild() != null) - { - ts += " )"; - } - return ts; - } - - public virtual string ToTree() - { - return ToTree(string.Empty); - } - - public virtual string ToTree(string prefix) - { - StringBuilder sb = new StringBuilder(prefix); - - // Replace vertical bar if there is no next sibling. - if ( (getNextSibling() == null) ) - sb.Append("+--"); - else - sb.Append("|--"); - - sb.Append( ToString() ); - sb.Append( Environment.NewLine ); - - if ( getFirstChild() != null ) - { - // Replace vertical bar if there is no next sibling. - if ( getNextSibling() == null ) - sb.Append( ((BaseAST) getFirstChild()).ToTree(prefix + " ") ); - else - sb.Append( ((BaseAST) getFirstChild()).ToTree(prefix + "| ") ); - } - - if ( getNextSibling() != null ) - sb.Append( ((BaseAST) getNextSibling()).ToTree(prefix) ); - - return sb.ToString(); - } - - public static string decode(string text) - { - char c, c1, c2, c3, c4, c5; - StringBuilder n = new StringBuilder(); - for (int i = 0; i < text.Length; i++) - { - c = text[i]; - if (c == '&') - { - c1 = text[i + 1]; - c2 = text[i + 2]; - c3 = text[i + 3]; - c4 = text[i + 4]; - c5 = text[i + 5]; - - if (c1 == 'a' && c2 == 'm' && c3 == 'p' && c4 == ';') - { - n.Append("&"); - i += 5; - } - else if (c1 == 'l' && c2 == 't' && c3 == ';') - { - n.Append("<"); - i += 4; - } - else if (c1 == 'g' && c2 == 't' && c3 == ';') - { - n.Append(">"); - i += 4; - } - else if (c1 == 'q' && c2 == 'u' && c3 == 'o' && c4 == 't' && c5 == ';') - { - n.Append("\""); - i += 6; - } - else if (c1 == 'a' && c2 == 'p' && c3 == 'o' && c4 == 's' && c5 == ';') - { - n.Append("'"); - i += 6; - } - else - n.Append("&"); - } - else - n.Append(c); - } - return n.ToString(); - } - - public static string encode(string text) - { - char c; - StringBuilder n = new StringBuilder(); - for (int i = 0; i < text.Length; i++) - { - c = text[i]; - switch (c) - { - case '&': - { - n.Append("&"); - break; - } - - case '<': - { - n.Append("<"); - break; - } - - case '>': - { - n.Append(">"); - break; - } - - case '"': - { - n.Append("""); - break; - } - - case '\'': - { - n.Append("'"); - break; - } - - default: - { - n.Append(c); - break; - } - - } - } - return n.ToString(); - } - - public virtual void xmlSerializeNode(TextWriter outWriter) - { - StringBuilder buf = new StringBuilder(100); - buf.Append("<"); - buf.Append(GetType().FullName + " "); - buf.Append("text=\"" + encode(getText()) + "\" type=\"" + Type + "\"/>"); - outWriter.Write(buf.ToString()); - } - - public virtual void xmlSerializeRootOpen(TextWriter outWriter) - { - StringBuilder buf = new StringBuilder(100); - buf.Append("<"); - buf.Append(GetType().FullName + " "); - buf.Append("text=\"" + encode(getText()) + "\" type=\"" + Type + "\">\n"); - outWriter.Write(buf.ToString()); - } - - public virtual void xmlSerializeRootClose(TextWriter outWriter) - { - outWriter.Write("\n"); - } - - public virtual void xmlSerialize(TextWriter outWriter) - { - // print out this node and all siblings - for (AST node = this; node != null; node = node.getNextSibling()) - { - if (node.getFirstChild() == null) - { - // print guts (class name, attributes) - ((BaseAST) node).xmlSerializeNode(outWriter); - } - else - { - ((BaseAST) node).xmlSerializeRootOpen(outWriter); - - // print children - ((BaseAST) node.getFirstChild()).xmlSerialize(outWriter); - - // print end tag - ((BaseAST) node).xmlSerializeRootClose(outWriter); - } - } - } - - #region Implementation of ICloneable - [Obsolete("Deprecated since version 2.7.2. Use ASTFactory.dup() instead.", false)] - public virtual object Clone() - { - return MemberwiseClone(); - } - #endregion - - public override Int32 GetHashCode() - { - return base.GetHashCode(); - } - } +using StringBuilder = System.Text.StringBuilder; +using ISerializable = System.Runtime.Serialization.ISerializable; +using TextWriter = System.IO.TextWriter; +using ArrayList = System.Collections.ArrayList; +using IEnumerator = System.Collections.IEnumerator; + +using AST = Spring.Expressions.Parser.antlr.collections.AST; + +namespace Spring.Expressions.Parser.antlr +{ + /*ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id:$ + */ + + // + // ANTLR C# Code Generator by Micheal Jordan + // Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com + // Anthony Oguntimehin + // + // With many thanks to Eric V. Smith from the ANTLR list. + // + + /* + * A Child-Sibling Tree. + * + * A tree with PLUS at the root and with two children 3 and 4 is + * structured as: + * + * PLUS + * | + * 3 -- 4 + * + * and can be specified easily in LISP notation as + * + * (PLUS 3 4) + * + * where every '(' starts a new subtree. + * + * These trees are particular useful for translators because of + * the flexibility of the children lists. They are also very easy + * to walk automatically, whereas trees with specific children + * reference fields can't easily be walked automatically. + * + * This class contains the basic support for an AST. + * Most people will create ASTs that are subclasses of + * BaseAST or of CommonAST. + */ + [Serializable()] + public abstract class BaseAST : AST + { + protected internal BaseAST down; + protected internal BaseAST right; + + private static bool verboseStringConversion = false; + private static string[] tokenNames = null; + + /*Add a node to the end of the child list for this node */ + public virtual void addChild(AST node) + { + if (node == null) + return ; + BaseAST t = this.down; + if (t != null) + { + while (t.right != null) + { + t = t.right; + } + t.right = (BaseAST) node; + } + else + { + this.down = (BaseAST) node; + } + } + + private void doWorkForFindAll(ArrayList v, AST target, bool partialMatch) + { + AST sibling; + + // Start walking sibling lists, looking for matches. +//siblingWalk: + for (sibling = this; sibling != null; sibling = sibling.getNextSibling()) + { + if ((partialMatch && sibling.EqualsTreePartial(target)) || (!partialMatch && sibling.EqualsTree(target))) + { + v.Add(sibling); + } + // regardless of match or not, check any children for matches + if (sibling.getFirstChild() != null) + { + ((BaseAST) sibling.getFirstChild()).doWorkForFindAll(v, target, partialMatch); + } + } + } + + public override bool Equals(object obj) + { + if (obj == null) + return false; + if (this.GetType() != obj.GetType()) + return false; + return Equals((AST)obj); + } + + /*Is node t equal to this in terms of token type and text? */ + public virtual bool Equals(AST t) + { + if (t == null) + return false; + + return (Object.Equals(this.getText(), t.getText())) && + (this.Type == t.Type); + } + + /*Is t an exact structural and equals() match of this tree. The + * 'this' reference is considered the start of a sibling list. + */ + public virtual bool EqualsList(AST t) + { + AST sibling; + + // the empty tree is not a match of any non-null tree. + if (t == null) + { + return false; + } + + // Otherwise, start walking sibling lists. First mismatch, return false. + for (sibling = this; sibling != null && t != null; sibling = sibling.getNextSibling(), t = t.getNextSibling()) + { + // as a quick optimization, check roots first. + if (!sibling.Equals(t)) + { + return false; + } + // if roots match, do full list match test on children. + if (sibling.getFirstChild() != null) + { + if (!sibling.getFirstChild().EqualsList(t.getFirstChild())) + { + return false; + } + } + else if (t.getFirstChild() != null) + { + return false; + } + } + if (sibling == null && t == null) + { + return true; + } + // one sibling list has more than the other + return false; + } + + /*Is 'sub' a subtree of this list? + * The siblings of the root are NOT ignored. + */ + public virtual bool EqualsListPartial(AST sub) + { + AST sibling; + + // the empty tree is always a subset of any tree. + if (sub == null) + { + return true; + } + + // Otherwise, start walking sibling lists. First mismatch, return false. + for (sibling = this; sibling != null && sub != null; sibling = sibling.getNextSibling(), sub = sub.getNextSibling()) + { + // as a quick optimization, check roots first. + if (!sibling.Equals(sub)) + return false; + // if roots match, do partial list match test on children. + if (sibling.getFirstChild() != null) + { + if (!sibling.getFirstChild().EqualsListPartial(sub.getFirstChild())) + return false; + } + } + if (sibling == null && sub != null) + { + // nothing left to match in this tree, but subtree has more + return false; + } + // either both are null or sibling has more, but subtree doesn't + return true; + } + + /*Is tree rooted at 'this' equal to 't'? The siblings + * of 'this' are ignored. + */ + public virtual bool EqualsTree(AST t) + { + // check roots first. + if (!this.Equals(t)) + return false; + // if roots match, do full list match test on children. + if (this.getFirstChild() != null) + { + if (!this.getFirstChild().EqualsList(t.getFirstChild())) + return false; + } + else if (t.getFirstChild() != null) + { + return false; + } + return true; + } + + /*Is 't' a subtree of the tree rooted at 'this'? The siblings + * of 'this' are ignored. + */ + public virtual bool EqualsTreePartial(AST sub) + { + // the empty tree is always a subset of any tree. + if (sub == null) + { + return true; + } + + // check roots first. + if (!this.Equals(sub)) + return false; + // if roots match, do full list partial match test on children. + if (this.getFirstChild() != null) + { + if (!this.getFirstChild().EqualsListPartial(sub.getFirstChild())) + return false; + } + return true; + } + + /*Walk the tree looking for all exact subtree matches. Return + * an IEnumerator that lets the caller walk the list + * of subtree roots found herein. + */ + public virtual IEnumerator findAll(AST target) + { + ArrayList roots = new ArrayList(10); + //AST sibling; + + // the empty tree cannot result in an enumeration + if (target == null) + { + return null; + } + + doWorkForFindAll(roots, target, false); // find all matches recursively + + return roots.GetEnumerator(); + } + + /*Walk the tree looking for all subtrees. Return + * an IEnumerator that lets the caller walk the list + * of subtree roots found herein. + */ + public virtual IEnumerator findAllPartial(AST sub) + { + ArrayList roots = new ArrayList(10); + //AST sibling; + + // the empty tree cannot result in an enumeration + if (sub == null) + { + return null; + } + + doWorkForFindAll(roots, sub, true); // find all matches recursively + + return roots.GetEnumerator(); + } + + /*Get the first child of this node; null if not children */ + public virtual AST getFirstChild() + { + return down; + } + + /*Get the next sibling in line after this one */ + public virtual AST getNextSibling() + { + return right; + } + + /*Get the token text for this node */ + public virtual string getText() + { + return ""; + } + + /*Get the token type for this node */ + public virtual int Type + { + get { return 0; } + set { ; } + } + + /// + /// Get number of children of this node; if leaf, returns 0 + /// + /// Number of children + public int getNumberOfChildren() + { + BaseAST t = this.down; + int n = 0; + if (t != null) + { + n = 1; + while (t.right != null) + { + t = t.right; + n++; + } + } + return n; + } + + public abstract void initialize(int t, string txt); + + public abstract void initialize(AST t); + + public abstract void initialize(IToken t); + + /*Remove all children */ + public virtual void removeChildren() + { + down = null; + } + + public virtual void setFirstChild(AST c) + { + down = (BaseAST) c; + } + + public virtual void setNextSibling(AST n) + { + right = (BaseAST) n; + } + + /*Set the token text for this node */ + public virtual void setText(string text) + { + ; + } + + /*Set the token type for this node */ + public virtual void setType(int ttype) + { + this.Type = ttype; + } + + public static void setVerboseStringConversion(bool verbose, string[] names) + { + verboseStringConversion = verbose; + tokenNames = names; + } + + override public string ToString() + { + StringBuilder b = new StringBuilder(); + // if verbose and type name not same as text (keyword probably) + if (verboseStringConversion && + (0 != String.Compare(getText(), (tokenNames[Type]), true)) && + (0 != String.Compare(getText(), StringUtils.stripFrontBack(tokenNames[Type], @"""", @""""), true))) + { + b.Append('['); + b.Append(getText()); + b.Append(",<"); + b.Append(tokenNames[Type]); + b.Append(">]"); + return b.ToString(); + } + return getText(); + } + + /*Print out a child-sibling tree in LISP notation */ + public virtual string ToStringList() + { + AST t = this; + string ts = ""; + if (t.getFirstChild() != null) + ts += " ("; + ts += " " + this.ToString(); + if (t.getFirstChild() != null) + { + ts += ((BaseAST) t.getFirstChild()).ToStringList(); + } + if (t.getFirstChild() != null) + ts += " )"; + if (t.getNextSibling() != null) + { + ts += ((BaseAST) t.getNextSibling()).ToStringList(); + } + return ts; + } + + public virtual string ToStringTree() + { + AST t = this; + string ts = ""; + if (t.getFirstChild() != null) + { + ts += " ("; + } + ts += " " + this.ToString(); + if (t.getFirstChild() != null) + { + ts += ((BaseAST) t.getFirstChild()).ToStringList(); + } + if (t.getFirstChild() != null) + { + ts += " )"; + } + return ts; + } + + public virtual string ToTree() + { + return ToTree(string.Empty); + } + + public virtual string ToTree(string prefix) + { + StringBuilder sb = new StringBuilder(prefix); + + // Replace vertical bar if there is no next sibling. + if ( (getNextSibling() == null) ) + sb.Append("+--"); + else + sb.Append("|--"); + + sb.Append( ToString() ); + sb.Append( Environment.NewLine ); + + if ( getFirstChild() != null ) + { + // Replace vertical bar if there is no next sibling. + if ( getNextSibling() == null ) + sb.Append( ((BaseAST) getFirstChild()).ToTree(prefix + " ") ); + else + sb.Append( ((BaseAST) getFirstChild()).ToTree(prefix + "| ") ); + } + + if ( getNextSibling() != null ) + sb.Append( ((BaseAST) getNextSibling()).ToTree(prefix) ); + + return sb.ToString(); + } + + public static string decode(string text) + { + char c, c1, c2, c3, c4, c5; + StringBuilder n = new StringBuilder(); + for (int i = 0; i < text.Length; i++) + { + c = text[i]; + if (c == '&') + { + c1 = text[i + 1]; + c2 = text[i + 2]; + c3 = text[i + 3]; + c4 = text[i + 4]; + c5 = text[i + 5]; + + if (c1 == 'a' && c2 == 'm' && c3 == 'p' && c4 == ';') + { + n.Append("&"); + i += 5; + } + else if (c1 == 'l' && c2 == 't' && c3 == ';') + { + n.Append("<"); + i += 4; + } + else if (c1 == 'g' && c2 == 't' && c3 == ';') + { + n.Append(">"); + i += 4; + } + else if (c1 == 'q' && c2 == 'u' && c3 == 'o' && c4 == 't' && c5 == ';') + { + n.Append("\""); + i += 6; + } + else if (c1 == 'a' && c2 == 'p' && c3 == 'o' && c4 == 's' && c5 == ';') + { + n.Append("'"); + i += 6; + } + else + n.Append("&"); + } + else + n.Append(c); + } + return n.ToString(); + } + + public static string encode(string text) + { + char c; + StringBuilder n = new StringBuilder(); + for (int i = 0; i < text.Length; i++) + { + c = text[i]; + switch (c) + { + case '&': + { + n.Append("&"); + break; + } + + case '<': + { + n.Append("<"); + break; + } + + case '>': + { + n.Append(">"); + break; + } + + case '"': + { + n.Append("""); + break; + } + + case '\'': + { + n.Append("'"); + break; + } + + default: + { + n.Append(c); + break; + } + + } + } + return n.ToString(); + } + + public virtual void xmlSerializeNode(TextWriter outWriter) + { + StringBuilder buf = new StringBuilder(100); + buf.Append("<"); + buf.Append(GetType().FullName + " "); + buf.Append("text=\"" + encode(getText()) + "\" type=\"" + Type + "\"/>"); + outWriter.Write(buf.ToString()); + } + + public virtual void xmlSerializeRootOpen(TextWriter outWriter) + { + StringBuilder buf = new StringBuilder(100); + buf.Append("<"); + buf.Append(GetType().FullName + " "); + buf.Append("text=\"" + encode(getText()) + "\" type=\"" + Type + "\">\n"); + outWriter.Write(buf.ToString()); + } + + public virtual void xmlSerializeRootClose(TextWriter outWriter) + { + outWriter.Write("\n"); + } + + public virtual void xmlSerialize(TextWriter outWriter) + { + // print out this node and all siblings + for (AST node = this; node != null; node = node.getNextSibling()) + { + if (node.getFirstChild() == null) + { + // print guts (class name, attributes) + ((BaseAST) node).xmlSerializeNode(outWriter); + } + else + { + ((BaseAST) node).xmlSerializeRootOpen(outWriter); + + // print children + ((BaseAST) node.getFirstChild()).xmlSerialize(outWriter); + + // print end tag + ((BaseAST) node).xmlSerializeRootClose(outWriter); + } + } + } + + #region Implementation of ICloneable + [Obsolete("Deprecated since version 2.7.2. Use ASTFactory.dup() instead.", false)] + public virtual object Clone() + { + return MemberwiseClone(); + } + #endregion + + public override Int32 GetHashCode() + { + return base.GetHashCode(); + } + } } \ No newline at end of file diff --git a/src/Spring/Spring.Core/Expressions/SpringAST.cs b/src/Spring/Spring.Core/Expressions/SpringAST.cs index 8ef1aa31..c83f2d5a 100644 --- a/src/Spring/Spring.Core/Expressions/SpringAST.cs +++ b/src/Spring/Spring.Core/Expressions/SpringAST.cs @@ -1,152 +1,152 @@ -using System; +using System; using System.Runtime.Serialization; using Spring.Expressions.Parser.antlr; -using Spring.Expressions.Parser.antlr.collections; - -namespace Spring.Expressions -{ - /// - /// For internal purposes only. Use for expression node implementations. - /// - /// - /// This class is only required to enable serialization of parsed Spring expressions since antlr.CommonAST - /// unfortunately is not marked as [Serializable].
- ///
- /// Note:Since SpringAST implements , deriving classes - /// have to explicitely override if they need to persist additional - /// data during serialization. - ///
- [Serializable] - public class SpringAST : Parser.antlr.BaseAST, ISerializable - { - #region Global SpringAST Factory - - internal class SpringASTCreator : Parser.antlr.ASTNodeCreator - { - public override Parser.antlr.collections.AST Create() - { - return new SpringAST(); - } - - public override string ASTNodeTypeName - { - get { return typeof(SpringAST).FullName; } - } - } - - /// - /// The global SpringAST node factory - /// - internal static readonly SpringASTCreator Creator = new SpringASTCreator(); - - #endregion - - #region Members - - private string text; - private int ttype; - - #endregion - - /// - /// Create an instance - /// - public SpringAST() - {} - - /// - /// Create an instance from a token - /// - public SpringAST(IToken token) - { - initialize(token); - } - - /// - /// initialize this instance from an AST - /// - public override void initialize(AST t) - { - this.setText(t.getText()); - this.Type = t.Type; - } - - /// - /// initialize this instance from an IToken - /// - public override void initialize(IToken tok) - { - this.setText(tok.getText()); - this.Type = tok.Type; - } - - /// - /// initialize this instance from a token type number and a text - /// - public override void initialize(int t, string txt) - { - this.Type = t; - this.setText(txt); - } - - /// - /// gets or sets the token type of this node - /// - public override int Type - { - get { return this.ttype; } - set { this.ttype = value; } - } - - /// - /// gets or sets the text of this node - /// - public string Text - { - get { return this.getText(); } - set { this.setText(value); } - } - - /// - /// sets the text of this node - /// - public override void setText(string txt) - { - this.text = txt; - } - - /// - /// gets the text of this node - /// - public override string getText() - { - return this.text; - } - - #region ISerializable Implementation - - /// - /// Create a new instance from SerializationInfo - /// - protected SpringAST(SerializationInfo info, StreamingContext context) - { - base.down = (BaseAST)info.GetValue("down", typeof(BaseAST)); - base.right = (BaseAST)info.GetValue("right", typeof(BaseAST)); - this.ttype = info.GetInt32("ttype"); - this.text = info.GetString("text"); - } - - /// - /// populate SerializationInfo from this instance - /// - public virtual void GetObjectData(SerializationInfo info, StreamingContext context) - { - info.AddValue("down", base.down, typeof(SpringAST)); - info.AddValue("right", base.right, typeof(SpringAST)); - info.AddValue("ttype", this.Type, typeof(int)); - info.AddValue("text", this.Text, typeof(string)); - } - - #endregion - } +using Spring.Expressions.Parser.antlr.collections; + +namespace Spring.Expressions +{ + /// + /// For internal purposes only. Use for expression node implementations. + /// + /// + /// This class is only required to enable serialization of parsed Spring expressions since antlr.CommonAST + /// unfortunately is not marked as [Serializable].
+ ///
+ /// Note:Since SpringAST implements , deriving classes + /// have to explicitely override if they need to persist additional + /// data during serialization. + ///
+ [Serializable] + public class SpringAST : Parser.antlr.BaseAST, ISerializable + { + #region Global SpringAST Factory + + internal class SpringASTCreator : Parser.antlr.ASTNodeCreator + { + public override Parser.antlr.collections.AST Create() + { + return new SpringAST(); + } + + public override string ASTNodeTypeName + { + get { return typeof(SpringAST).FullName; } + } + } + + /// + /// The global SpringAST node factory + /// + internal static readonly SpringASTCreator Creator = new SpringASTCreator(); + + #endregion + + #region Members + + private string text; + private int ttype; + + #endregion + + /// + /// Create an instance + /// + public SpringAST() + {} + + /// + /// Create an instance from a token + /// + public SpringAST(IToken token) + { + initialize(token); + } + + /// + /// initialize this instance from an AST + /// + public override void initialize(AST t) + { + this.setText(t.getText()); + this.Type = t.Type; + } + + /// + /// initialize this instance from an IToken + /// + public override void initialize(IToken tok) + { + this.setText(tok.getText()); + this.Type = tok.Type; + } + + /// + /// initialize this instance from a token type number and a text + /// + public override void initialize(int t, string txt) + { + this.Type = t; + this.setText(txt); + } + + /// + /// gets or sets the token type of this node + /// + public override int Type + { + get { return this.ttype; } + set { this.ttype = value; } + } + + /// + /// gets or sets the text of this node + /// + public string Text + { + get { return this.getText(); } + set { this.setText(value); } + } + + /// + /// sets the text of this node + /// + public override void setText(string txt) + { + this.text = txt; + } + + /// + /// gets the text of this node + /// + public override string getText() + { + return this.text; + } + + #region ISerializable Implementation + + /// + /// Create a new instance from SerializationInfo + /// + protected SpringAST(SerializationInfo info, StreamingContext context) + { + base.down = (BaseAST)info.GetValue("down", typeof(BaseAST)); + base.right = (BaseAST)info.GetValue("right", typeof(BaseAST)); + this.ttype = info.GetInt32("ttype"); + this.text = info.GetString("text"); + } + + /// + /// populate SerializationInfo from this instance + /// + public virtual void GetObjectData(SerializationInfo info, StreamingContext context) + { + info.AddValue("down", base.down, typeof(SpringAST)); + info.AddValue("right", base.right, typeof(SpringAST)); + info.AddValue("ttype", this.Type, typeof(int)); + info.AddValue("text", this.Text, typeof(string)); + } + + #endregion + } } \ No newline at end of file diff --git a/src/Spring/Spring.Core/Objects/Factory/Attributes/AutowiredAttributeObjectPostProcessor.cs b/src/Spring/Spring.Core/Objects/Factory/Attributes/AutowiredAttributeObjectPostProcessor.cs index 24b90ade..24723547 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Attributes/AutowiredAttributeObjectPostProcessor.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Attributes/AutowiredAttributeObjectPostProcessor.cs @@ -441,7 +441,7 @@ namespace Spring.Objects.Factory.Attributes public override void Inject(Object instance, String objectName, IPropertyValues pvs) { - var property = (PropertyInfo) _member; + var property = (PropertyInfo) Member; try { Object value; @@ -513,7 +513,7 @@ namespace Spring.Objects.Factory.Attributes public override void Inject(Object instance, String objectName, IPropertyValues pvs) { - var field = (FieldInfo) _member; + var field = (FieldInfo) Member; try { Object value; @@ -585,7 +585,7 @@ namespace Spring.Objects.Factory.Attributes public override void Inject(Object target, string objectName, IPropertyValues pvs) { - MethodInfo method = _member as MethodInfo; + MethodInfo method = Member as MethodInfo; try { Object[] arguments; diff --git a/src/Spring/Spring.Core/Objects/Factory/Attributes/InjectionMetadata.cs b/src/Spring/Spring.Core/Objects/Factory/Attributes/InjectionMetadata.cs index 1df4ffc9..b0f94b7e 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Attributes/InjectionMetadata.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Attributes/InjectionMetadata.cs @@ -89,7 +89,7 @@ namespace Spring.Objects.Factory.Attributes /// /// The Property, field, method or constructor info /// - protected readonly MemberInfo _member; + private readonly MemberInfo _member; /// /// Instantiates a new inject element @@ -100,6 +100,11 @@ namespace Spring.Objects.Factory.Attributes _member = member; } + public MemberInfo Member + { + get { return _member; } + } + /// /// Ececuted to inject value to associated memeber info /// diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/ConfigurableVariableSource.cs b/src/Spring/Spring.Core/Objects/Factory/Config/ConfigurableVariableSource.cs index 9605c88c..ef6e34e8 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Config/ConfigurableVariableSource.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Config/ConfigurableVariableSource.cs @@ -38,7 +38,7 @@ namespace Spring.Objects.Factory.Config [Serializable] public class ConfigurableVariableSource : IVariableSource { - protected NameValueCollection _variables; + private NameValueCollection _variables; /// /// Initializes a new instance of . diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/VariableAccessor.cs b/src/Spring/Spring.Core/Objects/Factory/Config/VariableAccessor.cs index dd6b99d2..24425756 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Config/VariableAccessor.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Config/VariableAccessor.cs @@ -243,6 +243,7 @@ namespace Spring.Objects.Factory.Config /// A that contains the value of the specified variable /// or , if returns null. /// + [CLSCompliant(false)] public ulong GetUInt64(string name, ulong defaultValue) { return GetUInt64(name, defaultValue, true); @@ -261,6 +262,7 @@ namespace Spring.Objects.Factory.Config /// A that contains the value of the specified variable /// or , if cannot be parsed. /// + [CLSCompliant(false)] public ulong GetUInt64(string name, ulong defaultValue, bool throwOnInvalidValue) { try @@ -337,6 +339,7 @@ namespace Spring.Objects.Factory.Config /// A that contains the value of the specified variable /// or , if returns null. /// + [CLSCompliant(false)] public uint GetUInt32(string name, uint defaultValue) { return GetUInt32(name, defaultValue, true); @@ -355,6 +358,7 @@ namespace Spring.Objects.Factory.Config /// A that contains the value of the specified variable /// or , if cannot be parsed. /// + [CLSCompliant(false)] public uint GetUInt32(string name, uint defaultValue, bool throwOnInvalidValue) { try @@ -431,6 +435,7 @@ namespace Spring.Objects.Factory.Config /// A that contains the value of the specified variable /// or , if returns null. /// + [CLSCompliant(false)] public ushort GetUInt16(string name, ushort defaultValue) { return GetUInt16(name, defaultValue, true); @@ -449,6 +454,7 @@ namespace Spring.Objects.Factory.Config /// A that contains the value of the specified variable /// or , if cannot be parsed. /// + [CLSCompliant(false)] public ushort GetUInt16(string name, ushort defaultValue, bool throwOnInvalidValue) { try diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs index 1a315c46..0f26d298 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs @@ -158,7 +158,7 @@ namespace Spring.Objects.Factory.Support /// /// Whether to cache object metadata or rather reobtain it for every access /// - protected bool cacheObjectMetadata = true; + private bool cacheObjectMetadata = true; /// @@ -766,6 +766,7 @@ namespace Spring.Objects.Factory.Support protected bool CacheObjectMetadata { get { return this.cacheObjectMetadata; } + set { this.cacheObjectMetadata = value; } } /// diff --git a/src/Spring/Spring.Core/Spring.Core.2010.csproj b/src/Spring/Spring.Core/Spring.Core.2010.csproj index 47e1506a..83f4d0b1 100644 --- a/src/Spring/Spring.Core/Spring.Core.2010.csproj +++ b/src/Spring/Spring.Core/Spring.Core.2010.csproj @@ -60,11 +60,12 @@ false false false - false + true 4 full prompt - 1591 + + false @@ -85,7 +86,7 @@ true false false - false + true 4 none prompt diff --git a/src/Spring/Spring.Data/Data/Core/AdoAccessor.cs b/src/Spring/Spring.Data/Data/Core/AdoAccessor.cs index dba68c3b..d1b23a5b 100644 --- a/src/Spring/Spring.Data/Data/Core/AdoAccessor.cs +++ b/src/Spring/Spring.Data/Data/Core/AdoAccessor.cs @@ -36,7 +36,7 @@ namespace Spring.Data.Core { protected object AdoUtils; - protected int commandTimeout = -1; + private int commandTimeout = -1; #region Properties diff --git a/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs b/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs index 41433802..a82d04e4 100644 --- a/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs +++ b/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs @@ -57,7 +57,7 @@ namespace Spring.Data.Core private IAdoExceptionTranslator exceptionTranslator; private bool lazyInit = true; - protected Type dataReaderWrapperType; + private Type dataReaderWrapperType; protected IDynamicConstructor newDataReaderWrapper; #endregion diff --git a/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs b/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs index e112e7d7..009804fb 100644 --- a/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs +++ b/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs @@ -50,8 +50,7 @@ namespace Spring.Data.Generic #region Fields private Core.AdoTemplate classicAdoTemplate; - protected Type dataReaderWrapperType; - + #endregion #region Constructors @@ -172,10 +171,10 @@ namespace Spring.Data.Generic /// public override int CommandTimeout { - get { return commandTimeout; } + get { return base.CommandTimeout; } set { - commandTimeout = value; + base.CommandTimeout = value; classicAdoTemplate.CommandTimeout = value; } } diff --git a/src/Spring/Spring.Data/Data/Objects/AbstractAdoOperation.cs b/src/Spring/Spring.Data/Data/Objects/AbstractAdoOperation.cs index 7d2fda12..da4045c8 100644 --- a/src/Spring/Spring.Data/Data/Objects/AbstractAdoOperation.cs +++ b/src/Spring/Spring.Data/Data/Objects/AbstractAdoOperation.cs @@ -54,7 +54,7 @@ namespace Spring.Data.Objects /// least checking that a IDbProvider and sql have been provided, /// but subclasses may also implement their own custom validation. /// - protected bool compiled; + private bool compiled; /// /// Object enabling us to create IDbCommands @@ -132,6 +132,7 @@ namespace Spring.Data.Objects public bool Compiled { get { return compiled; } + protected set { compiled = value; } } /// diff --git a/src/Spring/Spring.Data/Data/Objects/AdoOperation.cs b/src/Spring/Spring.Data/Data/Objects/AdoOperation.cs index cabdad01..09e7a289 100644 --- a/src/Spring/Spring.Data/Data/Objects/AdoOperation.cs +++ b/src/Spring/Spring.Data/Data/Objects/AdoOperation.cs @@ -21,6 +21,7 @@ #region Imports using System; + using Spring.Dao; using Spring.Data.Common; using Spring.Data.Core; @@ -44,16 +45,14 @@ namespace Spring.Data.Objects /// Mark Pollack (.NET) public abstract class AdoOperation : AbstractAdoOperation { - #region Fields private AdoTemplate adoTemplate = new AdoTemplate(); - - + #endregion #region Constructor (s) - + /// /// Initializes a new instance of the class. /// @@ -61,7 +60,8 @@ namespace Spring.Data.Objects /// before invoking the compile method and using this object. /// public AdoOperation() - {} + { + } /// /// Initializes a new instance of the class. @@ -72,7 +72,8 @@ namespace Spring.Data.Objects /// Database provider to use. public AdoOperation(IDbProvider provider) : this(provider, null) - {} + { + } /// /// Initializes a new instance of the class. @@ -86,7 +87,7 @@ namespace Spring.Data.Objects { //intialized AdoTemplate with the DbProvider DbProvider = provider; - Sql = sql; + Sql = sql; } #endregion @@ -107,13 +108,9 @@ namespace Spring.Data.Objects } adoTemplate = value; } - get - { - return adoTemplate; - } + get { return adoTemplate; } } - /// /// Gets or sets the db provider. /// @@ -122,20 +119,15 @@ namespace Spring.Data.Objects { set { - adoTemplate.DbProvider = value; + adoTemplate.DbProvider = value; if (DeclaredParameters == null) - { + { DeclaredParameters = new DbParameters(value); } } - get - { - return adoTemplate.DbProvider; - } + get { return adoTemplate.DbProvider; } } - - /// /// Sets the command timeout for IDbCommands that this AdoTemplate executes. /// @@ -153,7 +145,6 @@ namespace Spring.Data.Objects #endregion #region Methods - /// /// Compiles this operation. Ignores subsequent attempts to compile. @@ -171,28 +162,20 @@ namespace Spring.Data.Objects throw new InvalidDataAccessApiUsageException("Setting of CommandType is required"); } - try - { + try + { adoTemplate.AfterPropertiesSet(); } - catch (ArgumentException ex) + catch (ArgumentException ex) { throw new InvalidDataAccessApiUsageException(ex.Message); - } - - + } + CompileInternal(); - compiled = true; - - + Compiled = true; } } - - - - - #endregion } -} +} \ No newline at end of file diff --git a/src/Spring/Spring.Data/Data/Objects/Generic/AdoOperation.cs b/src/Spring/Spring.Data/Data/Objects/Generic/AdoOperation.cs index 682636a6..cac93c70 100644 --- a/src/Spring/Spring.Data/Data/Objects/Generic/AdoOperation.cs +++ b/src/Spring/Spring.Data/Data/Objects/Generic/AdoOperation.cs @@ -21,6 +21,7 @@ #region Imports using System; + using Spring.Dao; using Spring.Data.Common; @@ -43,16 +44,14 @@ namespace Spring.Data.Objects.Generic /// Mark Pollack (.NET) public abstract class AdoOperation : AbstractAdoOperation { - #region Fields private Data.Generic.AdoTemplate adoTemplate = new Data.Generic.AdoTemplate(); - - + #endregion #region Constructor (s) - + /// /// Initializes a new instance of the class. /// @@ -60,7 +59,8 @@ namespace Spring.Data.Objects.Generic /// before invoking the compile method and using this object. /// public AdoOperation() - {} + { + } /// /// Initializes a new instance of the class. @@ -71,7 +71,8 @@ namespace Spring.Data.Objects.Generic /// Database provider to use. public AdoOperation(IDbProvider provider) : this(provider, null) - {} + { + } /// /// Initializes a new instance of the class. @@ -85,7 +86,7 @@ namespace Spring.Data.Objects.Generic { //intialized AdoTemplate with the DbProvider DbProvider = provider; - Sql = sql; + Sql = sql; } #endregion @@ -106,13 +107,9 @@ namespace Spring.Data.Objects.Generic } adoTemplate = value; } - get - { - return adoTemplate; - } + get { return adoTemplate; } } - /// /// Gets or sets the db provider. /// @@ -127,14 +124,9 @@ namespace Spring.Data.Objects.Generic DeclaredParameters = new DbParameters(value); } } - get - { - return adoTemplate.DbProvider; - } + get { return adoTemplate.DbProvider; } } - - /// /// Sets the command timeout for IDbCommands that this AdoTemplate executes. /// @@ -152,7 +144,6 @@ namespace Spring.Data.Objects.Generic #endregion #region Methods - /// /// Compiles this operation. Ignores subsequent attempts to compile. @@ -170,23 +161,20 @@ namespace Spring.Data.Objects.Generic throw new InvalidDataAccessApiUsageException("Setting of CommandType is required"); } - try - { + try + { adoTemplate.AfterPropertiesSet(); } - catch (ArgumentException ex) + catch (ArgumentException ex) { throw new InvalidDataAccessApiUsageException(ex.Message); - } - - + } + CompileInternal(); - compiled = true; - - + Compiled = true; } } - + #endregion } -} +} \ No newline at end of file diff --git a/src/Spring/Spring.Data/Spring.Data.2010.csproj b/src/Spring/Spring.Data/Spring.Data.2010.csproj index 8f47487f..044f351c 100644 --- a/src/Spring/Spring.Data/Spring.Data.2010.csproj +++ b/src/Spring/Spring.Data/Spring.Data.2010.csproj @@ -68,7 +68,7 @@ true false false - false + true 4 none prompt diff --git a/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2010.csproj b/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2010.csproj index 59bb7285..da9f9dde 100644 --- a/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2010.csproj +++ b/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2010.csproj @@ -37,6 +37,7 @@ prompt 4 AllRules.ruleset + true diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs index a2a58432..5a7a5bb0 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs @@ -1167,7 +1167,7 @@ namespace Spring.Messaging.Nms.Core public object ReceiveSelectedAndConvert(string messageSelector) { CheckMessageConverter(); - return DoConvertFromMessage(ReceiveSelected(messageSelector)); ; + return DoConvertFromMessage(ReceiveSelected(messageSelector)); } /// Receive a message synchronously from the specified destination, but only diff --git a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueGatewaySupport.cs b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueGatewaySupport.cs index 04fc9404..5272ea09 100644 --- a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueGatewaySupport.cs +++ b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueGatewaySupport.cs @@ -19,7 +19,7 @@ #endregion using System; -using Spring.Context; + using Spring.Objects.Factory; namespace Spring.Messaging.Core @@ -56,7 +56,11 @@ namespace Spring.Messaging.Core } - public void AfterPropertiesSet() + /// + /// Invoked by an + /// after it has injected all of an object's dependencies. + /// + public void AfterPropertiesSet() { if (this.MessageQueueTemplate == null) { diff --git a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueMetadataCache.cs b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueMetadataCache.cs index 86799a2b..0e21365e 100644 --- a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueMetadataCache.cs +++ b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueMetadataCache.cs @@ -8,6 +8,9 @@ using Spring.Objects.Factory; namespace Spring.Messaging.Core { + /// + /// Hold cached data for queue's metadata. + /// public class MessageQueueMetadataCache : IApplicationContextAware, IInitializingObject { #region Logging Definition @@ -24,20 +27,33 @@ namespace Spring.Messaging.Core private bool isInitialized; + /// + /// Constructs a new instance of . + /// public MessageQueueMetadataCache() { } + /// + /// Constructs a new instance of . + /// public MessageQueueMetadataCache(IConfigurableApplicationContext configurableApplicationContext) { this.configurableApplicationContext = configurableApplicationContext; } + /// + /// Sets the that this + /// object runs in. + /// public IApplicationContext ApplicationContext { set { applicationContext = value; } } + /// + /// Initializes the cache. + /// public void Initialize() { IDictionary messageQueueDictionary = configurableApplicationContext.GetObjects(); @@ -72,7 +88,11 @@ namespace Spring.Messaging.Core isInitialized = true; } } - + + /// + /// Invoked by an + /// after it has injected all of an object's dependencies. + /// public void AfterPropertiesSet() { IConfigurableApplicationContext ctx = applicationContext as IConfigurableApplicationContext; @@ -98,6 +118,9 @@ namespace Spring.Messaging.Core } } + /// + /// Returns whether this cache has been initialized yet. + /// public bool Initalized { get @@ -184,6 +207,9 @@ namespace Spring.Messaging.Core } } + /// + /// Inserts metadata to the cache. + /// public void Insert(string path, MessageQueueMetadata messageQueueMetadata) { lock (itemStore.SyncRoot) diff --git a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTemplate.cs b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTemplate.cs index 777f0485..72456a6d 100644 --- a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTemplate.cs +++ b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTemplate.cs @@ -19,16 +19,15 @@ #endregion using System; -using System.Collections; using System.Messaging; -using Common.Logging; + using Spring.Context; -using Spring.Messaging.Support; using Spring.Messaging.Support.Converters; using Spring.Objects.Factory; -using Spring.Objects.Factory.Config; using Spring.Util; +using Common.Logging; + namespace Spring.Messaging.Core { /// @@ -83,12 +82,15 @@ namespace Spring.Messaging.Core private string messageConverterObjectName; private IMessageQueueFactory messageQueueFactory; - protected IConfigurableApplicationContext applicationContext; + private IConfigurableApplicationContext applicationContext; private TimeSpan timeout = MessageQueue.InfiniteTimeout; private MessageQueueMetadataCache metadataCache; + /// + /// The name that is used from cache registration inside the application context. + /// public const string METADATA_CACHE_NAME = "__MessageQueueMetadataCache__"; #endregion @@ -246,7 +248,7 @@ namespace Spring.Messaging.Core get { return applicationContext; } set { AssertUtils.ArgumentNotNull(value, "An ApplicationContext instance is required"); - IConfigurableApplicationContext ctx = value as IConfigurableApplicationContext; + var ctx = value as IConfigurableApplicationContext; if (ctx == null) { throw new InvalidOperationException( @@ -292,6 +294,9 @@ namespace Spring.Messaging.Core CreateDefaultMetadataCache(); } + /// + /// Constructs the metadata cache with default options. + /// protected virtual void CreateDefaultMetadataCache() { if (metadataCache == null) diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/MessageListenerAdapter.cs b/src/Spring/Spring.Messaging/Messaging/Listener/MessageListenerAdapter.cs index de391901..01122209 100644 --- a/src/Spring/Spring.Messaging/Messaging/Listener/MessageListenerAdapter.cs +++ b/src/Spring/Spring.Messaging/Messaging/Listener/MessageListenerAdapter.cs @@ -496,6 +496,11 @@ namespace Spring.Messaging.Listener return message; } + /// + /// Handles the result of a listener method. + /// + /// The result that was returned from listener. + /// The original request. protected virtual void HandleResult(object result, Message request) { if (logger.IsDebugEnabled) diff --git a/src/Spring/Spring.Messaging/Spring.Messaging.2010.csproj b/src/Spring/Spring.Messaging/Spring.Messaging.2010.csproj index 4c550ffb..7e437c08 100644 --- a/src/Spring/Spring.Messaging/Spring.Messaging.2010.csproj +++ b/src/Spring/Spring.Messaging/Spring.Messaging.2010.csproj @@ -25,7 +25,7 @@ prompt 4 Spring.Messaging.xml - false + true pdbonly diff --git a/src/Spring/Spring.Scheduling.Quartz21/AssemblyInfo.cs b/src/Spring/Spring.Scheduling.Quartz21/AssemblyInfo.cs new file mode 100644 index 00000000..c0c2824d --- /dev/null +++ b/src/Spring/Spring.Scheduling.Quartz21/AssemblyInfo.cs @@ -0,0 +1,42 @@ +#region License + +/* + * Copyright © 2002-2011 the original author or authors. + * + * 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. + */ + +#endregion + +using System.Reflection; +using System.Runtime.InteropServices; +using System.Security; + +[assembly: ComVisible(false)] +[assembly: AssemblyTitle("Spring.Scheduling.Quartz")] +[assembly: AssemblyDescription("Quartz.NET scheduler integration for Spring.NET")] + +// +// Security Permissions +// +// we need full, unrestricted access to reflection metadata... +//[assembly: ReflectionPermission(SecurityAction.RequestMinimum, Unrestricted = true)] +//[assembly: AssemblyKeyFile(@"C:\users\aseovic\projects\OpenSource\Spring.Net\Spring.Net.PrivateKey.keys")] +//[assembly: AssemblyKeyFile(@"C:\projects\Spring.Net\Spring.Net.snk")] + +#if !NET_4_0 +[assembly: AllowPartiallyTrustedCallers] + +[assembly: SecurityCritical] + +#endif diff --git a/src/Spring/Spring.Scheduling.Quartz21/Scheduling/Quartz/SchedulerAccessor.cs b/src/Spring/Spring.Scheduling.Quartz21/Scheduling/Quartz/SchedulerAccessor.cs index 0cecc0f2..30e99b7b 100644 --- a/src/Spring/Spring.Scheduling.Quartz21/Scheduling/Quartz/SchedulerAccessor.cs +++ b/src/Spring/Spring.Scheduling.Quartz21/Scheduling/Quartz/SchedulerAccessor.cs @@ -47,7 +47,7 @@ namespace Spring.Scheduling.Quartz /// /// Logger instance. /// - protected readonly ILog logger; + private readonly ILog logger; private bool overwriteExistingJobs; private string[] jobSchedulingDataLocations; @@ -66,7 +66,7 @@ namespace Spring.Scheduling.Quartz /// /// Resource loader instance for sub-classes /// - protected IResourceLoader resourceLoader; + private IResourceLoader resourceLoader; /// /// Initializes a new instance of the class. @@ -244,6 +244,15 @@ namespace Spring.Scheduling.Quartz public virtual IResourceLoader ResourceLoader { set { resourceLoader = value; } + protected get { return resourceLoader; } + } + + /// + /// Logger instance. + /// + protected ILog Logger + { + get { return logger; } } /// diff --git a/src/Spring/Spring.Scheduling.Quartz21/Scheduling/Quartz/SchedulerFactoryObject.cs b/src/Spring/Spring.Scheduling.Quartz21/Scheduling/Quartz/SchedulerFactoryObject.cs index 8f3b2d9f..9af3f2de 100644 --- a/src/Spring/Spring.Scheduling.Quartz21/Scheduling/Quartz/SchedulerFactoryObject.cs +++ b/src/Spring/Spring.Scheduling.Quartz21/Scheduling/Quartz/SchedulerFactoryObject.cs @@ -471,7 +471,7 @@ namespace Spring.Scheduling.Quartz /// public virtual void Dispose() { - logger.Info("Shutting down Quartz Scheduler"); + Logger.Info("Shutting down Quartz Scheduler"); scheduler.Shutdown(waitForJobsToCompleteOnShutdown); } @@ -657,9 +657,9 @@ namespace Spring.Scheduling.Quartz if (configLocation != null) { - if (logger.IsInfoEnabled) + if (Logger.IsInfoEnabled) { - logger.Info("Loading Quartz config from [" + configLocation + "]"); + Logger.Info("Loading Quartz config from [" + configLocation + "]"); } using (StreamReader sr = new StreamReader(configLocation.InputStream)) { @@ -783,16 +783,14 @@ namespace Spring.Scheduling.Quartz { if (startDelay.TotalSeconds <= 0) { - logger.Info("Starting Quartz Scheduler now"); + Logger.Info("Starting Quartz Scheduler now"); sched.Start(); } else { - if (logger.IsInfoEnabled) + if (Logger.IsInfoEnabled) { - logger.Info( - string.Format("Will start Quartz Scheduler [{0}] in {1} seconds", sched.SchedulerName, - startDelay)); + Logger.InfoFormat("Will start Quartz Scheduler [{0}] in {1} seconds", sched.SchedulerName, startDelay); } sched.StartDelayed(startDelay); } diff --git a/src/Spring/Spring.Scheduling.Quartz21/Spring.Scheduling.Quartz21.2010.csproj b/src/Spring/Spring.Scheduling.Quartz21/Spring.Scheduling.Quartz21.2010.csproj index 696aed06..7ddcff0e 100644 --- a/src/Spring/Spring.Scheduling.Quartz21/Spring.Scheduling.Quartz21.2010.csproj +++ b/src/Spring/Spring.Scheduling.Quartz21/Spring.Scheduling.Quartz21.2010.csproj @@ -35,6 +35,8 @@ TRACE;NET_4_0 prompt 4 + true + ..\..\..\build\VS.NET.2010\Spring.Scheduling.Quartz21\Release\Spring.Scheduling.Quartz21.XML @@ -48,6 +50,10 @@ + + CommonAssemblyInfo.cs + + diff --git a/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactoryObject.cs b/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactoryObject.cs index 96e039f6..459d2979 100644 --- a/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactoryObject.cs +++ b/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactoryObject.cs @@ -51,7 +51,7 @@ namespace Spring.ServiceModel.Activation /// /// The owning factory. /// - protected IObjectFactory objectFactory; + private IObjectFactory objectFactory; /// /// The instance managed by this factory. @@ -133,6 +133,7 @@ namespace Spring.ServiceModel.Activation /// public virtual IObjectFactory ObjectFactory { + protected get { return this.objectFactory; } set { this.objectFactory = value; } } diff --git a/src/Spring/Spring.Services/ServiceModel/ServiceExporter.cs b/src/Spring/Spring.Services/ServiceModel/ServiceExporter.cs index e6ebc108..79bc1a40 100644 --- a/src/Spring/Spring.Services/ServiceModel/ServiceExporter.cs +++ b/src/Spring/Spring.Services/ServiceModel/ServiceExporter.cs @@ -69,12 +69,12 @@ namespace Spring.ServiceModel /// /// The name of the object in the factory. /// - protected string objectName; + private string objectName; /// /// The owning factory. /// - protected DefaultListableObjectFactory objectFactory; + private DefaultListableObjectFactory objectFactory; /// /// The generated WCF service wrapper type. @@ -258,6 +258,7 @@ namespace Spring.ServiceModel /// public virtual IObjectFactory ObjectFactory { + protected get { return objectFactory; } set { if (value is DefaultListableObjectFactory) @@ -347,6 +348,7 @@ namespace Spring.ServiceModel /// public string ObjectName { + protected get { return this.objectName; } set { this.objectName = value; } } diff --git a/src/Spring/Spring.Services/Spring.Services.2010.csproj b/src/Spring/Spring.Services/Spring.Services.2010.csproj index 9bc59910..42b0fe3c 100644 --- a/src/Spring/Spring.Services/Spring.Services.2010.csproj +++ b/src/Spring/Spring.Services/Spring.Services.2010.csproj @@ -48,7 +48,7 @@ false false false - false + true 4 full prompt @@ -71,7 +71,7 @@ true false false - false + true 4 none prompt diff --git a/src/Spring/Spring.Template.Velocity/AssemblyInfo.cs b/src/Spring/Spring.Template.Velocity/AssemblyInfo.cs new file mode 100644 index 00000000..be9ce133 --- /dev/null +++ b/src/Spring/Spring.Template.Velocity/AssemblyInfo.cs @@ -0,0 +1,42 @@ +#region License + +/* + * Copyright © 2002-2011 the original author or authors. + * + * 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. + */ + +#endregion + +using System.Reflection; +using System.Runtime.InteropServices; +using System.Security; + +[assembly: ComVisible(false)] +[assembly: AssemblyTitle("Spring.Template.Velocity")] +[assembly: AssemblyDescription("NVelocity template engine integration for Spring.NET")] + +// +// Security Permissions +// +// we need full, unrestricted access to reflection metadata... +//[assembly: ReflectionPermission(SecurityAction.RequestMinimum, Unrestricted = true)] +//[assembly: AssemblyKeyFile(@"C:\users\aseovic\projects\OpenSource\Spring.Net\Spring.Net.PrivateKey.keys")] +//[assembly: AssemblyKeyFile(@"C:\projects\Spring.Net\Spring.Net.snk")] + +#if !NET_4_0 +[assembly: AllowPartiallyTrustedCallers] + +[assembly: SecurityCritical] + +#endif diff --git a/src/Spring/Spring.Template.Velocity/Spring.Template.Velocity.2010.csproj b/src/Spring/Spring.Template.Velocity/Spring.Template.Velocity.2010.csproj index 34418363..60d2efda 100644 --- a/src/Spring/Spring.Template.Velocity/Spring.Template.Velocity.2010.csproj +++ b/src/Spring/Spring.Template.Velocity/Spring.Template.Velocity.2010.csproj @@ -72,6 +72,10 @@ + + CommonAssemblyInfo.cs + + diff --git a/src/Spring/Spring.Template.Velocity/Template/Velocity/CommonsLoggingLogSystem.cs b/src/Spring/Spring.Template.Velocity/Template/Velocity/CommonsLoggingLogSystem.cs index 47b8045c..22ed46a1 100644 --- a/src/Spring/Spring.Template.Velocity/Template/Velocity/CommonsLoggingLogSystem.cs +++ b/src/Spring/Spring.Template.Velocity/Template/Velocity/CommonsLoggingLogSystem.cs @@ -18,6 +18,8 @@ #endregion +using System; + using Common.Logging; using NVelocity.Runtime; using NVelocity.Runtime.Log; @@ -41,7 +43,9 @@ namespace Spring.Template.Velocity /// Initializes the specified runtime services. No-op in current implementatin /// /// the runtime services. - public void Init(IRuntimeServices runtimeServices) { + [CLSCompliant(false)] + public void Init(IRuntimeServices runtimeServices) + { } /// @@ -49,7 +53,9 @@ namespace Spring.Template.Velocity /// /// LogLevel to match /// message to log - public void LogVelocityMessage(LogLevel level, string message) { + [CLSCompliant(false)] + public void LogVelocityMessage(LogLevel level, string message) + { switch (level) { case LogLevel.Error: log.Error(message); diff --git a/src/Spring/Spring.Template.Velocity/Template/Velocity/SpringResourceLoader.cs b/src/Spring/Spring.Template.Velocity/Template/Velocity/SpringResourceLoader.cs index f58246a3..3d8d9649 100644 --- a/src/Spring/Spring.Template.Velocity/Template/Velocity/SpringResourceLoader.cs +++ b/src/Spring/Spring.Template.Velocity/Template/Velocity/SpringResourceLoader.cs @@ -50,6 +50,7 @@ namespace Spring.Template.Velocity { /// /// /// Erez Mazor (.NET) + [CLSCompliant(false)] public class SpringResourceLoader : ResourceLoader { /// /// Prefix used for the NVelocity Configuration diff --git a/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactory.cs b/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactory.cs index 71a53144..322afee6 100644 --- a/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactory.cs +++ b/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactory.cs @@ -64,8 +64,8 @@ namespace Spring.Template.Velocity { /// /// /// Erez Mazor - public class VelocityEngineFactory { - private const char DELIMITER = ','; + public class VelocityEngineFactory + { /// /// Shared logger instance. @@ -198,7 +198,9 @@ namespace Spring.Template.Velocity { /// /// /// - public VelocityEngine CreateVelocityEngine() { + [CLSCompliant(false)] + public VelocityEngine CreateVelocityEngine() + { ExtendedProperties extendedProperties = new ExtendedProperties(); VelocityEngine velocityEngine = NewVelocityEngine(); @@ -272,7 +274,9 @@ namespace Spring.Template.Velocity { /// /// VelocityEngine instance (non-configured) /// - protected static VelocityEngine NewVelocityEngine() { + [CLSCompliant(false)] + protected static VelocityEngine NewVelocityEngine() + { return new VelocityEngine(); } @@ -288,7 +292,9 @@ namespace Spring.Template.Velocity { /// /// /// - protected void InitVelocityResourceLoader(VelocityEngine velocityEngine, ExtendedProperties extendedProperties, IList paths) { + [CLSCompliant(false)] + protected void InitVelocityResourceLoader(VelocityEngine velocityEngine, ExtendedProperties extendedProperties, IList paths) + { if (PreferFileSystemAccess) { // Try to load via the file system, fall back to SpringResourceLoader @@ -335,7 +341,9 @@ namespace Spring.Template.Velocity { /// resourceLoaderPath the path to load Velocity resources from /// /// - protected void InitSpringResourceLoader(VelocityEngine velocityEngine, ExtendedProperties extendedProperties, string resourceLoaderPathString) { + [CLSCompliant(false)] + protected void InitSpringResourceLoader(VelocityEngine velocityEngine, ExtendedProperties extendedProperties, string resourceLoaderPathString) + { extendedProperties.SetProperty(RuntimeConstants.RESOURCE_LOADER, SpringResourceLoader.NAME); Type springResourceLoaderType = typeof(SpringResourceLoader); string springResourceLoaderTypeName = springResourceLoaderType.FullName + "; " + springResourceLoaderType.Assembly.GetName().Name; @@ -355,7 +363,9 @@ namespace Spring.Template.Velocity { /// /// /// - protected void PostProcessVelocityEngine(VelocityEngine velocityEngine) { + [CLSCompliant(false)] + protected virtual void PostProcessVelocityEngine(VelocityEngine velocityEngine) + { } /// diff --git a/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactoryObject.cs b/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactoryObject.cs index a3b25168..0e83d4c1 100644 --- a/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactoryObject.cs +++ b/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactoryObject.cs @@ -34,7 +34,8 @@ namespace Spring.Template.Velocity /// /// /// Erez Mazor - public class VelocityEngineFactoryObject : VelocityEngineFactory, IFactoryObject, IInitializingObject, IResourceLoaderAware { + public class VelocityEngineFactoryObject : VelocityEngineFactory, IFactoryObject, IInitializingObject, IResourceLoaderAware + { private VelocityEngine velocityEngine; /// /// Get the velocity engine underlying object diff --git a/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineUtils.cs b/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineUtils.cs index 61a8ce50..44fcb62a 100644 --- a/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineUtils.cs +++ b/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineUtils.cs @@ -31,7 +31,9 @@ namespace Spring.Template.Velocity{ /// Generalized Utility class for merging velocity templates into a text writer or return the result as a string /// /// Erez Mazor - public class VelocityEngineUtils { + [CLSCompliant(false)] + public class VelocityEngineUtils + { /// /// Shared logger instance. diff --git a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalDbProviderSpringContextTests.cs b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalDbProviderSpringContextTests.cs index b1314c1f..92959f2e 100644 --- a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalDbProviderSpringContextTests.cs +++ b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalDbProviderSpringContextTests.cs @@ -1,22 +1,22 @@ #region License -/* - * Copyright 2002-2010 the original author or authors. - * - * 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. +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. */ -#endregion +#endregion using System; @@ -43,7 +43,7 @@ namespace Spring.Testing.Microsoft /// /// Holds the that this base class manages /// - protected AdoTemplate adoTemplate; + private AdoTemplate adoTemplate; /// /// Did this test delete any tables? If so, we forbid transaction completion, @@ -74,6 +74,7 @@ namespace Spring.Testing.Microsoft public AdoTemplate AdoTemplate { get { return adoTemplate; } + protected set { adoTemplate = value; } } /// diff --git a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalSpringContextTests.cs b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalSpringContextTests.cs index 8db5c50f..09d0ec4f 100644 --- a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalSpringContextTests.cs +++ b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalSpringContextTests.cs @@ -1,19 +1,19 @@ #region License -/* - * Copyright 2002-2010 the original author or authors. - * - * 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. +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. */ #endregion @@ -81,7 +81,7 @@ namespace Spring.Testing.Microsoft /// /// The transaction manager to use /// - protected IPlatformTransactionManager transactionManager; + private IPlatformTransactionManager transactionManager; /// /// Should we roll back by default? @@ -107,7 +107,7 @@ namespace Spring.Testing.Microsoft /// /// TransactionStatus for this test. Typical subclasses won't need to use it. /// - protected ITransactionStatus transactionStatus; + private ITransactionStatus transactionStatus; /// @@ -122,6 +122,7 @@ namespace Spring.Testing.Microsoft /// public IPlatformTransactionManager TransactionManager { + protected get { return transactionManager; } set { transactionManager = value; } } @@ -144,6 +145,15 @@ namespace Spring.Testing.Microsoft set { transactionDefinition = value; } } + /// + /// TransactionStatus for this test. Typical subclasses won't need to use it. + /// + protected ITransactionStatus TransactionStatus + { + get { return transactionStatus; } + set { transactionStatus = value; } + } + /// /// Prevents the transaction. /// diff --git a/src/Spring/Spring.Testing.NUnit/Spring.Testing.NUnit.2010.csproj b/src/Spring/Spring.Testing.NUnit/Spring.Testing.NUnit.2010.csproj index d8480fda..ea045c39 100644 --- a/src/Spring/Spring.Testing.NUnit/Spring.Testing.NUnit.2010.csproj +++ b/src/Spring/Spring.Testing.NUnit/Spring.Testing.NUnit.2010.csproj @@ -25,6 +25,7 @@ prompt 4 Spring.Testing.NUnit.xml + true pdbonly diff --git a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalDbProviderSpringContextTests.cs b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalDbProviderSpringContextTests.cs index aee0cc78..f2e151b3 100644 --- a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalDbProviderSpringContextTests.cs +++ b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalDbProviderSpringContextTests.cs @@ -23,7 +23,7 @@ namespace Spring.Testing.NUnit /// /// Holds the that this base class manages /// - protected AdoTemplate adoTemplate; + private AdoTemplate adoTemplate; /// /// Did this test delete any tables? If so, we forbid transaction completion, @@ -54,6 +54,7 @@ namespace Spring.Testing.NUnit public AdoTemplate AdoTemplate { get { return adoTemplate; } + protected set { adoTemplate = value; } } /// diff --git a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalSpringContextTests.cs b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalSpringContextTests.cs index 6f3407fc..baed7483 100644 --- a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalSpringContextTests.cs +++ b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalSpringContextTests.cs @@ -60,7 +60,7 @@ namespace Spring.Testing.NUnit /// /// The transaction manager to use /// - protected IPlatformTransactionManager transactionManager; + private IPlatformTransactionManager transactionManager; /// /// Should we roll back by default? @@ -86,21 +86,14 @@ namespace Spring.Testing.NUnit /// /// TransactionStatus for this test. Typical subclasses won't need to use it. /// - protected ITransactionStatus transactionStatus; - - - /// - /// Initializes a new instance of the class. - /// - public AbstractTransactionalSpringContextTests() - { - } + private ITransactionStatus transactionStatus; /// /// Sets the transaction manager to use. /// public IPlatformTransactionManager TransactionManager { + protected get { return transactionManager; } set { transactionManager = value; } } @@ -123,6 +116,15 @@ namespace Spring.Testing.NUnit set { transactionDefinition = value; } } + /// + /// TransactionStatus for this test. Typical subclasses won't need to use it. + /// + protected ITransactionStatus TransactionStatus + { + get { return transactionStatus; } + set { transactionStatus = value; } + } + /// /// Prevents the transaction. /// diff --git a/src/Spring/Spring.Web.Conversation.NHibernate32/Spring.Web.Conversation.NHibernate32.2010.csproj b/src/Spring/Spring.Web.Conversation.NHibernate32/Spring.Web.Conversation.NHibernate32.2010.csproj index f7ad11f7..85b84fc6 100644 --- a/src/Spring/Spring.Web.Conversation.NHibernate32/Spring.Web.Conversation.NHibernate32.2010.csproj +++ b/src/Spring/Spring.Web.Conversation.NHibernate32/Spring.Web.Conversation.NHibernate32.2010.csproj @@ -26,14 +26,16 @@ prompt 4 Spring.Web.Conversation.NHibernate32.xml + true pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Web.Conversation.NHibernate32\Release\ TRACE prompt 4 + true diff --git a/src/Spring/Spring.Web.Conversation.NHibernate33/Spring.Web.Conversation.NHibernate33.2010.csproj b/src/Spring/Spring.Web.Conversation.NHibernate33/Spring.Web.Conversation.NHibernate33.2010.csproj index aced41a8..b7e012f7 100644 --- a/src/Spring/Spring.Web.Conversation.NHibernate33/Spring.Web.Conversation.NHibernate33.2010.csproj +++ b/src/Spring/Spring.Web.Conversation.NHibernate33/Spring.Web.Conversation.NHibernate33.2010.csproj @@ -26,14 +26,16 @@ prompt 4 Spring.Web.Conversation.NHibernate33.XML + true pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Web.Conversation.NHibernate33\Release\ TRACE prompt 4 + true diff --git a/src/Spring/Spring.Web.Extensions/Spring.Web.Extensions.2010.csproj b/src/Spring/Spring.Web.Extensions/Spring.Web.Extensions.2010.csproj index 3656299f..e66a9c4a 100644 --- a/src/Spring/Spring.Web.Extensions/Spring.Web.Extensions.2010.csproj +++ b/src/Spring/Spring.Web.Extensions/Spring.Web.Extensions.2010.csproj @@ -25,6 +25,7 @@ prompt 4 Spring.Web.Extensions.xml + true pdbonly @@ -33,6 +34,7 @@ TRACE;NET_4_0;NET_3_5 prompt 4 + true diff --git a/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.2010.csproj b/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.2010.csproj index 4bfad8c4..376ffb7f 100644 --- a/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.2010.csproj +++ b/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.2010.csproj @@ -28,10 +28,11 @@ pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Web.Mvc3\Release\ TRACE prompt 4 + true diff --git a/src/Spring/Spring.Web.Mvc4/Spring.Web.Mvc4.2010.csproj b/src/Spring/Spring.Web.Mvc4/Spring.Web.Mvc4.2010.csproj index 9b7e5c46..7f56542b 100644 --- a/src/Spring/Spring.Web.Mvc4/Spring.Web.Mvc4.2010.csproj +++ b/src/Spring/Spring.Web.Mvc4/Spring.Web.Mvc4.2010.csproj @@ -28,10 +28,11 @@ pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Web.Mvc4\Release\ TRACE prompt 4 + true diff --git a/src/Spring/Spring.Web.Mvc4/SpringMvcDependencyResolver.cs b/src/Spring/Spring.Web.Mvc4/SpringMvcDependencyResolver.cs index 59cb4558..b425c1c6 100644 --- a/src/Spring/Spring.Web.Mvc4/SpringMvcDependencyResolver.cs +++ b/src/Spring/Spring.Web.Mvc4/SpringMvcDependencyResolver.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; @@ -17,7 +16,7 @@ namespace Spring.Web.Mvc /// /// The to be used by the resolver /// - protected IApplicationContext _context; + private IApplicationContext _context; /// /// Initializes a new instance of the class. @@ -51,6 +50,7 @@ namespace Spring.Web.Mvc return _context; } + protected set { _context = value; } } /// diff --git a/src/Spring/Spring.Web.Mvc5/Spring.Web.Mvc5.2010.csproj b/src/Spring/Spring.Web.Mvc5/Spring.Web.Mvc5.2010.csproj index 7e0a75ef..0dc6229f 100644 --- a/src/Spring/Spring.Web.Mvc5/Spring.Web.Mvc5.2010.csproj +++ b/src/Spring/Spring.Web.Mvc5/Spring.Web.Mvc5.2010.csproj @@ -31,11 +31,12 @@ pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Web.Mvc5\Release\ TRACE prompt 4 false + true diff --git a/src/Spring/Spring.Web/Spring.Web.2010.csproj b/src/Spring/Spring.Web/Spring.Web.2010.csproj index 2acf08b4..9b688f84 100644 --- a/src/Spring/Spring.Web/Spring.Web.2010.csproj +++ b/src/Spring/Spring.Web/Spring.Web.2010.csproj @@ -43,12 +43,11 @@ true 4096 false - - + 618 false false false - false + true 4 full prompt @@ -66,12 +65,11 @@ false 4096 false - - + 618 true false false - false + true 4 none prompt diff --git a/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs b/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs index d9bd382f..87f22f1c 100644 --- a/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs +++ b/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs @@ -98,12 +98,12 @@ namespace Spring.Web.Services /// /// The name of the object in the factory. /// - protected string objectName; + private string objectName; /// /// The owning factory. /// - protected IObjectFactory objectFactory; + private IObjectFactory objectFactory; /// /// The generated web service wrapper type. @@ -315,7 +315,8 @@ namespace Spring.Web.Services /// public virtual IObjectFactory ObjectFactory { - set { this.objectFactory = value; } + protected get { return objectFactory; } + set { objectFactory = value; } } #endregion @@ -338,7 +339,8 @@ namespace Spring.Web.Services /// public string ObjectName { - set { this.objectName = value; } + protected get { return objectName; } + set { objectName = value; } } #endregion diff --git a/test/Spring/Spring.Data.Integration.Tests/Data/OracleAdoTemplateTests.cs b/test/Spring/Spring.Data.Integration.Tests/Data/OracleAdoTemplateTests.cs index 92dff1cf..ff34b1cd 100644 --- a/test/Spring/Spring.Data.Integration.Tests/Data/OracleAdoTemplateTests.cs +++ b/test/Spring/Spring.Data.Integration.Tests/Data/OracleAdoTemplateTests.cs @@ -223,8 +223,6 @@ namespace Spring.Data [Test] public void ExecuteNonQueryText() { - int counter = 0; - int user_id = 100; string user_name = "George0"; @@ -240,7 +238,6 @@ namespace Spring.Data int user_id1 = 101; string user_name1 = "George1"; parameters.Add("id", OracleType.Int32).Value = user_id1; - counter++; parameters.Add("name", DbType.String, 12).Value = user_name1; adoOperations.ExecuteNonQuery(CommandType.Text, sql, parameters); diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Conversation/SerializeConversationTestModule.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Conversation/SerializeConversationTestModule.cs index 50ce4e60..41f562db 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Conversation/SerializeConversationTestModule.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Conversation/SerializeConversationTestModule.cs @@ -20,15 +20,11 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Web; using System.Runtime.Serialization.Formatters.Binary; using System.IO; -using System.Runtime.Remoting.Messaging; using System.Runtime.Serialization; using System.Reflection; -using Spring.Entities; namespace Spring.Web.Conversation { @@ -211,9 +207,6 @@ namespace Spring.Web.Conversation private static readonly Common.Logging.ILog LOG = Common.Logging.LogManager.GetLogger(typeof(SerializeConversationTestModule)); #endregion - public MySerializationSurrogate() - { - } #region ISerializationSurrogate Members diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/CircularDependenceTest.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/CircularDependenceTest.aspx.cs index 4bcd85e4..32befab8 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/CircularDependenceTest.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/CircularDependenceTest.aspx.cs @@ -1,21 +1,11 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; -using Spring.Web.Conversation; -using NUnit.Framework; -using Spring.Context.Support; using System.Text; -using Common.Logging; + using Spring.Context; using Spring.Web.Conversation; +using Common.Logging; + public partial class CircularDependenceTest : System.Web.UI.Page, IApplicationContextAware { private static readonly ILog LOG = LogManager.GetLogger(typeof(CircularDependenceTest)); diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/ConnectionReleaseModeIssue.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/ConnectionReleaseModeIssue.aspx.cs index 3cf21876..ea943d34 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/ConnectionReleaseModeIssue.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/ConnectionReleaseModeIssue.aspx.cs @@ -1,32 +1,26 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; -using Spring.Web.Conversation; +using System.Reflection; + using Spring.Data.NHibernate.Support; -using NHibernate; +using Spring.Bsn; using Spring.Entities; using Spring.Spring.Data.Common; -using NUnit.Framework; -using Spring.Bsn; -using NHibernate.Impl; -using System.Reflection; -using NHibernate.Cfg; using Spring.Context; using Spring.Web.Conversation; +using NHibernate; +using NHibernate.Cfg; +using NHibernate.Impl; + +using NUnit.Framework; + /// /// Page for . /// public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicationContextAware { private IConversationState conversation; + /// /// /// @@ -37,14 +31,15 @@ public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicati } private ISessionFactory sessionFactory; + public ISessionFactory SessionFactory { get { return sessionFactory; } set { sessionFactory = value; } } - private IConnectionReleaseModeIssueBsn connectionReleaseModeIssueBsn; + public IConnectionReleaseModeIssueBsn ConnectionReleaseModeIssueBsn { get { return connectionReleaseModeIssueBsn; } @@ -92,7 +87,7 @@ public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicati { //with conversation and "connection.release_mode" "auto"(AfterTransaction) //forcing "auto" by reflection. - Settings settings = ((SessionFactoryImpl)this.SessionFactory).Settings; + Settings settings = ((SessionFactoryImpl) this.SessionFactory).Settings; ConnectionReleaseMode connReleaseModeOriginal = settings.ConnectionReleaseMode; this.setConnectionReleaseModeByReflection(settings, ConnectionReleaseMode.AfterTransaction); @@ -126,11 +121,10 @@ public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicati Assert.AreEqual(1, masterEnt3.SPCDetailEntList.Count, "masterEnt3.SPCDetailEntList.Count"); Assert.AreEqual(6, ConnectionCreationTrackingDbProvider.Count, "ConnectionCreationTrackingDbProvider.Count"); - //Renew the conversation. this.Conversation.EndConversation(); this.Conversation.ConversationManager.FreeEnded(); - this.Conversation = (IConversationState)this.applicationContext.GetObject("convConnectionReleaseModeIssue"); + this.Conversation = (IConversationState) this.applicationContext.GetObject("convConnectionReleaseModeIssue"); this.setConnectionReleaseModeByReflection(settings, connReleaseModeOriginal); } @@ -149,7 +143,7 @@ public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicati { //with conversation and "connection.release_mode" "auto"(AfterTransaction) //forcing "auto" by reflection. - Settings settings = ((SessionFactoryImpl)this.SessionFactory).Settings; + Settings settings = ((SessionFactoryImpl) this.SessionFactory).Settings; ConnectionReleaseMode connReleaseModeOriginal = settings.ConnectionReleaseMode; this.setConnectionReleaseModeByReflection(settings, ConnectionReleaseMode.AfterTransaction); @@ -167,7 +161,7 @@ public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicati { //with NO conversation and "connection.release_mode" "auto"(AfterTransaction) //forcing "auto" by reflection. - Settings settings = ((SessionFactoryImpl)this.SessionFactory).Settings; + Settings settings = ((SessionFactoryImpl) this.SessionFactory).Settings; ConnectionReleaseMode connReleaseModeOriginal = settings.ConnectionReleaseMode; this.setConnectionReleaseModeByReflection(settings, ConnectionReleaseMode.AfterTransaction); @@ -202,7 +196,7 @@ public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicati private void connection_release_mode_on_close() { //forcing "on_close" by reflection. - Settings settings = ((SessionFactoryImpl)this.SessionFactory).Settings; + Settings settings = ((SessionFactoryImpl) this.SessionFactory).Settings; ConnectionReleaseMode connReleaseModeOriginal = settings.ConnectionReleaseMode; this.setConnectionReleaseModeByReflection(settings, ConnectionReleaseMode.OnClose); @@ -232,7 +226,7 @@ public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicati //Renew the conversation. this.Conversation.EndConversation(); this.Conversation.ConversationManager.FreeEnded(); - this.Conversation = (IConversationState)this.applicationContext.GetObject("convConnectionReleaseModeIssue"); + this.Conversation = (IConversationState) this.applicationContext.GetObject("convConnectionReleaseModeIssue"); this.setConnectionReleaseModeByReflection(settings, connReleaseModeOriginal); } @@ -248,19 +242,21 @@ public partial class ConnectionReleaseModeIssue : System.Web.UI.Page, IApplicati settings.GetType().GetProperty( "ConnectionReleaseMode", BindingFlags.Public | - BindingFlags.NonPublic | - BindingFlags.SetProperty | - BindingFlags.Instance); + BindingFlags.NonPublic | + BindingFlags.SetProperty | + BindingFlags.Instance); pInfoConnectionReleaseMode.SetValue(settings, mode, null); } #region IApplicationContextAware Members + private IApplicationContext applicationContext; + public IApplicationContext ApplicationContext { set { this.applicationContext = value; } } #endregion -} +} \ No newline at end of file diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndConversationTestBegin.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndConversationTestBegin.aspx.cs index 271ad21c..86864146 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndConversationTestBegin.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndConversationTestBegin.aspx.cs @@ -1,16 +1,7 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using Spring.Bsn; -using Spring.Web.Conversation; public partial class EndConversationTestBegin : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndConversationTestEnd.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndConversationTestEnd.aspx.cs index a8f37d48..552e24ad 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndConversationTestEnd.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndConversationTestEnd.aspx.cs @@ -1,16 +1,7 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Bsn; using Spring.Web.Conversation; -using Spring.Web.Conversation; public partial class EndConversationTestEnd : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCSwitchConversationSameRequest.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCSwitchConversationSameRequest.aspx.cs index 4c007b86..7fe1d64e 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCSwitchConversationSameRequest.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCSwitchConversationSameRequest.aspx.cs @@ -1,18 +1,9 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using Spring.Entities; using NHibernate; using Common.Logging; -using Spring.Web.Conversation; public partial class SPCSwitchConversationSameRequest : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Tests/Util/WebUtilsTests.cs b/test/Spring/Spring.Web.Tests/Util/WebUtilsTests.cs index 0e71a82d..260d0c1c 100644 --- a/test/Spring/Spring.Web.Tests/Util/WebUtilsTests.cs +++ b/test/Spring/Spring.Web.Tests/Util/WebUtilsTests.cs @@ -271,15 +271,15 @@ namespace Spring.Util Assert.AreEqual("/mYpath", WebUtils.GetRelativePath("/Mydir", "/mYdir/mYpath")); Assert.AreEqual("/myotherdir/mypath", WebUtils.GetRelativePath("/mydir", "/myotherdir/mypath")); } - - [Test] - public void GetNormalizedVirtualPath() - { - Assert.AreEqual(null, WebUtils.GetNormalizedVirtualPath(null)); - Assert.AreEqual(String.Empty, WebUtils.GetNormalizedVirtualPath(String.Empty)); - Assert.AreEqual("~test.aspx", WebUtils.GetNormalizedVirtualPath("~test.aspx")); - Assert.AreEqual("/test.aspx", WebUtils.GetNormalizedVirtualPath("~/test.aspx")); - Assert.AreEqual("/Complex.Path/~/test.aspx", WebUtils.GetNormalizedVirtualPath("~/Complex.Path/~/test.aspx")); - } + + [Test] + public void GetNormalizedVirtualPath() + { + Assert.AreEqual(null, WebUtils.GetNormalizedVirtualPath(null)); + Assert.AreEqual(String.Empty, WebUtils.GetNormalizedVirtualPath(String.Empty)); + Assert.AreEqual("~test.aspx", WebUtils.GetNormalizedVirtualPath("~test.aspx")); + Assert.AreEqual("/test.aspx", WebUtils.GetNormalizedVirtualPath("~/test.aspx")); + Assert.AreEqual("/Complex.Path/~/test.aspx", WebUtils.GetNormalizedVirtualPath("~/Complex.Path/~/test.aspx")); + } } } \ No newline at end of file