Package org.drools.factconstraints.client.config

Examples of org.drools.factconstraints.client.config.SimpleConstraintConfigurationImpl


  public static ConstraintConfiguration getEmptyConfiguration(String constraintName) {
    return copyConfig(getAllConfigurations().get(constraintName));
  }

  private static ConstraintConfiguration copyConfig(ConstraintConfiguration constraintConfiguration) {
    return new SimpleConstraintConfigurationImpl(constraintConfiguration);
  }
View Full Code Here


public class ConstraintsConstrainerTest {

    @Test
    public void test() {
    LinkedList<ConstraintConfiguration> list = new LinkedList<ConstraintConfiguration>();
    ConstraintConfiguration conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("age");
       
        list.add(conf);
    ConstraintsContainer cc = new ConstraintsContainer(list);
    assertTrue(cc.hasConstraints("Person"));
    assertFalse(cc.hasConstraints("Person3"));
   
    assertEquals(1, cc.getConstraints("Person").size());
   
    conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("name");
       
        cc.addConstraint(conf);
        assertEquals(2, cc.getConstraints("Person").size());
        assertEquals(1, cc.getConstraints("Person", "age").size());
        assertSame(conf, cc.getConstraints("Person", "name").get(0));
        assertEquals(0, cc.getConstraints("Person", "toothCount").size());
       
        conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Pet");
        conf.setFieldName("name");
   
        cc.addConstraint(conf);
       
        assertEquals(1, cc.getConstraints("Pet").size());
       
View Full Code Here

    private ConstraintConfiguration conf;
    private Constraint cons;
   
    @Before
    public void setup() {
        conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("name");
        conf.setArgumentValue(NotMatchesConstraint.NOT_MATCHES_ARGUMENT, "^[A-Z].*$");
       
        cons = new NotMatchesConstraint();
View Full Code Here

    private ConstraintConfiguration conf;

    @Before
    public void setup() {
        cons = new RangeConstraint();
        conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("age");

        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MIN, "0");
        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MAX, "120");
View Full Code Here

    private ConstraintConfiguration conf;

    @Before
    public void setup() {
        conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("age");
    }
View Full Code Here

    private ConstraintConfiguration conf;

    @Before
    public void setup() {
        cons = new RangeConstraint();
        conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("age");
    }
View Full Code Here

        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MIN, "0");
        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MAX, "120");
        System.out.println("Validation Rule:\n" + cons.getVerifierRule(conf) + "\n\n");

        //salary constraint
        ConstraintConfiguration salaryCons = new SimpleConstraintConfigurationImpl();
        salaryCons.setFactType("Person");
        salaryCons.setFieldName("salary");
        salaryCons.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MIN, "0");
        salaryCons.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MAX, "1000.6");

        System.out.println("Validation Rule:\n" + cons.getVerifierRule(salaryCons) + "\n\n");


        String ruleToVerify = "";
View Full Code Here

    private ConstraintConfiguration conf;

    @Before
    public void setup() {
        cons = new RangeConstraint();
        conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("age");

        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MIN, "0");
        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MAX, "120");
View Full Code Here

    private ConstraintConfiguration conf;

    @Before
    public void setup() {
        conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("age");
    }
View Full Code Here

    private ConstraintConfiguration conf;
    private Constraint cons;
   
    @Before
    public void setup() {
        conf = new SimpleConstraintConfigurationImpl();
        conf.setFactType("Person");
        conf.setFieldName("name");
       
        cons = new NotNullConstraint();
    }
View Full Code Here

TOP

Related Classes of org.drools.factconstraints.client.config.SimpleConstraintConfigurationImpl

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.