springnet-commits Mailing List for Spring Framework .NET (Page 16)
Brought to you by:
aseovic,
markpollack
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(33) |
Aug
(163) |
Sep
(491) |
Oct
(289) |
Nov
(336) |
Dec
(84) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(227) |
Feb
(413) |
Mar
(128) |
Apr
(232) |
May
(92) |
Jun
(299) |
Jul
(386) |
Aug
(228) |
Sep
(237) |
Oct
(426) |
Nov
(325) |
Dec
(405) |
2006 |
Jan
(315) |
Feb
(311) |
Mar
(152) |
Apr
(177) |
May
(443) |
Jun
(92) |
Jul
(88) |
Aug
(80) |
Sep
(288) |
Oct
(515) |
Nov
(1049) |
Dec
(440) |
2007 |
Jan
(179) |
Feb
(406) |
Mar
(294) |
Apr
(80) |
May
(432) |
Jun
(242) |
Jul
(452) |
Aug
(710) |
Sep
(206) |
Oct
(240) |
Nov
(65) |
Dec
(227) |
2008 |
Jan
(80) |
Feb
(90) |
Mar
(98) |
Apr
(136) |
May
(101) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Bruno B. <bb...@us...> - 2008-02-06 18:29:08
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16423/Aop/Framework/DynamicProxy Added Files: InheritanceAopProxyTests.cs Log Message: Added Inheritance-based aop proxy. --- NEW FILE: InheritanceAopProxyTests.cs --- (This appears to be a binary file; contents omitted.) |
From: Bruno B. <bb...@us...> - 2008-02-06 18:29:02
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16301 Modified Files: Spring.Aop.2005.csproj Log Message: Added Inheritance-based aop proxy. Index: Spring.Aop.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Spring.Aop.2005.csproj,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Spring.Aop.2005.csproj 5 Feb 2008 21:38:49 -0000 1.40 --- Spring.Aop.2005.csproj 6 Feb 2008 18:28:52 -0000 1.41 *************** *** 124,127 **** --- 124,129 ---- <Compile Include="Aop\Framework\DynamicProxy\CachedAopProxyFactory.cs" /> <Compile Include="Aop\Framework\DynamicProxy\DefaultAopProxyFactory.cs" /> + <Compile Include="Aop\Framework\DynamicProxy\InheritanceAopProxyTypeBuilder.cs" /> + <Compile Include="Aop\Framework\DynamicProxy\BaseAopProxyMethodBuilder.cs" /> <Compile Include="Aop\IAdvisors.cs" /> <Compile Include="Aop\Framework\AbstractMethodInvocation.cs"> |
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/DynamicProxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16301/Aop/Framework/DynamicProxy Modified Files: AbstractAopProxyMethodBuilder.cs AdvisedProxy.cs Added Files: BaseAopProxyMethodBuilder.cs InheritanceAopProxyTypeBuilder.cs Log Message: Added Inheritance-based aop proxy. --- NEW FILE: InheritanceAopProxyTypeBuilder.cs --- (This appears to be a binary file; contents omitted.) Index: AdvisedProxy.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/DynamicProxy/AdvisedProxy.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AdvisedProxy.cs 8 Oct 2007 22:04:51 -0000 1.9 --- AdvisedProxy.cs 6 Feb 2008 18:28:52 -0000 1.10 *************** *** 203,211 **** /// <param name="targetType">target type</param> /// <param name="targetMethod">taget method to invoke</param> /// <param name="args">method arguments</param> /// <param name="interceptors">interceptor chain</param> /// <returns>value returned by invocation chain</returns> ! public object Invoke(object proxy, object target, Type targetType, ! MethodInfo targetMethod, object[] args, IList interceptors) { IMethodInvocation invocation = null; --- 203,212 ---- /// <param name="targetType">target type</param> /// <param name="targetMethod">taget method to invoke</param> + /// <param name="proxyMethod">The method to invoke on proxy.</param> /// <param name="args">method arguments</param> /// <param name="interceptors">interceptor chain</param> /// <returns>value returned by invocation chain</returns> ! public object Invoke(object proxy, object target, Type targetType, ! MethodInfo targetMethod, MethodInfo proxyMethod, object[] args, IList interceptors) { IMethodInvocation invocation = null; *************** *** 213,222 **** { invocation = new DynamicMethodInvocation( ! proxy, target, targetMethod, args, targetType, interceptors); } else { invocation = new ReflectiveMethodInvocation( ! proxy, target, targetMethod, args, targetType, interceptors); } return invocation.Proceed(); --- 214,223 ---- { invocation = new DynamicMethodInvocation( ! proxy, target, targetMethod, proxyMethod, args, targetType, interceptors); } else { invocation = new ReflectiveMethodInvocation( ! proxy, target, targetMethod, proxyMethod, args, targetType, interceptors); } return invocation.Proceed(); Index: AbstractAopProxyMethodBuilder.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/DynamicProxy/AbstractAopProxyMethodBuilder.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractAopProxyMethodBuilder.cs 2 Aug 2007 16:28:29 -0000 1.8 --- AbstractAopProxyMethodBuilder.cs 6 Feb 2008 18:28:52 -0000 1.9 *************** *** 28,31 **** --- 28,32 ---- using Spring.Proxy; + using Spring.Util; #endregion *************** *** 54,57 **** --- 55,64 ---- protected IDictionary targetMethods; + /// <summary> + /// The dictionary to cache the list of target + /// <see cref="System.Reflection.MethodInfo"/>s defined on the proxy. + /// </summary> + protected IDictionary onProxyTargetMethods; + // variables *************** *** 79,85 **** /// <summary> /// The local variable to store the closed generic method ! /// when the proxied method is generic. /// </summary> protected LocalBuilder genericTargetMethod; #endif /// <summary> --- 86,98 ---- /// <summary> /// The local variable to store the closed generic method ! /// when the target method is generic. /// </summary> protected LocalBuilder genericTargetMethod; + + /// <summary> + /// The local variable to store the closed generic method + /// when the target method defined on the proxy is generic. + /// </summary> + protected LocalBuilder genericOnProxyTargetMethod; #endif /// <summary> *************** *** 87,90 **** --- 100,109 ---- /// </summary> protected FieldBuilder targetMethodCacheField; + + /// <summary> + /// The field to cache the target <see cref="System.Reflection.MethodInfo"/> + /// defined on the proxy. + /// </summary> + protected FieldBuilder onProxyTargetMethodCacheField; // convinience fields *************** *** 136,145 **** /// </param> protected AbstractAopProxyMethodBuilder( ! TypeBuilder typeBuilder, IAopProxyTypeGenerator aopProxyGenerator, bool explicitImplementation, IDictionary targetMethods) : base(typeBuilder, aopProxyGenerator, explicitImplementation) { this.aopProxyGenerator = aopProxyGenerator; this.targetMethods = targetMethods; } --- 155,191 ---- /// </param> protected AbstractAopProxyMethodBuilder( ! TypeBuilder typeBuilder, IAopProxyTypeGenerator aopProxyGenerator, bool explicitImplementation, IDictionary targetMethods) + : this(typeBuilder, aopProxyGenerator, explicitImplementation, targetMethods, new Hashtable()) + { + } + + /// <summary> + /// Creates a new instance of the method builder. + /// </summary> + /// <param name="typeBuilder">The type builder to use.</param> + /// <param name="aopProxyGenerator"> + /// The <see cref="IAopProxyTypeGenerator"/> implementation to use. + /// </param> + /// <param name="explicitImplementation"> + /// <see langword="true"/> if the interface is to be + /// implemented explicitly; otherwise <see langword="false"/>. + /// </param> + /// <param name="targetMethods"> + /// The dictionary to cache the list of target + /// <see cref="System.Reflection.MethodInfo"/>s. + /// </param> + /// <param name="onProxyTargetMethods"> + /// The dictionary to cache the list of target + /// <see cref="System.Reflection.MethodInfo"/>s defined on the proxy. + /// </param> + protected AbstractAopProxyMethodBuilder( + TypeBuilder typeBuilder, IAopProxyTypeGenerator aopProxyGenerator, + bool explicitImplementation, IDictionary targetMethods, IDictionary onProxyTargetMethods) : base(typeBuilder, aopProxyGenerator, explicitImplementation) { this.aopProxyGenerator = aopProxyGenerator; this.targetMethods = targetMethods; + this.onProxyTargetMethods = onProxyTargetMethods; } *************** *** 164,167 **** --- 210,214 ---- GenerateTargetMethodCacheField(il, method); + GenerateOnProxyTargetMethodCacheField(il, method); BeginMethod(il, method); *************** *** 195,198 **** --- 242,275 ---- #if NET_2_0 + MakeGenericMethod(il, method, targetMethodCacheField, genericTargetMethod); + #endif + } + + /// <summary> + /// Create static field that will cache target method when defined on the proxy. + /// </summary> + /// <param name="il">The IL generator to use.</param> + /// <param name="method">The target method.</param> + protected virtual void GenerateOnProxyTargetMethodCacheField( + ILGenerator il, MethodInfo method) + { + } + + #if NET_2_0 + /// <summary> + /// Create a closed generic method for the current call + /// if target method is a generic definition. + /// </summary> + /// <param name="il">The IL generator to use.</param> + /// <param name="method">The target method.</param> + /// <param name="methodCacheField"> + /// The field that contains the method generic definition + /// </param> + /// <param name="localMethod"> + /// The local variable to store the closed generic method. + /// </param> + protected void MakeGenericMethod(ILGenerator il, MethodInfo method, + FieldBuilder methodCacheField, LocalBuilder localMethod) + { // if target method is a generic definition, // create a closed generic method for the current call. *************** *** 203,207 **** LocalBuilder typeArgs = il.DeclareLocal(typeof(Type[])); ! il.Emit(OpCodes.Ldsfld, targetMethodCacheField); // specify array size and create an array --- 280,284 ---- LocalBuilder typeArgs = il.DeclareLocal(typeof(Type[])); ! il.Emit(OpCodes.Ldsfld, methodCacheField); // specify array size and create an array *************** *** 222,229 **** il.Emit(OpCodes.Ldloc, typeArgs); il.Emit(OpCodes.Callvirt, References.MakeGenericMethod); ! il.Emit(OpCodes.Stloc, genericTargetMethod); } - #endif } /// <summary> --- 299,306 ---- il.Emit(OpCodes.Ldloc, typeArgs); il.Emit(OpCodes.Callvirt, References.MakeGenericMethod); ! il.Emit(OpCodes.Stloc, localMethod); } } + #endif /// <summary> *************** *** 267,270 **** --- 344,371 ---- /// <summary> + /// Pushes the target <see cref="System.Reflection.MethodInfo"/> defined on the proxy to stack. + /// </summary> + /// <param name="il">The IL generator to use.</param> + /// <param name="method">The method to proxy.</param> + protected virtual void PushOnProxyTargetMethodInfo(ILGenerator il, MethodInfo method) + { + if (onProxyTargetMethodCacheField != null) + { + #if NET_2_0 + if (method.IsGenericMethodDefinition) + { + il.Emit(OpCodes.Ldloc, genericOnProxyTargetMethod); + return; + } + #endif + il.Emit(OpCodes.Ldsfld, onProxyTargetMethodCacheField); + } + else + { + il.Emit(OpCodes.Ldnull); + } + } + + /// <summary> /// Creates local variable declarations. /// </summary> *************** *** 281,284 **** --- 382,386 ---- { genericTargetMethod = il.DeclareLocal(typeof(MethodInfo)); + genericOnProxyTargetMethod = il.DeclareLocal(typeof(MethodInfo)); } #endif *************** *** 296,299 **** --- 398,402 ---- { genericTargetMethod.SetLocalSymInfo("genericTargetMethod"); + genericOnProxyTargetMethod.SetLocalSymInfo("genericOnProxyTargetMethod"); } #endif *************** *** 400,403 **** --- 503,507 ---- il.Emit(OpCodes.Ldloc, targetType); // target type PushTargetMethodInfo(il, method); // method + PushOnProxyTargetMethodInfo(il, method); // method defined on proxy il.Emit(OpCodes.Ldloc, arguments); // args il.Emit(OpCodes.Ldloc, interceptors); // interceptors *************** *** 638,642 **** public static readonly MethodInfo InvokeMethod = ! typeof(AdvisedProxy).GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(Object), typeof(Object), typeof(Type), typeof(MethodInfo), typeof(Object[]), typeof(IList) }, null); public static readonly MethodInfo GetInterceptorsMethod = --- 742,746 ---- public static readonly MethodInfo InvokeMethod = ! typeof(AdvisedProxy).GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(Object), typeof(Object), typeof(Type), typeof(MethodInfo), typeof(MethodInfo), typeof(Object[]), typeof(IList) }, null); public static readonly MethodInfo GetInterceptorsMethod = --- NEW FILE: BaseAopProxyMethodBuilder.cs --- (This appears to be a binary file; contents omitted.) |
From: Bruno B. <bb...@us...> - 2008-02-06 18:28:56
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16301/Aop/Framework Modified Files: DynamicMethodInvocation.cs ReflectiveMethodInvocation.cs Log Message: Added Inheritance-based aop proxy. Index: ReflectiveMethodInvocation.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/ReflectiveMethodInvocation.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ReflectiveMethodInvocation.cs 2 Aug 2007 16:28:30 -0000 1.17 --- ReflectiveMethodInvocation.cs 6 Feb 2008 18:28:52 -0000 1.18 *************** *** 43,46 **** --- 43,51 ---- public class ReflectiveMethodInvocation : AbstractMethodInvocation { + /// <summary> + /// The method invocation that is to be invoked on the proxy. + /// </summary> + protected MethodInfo proxyMethod; + /// <summary> /// Creates a new instance of the *************** *** 50,53 **** --- 55,59 ---- /// <param name="target">The target object.</param> /// <param name="method">The target method proxied.</param> + /// <param name="proxyMethod">The method to invoke on proxy.</param> /// <param name="arguments">The target method's arguments.</param> /// <param name="targetType"> *************** *** 62,69 **** /// </exception> public ReflectiveMethodInvocation( ! object proxy, object target, MethodInfo method, object[] arguments, Type targetType, IList interceptors) : base(proxy, target, method, arguments, targetType, interceptors) ! {} /// <summary> --- 68,77 ---- /// </exception> public ReflectiveMethodInvocation( ! object proxy, object target, MethodInfo method, MethodInfo proxyMethod, object[] arguments, Type targetType, IList interceptors) : base(proxy, target, method, arguments, targetType, interceptors) ! { ! this.proxyMethod = proxyMethod; ! } /// <summary> *************** *** 86,90 **** try { ! return method.Invoke(target, arguments); } catch (TargetInvocationException ex) --- 94,105 ---- try { ! if (proxyMethod == null) ! { ! return method.Invoke(target, arguments); ! } ! else ! { ! return proxyMethod.Invoke(target, arguments); ! } } catch (TargetInvocationException ex) *************** *** 108,112 **** { ReflectiveMethodInvocation rmi = new ReflectiveMethodInvocation( ! this.proxy, this.target, this.method, this.arguments, this.targetType, this.interceptors); rmi.currentInterceptorIndex = this.currentInterceptorIndex + 1; --- 123,127 ---- { ReflectiveMethodInvocation rmi = new ReflectiveMethodInvocation( ! this.proxy, this.target, this.method, this.proxyMethod, this.arguments, this.targetType, this.interceptors); rmi.currentInterceptorIndex = this.currentInterceptorIndex + 1; Index: DynamicMethodInvocation.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/DynamicMethodInvocation.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DynamicMethodInvocation.cs 8 Aug 2007 03:58:14 -0000 1.2 --- DynamicMethodInvocation.cs 6 Feb 2008 18:28:52 -0000 1.3 *************** *** 43,46 **** --- 43,51 ---- public class DynamicMethodInvocation : AbstractMethodInvocation { + /// <summary> + /// The method invocation that is to be invoked on the proxy. + /// </summary> + protected MethodInfo proxyMethod; + /// <summary> /// Creates a new instance of the *************** *** 50,53 **** --- 55,59 ---- /// <param name="target">The target object.</param> /// <param name="method">The target method proxied.</param> + /// <param name="proxyMethod">The method to invoke on proxy.</param> /// <param name="arguments">The target method's arguments.</param> /// <param name="targetType"> *************** *** 62,69 **** /// </exception> public DynamicMethodInvocation( ! object proxy, object target, MethodInfo method, object[] arguments, Type targetType, IList interceptors) : base(proxy, target, method, arguments, targetType, interceptors) ! {} /// <summary> --- 68,77 ---- /// </exception> public DynamicMethodInvocation( ! object proxy, object target, MethodInfo method, MethodInfo proxyMethod, object[] arguments, Type targetType, IList interceptors) : base(proxy, target, method, arguments, targetType, interceptors) ! { ! this.proxyMethod = proxyMethod; ! } /// <summary> *************** *** 84,88 **** protected override object InvokeJoinpoint() { ! IDynamicMethod targetMethod = new SafeMethod(method); try { --- 92,96 ---- protected override object InvokeJoinpoint() { ! IDynamicMethod targetMethod = (this.proxyMethod == null) ? new SafeMethod(method) : new SafeMethod(proxyMethod); try { *************** *** 110,114 **** { DynamicMethodInvocation rmi = new DynamicMethodInvocation( ! this.proxy, this.target, this.method, this.arguments, this.targetType, this.interceptors); rmi.currentInterceptorIndex = this.currentInterceptorIndex + 1; --- 118,122 ---- { DynamicMethodInvocation rmi = new DynamicMethodInvocation( ! this.proxy, this.target, this.method, this.proxyMethod, this.arguments, this.targetType, this.interceptors); rmi.currentInterceptorIndex = this.currentInterceptorIndex + 1; |
From: Bruno B. <bb...@us...> - 2008-02-06 18:26:50
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Proxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15476/Proxy Modified Files: AbstractProxyMethodBuilder.cs Log Message: Added Inheritance-based aop proxy. Index: AbstractProxyMethodBuilder.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Proxy/AbstractProxyMethodBuilder.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractProxyMethodBuilder.cs 28 Jul 2007 00:33:20 -0000 1.6 --- AbstractProxyMethodBuilder.cs 6 Feb 2008 18:26:42 -0000 1.7 *************** *** 97,102 **** DefineMethod(method, interfaceMethod, explicitImplementation); - DefineParameters(methodBuilder, method); - ILGenerator il = methodBuilder.GetILGenerator(); --- 97,100 ---- *************** *** 193,196 **** --- 191,228 ---- #if NET_2_0 + DefineGenericParameters(methodBuilder, method); + #endif + DefineParameters(methodBuilder, method); + + return methodBuilder; + } + + /// <summary> + /// Defines method parameters based on proxied method metadata. + /// </summary> + /// <param name="methodBuilder"> + /// The <see cref="System.Reflection.Emit.MethodBuilder"/> to use. + /// </param> + /// <param name="method">The method to proxy.</param> + protected void DefineParameters(MethodBuilder methodBuilder, MethodInfo method) + { + int n = 1; + foreach (ParameterInfo param in method.GetParameters()) + { + ParameterBuilder pb = methodBuilder.DefineParameter(n, param.Attributes, param.Name); + n++; + } + } + + #if NET_2_0 + /// <summary> + /// Defines generic method parameters based on proxied method metadata. + /// </summary> + /// <param name="methodBuilder"> + /// The <see cref="System.Reflection.Emit.MethodBuilder"/> to use. + /// </param> + /// <param name="method">The method to proxy.</param> + protected void DefineGenericParameters(MethodBuilder methodBuilder, MethodInfo method) + { if (method.IsGenericMethodDefinition) { *************** *** 198,202 **** // define generic parameters ! GenericTypeParameterBuilder[] gtpBuilders = methodBuilder.DefineGenericParameters(ReflectionUtils.GetGenericParameterNames(genericArguments)); --- 230,234 ---- // define generic parameters ! GenericTypeParameterBuilder[] gtpBuilders = methodBuilder.DefineGenericParameters(ReflectionUtils.GetGenericParameterNames(genericArguments)); *************** *** 218,242 **** } } - #endif - - return methodBuilder; - } - - /// <summary> - /// Defines method parameters based on proxied method metadata. - /// </summary> - /// <param name="methodBuilder"> - /// The <see cref="System.Reflection.Emit.MethodBuilder"/> to use. - /// </param> - /// <param name="method">The method to proxy.</param> - protected virtual void DefineParameters(MethodBuilder methodBuilder, MethodInfo method) - { - int n = 1; - foreach (ParameterInfo param in method.GetParameters()) - { - ParameterBuilder pb = methodBuilder.DefineParameter(n, param.Attributes, param.Name); - n++; - } } /// <summary> --- 250,255 ---- } } } + #endif /// <summary> |
From: Aleksandar S. <as...@us...> - 2008-02-05 21:38:58
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Validation In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv378/src/Spring/Spring.Aop/Aspects/Validation Added Files: ParameterValidationAdvice.cs Log Message: Added implementation of parameter validation advice. --- NEW FILE: ParameterValidationAdvice.cs --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar S. <as...@us...> - 2008-02-05 21:38:53
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv378/src/Spring/Spring.Core Modified Files: Spring.Core.2005.csproj Log Message: Added implementation of parameter validation advice. Index: Spring.Core.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Spring.Core.2005.csproj,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** Spring.Core.2005.csproj 5 Feb 2008 20:40:25 -0000 1.115 --- Spring.Core.2005.csproj 5 Feb 2008 21:38:49 -0000 1.116 *************** *** 999,1002 **** --- 999,1003 ---- <SubType>Code</SubType> </Compile> + <Compile Include="Validation\ValidationAttribute.cs" /> <Compile Include="Validation\ValidationException.cs" /> <Compile Include="Validation\IValidationAction.cs" /> |
From: Aleksandar S. <as...@us...> - 2008-02-05 21:38:53
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Validation In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv378/test/Spring/Spring.Aop.Tests/Aspects/Validation Added Files: ParameterValidationAdviceTests.cs Log Message: Added implementation of parameter validation advice. --- NEW FILE: ParameterValidationAdviceTests.cs --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar S. <as...@us...> - 2008-02-05 21:38:52
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv378/src/Spring/Spring.Core/Validation Added Files: ValidationAttribute.cs Log Message: Added implementation of parameter validation advice. --- NEW FILE: ValidationAttribute.cs --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar S. <as...@us...> - 2008-02-05 21:38:52
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv378/src/Spring/Spring.Aop Modified Files: Spring.Aop.2005.csproj Log Message: Added implementation of parameter validation advice. Index: Spring.Aop.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Spring.Aop.2005.csproj,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Spring.Aop.2005.csproj 6 Dec 2007 06:49:20 -0000 1.39 --- Spring.Aop.2005.csproj 5 Feb 2008 21:38:49 -0000 1.40 *************** *** 400,403 **** --- 400,404 ---- <Compile Include="Aspects\IExceptionHandler.cs" /> <Compile Include="Aspects\RetryExceptionHandler.cs" /> + <Compile Include="Aspects\Validation\ParameterValidationAdvice.cs" /> <Compile Include="AssemblyInfo.cs"> <SubType>Code</SubType> |
From: Aleksandar S. <as...@us...> - 2008-02-05 21:38:52
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv378/test/Spring/Spring.Aop.Tests Modified Files: Spring.Aop.Tests.2005.csproj Log Message: Added implementation of parameter validation advice. Index: Spring.Aop.Tests.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2005.csproj,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Spring.Aop.Tests.2005.csproj 8 Oct 2007 22:05:26 -0000 1.32 --- Spring.Aop.Tests.2005.csproj 5 Feb 2008 21:38:49 -0000 1.33 *************** *** 254,257 **** --- 254,258 ---- <Compile Include="Aspects\Logging\TestableSimpleLoggingAdvice.cs" /> <Compile Include="Aspects\RetryAdviceTests.cs" /> + <Compile Include="Aspects\Validation\ParameterValidationAdviceTests.cs" /> <Compile Include="AssemblyInfo.cs"> <SubType>Code</SubType> |
From: Aleksandar S. <as...@us...> - 2008-02-05 21:37:58
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Validation In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32429/Validation Log Message: Directory /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Validation added to the repository |
From: Aleksandar S. <as...@us...> - 2008-02-05 21:37:40
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Validation In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32400/Validation Log Message: Directory /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Validation added to the repository |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:50
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators/Integration In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/test/Spring/Spring.Core.Tests/Validation/Validators/Integration Modified Files: CreditCardValidatorIntegrationTests.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: CreditCardValidatorIntegrationTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators/Integration/CreditCardValidatorIntegrationTests.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CreditCardValidatorIntegrationTests.cs 8 Aug 2007 17:49:15 -0000 1.4 --- CreditCardValidatorIntegrationTests.cs 5 Feb 2008 20:40:27 -0000 1.5 *************** *** 105,109 **** XmlObjectFactory objectFactory = new XmlObjectFactory(resource, null); ! ValidationErrors errors = new ValidationErrors(); Contact contact = new Contact(); IValidator validator = (IValidator)objectFactory.GetObject("ccValidator"); --- 105,109 ---- XmlObjectFactory objectFactory = new XmlObjectFactory(resource, null); ! IValidationErrors errors = new ValidationErrors(); Contact contact = new Contact(); IValidator validator = (IValidator)objectFactory.GetObject("ccValidator"); |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:50
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/test/Spring/Spring.Core.Tests/Validation Modified Files: AnyValidatorGroupTests.cs CollectionValidatorTests.cs ExclusiveValidatorGroupTests.cs ValidationErrorsTests.cs ValidatorGroupTests.cs ValidatorReferenceTests.cs Added Files: ValidationExceptionTests.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. --- NEW FILE: ValidationExceptionTests.cs --- #region License /* * Copyright 2004 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; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using NUnit.Framework; namespace Spring.Validation { /// <summary> /// Unit tests for the ValidationException class. /// </summary> /// <author>Aleksandar Seovic</author> /// <version>$Id: ValidationExceptionTests.cs,v 1.1 2008/02/05 20:40:27 aseovic Exp $</version> [TestFixture] public sealed class ValidationExceptionTests { [Test] public void InstantiationUsingDefaultConstructor() { ValidationException ex = new ValidationException(); Assert.IsNull(ex.ValidationErrors); } [Test] public void InstantiationSupplyingValidationErrors() { ValidationException ex = new ValidationException(new ValidationErrors()); Assert.IsTrue(ex.ValidationErrors.IsEmpty); } [Test] public void InstantiationSupplyingMessageAndValidationErrors() { ValidationException ex = new ValidationException("my message", new ValidationErrors()); Assert.AreEqual("my message", ex.Message); Assert.IsTrue(ex.ValidationErrors.IsEmpty); } [Test] public void InstantiationSupplyingMessageValidationErrorsAndRootCause() { Exception rootCause = new Exception("root cause"); ValidationException ex = new ValidationException("my message", rootCause, new ValidationErrors()); Assert.AreEqual("my message", ex.Message); Assert.IsTrue(ex.ValidationErrors.IsEmpty); Assert.AreEqual(rootCause, ex.InnerException); Assert.AreEqual("root cause", ex.InnerException.Message); } [Test] public void TestExceptionSerialization() { MemoryStream buffer = new MemoryStream(); BinaryFormatter serializer = new BinaryFormatter(); Exception rootCause = new Exception("root cause"); ValidationException e1 = new ValidationException("my message", rootCause, new ValidationErrors()); serializer.Serialize(buffer, e1); buffer.Position = 0; ValidationException e2 = (ValidationException)serializer.Deserialize(buffer); Assert.AreEqual("my message", e2.Message); Assert.IsTrue(e2.ValidationErrors.IsEmpty); Assert.AreEqual("root cause", e2.InnerException.Message); } } } Index: ValidationErrorsTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/ValidationErrorsTests.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ValidationErrorsTests.cs 19 Feb 2007 17:56:42 -0000 1.6 --- ValidationErrorsTests.cs 5 Feb 2008 20:40:26 -0000 1.7 *************** *** 49,53 **** public void ContainsNoErrorsDirectlyAfterInstantiation() { ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(errors.IsEmpty); Assert.IsNotNull(errors.GetErrors(GoodErrorKey)); --- 49,53 ---- public void ContainsNoErrorsDirectlyAfterInstantiation() { ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(errors.IsEmpty); Assert.IsNotNull(errors.GetErrors(GoodErrorKey)); *************** *** 65,69 **** public void AddErrorWithNullKey() { ! ValidationErrors errors = new ValidationErrors(); errors.AddError(null, ErrorMessageOne); } --- 65,69 ---- public void AddErrorWithNullKey() { ! IValidationErrors errors = new ValidationErrors(); errors.AddError(null, ErrorMessageOne); } *************** *** 72,76 **** public void AddErrorSunnyDay() { ! ValidationErrors errors = new ValidationErrors(); errors.AddError(GoodErrorKey, ErrorMessageOne); Assert.IsFalse(errors.IsEmpty); --- 72,76 ---- public void AddErrorSunnyDay() { ! IValidationErrors errors = new ValidationErrors(); errors.AddError(GoodErrorKey, ErrorMessageOne); Assert.IsFalse(errors.IsEmpty); *************** *** 82,86 **** public void AddTwoErrorsSameKey() { ! ValidationErrors errors = new ValidationErrors(); errors.AddError(GoodErrorKey, ErrorMessageOne); errors.AddError(GoodErrorKey, ErrorMessageTwo); --- 82,86 ---- public void AddTwoErrorsSameKey() { ! IValidationErrors errors = new ValidationErrors(); errors.AddError(GoodErrorKey, ErrorMessageOne); errors.AddError(GoodErrorKey, ErrorMessageTwo); *************** *** 93,97 **** public void EmptyErrorsReturnEmptyCollections() { ! ValidationErrors errors = new ValidationErrors(); IList typedErrors = errors.GetErrors("xyz"); --- 93,97 ---- public void EmptyErrorsReturnEmptyCollections() { ! IValidationErrors errors = new ValidationErrors(); IList typedErrors = errors.GetErrors("xyz"); *************** *** 107,111 **** public void MergeErrorsWithNull() { ! ValidationErrors errors = new ValidationErrors(); errors.AddError(GoodErrorKey, ErrorMessageOne); errors.AddError(GoodErrorKey, ErrorMessageTwo); --- 107,111 ---- public void MergeErrorsWithNull() { ! IValidationErrors errors = new ValidationErrors(); errors.AddError(GoodErrorKey, ErrorMessageOne); errors.AddError(GoodErrorKey, ErrorMessageTwo); *************** *** 127,131 **** ! ValidationErrors errors = new ValidationErrors(); errors.AddError(GoodErrorKey, ErrorMessageOne); errors.MergeErrors(otherErrors); --- 127,131 ---- ! IValidationErrors errors = new ValidationErrors(); errors.AddError(GoodErrorKey, ErrorMessageOne); errors.MergeErrors(otherErrors); Index: ValidatorGroupTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/ValidatorGroupTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ValidatorGroupTests.cs 9 Apr 2006 07:24:52 -0000 1.3 --- ValidatorGroupTests.cs 5 Feb 2008 20:40:26 -0000 1.4 *************** *** 48,52 **** vg.Validators.Add(new FalseValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 48,52 ---- vg.Validators.Add(new FalseValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 66,70 **** vg.Validators.Add(new TrueValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 66,70 ---- vg.Validators.Add(new TrueValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 84,88 **** vg.Validators.Add(new FalseValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 84,88 ---- vg.Validators.Add(new FalseValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 103,107 **** vg.Validators = validators; ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 103,107 ---- vg.Validators = validators; ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); Index: CollectionValidatorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/CollectionValidatorTests.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CollectionValidatorTests.cs 8 Aug 2007 17:48:45 -0000 1.5 --- CollectionValidatorTests.cs 5 Feb 2008 20:40:26 -0000 1.6 *************** *** 81,85 **** setPersons.AddAll(listPersons); ! ValidationErrors ve = new ValidationErrors(); Assert.IsTrue(validator.Validate(listPersons, ve)); --- 81,85 ---- setPersons.AddAll(listPersons); ! IValidationErrors ve = new ValidationErrors(); Assert.IsTrue(validator.Validate(listPersons, ve)); *************** *** 123,127 **** validator.Validators.Add(req); ! ValidationErrors ve = new ValidationErrors(); Assert.IsFalse(validator.Validate(persons, ve)); --- 123,127 ---- validator.Validators.Add(req); ! IValidationErrors ve = new ValidationErrors(); Assert.IsFalse(validator.Validate(persons, ve)); *************** *** 202,206 **** soc.Members.Add(new TestObject("Ivan Cikic", 28)); ! ValidationErrors err1 = new ValidationErrors(); Assert.IsTrue(validator.Validate(soc, err1)); --- 202,206 ---- soc.Members.Add(new TestObject("Ivan Cikic", 28)); ! IValidationErrors err1 = new ValidationErrors(); Assert.IsTrue(validator.Validate(soc, err1)); Index: ExclusiveValidatorGroupTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/ExclusiveValidatorGroupTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExclusiveValidatorGroupTests.cs 9 Apr 2006 07:24:52 -0000 1.3 --- ExclusiveValidatorGroupTests.cs 5 Feb 2008 20:40:26 -0000 1.4 *************** *** 48,52 **** vg.Validators.Add(new FalseValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 48,52 ---- vg.Validators.Add(new FalseValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 69,73 **** vg.Validators.Add(new TrueValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 69,73 ---- vg.Validators.Add(new TrueValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 90,94 **** vg.Validators.Add(new FalseValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 90,94 ---- vg.Validators.Add(new FalseValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 108,112 **** vg.Validators.Add(new FalseValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 108,112 ---- vg.Validators.Add(new FalseValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); Index: ValidatorReferenceTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/ValidatorReferenceTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ValidatorReferenceTests.cs 9 Apr 2006 07:24:52 -0000 1.2 --- ValidatorReferenceTests.cs 5 Feb 2008 20:40:27 -0000 1.3 *************** *** 46,50 **** v.Name = "validator"; ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(v.Validate(null, null, errors)); --- 46,50 ---- v.Name = "validator"; ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(v.Validate(null, null, errors)); *************** *** 62,66 **** v.Name = "validator"; ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(v.Validate(null, null, errors)); Assert.IsFalse(v.Validate(null, errors)); --- 62,66 ---- v.Name = "validator"; ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(v.Validate(null, null, errors)); Assert.IsFalse(v.Validate(null, errors)); *************** *** 83,87 **** v1.Name = "cv1"; ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(v1.Validate(context, null, errors)); --- 83,87 ---- v1.Name = "cv1"; ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(v1.Validate(context, null, errors)); Index: AnyValidatorGroupTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/AnyValidatorGroupTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AnyValidatorGroupTests.cs 9 Apr 2006 07:24:52 -0000 1.3 --- AnyValidatorGroupTests.cs 5 Feb 2008 20:40:26 -0000 1.4 *************** *** 45,49 **** vg.Validators.Add(new FalseValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 45,49 ---- vg.Validators.Add(new FalseValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 63,67 **** vg.Validators.Add(new TrueValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 63,67 ---- vg.Validators.Add(new TrueValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 81,85 **** vg.Validators.Add(new FalseValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 81,85 ---- vg.Validators.Add(new FalseValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); *************** *** 98,102 **** vg.Validators.Add(new FalseValidator()); ! ValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); --- 98,102 ---- vg.Validators.Add(new FalseValidator()); ! IValidationErrors errors = new ValidationErrors(); errors.AddError("existingErrors", new ErrorMessage("error", null)); |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:50
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/test/Spring/Spring.Core.Tests/Validation/Validators Modified Files: ConditionValidatorTests.cs CreditCardValidatorTests.cs EmailValidatorTests.cs ISBNValidatorTests.cs RequiredValidatorTests.cs UrlValidatorTests.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: ConditionValidatorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators/ConditionValidatorTests.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ConditionValidatorTests.cs 9 Apr 2006 07:24:53 -0000 1.8 --- ConditionValidatorTests.cs 5 Feb 2008 20:40:27 -0000 1.9 *************** *** 74,78 **** ConditionValidator validator = new ConditionValidator(Expression.Parse("Name == 'Nikola Tesla'"), null); validator.Actions = new ErrorMessageAction[] {new ErrorMessageAction("Wrong name", "InventorValidator") }; ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(tesla, errors)); Assert.IsFalse(errors.IsEmpty); --- 74,78 ---- ConditionValidator validator = new ConditionValidator(Expression.Parse("Name == 'Nikola Tesla'"), null); validator.Actions = new ErrorMessageAction[] {new ErrorMessageAction("Wrong name", "InventorValidator") }; ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(tesla, errors)); Assert.IsFalse(errors.IsEmpty); *************** *** 89,93 **** validator.Test = Expression.Parse("false"); validator.When = Expression.Parse("false"); ! ValidationErrors errors = new ValidationErrors(); bool valid = validator.Validate(new object(), null, errors); --- 89,93 ---- validator.Test = Expression.Parse("false"); validator.When = Expression.Parse("false"); ! IValidationErrors errors = new ValidationErrors(); bool valid = validator.Validate(new object(), null, errors); Index: RequiredValidatorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators/RequiredValidatorTests.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RequiredValidatorTests.cs 9 Apr 2006 07:24:53 -0000 1.6 --- RequiredValidatorTests.cs 5 Feb 2008 20:40:27 -0000 1.7 *************** *** 42,46 **** RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("null"); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 42,46 ---- RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("null"); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 50,54 **** { RequiredValidator validator = new RequiredValidator("0", null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 50,54 ---- { RequiredValidator validator = new RequiredValidator("0", null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 58,62 **** { RequiredValidator validator = new RequiredValidator(Expression.Parse("100"), null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } --- 58,62 ---- { RequiredValidator validator = new RequiredValidator(Expression.Parse("100"), null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } *************** *** 67,71 **** RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("-100"); ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } --- 67,71 ---- RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("-100"); ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } *************** *** 75,79 **** { RequiredValidator validator = new RequiredValidator("''", null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 75,79 ---- { RequiredValidator validator = new RequiredValidator("''", null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 83,87 **** { RequiredValidator validator = new RequiredValidator(Expression.Parse("' '"), null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 83,87 ---- { RequiredValidator validator = new RequiredValidator(Expression.Parse("' '"), null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 92,96 **** RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("'some non-empty string'"); ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } --- 92,96 ---- RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("'some non-empty string'"); ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } *************** *** 100,104 **** { RequiredValidator validator = new RequiredValidator("DateTime.Today", null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } --- 100,104 ---- { RequiredValidator validator = new RequiredValidator("DateTime.Today", null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } *************** *** 108,112 **** { RequiredValidator validator = new RequiredValidator(Expression.Parse("DateTime.MinValue"), null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 108,112 ---- { RequiredValidator validator = new RequiredValidator(Expression.Parse("DateTime.MinValue"), null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 117,121 **** RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("DateTime.MaxValue"); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 117,121 ---- RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("DateTime.MaxValue"); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 125,129 **** { RequiredValidator validator = new RequiredValidator("0.00F", null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 125,129 ---- { RequiredValidator validator = new RequiredValidator("0.00F", null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 133,137 **** { RequiredValidator validator = new RequiredValidator(Expression.Parse("5.25F"), null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } --- 133,137 ---- { RequiredValidator validator = new RequiredValidator(Expression.Parse("5.25F"), null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } *************** *** 141,145 **** { RequiredValidator validator = new RequiredValidator("0.00D", null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 141,145 ---- { RequiredValidator validator = new RequiredValidator("0.00D", null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 149,153 **** { RequiredValidator validator = new RequiredValidator("5.25D", null); ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } --- 149,153 ---- { RequiredValidator validator = new RequiredValidator("5.25D", null); ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } *************** *** 158,162 **** RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("char.MinValue"); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 158,162 ---- RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("char.MinValue"); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 167,171 **** RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("' '.ToCharArray()[0]"); ! ValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } --- 167,171 ---- RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("' '.ToCharArray()[0]"); ! IValidationErrors errors = new ValidationErrors(); Assert.IsFalse(validator.Validate(null, errors)); } *************** *** 176,180 **** RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("'xyz'.ToCharArray()[1]"); ! ValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } --- 176,180 ---- RequiredValidator validator = new RequiredValidator(); validator.Test = Expression.Parse("'xyz'.ToCharArray()[1]"); ! IValidationErrors errors = new ValidationErrors(); Assert.IsTrue(validator.Validate(null, errors)); } *************** *** 184,188 **** { RequiredValidator validator = new RequiredValidator("DateTime.MinValue", "false"); ! ValidationErrors errors = new ValidationErrors(); bool valid = validator.Validate(new object(), null, errors); --- 184,188 ---- { RequiredValidator validator = new RequiredValidator("DateTime.MinValue", "false"); ! IValidationErrors errors = new ValidationErrors(); bool valid = validator.Validate(new object(), null, errors); Index: ISBNValidatorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators/ISBNValidatorTests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ISBNValidatorTests.cs 8 Feb 2007 02:18:58 -0000 1.1 --- ISBNValidatorTests.cs 5 Feb 2008 20:40:27 -0000 1.2 *************** *** 56,70 **** Assert.IsFalse(validator.Validate("a789g70002343", new ValidationErrors())); Assert.IsFalse(validator.Validate("978907000234x", new ValidationErrors())); ! Assert.IsFalse(validator.Validate("", new ValidationErrors())); ! Assert.IsFalse(validator.Validate(" ", new ValidationErrors())); } - - [Test] - [ExpectedException(typeof(ArgumentException))] - public void WithNull() - { - ISBNValidator validator = new ISBNValidator(); - Assert.IsFalse(validator.Validate(null, new ValidationErrors())); - } } } --- 56,63 ---- Assert.IsFalse(validator.Validate("a789g70002343", new ValidationErrors())); Assert.IsFalse(validator.Validate("978907000234x", new ValidationErrors())); ! Assert.IsTrue(validator.Validate("", new ValidationErrors())); ! Assert.IsTrue(validator.Validate(" ", new ValidationErrors())); ! Assert.IsTrue(validator.Validate(null, new ValidationErrors())); } } } Index: CreditCardValidatorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators/CreditCardValidatorTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CreditCardValidatorTests.cs 19 Feb 2007 17:56:42 -0000 1.2 --- CreditCardValidatorTests.cs 5 Feb 2008 20:40:27 -0000 1.3 *************** *** 42,55 **** Assert.IsTrue(validator.Validate("378282246310005", new ValidationErrors())); Assert.IsFalse(validator.Validate("444444444", new ValidationErrors())); ! Assert.IsFalse(validator.Validate(" ", new ValidationErrors())); ! Assert.IsFalse(validator.Validate("", new ValidationErrors())); ! } ! ! [Test] ! [ExpectedException(typeof(ArgumentException))] ! public void WithNull() ! { ! CreditCardValidator validator = new CreditCardValidator(); ! Assert.IsFalse(validator.Validate(null, new ValidationErrors())); } } --- 42,48 ---- Assert.IsTrue(validator.Validate("378282246310005", new ValidationErrors())); Assert.IsFalse(validator.Validate("444444444", new ValidationErrors())); ! Assert.IsTrue(validator.Validate(" ", new ValidationErrors())); ! Assert.IsTrue(validator.Validate("", new ValidationErrors())); ! Assert.IsTrue(validator.Validate(null, new ValidationErrors())); } } Index: UrlValidatorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators/UrlValidatorTests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UrlValidatorTests.cs 8 Feb 2007 02:18:58 -0000 1.1 --- UrlValidatorTests.cs 5 Feb 2008 20:40:27 -0000 1.2 *************** *** 59,73 **** Assert.IsFalse(validator.Validate("http://1.1", new ValidationErrors())); Assert.IsFalse(validator.Validate("ht:1.1", new ValidationErrors())); ! Assert.IsFalse(validator.Validate("/:www.1.com", new ValidationErrors())); ! Assert.IsFalse(validator.Validate("", new ValidationErrors())); ! Assert.IsFalse(validator.Validate(" ", new ValidationErrors())); ! } ! ! [Test] ! [ExpectedException(typeof(ArgumentException))] ! public void WithNull() ! { ! UrlValidator validator = new UrlValidator(); ! Assert.IsFalse(validator.Validate(null, new ValidationErrors())); } } --- 59,66 ---- Assert.IsFalse(validator.Validate("http://1.1", new ValidationErrors())); Assert.IsFalse(validator.Validate("ht:1.1", new ValidationErrors())); ! Assert.IsFalse(validator.Validate("/:www.1.com", new ValidationErrors())); ! Assert.IsTrue(validator.Validate("", new ValidationErrors())); ! Assert.IsTrue(validator.Validate(" ", new ValidationErrors())); ! Assert.IsTrue(validator.Validate(null, new ValidationErrors())); } } Index: EmailValidatorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Validators/EmailValidatorTests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EmailValidatorTests.cs 8 Feb 2007 02:18:58 -0000 1.1 --- EmailValidatorTests.cs 5 Feb 2008 20:40:27 -0000 1.2 *************** *** 55,68 **** Assert.IsFalse(validator.Validate("goran@@", new ValidationErrors())); Assert.IsFalse(validator.Validate("goran@eu s4hc.com", new ValidationErrors())); ! Assert.IsFalse(validator.Validate(" ", new ValidationErrors())); ! Assert.IsFalse(validator.Validate("", new ValidationErrors())); ! } ! ! [Test] ! [ExpectedException(typeof(ArgumentException))] ! public void WithNull() ! { ! EmailValidator validator = new EmailValidator(); ! Assert.IsFalse(validator.Validate(null, new ValidationErrors())); } } --- 55,61 ---- Assert.IsFalse(validator.Validate("goran@@", new ValidationErrors())); Assert.IsFalse(validator.Validate("goran@eu s4hc.com", new ValidationErrors())); ! Assert.IsTrue(validator.Validate(" ", new ValidationErrors())); ! Assert.IsTrue(validator.Validate("", new ValidationErrors())); ! Assert.IsTrue(validator.Validate(null, new ValidationErrors())); } } |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:50
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/src/Spring/Spring.Core/Validation Modified Files: AnyValidatorGroup.cs BaseValidationAction.cs BaseValidator.cs CollectionValidator.cs ExclusiveValidatorGroup.cs IValidationAction.cs IValidator.cs ValidationErrors.cs ValidatorGroup.cs ValidatorReference.cs Added Files: IValidationErrors.cs ValidationException.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: ValidatorReference.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/ValidatorReference.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ValidatorReference.cs 9 Apr 2006 07:19:01 -0000 1.4 --- ValidatorReference.cs 5 Feb 2008 20:40:26 -0000 1.5 *************** *** 93,97 **** /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public bool Validate(object validationContext, ValidationErrors errors) { return Validate(validationContext, null, errors); --- 93,97 ---- /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public bool Validate(object validationContext, IValidationErrors errors) { return Validate(validationContext, null, errors); *************** *** 105,109 **** /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public bool Validate(object validationContext, IDictionary contextParams, ValidationErrors errors) { if (Context != null) --- 105,109 ---- /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public bool Validate(object validationContext, IDictionary contextParams, IValidationErrors errors) { if (Context != null) Index: ValidationErrors.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/ValidationErrors.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ValidationErrors.cs 31 Jul 2007 03:47:23 -0000 1.8 --- ValidationErrors.cs 5 Feb 2008 20:40:26 -0000 1.9 *************** *** 27,32 **** using System.Xml.Serialization; using Spring.Context; - using Spring.Core; - using Spring.Objects; using Spring.Util; --- 27,30 ---- *************** *** 49,53 **** /// <version>$Id$</version> [Serializable] ! public sealed class ValidationErrors : IXmlSerializable { #region Constructors --- 47,51 ---- /// <version>$Id$</version> [Serializable] ! public class ValidationErrors : IValidationErrors, IXmlSerializable { #region Constructors *************** *** 177,198 **** /// instance's collection of errors. /// </summary> ! /// <param name="key"> ! /// The key that should be used for message grouping; can't be /// <see lang="null"/>. /// </param> /// <param name="message">The error message to add.</param> /// <exception cref="System.ArgumentNullException"> ! /// If the supplied <paramref name="key"/> or <paramref name="message"/> is <see langword="null"/>. /// </exception> ! public void AddError(string key, ErrorMessage message) { ! AssertUtils.ArgumentNotNull(key, "key"); AssertUtils.ArgumentNotNull(message, "errorMessage"); ! IList errors = (IList) errorMap[key]; if (errors == null) { errors = new ArrayList(); ! errorMap[key] = errors; } errors.Add(message); --- 175,196 ---- /// instance's collection of errors. /// </summary> ! /// <param name="provider"> ! /// The provider that should be used for message grouping; can't be /// <see lang="null"/>. /// </param> /// <param name="message">The error message to add.</param> /// <exception cref="System.ArgumentNullException"> ! /// If the supplied <paramref name="provider"/> or <paramref name="message"/> is <see langword="null"/>. /// </exception> ! public void AddError(string provider, ErrorMessage message) { ! AssertUtils.ArgumentNotNull(provider, "provider"); AssertUtils.ArgumentNotNull(message, "errorMessage"); ! IList errors = (IList) errorMap[provider]; if (errors == null) { errors = new ArrayList(); ! errorMap[provider] = errors; } errors.Add(message); *************** *** 232,271 **** /// <summary> ! /// Gets the list of errors for the supplied lookup <paramref name="key"/>. /// </summary> /// <remarks> /// <p> ! /// If there are no errors for the supplied lookup <paramref name="key"/>, /// an <b>empty</b> <see cref="System.Collections.IList"/> will be returned. /// </p> /// </remarks> ! /// <param name="key">Error key that was used to group messages.</param> /// <returns> ! /// A list of all <see cref="ErrorMessage"/>s for the supplied lookup <paramref name="key"/>. /// </returns> ! public IList GetErrors(string key) { ! IList errors = (IList) errorMap[key]; return errors == null ? ObjectUtils.EmptyObjects : errors; } /// <summary> ! /// Gets the list of resolved error messages for the supplied lookup <paramref name="key"/>. /// </summary> /// <remarks> /// <p> ! /// If there are no errors for the supplied lookup <paramref name="key"/>, /// an <b>empty</b> <see cref="System.Collections.IList"/> will be returned. /// </p> /// </remarks> ! /// <param name="key">Error key that was used to group messages.</param> /// <param name="messageSource"><see cref="IMessageSource"/> to resolve messages against.</param> /// <returns> ! /// A list of resolved error messages for the supplied lookup <paramref name="key"/>. /// </returns> ! public IList GetResolvedErrors(string key, IMessageSource messageSource) { IList messages = new ArrayList(); ! IList errors = (IList) errorMap[key]; if (errors != null) --- 230,269 ---- /// <summary> ! /// Gets the list of errors for the supplied lookup <paramref name="provider"/>. /// </summary> /// <remarks> /// <p> ! /// If there are no errors for the supplied lookup <paramref name="provider"/>, /// an <b>empty</b> <see cref="System.Collections.IList"/> will be returned. /// </p> /// </remarks> ! /// <param name="provider">Error key that was used to group messages.</param> /// <returns> ! /// A list of all <see cref="ErrorMessage"/>s for the supplied lookup <paramref name="provider"/>. /// </returns> ! public IList GetErrors(string provider) { ! IList errors = (IList) errorMap[provider]; return errors == null ? ObjectUtils.EmptyObjects : errors; } /// <summary> ! /// Gets the list of resolved error messages for the supplied lookup <paramref name="provider"/>. /// </summary> /// <remarks> /// <p> ! /// If there are no errors for the supplied lookup <paramref name="provider"/>, /// an <b>empty</b> <see cref="System.Collections.IList"/> will be returned. /// </p> /// </remarks> ! /// <param name="provider">Error key that was used to group messages.</param> /// <param name="messageSource"><see cref="IMessageSource"/> to resolve messages against.</param> /// <returns> ! /// A list of resolved error messages for the supplied lookup <paramref name="provider"/>. /// </returns> ! public IList GetResolvedErrors(string provider, IMessageSource messageSource) { IList messages = new ArrayList(); ! IList errors = (IList) errorMap[provider]; if (errors != null) *************** *** 284,288 **** #region Data members ! private IDictionary errorMap = new Hashtable(); #endregion --- 282,286 ---- #region Data members ! private readonly IDictionary errorMap = new Hashtable(); #endregion Index: BaseValidationAction.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/BaseValidationAction.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BaseValidationAction.cs 9 Apr 2006 07:19:01 -0000 1.5 --- BaseValidationAction.cs 5 Feb 2008 20:40:26 -0000 1.6 *************** *** 79,83 **** /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! public virtual void Execute(bool isValid, object validationContext, IDictionary contextParams, ValidationErrors errors) { if (EvaluateWhen(validationContext, contextParams)) --- 79,83 ---- /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! public virtual void Execute(bool isValid, object validationContext, IDictionary contextParams, IValidationErrors errors) { if (EvaluateWhen(validationContext, contextParams)) *************** *** 104,108 **** /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected virtual void OnValid(object validationContext, IDictionary contextParams, ValidationErrors errors) {} --- 104,108 ---- /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected virtual void OnValid(object validationContext, IDictionary contextParams, IValidationErrors errors) {} *************** *** 113,117 **** /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected virtual void OnInvalid(object validationContext, IDictionary contextParams, ValidationErrors errors) {} --- 113,117 ---- /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected virtual void OnInvalid(object validationContext, IDictionary contextParams, IValidationErrors errors) {} Index: ValidatorGroup.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/ValidatorGroup.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ValidatorGroup.cs 9 Apr 2006 07:19:01 -0000 1.9 --- ValidatorGroup.cs 5 Feb 2008 20:40:26 -0000 1.10 *************** *** 94,98 **** /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public override bool Validate(object validationContext, IDictionary contextParams, ValidationErrors errors) { bool valid = true; --- 94,98 ---- /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public override bool Validate(object validationContext, IDictionary contextParams, IValidationErrors errors) { bool valid = true; Index: BaseValidator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/BaseValidator.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BaseValidator.cs 9 Apr 2006 07:19:01 -0000 1.11 --- BaseValidator.cs 5 Feb 2008 20:40:26 -0000 1.12 *************** *** 123,127 **** /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public bool Validate(object validationContext, ValidationErrors errors) { return Validate(validationContext, null, errors); --- 123,127 ---- /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public bool Validate(object validationContext, IValidationErrors errors) { return Validate(validationContext, null, errors); *************** *** 135,139 **** /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public virtual bool Validate(object validationContext, IDictionary contextParams, ValidationErrors errors) { bool valid = true; --- 135,139 ---- /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public virtual bool Validate(object validationContext, IDictionary contextParams, IValidationErrors errors) { bool valid = true; *************** *** 195,199 **** /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected void ProcessActions(bool isValid, object validationContext, IDictionary contextParams, ValidationErrors errors) { if (actions != null && actions.Count > 0) --- 195,199 ---- /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected void ProcessActions(bool isValid, object validationContext, IDictionary contextParams, IValidationErrors errors) { if (actions != null && actions.Count > 0) --- NEW FILE: ValidationException.cs --- (This appears to be a binary file; contents omitted.) Index: IValidator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/IValidator.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IValidator.cs 9 Apr 2006 07:19:01 -0000 1.7 --- IValidator.cs 5 Feb 2008 20:40:26 -0000 1.8 *************** *** 43,47 **** /// custom validation ligic being implemented in an override of the /// <see lang="abstract"/> ! /// <see cref="BaseValidator.Validate(object, ValidationErrors)"/> /// template method. /// </p> --- 43,47 ---- /// custom validation ligic being implemented in an override of the /// <see lang="abstract"/> ! /// <see cref="BaseValidator.Validate(object, IValidationErrors)"/> /// template method. /// </p> *************** *** 63,67 **** /// <see lang="true"/> if validation was successful. /// </returns> ! bool Validate(object validationContext, ValidationErrors errors); /// <summary> --- 63,67 ---- /// <see lang="true"/> if validation was successful. /// </returns> ! bool Validate(object validationContext, IValidationErrors errors); /// <summary> *************** *** 77,81 **** /// <see lang="true"/> if validation was successful. /// </returns> ! bool Validate(object validationContext, IDictionary contextParams, ValidationErrors errors); } --- 77,81 ---- /// <see lang="true"/> if validation was successful. /// </returns> ! bool Validate(object validationContext, IDictionary contextParams, IValidationErrors errors); } --- NEW FILE: IValidationErrors.cs --- using System.Collections; using Spring.Context; namespace Spring.Validation { /// <summary> /// An interface that validation errors containers have to implement. /// </summary> /// <author>Aleksandar Seovic</author> /// <version>$Id: IValidationErrors.cs,v 1.1 2008/02/05 20:40:26 aseovic Exp $</version> public interface IValidationErrors { /// <summary> /// Does this instance contain any validation errors? /// </summary> /// <remarks> /// <p> /// If this returns <see lang="true"/>, this means that it (obviously) /// contains no validation errors. /// </p> /// </remarks> /// <value><see lang="true"/> if this instance is empty.</value> bool IsEmpty { get; } /// <summary> /// Gets the list of all error providers. /// </summary> IList Providers { get; } /// <summary> /// Adds the supplied <paramref name="message"/> to this /// instance's collection of errors. /// </summary> /// <param name="provider"> /// The provider that should be used for message grouping; can't be /// <see lang="null"/>. /// </param> /// <param name="message">The error message to add.</param> /// <exception cref="System.ArgumentNullException"> /// If the supplied <paramref name="provider"/> or <paramref name="message"/> is <see langword="null"/>. /// </exception> void AddError(string provider, ErrorMessage message); /// <summary> /// Merges another instance of <see cref="ValidationErrors"/> into this one. /// </summary> /// <remarks> /// <p> /// If the supplied <paramref name="errorsToMerge"/> is <see lang="null"/>, /// then no errors will be added to this instance, and this method will /// (silently) return. /// </p> /// </remarks> /// <param name="errorsToMerge"> /// The validation errors to merge; can be <see lang="null"/>. /// </param> void MergeErrors(ValidationErrors errorsToMerge); /// <summary> /// Gets the list of errors for the supplied error <paramref name="provider"/>. /// </summary> /// <remarks> /// <p> /// If there are no errors for the supplied <paramref name="provider"/>, /// an <b>empty</b> <see cref="System.Collections.IList"/> will be returned. /// </p> /// </remarks> /// <param name="provider">Error key that was used to group messages.</param> /// <returns> /// A list of all <see cref="ErrorMessage"/>s for the supplied lookup <paramref name="provider"/>. /// </returns> IList GetErrors(string provider); /// <summary> /// Gets the list of resolved error messages for the supplied lookup <paramref name="provider"/>. /// </summary> /// <remarks> /// <p> /// If there are no errors for the supplied lookup <paramref name="provider"/>, /// an <b>empty</b> <see cref="System.Collections.IList"/> will be returned. /// </p> /// </remarks> /// <param name="provider">Error key that was used to group messages.</param> /// <param name="messageSource"><see cref="IMessageSource"/> to resolve messages against.</param> /// <returns> /// A list of resolved error messages for the supplied lookup <paramref name="provider"/>. /// </returns> IList GetResolvedErrors(string provider, IMessageSource messageSource); } } Index: CollectionValidator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/CollectionValidator.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CollectionValidator.cs 10 Oct 2007 18:10:17 -0000 1.4 --- CollectionValidator.cs 5 Feb 2008 20:40:26 -0000 1.5 *************** *** 140,144 **** /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public override bool Validate(object validationContext, IDictionary contextParams, ValidationErrors errors) { if (Context != null) --- 140,144 ---- /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public override bool Validate(object validationContext, IDictionary contextParams, IValidationErrors errors) { if (Context != null) *************** *** 164,168 **** // OR to pass validation errors collection that was passed to this method //(and collect all error messages returned by the item validators) ! ValidationErrors err = (includeElementErrors)? errors : new ValidationErrors(); foreach (object objectToValidate in collectionToValidate) --- 164,168 ---- // OR to pass validation errors collection that was passed to this method //(and collect all error messages returned by the item validators) ! IValidationErrors err = (includeElementErrors)? errors : new ValidationErrors(); foreach (object objectToValidate in collectionToValidate) Index: ExclusiveValidatorGroup.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/ExclusiveValidatorGroup.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ExclusiveValidatorGroup.cs 28 Feb 2007 20:30:25 -0000 1.7 --- ExclusiveValidatorGroup.cs 5 Feb 2008 20:40:26 -0000 1.8 *************** *** 73,79 **** /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public override bool Validate(object validationContext, IDictionary contextParams, ValidationErrors errors) { ! ValidationErrors tmpErrors = new ValidationErrors(); bool valid = true; --- 73,79 ---- /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public override bool Validate(object validationContext, IDictionary contextParams, IValidationErrors errors) { ! IValidationErrors tmpErrors = new ValidationErrors(); bool valid = true; Index: IValidationAction.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/IValidationAction.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IValidationAction.cs 9 Apr 2006 07:19:01 -0000 1.3 --- IValidationAction.cs 5 Feb 2008 20:40:26 -0000 1.4 *************** *** 53,57 **** /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! void Execute(bool isValid, object validationContext, IDictionary contextParams, ValidationErrors errors); } } \ No newline at end of file --- 53,57 ---- /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! void Execute(bool isValid, object validationContext, IDictionary contextParams, IValidationErrors errors); } } \ No newline at end of file Index: AnyValidatorGroup.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/AnyValidatorGroup.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AnyValidatorGroup.cs 9 Apr 2006 07:19:01 -0000 1.8 --- AnyValidatorGroup.cs 5 Feb 2008 20:40:26 -0000 1.9 *************** *** 74,78 **** /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public override bool Validate(object validationContext, IDictionary contextParams, ValidationErrors errors) { ValidationErrors tmpErrors = new ValidationErrors(); --- 74,78 ---- /// <param name="errors"><see cref="ValidationErrors"/> instance to add error messages to.</param> /// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns> ! public override bool Validate(object validationContext, IDictionary contextParams, IValidationErrors errors) { ValidationErrors tmpErrors = new ValidationErrors(); |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:50
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/DataBinding In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/src/Spring/Spring.Core/DataBinding Modified Files: AbstractBinding.cs AbstractSimpleBinding.cs BaseBindingContainer.cs IBinding.cs ListBinding.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: IBinding.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/DataBinding/IBinding.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IBinding.cs 7 Dec 2006 06:40:35 -0000 1.2 --- IBinding.cs 5 Feb 2008 20:40:25 -0000 1.3 *************** *** 23,27 **** /// Validation errors collection that type conversion errors should be added to. /// </param> ! void BindSourceToTarget(object source, object target, ValidationErrors validationErrors); /// <summary> --- 23,27 ---- /// Validation errors collection that type conversion errors should be added to. /// </param> ! void BindSourceToTarget(object source, object target, IValidationErrors validationErrors); /// <summary> *************** *** 40,44 **** /// Variables that should be used during expression evaluation. /// </param> ! void BindSourceToTarget(object source, object target, ValidationErrors validationErrors, IDictionary variables); /// <summary> --- 40,44 ---- /// Variables that should be used during expression evaluation. /// </param> ! void BindSourceToTarget(object source, object target, IValidationErrors validationErrors, IDictionary variables); /// <summary> *************** *** 54,58 **** /// Validation errors collection that type conversion errors should be added to. /// </param> ! void BindTargetToSource(object source, object target, ValidationErrors validationErrors); /// <summary> --- 54,58 ---- /// Validation errors collection that type conversion errors should be added to. /// </param> ! void BindTargetToSource(object source, object target, IValidationErrors validationErrors); /// <summary> *************** *** 71,75 **** /// Variables that should be used during expression evaluation. /// </param> ! void BindTargetToSource(object source, object target, ValidationErrors validationErrors, IDictionary variables); /// <summary> --- 71,75 ---- /// Variables that should be used during expression evaluation. /// </param> ! void BindTargetToSource(object source, object target, IValidationErrors validationErrors, IDictionary variables); /// <summary> Index: AbstractBinding.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/DataBinding/AbstractBinding.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractBinding.cs 21 Nov 2006 05:46:57 -0000 1.1 --- AbstractBinding.cs 5 Feb 2008 20:40:25 -0000 1.2 *************** *** 90,94 **** /// Validation errors collection that type conversion errors should be added to. /// </param> ! public void BindSourceToTarget(object source, object target, ValidationErrors validationErrors) { BindSourceToTarget(source, target, validationErrors, null); --- 90,94 ---- /// Validation errors collection that type conversion errors should be added to. /// </param> ! public void BindSourceToTarget(object source, object target, IValidationErrors validationErrors) { BindSourceToTarget(source, target, validationErrors, null); *************** *** 107,111 **** /// Validation errors collection that type conversion errors should be added to. /// </param> ! public void BindTargetToSource(object source, object target, ValidationErrors validationErrors) { BindTargetToSource(source, target, validationErrors, null); --- 107,111 ---- /// Validation errors collection that type conversion errors should be added to. /// </param> ! public void BindTargetToSource(object source, object target, IValidationErrors validationErrors) { BindTargetToSource(source, target, validationErrors, null); *************** *** 127,131 **** /// Variables that should be used during expression evaluation. /// </param> ! public abstract void BindSourceToTarget(object source, object target, ValidationErrors validationErrors, IDictionary variables); /// <summary> --- 127,131 ---- /// Variables that should be used during expression evaluation. /// </param> ! public abstract void BindSourceToTarget(object source, object target, IValidationErrors validationErrors, IDictionary variables); /// <summary> *************** *** 144,148 **** /// Variables that should be used during expression evaluation. /// </param> ! public abstract void BindTargetToSource(object source, object target, ValidationErrors validationErrors, IDictionary variables); /// <summary> --- 144,148 ---- /// Variables that should be used during expression evaluation. /// </param> ! public abstract void BindTargetToSource(object source, object target, IValidationErrors validationErrors, IDictionary variables); /// <summary> Index: AbstractSimpleBinding.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/DataBinding/AbstractSimpleBinding.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AbstractSimpleBinding.cs 27 Aug 2007 13:57:18 -0000 1.3 --- AbstractSimpleBinding.cs 5 Feb 2008 20:40:25 -0000 1.4 *************** *** 70,74 **** /// Variables that should be used during expression evaluation. /// </param> ! public override void BindSourceToTarget(object source, object target, ValidationErrors validationErrors, IDictionary variables) { --- 70,74 ---- /// Variables that should be used during expression evaluation. /// </param> ! public override void BindSourceToTarget(object source, object target, IValidationErrors validationErrors, IDictionary variables) { *************** *** 137,141 **** /// Variables that should be used during expression evaluation. /// </param> ! public override void BindTargetToSource(object source, object target, ValidationErrors validationErrors, IDictionary variables) { --- 137,141 ---- /// Variables that should be used during expression evaluation. /// </param> ! public override void BindTargetToSource(object source, object target, IValidationErrors validationErrors, IDictionary variables) { Index: BaseBindingContainer.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/DataBinding/BaseBindingContainer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BaseBindingContainer.cs 21 Nov 2006 05:46:57 -0000 1.1 --- BaseBindingContainer.cs 5 Feb 2008 20:40:25 -0000 1.2 *************** *** 175,179 **** /// Validation errors collection that type conversion errors should be added to. /// </param> ! public void BindSourceToTarget(object source, object target, ValidationErrors validationErrors) { BindSourceToTarget(source, target, validationErrors, null); --- 175,179 ---- /// Validation errors collection that type conversion errors should be added to. /// </param> ! public void BindSourceToTarget(object source, object target, IValidationErrors validationErrors) { BindSourceToTarget(source, target, validationErrors, null); *************** *** 195,199 **** /// Variables that should be used during expression evaluation. /// </param> ! public virtual void BindSourceToTarget(object source, object target, ValidationErrors validationErrors, IDictionary variables) { --- 195,199 ---- /// Variables that should be used during expression evaluation. /// </param> ! public virtual void BindSourceToTarget(object source, object target, IValidationErrors validationErrors, IDictionary variables) { *************** *** 216,220 **** /// Validation errors collection that type conversion errors should be added to. /// </param> ! public void BindTargetToSource(object source, object target, ValidationErrors validationErrors) { BindTargetToSource(source, target, validationErrors, null); --- 216,220 ---- /// Validation errors collection that type conversion errors should be added to. /// </param> ! public void BindTargetToSource(object source, object target, IValidationErrors validationErrors) { BindTargetToSource(source, target, validationErrors, null); *************** *** 236,240 **** /// Variables that should be used during expression evaluation. /// </param> ! public virtual void BindTargetToSource(object source, object target, ValidationErrors validationErrors, IDictionary variables) { --- 236,240 ---- /// Variables that should be used during expression evaluation. /// </param> ! public virtual void BindTargetToSource(object source, object target, IValidationErrors validationErrors, IDictionary variables) { Index: ListBinding.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/DataBinding/ListBinding.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ListBinding.cs 29 Nov 2006 18:59:07 -0000 1.1 --- ListBinding.cs 5 Feb 2008 20:40:25 -0000 1.2 *************** *** 32,36 **** /// Variables that should be used during expression evaluation. /// </param> ! public override void BindSourceToTarget(object source, object target, ValidationErrors validationErrors, IDictionary variables) { --- 32,36 ---- /// Variables that should be used during expression evaluation. /// </param> ! public override void BindSourceToTarget(object source, object target, IValidationErrors validationErrors, IDictionary variables) { *************** *** 60,64 **** /// Variables that should be used during expression evaluation. /// </param> ! public override void BindTargetToSource(object source, object target, ValidationErrors validationErrors, IDictionary variables) { --- 60,64 ---- /// Variables that should be used during expression evaluation. /// </param> ! public override void BindTargetToSource(object source, object target, IValidationErrors validationErrors, IDictionary variables) { |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:50
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Actions In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/src/Spring/Spring.Core/Validation/Actions Modified Files: ErrorMessageAction.cs ExpressionAction.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: ExpressionAction.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Actions/ExpressionAction.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ExpressionAction.cs 9 Apr 2006 07:19:01 -0000 1.5 --- ExpressionAction.cs 5 Feb 2008 20:40:25 -0000 1.6 *************** *** 89,93 **** /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected override void OnValid(object validationContext, IDictionary contextParams, ValidationErrors errors) { if (Valid != null) --- 89,93 ---- /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected override void OnValid(object validationContext, IDictionary contextParams, IValidationErrors errors) { if (Valid != null) *************** *** 103,107 **** /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected override void OnInvalid(object validationContext, IDictionary contextParams, ValidationErrors errors) { if (Invalid != null) --- 103,107 ---- /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected override void OnInvalid(object validationContext, IDictionary contextParams, IValidationErrors errors) { if (Invalid != null) Index: ErrorMessageAction.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Actions/ErrorMessageAction.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ErrorMessageAction.cs 9 Apr 2006 07:19:01 -0000 1.4 --- ErrorMessageAction.cs 5 Feb 2008 20:40:25 -0000 1.5 *************** *** 71,75 **** /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected override void OnInvalid(object validationContext, IDictionary contextParams, ValidationErrors errors) { ErrorMessage error = CreateErrorMessage(validationContext, contextParams); --- 71,75 ---- /// <param name="contextParams">Additional context parameters.</param> /// <param name="errors">Validation errors container.</param> ! protected override void OnInvalid(object validationContext, IDictionary contextParams, IValidationErrors errors) { ErrorMessage error = CreateErrorMessage(validationContext, contextParams); |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:50
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/test/Spring/Spring.Core.Tests Modified Files: Spring.Core.Tests.2005.csproj Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: Spring.Core.Tests.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2005.csproj,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** Spring.Core.Tests.2005.csproj 29 Jan 2008 20:11:19 -0000 1.72 --- Spring.Core.Tests.2005.csproj 5 Feb 2008 20:40:26 -0000 1.73 *************** *** 681,684 **** --- 681,685 ---- <Compile Include="Validation\ExclusiveValidatorGroupTests.cs" /> <Compile Include="Validation\HelperClasses.cs" /> + <Compile Include="Validation\ValidationExceptionTests.cs" /> <Compile Include="Validation\ValidationConfigParserTests.cs"> <SubType>Code</SubType> |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:49
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/DataBinding In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/src/Spring/Spring.Web/DataBinding Modified Files: HttpRequestBindingContainer.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: HttpRequestBindingContainer.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/DataBinding/HttpRequestBindingContainer.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HttpRequestBindingContainer.cs 14 Dec 2007 17:47:26 -0000 1.5 --- HttpRequestBindingContainer.cs 5 Feb 2008 20:40:26 -0000 1.6 *************** *** 97,101 **** /// Variables that should be used during expression evaluation. /// </param> ! public override void BindSourceToTarget(object source, object target, ValidationErrors validationErrors, IDictionary variables) { HttpRequest request; --- 97,101 ---- /// Variables that should be used during expression evaluation. /// </param> ! public override void BindSourceToTarget(object source, object target, IValidationErrors validationErrors, IDictionary variables) { HttpRequest request; *************** *** 163,167 **** /// Variables that should be used during expression evaluation. /// </param> ! public override void BindTargetToSource(object source, object target, ValidationErrors validationErrors, IDictionary variables) { // can't bind to a read-only Request object... --- 163,167 ---- /// Variables that should be used during expression evaluation. /// </param> ! public override void BindTargetToSource(object source, object target, IValidationErrors validationErrors, IDictionary variables) { // can't bind to a read-only Request object... |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:49
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/src/Spring/Spring.Core Modified Files: Spring.Core.2005.csproj Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: Spring.Core.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Spring.Core.2005.csproj,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** Spring.Core.2005.csproj 4 Feb 2008 22:42:49 -0000 1.114 --- Spring.Core.2005.csproj 5 Feb 2008 20:40:25 -0000 1.115 *************** *** 999,1003 **** --- 999,1005 ---- <SubType>Code</SubType> </Compile> + <Compile Include="Validation\ValidationException.cs" /> <Compile Include="Validation\IValidationAction.cs" /> + <Compile Include="Validation\IValidationErrors.cs" /> <Compile Include="Validation\IValidator.cs"> <SubType>Code</SubType> |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:49
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Actions In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/test/Spring/Spring.Core.Tests/Validation/Actions Modified Files: ErrorMessageActionTests.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: ErrorMessageActionTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Validation/Actions/ErrorMessageActionTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ErrorMessageActionTests.cs 9 Apr 2006 07:24:52 -0000 1.3 --- ErrorMessageActionTests.cs 5 Feb 2008 20:40:26 -0000 1.4 *************** *** 75,79 **** { Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); ! ValidationErrors errors = new ValidationErrors(); ErrorMessageAction action = new ErrorMessageAction("error", "errors"); --- 75,79 ---- { Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); ! IValidationErrors errors = new ValidationErrors(); ErrorMessageAction action = new ErrorMessageAction("error", "errors"); *************** *** 86,90 **** { Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); ! ValidationErrors errors = new ValidationErrors(); ErrorMessageAction action = new ErrorMessageAction("{0}, {1}", "errors"); --- 86,90 ---- { Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); ! IValidationErrors errors = new ValidationErrors(); ErrorMessageAction action = new ErrorMessageAction("{0}, {1}", "errors"); *************** *** 101,105 **** { Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); ! ValidationErrors errors = new ValidationErrors(); ErrorMessageAction action = new ErrorMessageAction("{0}, {1}", "errors"); --- 101,105 ---- { Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); ! IValidationErrors errors = new ValidationErrors(); ErrorMessageAction action = new ErrorMessageAction("{0}, {1}", "errors"); |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:49
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/UI In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/src/Spring/Spring.Web/Web/UI Modified Files: Page.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: Page.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/UI/Page.cs,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** Page.cs 2 Feb 2008 09:12:44 -0000 1.86 --- Page.cs 5 Feb 2008 20:40:26 -0000 1.87 *************** *** 117,121 **** private IMessageSource messageSource; private IBindingContainer bindingManager; ! private ValidationErrors validationErrors = new ValidationErrors(); private IDictionary results; --- 117,121 ---- private IMessageSource messageSource; private IBindingContainer bindingManager; ! private IValidationErrors validationErrors = new ValidationErrors(); private IDictionary results; *************** *** 1143,1147 **** /// </summary> /// <value>The validation errors container.</value> ! public ValidationErrors ValidationErrors { get { return validationErrors; } --- 1143,1147 ---- /// </summary> /// <value>The validation errors container.</value> ! public IValidationErrors ValidationErrors { get { return validationErrors; } |
From: Aleksandar S. <as...@us...> - 2008-02-05 20:40:49
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/src/Spring/Spring.Core/Validation/Validators Modified Files: CreditCardValidator.cs EmailValidator.cs ISBNValidator.cs UrlValidator.cs Log Message: Extracted IValidationErrors interface and made ValidationErrors non-sealed. Added ValidationException class. Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty. Index: CreditCardValidator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators/CreditCardValidator.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CreditCardValidator.cs 27 Aug 2007 09:38:56 -0000 1.2 --- CreditCardValidator.cs 5 Feb 2008 20:40:26 -0000 1.3 *************** *** 114,120 **** { string text = objectToValidate as string; ! if (text == null) { ! throw new ArgumentException("Test for CreditCardValidator must evaluate to a string."); } --- 114,120 ---- { string text = objectToValidate as string; ! if (StringUtils.IsNullOrEmpty(text)) { ! return true; } Index: UrlValidator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators/UrlValidator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UrlValidator.cs 8 Feb 2007 02:18:58 -0000 1.1 --- UrlValidator.cs 5 Feb 2008 20:40:26 -0000 1.2 *************** *** 85,91 **** { string text = objectToValidate as string; ! if (text == null) { ! throw new ArgumentException("Test for UrlValidator must evaluate to a string."); } --- 85,91 ---- { string text = objectToValidate as string; ! if (StringUtils.IsNullOrEmpty(text)) { ! return true; } Index: EmailValidator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators/EmailValidator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EmailValidator.cs 8 Feb 2007 02:18:58 -0000 1.1 --- EmailValidator.cs 5 Feb 2008 20:40:26 -0000 1.2 *************** *** 93,99 **** { string text = objectToValidate as string; ! if (text == null) { ! throw new ArgumentException("Test for EmailValidator must evaluate to a string."); } --- 93,99 ---- { string text = objectToValidate as string; ! if (StringUtils.IsNullOrEmpty(text)) { ! return true; } Index: ISBNValidator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators/ISBNValidator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ISBNValidator.cs 8 Feb 2007 02:18:58 -0000 1.1 --- ISBNValidator.cs 5 Feb 2008 20:40:26 -0000 1.2 *************** *** 86,92 **** { String isbn = objectToValidate as String; ! if (isbn == null) { ! throw new ArgumentException("Test for ISBNValidator must evaluate to a string."); } --- 86,92 ---- { String isbn = objectToValidate as String; ! if (StringUtils.IsNullOrEmpty(isbn)) { ! return true; } |