Package org.apache.fulcrum.intake.model

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


    }

    public void testBasicConfigLoads() throws Exception {

        Group group = intakeService.getGroup("LoginGroup");

        File file = new File( BASEDIR, "target/appData.ser");
        assertTrue(
            "Make sure serialized data file exists:" + file,
            file.exists());

        assertNotNull(group);
        assertEquals("loginGroupKey", group.getGID());
        assertEquals("LoginGroup", group.getIntakeGroupName());

        Group group2 = intakeService.getGroup("AnotherGroup");
        assertNotNull(group2);
        assertEquals("anotherGroupKey", group2.getGID());
        assertEquals("AnotherGroup", group2.getIntakeGroupName());
    }
View Full Code Here


    public void testFacadeConfigured() throws Exception
    {
        // this.lookup causes the workflow service to be configured.
        IntakeService is = (IntakeService) this.resolve( IntakeService.class.getName() );
        Group group = is.getGroup("LoginGroup");
        assertNotNull(group);
        assertTrue(IntakeServiceFacade.isInitialized());
        group = IntakeServiceFacade.getGroup("LoginGroup");
    assertNotNull(group);
    }
View Full Code Here

    }

    public void testInterfaceMapTo() throws Exception
    {
        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

    }

    public void testEmptyBooleanField() throws Exception
    {
        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

    }

    public void testBooleanField() throws Exception
    {
        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

    }

    public void testRequiredBooleanField() throws Exception
    {
        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

    }
   
    public void testInvalidNumberMessage() throws Exception // TRB-74
    {
        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)
View Full Code Here

        intakeTool.init(getRunData());
        File file = new File("./target/appData.ser");
        assertTrue(
            "Make sure serialized data file exists:" + file,
            file.exists());
        Group group = intakeTool.get("LoginGroup","loginGroupKey");
        assertNotNull(group);
        assertEquals("loginGroupKey", group.getGID());
        assertEquals("LoginGroup", group.getIntakeGroupName());
    }
View Full Code Here

TOP

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

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.