Examples of MutableBooleanValue


Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

        MutableEnumeratedConstraint enumeratedConstraint =
                MetaDataFactory.getDefaultInstance().getTypeFactory().
                getConstraintFactory().createEnumeratedConstraint();

        MutableBooleanValue booleanValue = MetaDataFactory.getDefaultInstance().
                getValueFactory().createBooleanValue();

        booleanValue.setValue(Boolean.TRUE);
        enumeratedConstraint.getMutableEnumeratedValues().add(booleanValue);
        mutableBooleanType.setEnumeratedConstraint(enumeratedConstraint);
        return mutableBooleanType;
    }
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

    public void testVerify() {
        final MutableBooleanType booleanType = TYPE_FACTORY.createBooleanType();

        // normal case
        MutableBooleanValue booleanValue = VALUE_FACTORY.createBooleanValue();
        Collection errors = booleanType.verify(booleanValue);
        assertEquals(0, errors.size());

        // invalid type
        StringValue stringValue = VALUE_FACTORY.createStringValue();
        errors = booleanType.verify(stringValue);
        assertEquals(1, errors.size());
        VerificationError error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_INVALID_IMPLEMENTATION,
            error.getType());
        assertEquals("", error.getLocation());
        assertEquals(stringValue, error.getInvalidValue());
        assertNull(error.getConstraint());

        // enumerated constraint
        final MutableEnumeratedConstraint enumeratedConstraint =
            CONSTRAINT_FACTORY.createEnumeratedConstraint();
        final List enumeratedValues =
            enumeratedConstraint.getMutableEnumeratedValues();
        final MutableBooleanValue constraintValue =
            VALUE_FACTORY.createBooleanValue();
        constraintValue.setValue(Boolean.FALSE);
        enumeratedValues.add(constraintValue);
        booleanType.setEnumeratedConstraint(enumeratedConstraint);
        // check constraint with right value
        booleanValue.setValue(Boolean.FALSE);
        errors = booleanType.verify(booleanValue);
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

        fieldValues.put("foo", fooValue);
        final MutableNumberValue numberValue = VALUE_FACTORY.createNumberValue();
        fieldValues.put("bar", numberValue);
        final MutableStructureValue childStructureValue =
            VALUE_FACTORY.createStructureValue();
        final MutableBooleanValue booleanValue =
            VALUE_FACTORY.createBooleanValue();
        childStructureValue.getFieldValuesAsMutableMap().put(
            "baz", booleanValue);
        fieldValues.put("child", childStructureValue);
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

        MutableEnumeratedConstraint enumeratedConstraint =
                MetaDataFactory.getDefaultInstance().getTypeFactory().
                getConstraintFactory().createEnumeratedConstraint();

        MutableBooleanValue booleanValue = MetaDataFactory.getDefaultInstance().
                getValueFactory().createBooleanValue();

        booleanValue.setValue(Boolean.TRUE);
        enumeratedConstraint.getMutableEnumeratedValues().add(booleanValue);
        mutableBooleanType.setEnumeratedConstraint(enumeratedConstraint);
        return mutableBooleanType;
    }
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

     * This tests that the get method will only work if the key is of the
     * permitted type.
     */
    public void testGetOnlyAcceptsAllowableKeys() {
        MetaDataFactory f = MetaDataFactory.getDefaultInstance();
        MutableBooleanValue allowableValue = (MutableBooleanValue) f.getValueFactory()
            .createBooleanValue().createMutable();
        String allowableKey = "key";

        NumberValue forbiddenKey = (NumberValue) f.getValueFactory()
            .createNumberValue();

        // create the map so that it only allows allowable values and keys
        TypedMap typedMap = createTypedMap(new HashMap(),
                                           allowableValue.getClass(), false);

        // test that we can add an allowable value with an allowable key
        try {
            typedMap.get(allowableKey);
        } catch (IllegalArgumentException e) {
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

     * not allow callers to use setValue on the <code>Map.Entry</code> object with
     * forbidden types, but will allow callers to setValue with an allowed type.
     */
    public void testEntrySetIteratorWillOnlyAllowCorrectType() {
        MetaDataFactory f = MetaDataFactory.getDefaultInstance();
        MutableBooleanValue allowableValue= (MutableBooleanValue) f.getValueFactory()
            .createBooleanValue().createMutable();
        allowableValue.setValue(Boolean.TRUE);

        BooleanValue newAllowableValue = (BooleanValue) f.getValueFactory()
            .createBooleanValue();
        String allowableKey = "key";
        NumberValue forbiddenValue = (NumberValue) f.getValueFactory().createNumberValue();

        // create the map so that it only allows allowable values and keys
        TypedMap typedMap = createTypedMap(new HashMap(),
                                           allowableValue.getClass(), false);

        typedMap.put(allowableKey, allowableValue);
        Set entrySet = typedMap.entrySet();
        Iterator iter = entrySet.iterator();
        Map.Entry entry = (Map.Entry) iter.next();
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

     * This test ensures that when entrySet() is called, the set returned is backed by the
     * <code>TypedMap</code>.
     */
    public void testEntrySetIteratorEffectsTheSet() {
        MetaDataFactory f = MetaDataFactory.getDefaultInstance();
        MutableBooleanValue originalValue = (MutableBooleanValue) f.getValueFactory()
            .createBooleanValue().createMutable();
        originalValue.setValue(Boolean.TRUE);

        BooleanValue newValue = (BooleanValue) f.getValueFactory()
            .createBooleanValue();
        String key = "key";

        // create the map
        TypedMap typedMap = createTypedMap(new HashMap(),
                                           originalValue.getClass(), false);
        typedMap.put(key, originalValue);

        // Get an iterator on the entry set
        Set entrySet = typedMap.entrySet();
        Iterator iter = entrySet.iterator();
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

        // Set an enumerated constraint on this object
        MutableEnumeratedConstraint enumeratedConstraint =
                MetaDataFactory.getDefaultInstance().getTypeFactory().
                getConstraintFactory().createEnumeratedConstraint();

        MutableBooleanValue booleanValue = MetaDataFactory.getDefaultInstance().
                getValueFactory().createBooleanValue();

        booleanValue.setValue(Boolean.TRUE);
        enumeratedConstraint.getMutableEnumeratedValues().add(booleanValue);
        mutableNumberType.setEnumeratedConstraint(enumeratedConstraint);

        ConstraintFactory constraintFactory = MetaDataFactory.getDefaultInstance().
                getTypeFactory().getConstraintFactory();
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

    /**
     * Tests that the typed list only accepts allowable types.
     */
    public void testSetOnlyStoresAllowableTypes() {
        MetaDataFactory f = MetaDataFactory.getDefaultInstance();
        MutableBooleanValue allowableObject = (MutableBooleanValue) f.getValueFactory()
            .createBooleanValue().createMutable();
        allowableObject.setValue(Boolean.TRUE);

        NumberValue unallowableObject = (NumberValue) f.getValueFactory()
            .createNumberValue();

        TypedSet typedSet = new TypedSet(new HashSet(), BooleanValue.class);

        try {
            typedSet.add(allowableObject);
        } catch (IllegalArgumentException e) {
            fail("Adding a " + allowableObject.getClass() + " should be permitted.");
        }

        // check that the mutable list will not allow a forbiden type
        try {
            typedSet.add(unallowableObject);
            fail("Adding any thing other than a " + allowableObject.getClass() +
                    " should throw an IllegalArgumentException.");
        } catch (IllegalArgumentException e) {
            // expected.
        }
    }
View Full Code Here

Examples of com.volantis.shared.metadata.value.mutable.MutableBooleanValue

     */
    public void testAddOnlyStoresImmutable() {
        ImmutableGeneratingTypedList typedList =
                new ImmutableGeneratingTypedList(new ArrayList(), BooleanValue.class);

        MutableBooleanValue booleanValue = MetaDataFactory.getDefaultInstance().
                getValueFactory().createBooleanValue();
        typedList.add(booleanValue);

        BooleanValue obtainedBooleanValue = (BooleanValue) typedList.get(0);

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.