Package org.emftrace.metamodel.QUARCModel.Constraints

Examples of org.emftrace.metamodel.QUARCModel.Constraints.Constraint


  }

  @Test
  public void testForEmptyPrecondition() {

    Constraint constraint = ConstraintsFactory.eINSTANCE.createConstraint();
    TechnicalProperty property = createPropertyWithTypeString();
    constraint.setTechnicalProperty(property);
    constraint.setValue("foo");
    constraint.setOperator(BaseConditionOperators.EQUALS);
    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    initConditionEvaluator();

    assertLogicalTrue();
View Full Code Here


 
 
  @Test
  public void testForPreconditionWithPropertyCategory() {

    Constraint constraint = ConstraintsFactory.eINSTANCE.createConstraint();
    TechnicalProperty property = ConstraintsFactory.eINSTANCE.createTechnicalPropertyCategory();
    property.setName("foo property category");
    constraint.setTechnicalProperty(property);
    constraint.setValue("foo");
    constraint.setOperator(BaseConditionOperators.EQUALS);
   
    constraint.setOperator(BaseConditionOperators.EQUALS);
    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    initConditionEvaluator();
   
    BaseCondition baseCondition = createBaseCondition(property,
View Full Code Here

  }

  @Test
  public void testForNullPrecondition() {

    Constraint constraint = ConstraintsFactory.eINSTANCE.createConstraint();
    TechnicalProperty property = createPropertyWithTypeString();

    constraint.setTechnicalProperty(property);
    constraint.setValue("foo");
    constraint.setOperator(BaseConditionOperators.EQUALS);
    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    initConditionEvaluator();

    precondition = null;
View Full Code Here

    return property;
  }

  private Constraint createConstraint(TechnicalProperty property, String value) {
    Constraint constraint = ConstraintsFactory.eINSTANCE.createConstraint();

    constraint.setTechnicalProperty(property);
    constraint.setValue(value);
    return constraint;
  }
View Full Code Here

  @Test
  public void testForStringEquals() {

    TechnicalProperty property = createPropertyWithTypeString();

    Constraint constraint = createConstraint(property, "foo");
    constraint.setOperator(BaseConditionOperators.EQUALS);
    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.EQUALS, "foo");
View Full Code Here

  @Test
  public void testForStringEqualsIgnoreCase() {

    TechnicalProperty property = createPropertyWithTypeString();

    Constraint constraint = createConstraint(property, "foo");
    constraint.setOperator(BaseConditionOperators.EQUALS);
    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.EQUALS_IGNORE_CASE, "foo");
View Full Code Here

  @Test
  public void testForStringInvalidOperators() {

    TechnicalProperty property = createPropertyWithTypeString();

    Constraint constraint = createConstraint(property, "1");
    constraint.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.MATCHES, "1");
View Full Code Here

  @Test
  public void testForEnumEqualsEquals() {

    TechnicalProperty property = createPropertyWithTypeEnum();

    Constraint constraint = createConstraint(property, "foo");
    constraint.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.EQUALS, "foo");
View Full Code Here

  @Test
  public void testForEnumInvalidOperators() {

    TechnicalProperty property = createPropertyWithTypeEnum();

    Constraint constraint = createConstraint(property, "foo");
    constraint.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.MATCHES, "foo");
View Full Code Here

  @Test
  public void testForRegExMatches() {

    TechnicalProperty property = createPropertyWithTypeRegularExpression();

    Constraint constraint = createConstraint(property, "foo");
    constraint.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.MATCHES, "foo");

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.AND);
    precondition.getBaseConditions().add(baseCondition);

    baseCondition.setValue("(foo|bar)");
    // test for true

    constraint.setValue("foo");
    assertLogicalTrue();

    constraint.setValue("bar");
    assertLogicalTrue();

    // test for false
    constraint.setValue("foo bar");

    assertLogicalFalse();

  }
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.QUARCModel.Constraints.Constraint

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.