Package org.emftrace.metamodel.QUARCModel.Constraints

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


  @Test
  public void testForFloatMax() {

    TechnicalProperty property = createPropertyWithTypeFloat();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.MAXIMAL, "1.0");

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

    // test for true

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

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

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

  }
View Full Code Here


  @Test
  public void testForFloatMin() {

    TechnicalProperty property = createPropertyWithTypeFloat();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

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

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

    // test for true

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

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

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

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

  }
View Full Code Here

  @Test
  public void testForFloatGreaterThan() {

    TechnicalProperty property = createPropertyWithTypeFloat();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

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

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

    // test for true

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

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

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

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

  }
View Full Code Here

  @Test
  public void testForFloatSmallerThan() {

    TechnicalProperty property = createPropertyWithTypeFloat();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

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

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

    // test for true

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

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

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

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

  }
View Full Code Here

  @Test
  public void testForFloatInvalidOperators() {

    TechnicalProperty property = createPropertyWithTypeFloat();

    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 testForFloatInvalidValues() {

    TechnicalProperty property = createPropertyWithTypeFloat();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

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

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

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

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

    constraint.setValue(null);
    assertIsInvalid();

    baseCondition.setValue("1.1.2");
    assertIsInvalid();
View Full Code Here

  @Test
  public void testForBooleanIsTrue() {

    TechnicalProperty property = createPropertyWithTypeBoolean();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

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

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

    // test for true

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

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

  }
View Full Code Here

  @Test
  public void testForBooleanIsFalse() {
   
    TechnicalProperty property = createPropertyWithTypeBoolean();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

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

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

    // test for true

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

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

  }
View Full Code Here

  @Test
  public void testForBooleanInvalidOperators() {

    TechnicalProperty property = createPropertyWithTypeBoolean();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

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

  @Test
  public void testForBooleanInvalidValues() {

    TechnicalProperty property = createPropertyWithTypeBoolean();

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

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

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

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

   
    constraint.setValue("1");
    assertIsInvalid();
   
    constraint.setValue("1.1.2");
    assertIsInvalid();

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

    constraint.setValue(null);
    assertIsInvalid();

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