Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.FieldValidationSupport


    public void process_submission_extracts_value_from_decoder() throws Exception
    {
        MultipartDecoder decoder = mockMultipartDecoder();
        UploadedFile uploadedFile = mockUploadedFile();
        ComponentResources resources = mockComponentResources();
        FieldValidationSupport support = mockFieldValidationSupport();
        FieldValidator validate = mockFieldValidator();

        Upload component = new Upload(null, validate, decoder, null, resources, support);

        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
        expect(uploadedFile.getFileName()).andReturn("foo").anyTimes();

        support.validate(uploadedFile, resources, validate);

        replay();

        component.processSubmission("test");
View Full Code Here


    public void process_submission_ignores_null_value() throws Exception
    {
        MultipartDecoder decoder = mockMultipartDecoder();
        UploadedFile uploadedFile = mockUploadedFile();
        ComponentResources resources = mockComponentResources();
        FieldValidationSupport support = mockFieldValidationSupport();
        FieldValidator validate = mockFieldValidator();

        Upload component = new Upload(null, validate, decoder, null, resources, support);

        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
        expect(uploadedFile.getFileName()).andReturn("").atLeastOnce();

        support.validate(null, resources, validate);


        replay();

        component.processSubmission("test");
View Full Code Here

    {
        MultipartDecoder decoder = mockMultipartDecoder();
        UploadedFile uploadedFile = mockUploadedFile();
        FieldValidator<Object> validate = mockFieldValidator();
        ComponentResources resources = mockComponentResources();
        FieldValidationSupport support = mockFieldValidationSupport();

        Upload component = new Upload(null, validate, decoder, null, resources, support);

        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
        expect(uploadedFile.getFileName()).andReturn("test").atLeastOnce();

        support.validate(uploadedFile, resources, validate);

        replay();

        component.processSubmission("test");
View Full Code Here

        MultipartDecoder decoder = mockMultipartDecoder();
        UploadedFile uploadedFile = mockUploadedFile();
        FieldValidator<Object> validate = mockFieldValidator();
        ValidationTracker tracker = mockValidationTracker();
        ComponentResources resources = mockComponentResources();
        FieldValidationSupport support = mockFieldValidationSupport();

        Upload component = new Upload(null, validate, decoder, tracker, resources, support);

        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
        expect(uploadedFile.getFileName()).andReturn("test").atLeastOnce();

        support.validate(uploadedFile, resources, validate);
        expectLastCall().andThrow(new ValidationException("an error"));

        tracker.recordError(component, "an error");
        replay();
View Full Code Here


        replay();


        FieldValidationSupport support = new FieldValidationSupportImpl(source);

        Object actual = support.parseClient(clientValue, resources, translator);

        assertEquals(actual, clientValue.toUpperCase());

        verify();
    }
View Full Code Here

                new ComponentEventException(ve.getMessage(), null, ve));


        replay();

        FieldValidationSupport support = new FieldValidationSupportImpl(source);

        try
        {
            support.parseClient(clientValue, resources, translator);

            unreachable();
        }
        catch (ValidationException ex)
        {
View Full Code Here

                                               EasyMock.isA(ComponentEventHandler.class))).andThrow(cee);


        replay();

        FieldValidationSupport support = new FieldValidationSupportImpl(source);

        try
        {
            support.parseClient(clientValue, resources, translator);

            unreachable();
        }
        catch (ComponentEventException ex)
        {
View Full Code Here

        expect(translator.parseClient(clientValue, messages)).andReturn("foobar");

        replay();

        FieldValidationSupport support = new FieldValidationSupportImpl(source);

        Object actual = support.parseClient(clientValue, resources, translator);

        assertEquals(actual, "foobar");

        verify();
    }
View Full Code Here

        expect(translator.toClient(value)).andReturn(clientValue);

        replay();

        FieldValidationSupport support = new FieldValidationSupportImpl(source);

        String actual = support.toClient(value, resources, translator);

        assertEquals(actual, clientValue);

        verify();
    }
View Full Code Here

                                               EasyMock.isA(ComponentEventHandler.class))).andAnswer(answer);


        replay();

        FieldValidationSupport support = new FieldValidationSupportImpl(source);

        String actual = support.toClient(value, resources, translator);

        assertEquals(actual, clientValue);

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.FieldValidationSupport

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.