Examples of MutableMaximumValueConstraint


Examples of com.volantis.shared.metadata.type.constraint.mutable.MutableMaximumValueConstraint

                constraintFactory.createMinimumValueConstraint();
        minimumValue.setLimit(new Double(1.0));
        mutableNumberType.setMinimumValueConstraint(minimumValue);

        // Set the maximum value to 2.0
        MutableMaximumValueConstraint maximumValue =
                constraintFactory.createMaximumValueConstraint();
        maximumValue.setLimit(new Double(2.0));
        mutableNumberType.setMaximumValueConstraint(maximumValue);

        return mutableNumberType;
    }
View Full Code Here

Examples of com.volantis.shared.metadata.type.constraint.mutable.MutableMaximumValueConstraint

        assertEquals(numberValue, error.getInvalidValue());
        assertEquals(minValueConstraint, error.getConstraint());
        numberType.setMinimumValueConstraint(null);

        // maximum value constraint with inclusive set to true
        final MutableMaximumValueConstraint maxValueConstraint =
            CONSTRAINT_FACTORY.createMaximumValueConstraint();
        maxValueConstraint.setLimit(new Integer(6));
        maxValueConstraint.setInclusive(true);
        numberType.setMaximumValueConstraint(maxValueConstraint);
        // check constraint with right value
        numberValue.setValue(new Integer(6));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
        // check constraint violation
        numberValue.setValue(new Integer(7));
        errors = numberType.verify(numberValue);
        assertEquals(1, errors.size());
        error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_CONSTRAINT_VIOLATION,
            error.getType());
        assertEquals("", error.getLocation());
        assertEquals(numberValue, error.getInvalidValue());
        assertEquals(maxValueConstraint, error.getConstraint());
        numberType.setEnumeratedConstraint(null);

        // maximum value constraint with inclusive set to false
        maxValueConstraint.setInclusive(false);
        numberType.setMaximumValueConstraint(maxValueConstraint);
        // check constraint with right value
        numberValue.setValue(new Integer(5));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
View Full Code Here

Examples of com.volantis.shared.metadata.type.constraint.mutable.MutableMaximumValueConstraint

        MutableNumberType numberType = TYPE_FACTORY.createNumberType();

        Integer min = new Integer(minInclusive);
        Integer max = new Integer(maxInclusive);

        MutableMaximumValueConstraint maxConstraint
                = CONSTRAINT_FACTORY.createMaximumValueConstraint();
        maxConstraint.setLimit(max);
        maxConstraint.setInclusive(true);

        MutableMinimumValueConstraint minConstraint
                = CONSTRAINT_FACTORY.createMinimumValueConstraint();
        minConstraint.setLimit(min);
        minConstraint.setInclusive(true);
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.