Package org.emftrace.metamodel.QUARCModel.Constraints

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


  @Test
  public void testForRegExInvalidOperators() {

    TechnicalProperty property = createPropertyWithTypeRegularExpression();
   
    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 testForRegExInvalidValues() {
    TechnicalProperty property = createPropertyWithTypeRegularExpression();

    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 testForIntEquals() {
    TechnicalProperty property = createPropertyWithTypeInteger();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.EQUALS, "1");

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

    // test for true
    constraint.setValue("1");
    assertLogicalTrue();

    constraint.setValue("0");
    assertLogicalFalse();

    constraint.setValue("2");
    assertLogicalFalse();

  }
View Full Code Here

  @Test
  public void testForIntMin() {

    TechnicalProperty property = createPropertyWithTypeInteger();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.MINIMAL, "1");

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

    // test for true

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

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

    constraint.setValue("0");
    assertLogicalFalse();

  }
View Full Code Here

  @Test
  public void testForIntGreaterThan() {

    TechnicalProperty property = createPropertyWithTypeInteger();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.GREATER_THAN, "1");

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

    // test for true

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

    constraint.setValue("1");
    assertLogicalFalse();

    constraint.setValue("0");
    assertLogicalFalse();

  }
View Full Code Here

  @Test
  public void testForIntSmallerThan() {

    TechnicalProperty property = createPropertyWithTypeInteger();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.LESS_THAN, "1");

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

    // test for true

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

    constraint.setValue("1");
    assertLogicalFalse();

    constraint.setValue("2");
    assertLogicalFalse();

  }
View Full Code Here

  @Test
  public void testForIntInvalidOperators() {

    TechnicalProperty property = createPropertyWithTypeInteger();

    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 testForIntApproximatelyEqualsWithRelativeTolerance() {
    TechnicalProperty property = createPropertyWithTypeInteger();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.APPROXIMATELY_EQUALS, "100");
    baseCondition.setTolerance("0.01");
    baseCondition.setToleranceType(ToleranceTypes.RELATIVE);

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

    // test for true

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

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

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

    // test for false
    constraint.setValue("102");
    assertLogicalFalse();
   
    constraint.setValue("98");
    assertLogicalFalse();

  }
View Full Code Here

 
  @Test
  public void testForIntApproximatelyEqualsWithAbsoluteTolerance() {
    TechnicalProperty property = createPropertyWithTypeInteger();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.APPROXIMATELY_EQUALS, "100");
    baseCondition.setTolerance("1");
    baseCondition.setToleranceType(ToleranceTypes.ABSOLUTE);

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

    // test for true

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

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

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

    // test for false
    constraint.setValue("102");
    assertLogicalFalse();
   
    constraint.setValue("98");
    assertLogicalFalse();

  }
View Full Code Here

  @Test
  public void testForIntInvalidValues() {

    TechnicalProperty property = createPropertyWithTypeInteger();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.EQUALS, "1");

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

    constraint.setValue("1.1");
    assertIsInvalid();

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

    constraint.setValue(null);
    assertIsInvalid();

    baseCondition.setValue("1.1");
    assertIsInvalid();
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.