Package org.apache.fulcrum.intake.model

Examples of org.apache.fulcrum.intake.model.Field


            FieldReference ref = (FieldReference)i.next();
            boolean comp_true = true;

            try
            {
                Field refField = group.get(ref.getFieldName());
               
                if (refField.isSet())
                {
                    /*
                     * Fields are processed in sequence so that our
                     * reference field might have been set but not
                     * yet validated. We check this here.
                     */
                    if (!refField.isValidated())
                    {
                        refField.validate();
                    }
                   
                    if (refField.isValid())
                    {
                        try
                        {
                            comp_true = compareCallback.compareValues(ref.getCompare(),
                                    value,
                                    refField.getValue());
                        }
                        catch (ClassCastException e)
                        {
                            throw new IntakeException("Type mismatch comparing " +
                                    value + " with " + refField.getValue(), e);
                        }
                    }
                }
            }
            catch (IntakeException e)
View Full Code Here


    {
        IntakeService is = (IntakeService) this.resolve( IntakeService.class.getName() );
        Group group = is.getGroup("LoginIfcGroup");
        assertNotNull(group);
       
        Field userNameField = group.get("Username");
       
        ParserService ps = (ParserService) this.resolve( ParserService.class.getName() );
        ValueParser pp = ps.getParser(DefaultParameterParser.class);
       
        pp.setString(userNameField.getKey(), "Joe");
        userNameField.init(pp);
        userNameField.validate();
       
        LoginForm form = new LoginForm();
        group.setProperties(form);
       
        assertEquals("User names should be equal", "Joe", form.getUsername());
View Full Code Here

        IntakeService is = (IntakeService) this.resolve( IntakeService.class.getName() );
        Group group = is.getGroup("BooleanTest");
        assertNotNull(group);
        assertTrue(IntakeServiceFacade.isInitialized());
        group = IntakeServiceFacade.getGroup("BooleanTest");
        Field booleanField = group.get("EmptyBooleanTestField");
        assertTrue("The Default Validator of an intake Field type boolean should be BooleanValidator", (booleanField.getValidator() instanceof BooleanValidator));
        assertFalse("An Empty intake Field type boolean should not be required", booleanField.isRequired());
    }
View Full Code Here

        IntakeService is = (IntakeService) this.resolve( IntakeService.class.getName() );
        Group group = is.getGroup("BooleanTest");
        assertNotNull(group);
        assertTrue(IntakeServiceFacade.isInitialized());
        group = IntakeServiceFacade.getGroup("BooleanTest");
        Field booleanField = group.get("BooleanTestField");
        assertTrue("The Default Validator of an intake Field type boolean should be BooleanValidator", (booleanField.getValidator() instanceof BooleanValidator));
        assertFalse("An intake Field type boolean, which is not required, should not be required", booleanField.isRequired());
    }
View Full Code Here

        IntakeService is = (IntakeService) this.resolve( IntakeService.class.getName() );
        Group group = is.getGroup("BooleanTest");
        assertNotNull(group);
        assertTrue(IntakeServiceFacade.isInitialized());
        group = IntakeServiceFacade.getGroup("BooleanTest");
        Field booleanField = group.get("RequiredBooleanTestField");
        assertTrue("The Default Validator of an intake Field type boolean should be BooleanValidator", (booleanField.getValidator() instanceof BooleanValidator));
        assertTrue("An intake Field type boolean, which is required, should be required", booleanField.isRequired());
    }
View Full Code Here

    {
        IntakeService is = (IntakeService) this.resolve( IntakeService.class.getName() );
        Group group = is.getGroup("NumberTest");
        assertNotNull(group);

        Field intField = group.get("EmptyIntegerTestField");
        try
        {
            intField.getValidator().assertValidity("aa");
        }
        catch (ValidationException ve)
        {
            assertEquals("Invalid number message is wrong.", "Entry was not a valid Integer", ve.getMessage());
        }
       
        Field longField = group.get("EmptyLongTestField");
        try
        {
            longField.getValidator().assertValidity("aa");
        }
        catch (ValidationException ve)
        {
            assertEquals("Invalid number message is wrong.", "Entry was not a valid Long", ve.getMessage());
        }

        Field shortField = group.get("EmptyShortTestField");
        try
        {
            shortField.getValidator().assertValidity("aa");
        }
        catch (ValidationException ve)
        {
            assertEquals("Invalid number message is wrong.", "Entry was not a valid Short", ve.getMessage());
        }

        Field floatField = group.get("EmptyFloatTestField");
        try
        {
            floatField.getValidator().assertValidity("aa");
        }
        catch (ValidationException ve)
        {
            assertEquals("Invalid number message is wrong.", "Entry was not a valid Float", ve.getMessage());
        }

        Field doubleField = group.get("EmptyDoubleTestField");
        try
        {
            doubleField.getValidator().assertValidity("aa");
        }
        catch (ValidationException ve)
        {
            assertEquals("Invalid number message is wrong.", "Entry was not a valid Double", ve.getMessage());
        }

        Field bigDecimalField = group.get("EmptyBigDecimalTestField");
        try
        {
            bigDecimalField.getValidator().assertValidity("aa");
        }
        catch (ValidationException ve)
        {
            assertEquals("Invalid number message is wrong.", "Entry was not a valid BigDecimal", ve.getMessage());
        }

        Field numberField = group.get("NumberTestField");
        try
        {
            numberField.getValidator().assertValidity("aa");
        }
        catch (ValidationException ve)
        {
            assertEquals("Invalid number message is wrong.", "Not a number", ve.getMessage());
        }
View Full Code Here

TOP

Related Classes of org.apache.fulcrum.intake.model.Field

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.