Package com.volantis.shared.metadata.value

Examples of com.volantis.shared.metadata.value.BooleanValue


        assertEquals("[@unit]", error.getLocation());
        assertEquals(QuantityUnits.PIXELS, error.getInvalidValue());
        assertEquals(enumeratedConstraint, error.getConstraint());

        // invalid type
        BooleanValue booleanValue = VALUE_FACTORY.createBooleanValue();
        errors = quantityType.verify(booleanValue);
        assertEquals(1, errors.size());
        error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_INVALID_IMPLEMENTATION,
            error.getType());
View Full Code Here


            VALUE_FACTORY.createStructureValue();
        Collection errors = structureType.verify(structureValue);
        assertEquals(0, errors.size());

        // invalid type
        final BooleanValue booleanValue = VALUE_FACTORY.createBooleanValue();
        errors = structureType.verify(booleanValue);
        assertEquals(1, errors.size());
        VerificationError error =
            (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_INVALID_IMPLEMENTATION,
View Full Code Here

            VALUE_FACTORY.createChoiceValue();
        Collection errors = choiceType.verify(choiceValue);
        assertEquals(0, errors.size());

        // invalid type
        final BooleanValue booleanValue = VALUE_FACTORY.createBooleanValue();
        errors = choiceType.verify(booleanValue);
        assertEquals(1, errors.size());
        checkError(errors, "", VerificationError.TYPE_INVALID_IMPLEMENTATION,
                booleanValue, null);
    }
View Full Code Here

        assertEquals("", error.getLocation());
        assertEquals(stringValue, error.getInvalidValue());
        assertNull(error.getConstraint());

        // invalid type
        BooleanValue booleanValue = VALUE_FACTORY.createBooleanValue();
        errors = stringType.verify(booleanValue);
        assertEquals(1, errors.size());
        error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_INVALID_IMPLEMENTATION,
            error.getType());
View Full Code Here

            createCollectionValue(new String[]{"one", "two"});
        Collection errors = collectionType.verify(collectionValue);
        assertEquals(0, errors.size());

        // invalid type
        BooleanValue booleanValue = VALUE_FACTORY.createBooleanValue();
        errors = collectionType.verify(booleanValue);
        assertEquals(1, errors.size());
        VerificationError error =
            (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_INVALID_IMPLEMENTATION,
View Full Code Here

     */
    public void testMapOnlyStoresAllowableTypes() {
        MetaDataFactory f = MetaDataFactory.getDefaultInstance();
        String key = "key";

        BooleanValue allowableValue = (BooleanValue) f.getValueFactory()
            .createBooleanValue();
        Object forbiddenValue = new Integer(1);

        // 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.put(key, allowableValue);
        } catch (IllegalArgumentException e) {
            fail("Adding a " + allowableValue.getClass() + " value with a "
                 + key.getClass() + " key should be permitted.");
        }

        // test that we can not add a forbidden value with an allowable key
        try {
            typedMap.put(key, forbiddenValue);
            fail("Adding a forbidden value with an allowed key should not be " +
                 "permitted. Allowed value: " + allowableValue.getClass()
                 + " forbidden value : " + forbiddenValue.getClass());
        } catch (IllegalArgumentException e) {
            // expected
        }
    }
View Full Code Here

     */
    public void testContainsValueOnlyAcceptsAllowableValues() {
        MetaDataFactory f = MetaDataFactory.getDefaultInstance();
        String allowableKey = "key";

        BooleanValue allowableValue = (BooleanValue) f.getValueFactory()
            .createBooleanValue();
        Object forbiddenValue = new Integer(1);

        // 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.containsValue(allowableValue);
        } catch (IllegalArgumentException e) {
View Full Code Here

     */
    public void testContainsKeyOnlyAcceptsAllowableKeys() {
        MetaDataFactory f = MetaDataFactory.getDefaultInstance();
        String allowableKey = "key";

        BooleanValue allowableValue = (BooleanValue) f.getValueFactory()
            .createBooleanValue();
        Object forbiddenKey = new Integer(2);
        // 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.containsKey(allowableKey);
        } catch (IllegalArgumentException e) {
View Full Code Here

     */
    public void testRemoveAcceptsAllowableValues() {
        MetaDataFactory f = MetaDataFactory.getDefaultInstance();
        String allowableKey = "key";

        BooleanValue allowableValue = (BooleanValue) f.getValueFactory()
            .createBooleanValue();
        Object forbiddenValue = new Integer(1);
        // create the map so that it only allows allowable values and keys
        TypedMap typedMap = createTypedMap(new HashMap(),
                                           allowableValue.getClass(), false);

        typedMap.put(allowableKey, allowableValue);

        // test that we can add remove with an allowable value
        try {
View Full Code Here

        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
View Full Code Here

TOP

Related Classes of com.volantis.shared.metadata.value.BooleanValue

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.