Package org.apache.tapestry

Examples of org.apache.tapestry.FieldValidator


        FieldValidatorSource source = mockFieldValidatorSource();
        ComponentResources container = mockComponentResources();
        ComponentResources component = mockComponentResources();
        FieldComponent instance = newMock(FieldComponent.class);
        Location l = mockLocation();
        FieldValidator validator = mockFieldValidator();

        String expression = "required,minLength=5";

        train_getComponent(component, instance);
View Full Code Here


    public void invokes_all_constraint_generators() throws Exception
    {
        getMocksControl().checkOrder(true);

        ValidationConstraintGenerator gen = mockValidationConstraintGenerator();
        FieldValidator fv1 = mockFieldValidator();
        FieldValidator fv2 = mockFieldValidator();
        FieldValidatorSource source = mockFieldValidatorSource();
        Class propertyType = Integer.class;
        AnnotationProvider provider = mockAnnotationProvider();
        String overrideId = "overrideId";
        Messages overrideMessages = mockMessages();
        Field field = mockField();
        Locale locale = Locale.ENGLISH;
        String value = "*VALUE*";

        train_buildConstraints(gen, propertyType, provider, "cons1", "cons2");

        train_createValidator(
                source,
                field,
                "cons1",
                null,
                overrideId,
                overrideMessages,
                locale,
                fv1);

        train_createValidator(
                source,
                field,
                "cons2",
                null,
                overrideId,
                overrideMessages,
                locale,
                fv2);

        fv1.validate(value);
        fv2.validate(value);

        replay();

        FieldValidatorDefaultSource fieldValidatorSource = new FieldValidatorDefaultSourceImpl(gen,
                source);

        FieldValidator composite = fieldValidatorSource.createDefaultValidator(
                field,
                overrideId,
                overrideMessages,
                locale,
                propertyType,
                provider);

        composite.validate(value);

        verify();
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void validator_with_constraint() throws Exception
    {
        ValidationConstraintGenerator gen = mockValidationConstraintGenerator();
        FieldValidator fv = mockFieldValidator();
        FieldValidatorSource source = mockFieldValidatorSource();
        Class propertyType = Integer.class;
        AnnotationProvider provider = mockAnnotationProvider();
        String overrideId = "overrideId";
        Messages overrideMessages = mockMessages();
        Field field = mockField();
        Locale locale = Locale.ENGLISH;

        train_buildConstraints(gen, propertyType, provider, "foo=bar");

        train_createValidator(source, field, "foo", "bar", overrideId, overrideMessages, locale, fv);

        replay();

        FieldValidatorDefaultSource fieldValidatorSource = new FieldValidatorDefaultSourceImpl(gen,
                source);

        FieldValidator composite = fieldValidatorSource.createDefaultValidator(
                field,
                overrideId,
                overrideMessages,
                locale,
                propertyType,
View Full Code Here

        replay();

        FieldValidatorDefaultSource fieldValidatorSource = new FieldValidatorDefaultSourceImpl(gen,
                source);

        FieldValidator composite = fieldValidatorSource.createDefaultValidator(
                field,
                overrideId,
                overrideMessages,
                locale,
                propertyType,
                provider);

        composite.validate(value);

        verify();
    }
View Full Code Here

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, null,
                map);

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, null,
                map);

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, null,
                map);

        FieldValidator fieldValidator = source.createValidators(field, "minlength");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, null,
                map);

        FieldValidator fieldValidator = source.createValidators(field, "required");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, null,
                map);

        FieldValidator fieldValidator = source.createValidators(field, "required,minLength=15");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, null,
                map);

        FieldValidator fieldValidator = source.createValidator(field, "minLength", "5");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.FieldValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.