SPRNET-1234

This commit is contained in:
eeichinger
2009-07-26 17:49:40 +00:00
parent 96a447f7c3
commit 6091e9c491
18 changed files with 329 additions and 187 deletions

View File

@@ -1,4 +1,4 @@
Changes (1.2.0 to 1.2.1 or greater)
Changes (1.2.0 to 1.3 or greater)
========================
Spring.Core
@@ -32,6 +32,8 @@ Spring.Core
4. AbstractApplicationContext.CaseSensitive renamed to AbstractApplicationContext.IsCaseSensitive
5. Spring.Validation: Base class BaseValidator changed to BaseSingleValidator for single validators as compared to group validators
which now commonly derive from BaseGroupValidator instead of ValidatorGroup
Spring.Aop
----------

View File

@@ -1044,6 +1044,8 @@
<Compile Include="Util\StringUtils.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Validation\BaseSimpleValidator.cs" />
<Compile Include="Validation\BaseValidatorGroup.cs" />
<Compile Include="Validation\Actions\ErrorMessageAction.cs" />
<Compile Include="Validation\Actions\ExpressionAction.cs" />
<Compile Include="Validation\AnyValidatorGroup.cs">

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright 2002-2004 the original author or authors.
* Copyright 2002-2009 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.
@@ -19,7 +19,6 @@
#endregion
using System.Collections;
using Spring.Expressions;
namespace Spring.Validation
@@ -37,9 +36,11 @@ namespace Spring.Validation
/// for the contained validators, but only if this validator is not valid (meaning, when none
/// of the contained validators are valid).
/// </p>
/// <p><b>Note</b>, that <see cref="BaseValidatorGroup.FastValidate"/> defaults to <c>true</c> for this validator type!</p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
public class AnyValidatorGroup : ValidatorGroup
/// <author>Erich Eichinger</author>
public class AnyValidatorGroup : BaseValidatorGroup
{
#region Constructors
@@ -55,7 +56,8 @@ namespace Spring.Validation
/// Initializes a new instance of the <see cref="AnyValidatorGroup"/> class.
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public AnyValidatorGroup(string when) : base(when)
public AnyValidatorGroup(string when)
: base(when)
{
this.FastValidate = true;
}
@@ -64,7 +66,8 @@ namespace Spring.Validation
/// Initializes a new instance of the <see cref="AnyValidatorGroup"/> class.
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public AnyValidatorGroup(IExpression when) : base(when)
public AnyValidatorGroup(IExpression when)
: base(when)
{
this.FastValidate = true;
}
@@ -80,6 +83,7 @@ namespace Spring.Validation
/// <returns><c>True</c> if validation was successful, <c>False</c> otherwise.</returns>
protected override bool ValidateGroup(IDictionary contextParams, IValidationErrors errors, object validationContext)
{
// capture errors in separate collection to only add them to the error collector in case of errors
ValidationErrors tmpErrors = new ValidationErrors();
bool valid = false;
foreach (IValidator validator in Validators)

View File

@@ -0,0 +1,123 @@
#region License
/*
* Copyright <20> 2002-2009 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.Collections;
using Spring.Expressions;
namespace Spring.Validation
{
/// <summary>
/// Base class that defines common properties for all single validators.
/// </summary>
/// <remarks>
/// <p>
/// Custom single validators should always extend this class instead of
/// simply implementing <see cref="IValidator"/> interface, in
/// order to inherit common validator functionality.
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
/// <author>Erich Eichinger</author>
public abstract class BaseSimpleValidator : BaseValidator
{
private IExpression test;
/// <summary>
/// Gets or sets the test expression.
/// </summary>
/// <value>The test expression.</value>
public IExpression Test
{
get { return test; }
set { test = value; }
}
/// <summary>
/// Creates a new instance of the validator without any <see cref="Test"/>
/// and <see cref="BaseValidator.When"/> criteria
/// </summary>
public BaseSimpleValidator()
{
}
/// <summary>
/// Creates a new instance of the <see cref="BaseValidator"/> class.
/// </summary>
/// <param name="test">The expression to validate.</param>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public BaseSimpleValidator(string test, string when)
: base( when)
{
this.test = (test != null ? Expression.Parse(test) : null);
}
/// <summary>
/// Creates a new instance of the <see cref="BaseValidator"/> class.
/// </summary>
/// <param name="test">The expression to validate.</param>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public BaseSimpleValidator(IExpression test, IExpression when):base(when)
{
this.test = test;
}
/// <summary>
/// Validates the specified object.
/// </summary>
/// <param name="validationContext">The object to validate.</param>
/// <param name="contextParams">Additional context parameters.</param>
/// <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;
if (EvaluateWhen(validationContext, contextParams))
{
valid = Validate(EvaluateTest(validationContext, contextParams));
ProcessActions(valid, validationContext, contextParams, errors);
}
return valid;
}
/// <summary>
/// Validates test object.
/// </summary>
/// <param name="objectToValidate">Object to validate.</param>
/// <returns><c>True</c> if specified object is valid, <c>False</c> otherwise.</returns>
protected abstract bool Validate(object objectToValidate);
/// <summary>
/// Evaluates test expression.
/// </summary>
/// <param name="rootContext">Root context to use for expression evaluation.</param>
/// <param name="contextParams">Additional context parameters.</param>
/// <returns>Result of the test expression evaluation, or validation context if test is <c>null</c>.</returns>
protected object EvaluateTest(object rootContext, IDictionary contextParams)
{
if (Test == null)
{
return rootContext;
}
return Test.GetValue(rootContext, contextParams);
}
}
}

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright <20> 2002-2005 the original author or authors.
* Copyright <20> 2002-2009 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.
@@ -18,15 +18,10 @@
#endregion
#region Imports
using System;
using System.Collections;
using Spring.Expressions;
#endregion
namespace Spring.Validation
{
/// <summary>
@@ -40,13 +35,13 @@ namespace Spring.Validation
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
/// <author>Erich Eichinger</author>
public abstract class BaseValidator : IValidator
{
#region Fields
private IList actions = new ArrayList();
private IExpression test;
private IExpression when;
#endregion
@@ -62,20 +57,17 @@ namespace Spring.Validation
/// <summary>
/// Creates a new instance of the <see cref="BaseValidator"/> class.
/// </summary>
/// <param name="test">The expression to validate.</param>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public BaseValidator(string test, string when)
: this((test != null ? Expression.Parse(test) : null), (when != null ? Expression.Parse(when) : null))
public BaseValidator(string when)
: this((when != null ? Expression.Parse(when) : null))
{}
/// <summary>
/// Creates a new instance of the <see cref="BaseValidator"/> class.
/// </summary>
/// <param name="test">The expression to validate.</param>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public BaseValidator(IExpression test, IExpression when)
public BaseValidator(IExpression when)
{
this.test = test;
this.when = when;
}
@@ -83,16 +75,6 @@ namespace Spring.Validation
#region Properties
/// <summary>
/// Gets or sets the test expression.
/// </summary>
/// <value>The test expression.</value>
public IExpression Test
{
get { return test; }
set { test = value; }
}
/// <summary>
/// Gets or sets the expression that determines if this validator should be evaluated.
/// </summary>
@@ -133,43 +115,10 @@ namespace Spring.Validation
/// <param name="contextParams">Additional context parameters.</param>
/// <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;
if (EvaluateWhen(validationContext, contextParams))
{
valid = Validate(EvaluateTest(validationContext, contextParams));
ProcessActions(valid, validationContext, contextParams, errors);
}
return valid;
}
/// <summary>
/// Validates test object.
/// </summary>
/// <param name="objectToValidate">Object to validate.</param>
/// <returns><c>True</c> if specified object is valid, <c>False</c> otherwise.</returns>
protected abstract bool Validate(object objectToValidate);
public abstract bool Validate(object validationContext, IDictionary contextParams, IValidationErrors errors);
#region Helper Methods
/// <summary>
/// Evaluates test expression.
/// </summary>
/// <param name="rootContext">Root context to use for expression evaluation.</param>
/// <param name="contextParams">Additional context parameters.</param>
/// <returns>Result of the test expression evaluation, or validation context if test is <c>null</c>.</returns>
protected object EvaluateTest(object rootContext, IDictionary contextParams)
{
if (Test == null)
{
return rootContext;
}
return Test.GetValue(rootContext, contextParams);
}
/// <summary>
/// Evaluates when expression.
/// </summary>

View File

@@ -0,0 +1,111 @@
#region License
/*
* Copyright <20> 2002-2009 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.Collections;
using Spring.Expressions;
namespace Spring.Validation
{
/// <summary>
/// Base class for composite validators
/// </summary>
public abstract class BaseValidatorGroup : BaseValidator
{
// TODO (EE): extend validation schema for "FastValidate"
private IList validators = new ArrayList();
private bool fastValidate = false;
/// <summary>
/// Initializes a new instance
/// </summary>
public BaseValidatorGroup()
{}
/// <summary>
/// Initializes a new instance
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public BaseValidatorGroup(string when)
: base(when)
{}
/// <summary>
/// Initializes a new instance
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public BaseValidatorGroup(IExpression when)
: base(when)
{}
/// <summary>
/// Gets or sets the child validators.
/// </summary>
/// <value>The validators.</value>
public IList Validators
{
get { return validators; }
set { validators = value; }
}
/// <summary>
/// When set <c>true</c>, shortcircuits evaluation.
/// </summary>
/// <remarks>
/// Setting this property true causes the evaluation process to prematurely abort
/// if the end result is known. Any remaining child validators will not be considered then.
/// Setting this value false causes implementations to evaluate all child validators, regardless
/// of the potentially already known result.
/// </remarks>
public bool FastValidate
{
get { return fastValidate; }
set { fastValidate = value; }
}
/// <summary>
/// Validates the specified object.
/// </summary>
/// <param name="validationContext">The object to validate.</param>
/// <param name="contextParams">Additional context parameters.</param>
/// <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 (EvaluateWhen(validationContext, contextParams))
{
bool valid = ValidateGroup(contextParams, errors, validationContext);
ProcessActions(valid, validationContext, contextParams, errors);
return valid;
}
return true;
}
/// <summary>
/// Actual implementation how to validate the specified object.
/// </summary>
/// <param name="validationContext">The object to validate.</param>
/// <param name="contextParams">Additional context parameters.</param>
/// <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>
protected abstract bool ValidateGroup(IDictionary contextParams, IValidationErrors errors, object validationContext);
}
}

View File

@@ -1,3 +1,23 @@
#region License
/*
* Copyright 2002-2009 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.Collections;
using Spring.Expressions;
@@ -13,9 +33,10 @@ namespace Spring.Validation
/// collection are valid for all of the objects in the specified collection.
/// </p>
/// <p>
/// You can specify if you want to validate all of the collection elements regardless of the errors, by
/// setting the <c>ValidateAll</c> property to true.
/// You can specify if you want to validate all of the collection elements regardless of the errors by
/// setting the <see cref="BaseValidatorGroup.FastValidate"/> property to <c>false</c>.
/// </p>
/// <p><b>Note</b>, that <see cref="BaseValidatorGroup.FastValidate"/> defaults to <c>true</c> for this validator type!</p>
/// <p>
/// If you set the <c>IncludeElementErrors</c> property to <c>true</c>,
/// <c>ValidationErrors</c> collection will contain a union of all validation error messages
@@ -25,7 +46,7 @@ namespace Spring.Validation
/// </remarks>
/// <author>Damjan Tomic</author>
/// <author>Aleksandar Seovic</author>
public class CollectionValidator : ValidatorGroup
public class CollectionValidator : BaseValidatorGroup
{
#region Fields
@@ -40,7 +61,7 @@ namespace Spring.Validation
/// Gets or sets the value that indicates whether to validate all elements of the collection
/// regardless of the errors.
/// </summary>
/// <remarks>This is just an alias for <see cref="ValidatorGroup.FastValidate"/></remarks>
/// <remarks>This is just an alias for <see cref="BaseValidatorGroup.FastValidate"/> property</remarks>
public bool ValidateAll
{
get { return !base.FastValidate; }
@@ -102,12 +123,10 @@ namespace Spring.Validation
/// </param>
/// <param name="includeElementErrors">The bool that determines whether Validate method should collect
/// all error messages returned by the item validators</param>
public CollectionValidator(IExpression when, bool validateAll, bool includeElementErrors)
: base(when)
public CollectionValidator(string when, bool validateAll, bool includeElementErrors)
: this((when != null ? Expression.Parse(when) : null), validateAll,includeElementErrors)
{
this.FastValidate = validateAll;
this.includeElementErrors = includeElementErrors;
}
/// <summary>
@@ -119,10 +138,12 @@ namespace Spring.Validation
/// </param>
/// <param name="includeElementErrors">The bool that determines whether Validate method should collect
/// all error messages returned by the item validators</param>
public CollectionValidator(string when, bool validateAll, bool includeElementErrors)
: this((when != null ? Expression.Parse(when) : null), validateAll,includeElementErrors)
public CollectionValidator(IExpression when, bool validateAll, bool includeElementErrors)
: base(when)
{
this.FastValidate = validateAll;
this.includeElementErrors = includeElementErrors;
}
#endregion

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright 2002-2004 the original author or authors.
* Copyright 2002-2009 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.
@@ -19,7 +19,6 @@
#endregion
using System.Collections;
using Spring.Expressions;
namespace Spring.Validation
@@ -37,11 +36,12 @@ namespace Spring.Validation
/// of the contained validators are valid).
/// </p>
/// <p>
/// By default, this validator group uses <c><see cref="ValidatorGroup.FastValidate"/> == true</c> semantics.
/// By default, this validator group uses <c><see cref="BaseValidatorGroup.FastValidate"/> == true</c> semantics.
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
public class ExclusiveValidatorGroup : ValidatorGroup
/// <author>Erich Eichinger</author>
public class ExclusiveValidatorGroup : BaseValidatorGroup
{
#region Constructors
@@ -57,7 +57,8 @@ namespace Spring.Validation
/// Initializes a new instance of the <see cref="ExclusiveValidatorGroup"/> class.
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public ExclusiveValidatorGroup(string when) : base(when)
public ExclusiveValidatorGroup(string when)
: base(when)
{
this.FastValidate = true;
}
@@ -66,7 +67,8 @@ namespace Spring.Validation
/// Initializes a new instance of the <see cref="ExclusiveValidatorGroup"/> class.
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public ExclusiveValidatorGroup(IExpression when) : base(when)
public ExclusiveValidatorGroup(IExpression when)
: base(when)
{
this.FastValidate = true;
}

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright 2002-2004 the original author or authors.
* Copyright 2002-2009 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.
@@ -18,9 +18,7 @@
#endregion
using System;
using System.Collections;
using Spring.Expressions;
namespace Spring.Validation
@@ -39,84 +37,36 @@ namespace Spring.Validation
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
public class ValidatorGroup : BaseValidator
/// <author>Erich Eichinger</author>
public class ValidatorGroup : BaseValidatorGroup
{
#region Fields
private IList validators = new ArrayList();
private bool fastValidate = false;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ValidatorGroup"/> class.
/// Initializes a new instance
/// </summary>
public ValidatorGroup()
{}
/// <summary>
/// Initializes a new instance of the <see cref="ValidatorGroup"/> class.
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public ValidatorGroup(string when) : this((when != null ? Expression.Parse(when) : null))
{}
/// <summary>
/// Initializes a new instance of the <see cref="ValidatorGroup"/> class.
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public ValidatorGroup(IExpression when) : base(null, when)
{}
#endregion
#region Properties
/// <summary>
/// Gets or sets the validators.
/// </summary>
/// <value>The validators.</value>
public IList Validators
public ValidatorGroup() : base()
{
get { return validators; }
set { validators = value; }
}
/// <summary>
/// When set <c>true</c>, shortcircuits evaluation.
/// Initializes a new instance
/// </summary>
/// <remarks>
/// The validators within the group will only be validated
/// in order until the first validator fails.
/// </remarks>
public bool FastValidate
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public ValidatorGroup(string when) : base(when)
{
}
/// <summary>
/// Initializes a new instance
/// </summary>
/// <param name="when">The expression that determines if this validator should be evaluated.</param>
public ValidatorGroup(IExpression when) : base(when)
{
get { return fastValidate; }
set { fastValidate = value; }
}
#endregion
/// <summary>
/// Validates the specified object.
/// </summary>
/// <param name="validationContext">The object to validate.</param>
/// <param name="contextParams">Additional context parameters.</param>
/// <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 (EvaluateWhen(validationContext, contextParams))
{
bool valid = ValidateGroup(contextParams, errors, validationContext);
ProcessActions(valid, validationContext, contextParams, errors);
return valid;
}
return true;
}
/// <summary>
/// Actual implementation how to validate the specified object.
/// </summary>
@@ -124,28 +74,18 @@ namespace Spring.Validation
/// <param name="contextParams">Additional context parameters.</param>
/// <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>
protected virtual bool ValidateGroup(IDictionary contextParams, IValidationErrors errors, object validationContext)
protected override bool ValidateGroup(IDictionary contextParams, IValidationErrors errors, object validationContext)
{
bool valid = true;
foreach (IValidator validator in validators)
foreach (IValidator validator in this.Validators)
{
valid = validator.Validate(validationContext, contextParams, errors) && valid;
if (!valid && FastValidate)
if (!valid && this.FastValidate)
{
break;
}
}
return valid;
}
/// <summary>
/// Doesn't do anything for validator group as there is no single test.
/// </summary>
/// <param name="objectToValidate">Object to validate.</param>
/// <returns><c>True</c> if specified object is valid, <c>False</c> otherwise.</returns>
protected override bool Validate(object objectToValidate)
{
throw new NotSupportedException("Validator group does not support this method.");
}
}
}

View File

@@ -33,7 +33,7 @@ namespace Spring.Validation
/// Evaluates validator test using condition evaluator.
/// </summary>
/// <author>Aleksandar Seovic</author>
public class ConditionValidator : BaseValidator
public class ConditionValidator : BaseSimpleValidator
{
#region Constructors

View File

@@ -37,7 +37,7 @@ namespace Spring.Validation.Validators
/// the value of <see cref="CardType"/> property to a concrete <see cref="ICreditCardType"/>
/// instance.
/// </remarks>
public class CreditCardValidator : BaseValidator
public class CreditCardValidator : BaseSimpleValidator
{
#region Properties

View File

@@ -39,7 +39,7 @@ namespace Spring.Validation.Validators
/// pass validator, even though there is no TLD "nowhere".
/// </remarks>
/// <author>Goran Milosavljevic</author>
public class EmailValidator : BaseValidator
public class EmailValidator : BaseSimpleValidator
{
#region Constructors

View File

@@ -33,7 +33,7 @@ namespace Spring.Validation.Validators
/// Validates that the object is valid ISBN-10 or ISBN-13 value.
/// </summary>
/// <author>Goran Milosavljevic</author>
public class ISBNValidator : BaseValidator
public class ISBNValidator : BaseSimpleValidator
{
#region Constructors

View File

@@ -40,7 +40,7 @@ namespace Spring.Validation
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
public class RegularExpressionValidator : BaseValidator
public class RegularExpressionValidator : BaseSimpleValidator
{
#region Fields

View File

@@ -68,7 +68,7 @@ namespace Spring.Validation
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
public class RequiredValidator : BaseValidator
public class RequiredValidator : BaseSimpleValidator
{
#region Constructors

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright 2002-2005 the original author or authors.
* Copyright 2002-2009 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.
@@ -18,31 +18,27 @@
#endregion
#region Imports
using System;
using System.Text.RegularExpressions;
using Spring.Expressions;
using Spring.Util;
#endregion
namespace Spring.Validation.Validators
{
/// <summary>
/// Validates that the value is valid URL.
/// </summary>
/// <author>Goran Milosavljevic</author>
public class UrlValidator : BaseValidator
public class UrlValidator : BaseSimpleValidator
{
#region Constructors
/// <summary>
/// Creates a new instance of the <b>UrlValidator</b> class.
/// </summary>
#region Constructors
/// <summary>
/// Creates a new instance of the <b>UrlValidator</b> class.
/// </summary>
public UrlValidator()
{}
{
}
/// <summary>
/// Creates a new instance of the <b>UrlValidator</b> class.
/// </summary>

View File

@@ -27,7 +27,7 @@ using Spring.Validation.Actions;
namespace Spring.Validation
{
public abstract class BaseTestValidator : BaseValidator
public abstract class BaseTestValidator : BaseSimpleValidator
{
private bool _wasCalled;

View File

@@ -129,13 +129,5 @@ namespace Spring.Validation
Assert.AreEqual(0, errors.GetErrors("errors").Count);
Assert.AreEqual(1, errors.GetErrors("existingErrors").Count);
}
[Test]
[ExpectedException(typeof(NotSupportedException))]
public void TestNonSupportedValidateMethod()
{
this.Validate("xyz");
}
}
}