Examples of RegexConstraint


Examples of org.ocpsoft.rewrite.param.RegexConstraint

      MockEvaluationContext context = new MockEvaluationContext();
      ParameterUtils.initialize(context, requestParam);
      ParameterStore store = DefaultParameterStore.getInstance(context);

      ((ParameterConfiguration<?>) store.get("value")).constrainedBy(new RegexConstraint("(cab|xxx)"));
      Assert.assertFalse(requestParam.evaluate(rewrite, context));
   }
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

   }

   @Override
   public ConfigurationRuleParameterBuilder matches(final String pattern)
   {
      param.constrainedBy(new RegexConstraint(pattern));
      return this;
   }
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

   @Override
   public Set<Parameter<?>> getParameters()
   {
      Set<Parameter<?>> result = new LinkedHashSet<Parameter<?>>();
      result.add(new ImmutableParameter(new DefaultParameter("*").constrainedBy(new RegexConstraint(".*"))));
      return result;
   }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.constraint.RegexConstraint

                    IntegerRangeConstraint ic = new IntegerRangeConstraint(longMin, longMax);
                    toConstraints.add(ic);
                } else if (constraint instanceof RegexConstraintType) {
                    RegexConstraintType regexDetails = (RegexConstraintType) constraint;

                    RegexConstraint rc = new RegexConstraint();
                    rc.setDetails(regexDetails.getExpression());

                    toConstraints.add(rc);
                } else {
                    // this will only occur if we change the .xsd schema and add a type but forget to add to the code above
                    throw new InvalidPluginDescriptorException("Unknown constraint type: " + fromC);
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.constraint.RegexConstraint

        pd.setSummary(true);
        pd.setOrder(0);
        pd.setAllowCustomEnumeratedValue(false);
        pd.setConfigurationDefinition(configDef);

        RegexConstraint constraint = new RegexConstraint();
        constraint.setDetails(PROP_NAME_REGEX_PATTERN);
        pd.addConstraints(constraint);

        return pd;
    }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.constraint.RegexConstraint

        pd.setReadOnly(readOnly);
        pd.setSummary(true);
        pd.setOrder(1);
        pd.setAllowCustomEnumeratedValue(false);

        RegexConstraint constraint = new RegexConstraint();
        constraint.setDetails(PROP_BASEDIR_PATH_REGEX_PATTERN);
        pd.addConstraints(constraint);

        return pd;
    }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.constraint.RegexConstraint

        pd.setSummary(true);
        pd.setOrder(0);
        pd.setAllowCustomEnumeratedValue(false);
        pd.setDefaultValue(".");

        RegexConstraint constraint = new RegexConstraint();
        constraint.setDetails(PROP_FILTER_PATH_REGEX_PATTERN);
        pd.addConstraints(constraint);

        return pd;
    }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.constraint.RegexConstraint

        pd.setReadOnly(readOnly);
        pd.setSummary(true);
        pd.setOrder(1);
        pd.setAllowCustomEnumeratedValue(false);

        RegexConstraint constraint = new RegexConstraint();
        constraint.setDetails(PROP_FILTER_PATTERN_REGEX_PATTERN);
        pd.addConstraints(constraint);

        return pd;
    }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.constraint.RegexConstraint

                doubleRangeValidator.setMaximum(maxValue);
            }

            validator = doubleRangeValidator;
        } else if (constraint instanceof RegexConstraint) {
            RegexConstraint regexConstraint = (RegexConstraint) constraint;
            validator = new RegexValidator(regexConstraint.getDetails());
        } else {
            throw new IllegalArgumentException("Unknown constraint type: " + constraint.getClass().getName());
        }

        return validator;
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.constraint.RegexConstraint

        PropertyDefinitionSimple alpha = def.getPropertyDefinitionSimple("alpha");
        assert alpha.getType() == PropertySimpleType.STRING;
        assert alpha.isRequired();
        assert alpha.getConstraints().size() == 1;
        RegexConstraint regexConstraint = (RegexConstraint) alpha.getConstraints().iterator().next();
        assert regexConstraint.getDetails().equals("^\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}$");

        PropertyDefinitionSimple bravo = def.getPropertyDefinitionSimple("bravo");
        assert bravo.getType() == PropertySimpleType.STRING;
        assert bravo.getEnumeratedValues().size() == 4;
        assert bravo.getEnumeratedValues().get(0).getName().equals("First Option Name");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.