Package org.apache.myfaces.trinidad.validator

Examples of org.apache.myfaces.trinidad.validator.RegExpValidator


            return false;
        }

        String[] patterns = (String[])metaData.get(CommonMetaDataKeys.PATTERN);

        RegExpValidator regExpValidator;

        for(String pattern : patterns)
        {
            regExpValidator = (RegExpValidator)facesContext.getApplication()
                                                .createValidator("org.apache.myfaces.trinidad.RegExp");

            regExpValidator.setPattern(pattern);
            regExpValidator.setMessageDetailNoMatch((String)metaData.get(
                CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE));

            if(regExpValidator instanceof ClientValidator && uiComponent instanceof EditableValueHolder)
            {
                ((EditableValueHolder)uiComponent).addValidator(
View Full Code Here


            return false;
        }

        String[] patterns = (String[])metaData.get(CommonMetaDataKeys.PATTERN);

        RegExpValidator regExpValidator;

        for(String pattern : patterns)
        {
            regExpValidator = (RegExpValidator)facesContext.getApplication()
                                                .createValidator("org.apache.myfaces.trinidad.RegExp");

            regExpValidator.setPattern(pattern);
            regExpValidator.setMessageDetailNoMatch((String)metaData.get(
                CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE));

            if(regExpValidator instanceof ClientValidator && uiComponent instanceof EditableValueHolder)
            {
                ((EditableValueHolder)uiComponent).addValidator(
View Full Code Here

            return false;
        }

        String[] patterns = (String[])metaData.get(CommonMetaDataKeys.PATTERN);

        RegExpValidator regExpValidator;

        for(String pattern : patterns)
        {
            regExpValidator = (RegExpValidator)facesContext.getApplication()
                                                .createValidator("org.apache.myfaces.trinidad.RegExp");

            regExpValidator.setPattern(pattern);
            regExpValidator.setMessageDetailNoMatch((String)metaData.get(
                CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE));

            ((EditableValueHolder)uiComponent).addValidator(regExpValidator);
        }
        return true;
View Full Code Here

  public void testNull() throws ValidatorException
  {
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    RegExpValidator validator = new RegExpValidator();

    doTestNull(facesContext, wrapper, validator);
  }
View Full Code Here

  public void testNullContext()
  {
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    RegExpValidator validator = new RegExpValidator();

    doTestNullContext(wrapper, validator);
  }
View Full Code Here

    doTestNullContext(wrapper, validator);
  }

  public void testNullComponent()
  {
    RegExpValidator validator = new RegExpValidator();

    doTestNullComponent(facesContext, validator);
  }
View Full Code Here

  /**
   * Tests that non String objects throw a ValidationException.
   */
  public void testNotString()
  {
    doTestIsNotString(new RegExpValidator());
  }
View Full Code Here

    Mock mock = mock(UIComponent.class);
    UIComponent component = (UIComponent) mock.proxy();

    try
    {
      RegExpValidator validator = new RegExpValidator();
      validator.validate(facesContext, component, "someValue");
      // test fails if it is here

      fail("Expected Null pointer exception");
    }
    catch (NullPointerException npe)
View Full Code Here

  public void testWithPattern()
  {
    Mock mock = mock(UIComponent.class);
    UIComponent component = (UIComponent) mock.proxy();

    RegExpValidator validator = new RegExpValidator();
    validator.setPattern("[1-9]|[1-9][0-9]|[1-9][0-9][0-9]");
    validator.validate(facesContext, component, "15");

    mock.verify();
  }
View Full Code Here

    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    setMockLabelForComponent(wrapper);

    try
    {
      RegExpValidator validator = new RegExpValidator();
      String value = "999999";
      validator.setPattern("");
      validator.validate(facesContext, component, value);
      fail("Expected ValidatorException");
    }
    catch (ValidatorException ve)
    {
      // if exception then fine.
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.validator.RegExpValidator

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.