Package com.volantis.shared.metadata.value.immutable

Examples of com.volantis.shared.metadata.value.immutable.ImmutableSetValue


    public void testSetRetrieval() throws Exception {
        ImmutableMetaDataValue value =
                createService().getCharacteristic("/key3");

        ImmutableSetValue set = assertImmutableSet(value, 3);

        Collection collection = set.getContentsAsCollection();
        Iterator iter = collection.iterator();
        // check that this items at index 0 is a boolean of value true
        assertImmutableStructure((ImmutableMetaDataValue)iter.next(), 2);

        // check that this items at index 1 is a boolean of value false
View Full Code Here


        if (!(value instanceof ImmutableSetValue)) {
            fail("Expected a ImmutableSetValue but got a " +
                 value.getClass().toString());
        }

        ImmutableSetValue set = (ImmutableSetValue) value;
        assertEquals("set should have size of " + expectedSize,
                     expectedSize,
                     set.getContentsAsCollection().size());
        return set;
    }
View Full Code Here

        final Object otherString = doRoundTrip(string);
        assertEquals(string, otherString);
    }

    public void testSetWithStrings() throws Exception {
        final ImmutableSetValue set = (ImmutableSetValue) unmarshall(
            getResourceAsString("res/set-with-strings.xml"),
            ImmutableSetValueImpl.class);

        // check the created object
        final Set expectedSet = new HashSet();
        MutableStringValue value = new MutableStringValueImpl();
        value.setValue("First Value");
        expectedSet.add(value.createImmutable());
        value.setValue("Second Value");
        expectedSet.add(value.createImmutable());
        assertEquals(expectedSet, set.getContentsAsSet());

        final Object otherList = doRoundTrip(set);
        assertEquals(set, otherList);
    }
View Full Code Here

        final Object otherList = doRoundTrip(set);
        assertEquals(set, otherList);
    }

    public void testSetWithBooleansAndStrings() throws Exception {
        final ImmutableSetValue set = (ImmutableSetValue) unmarshall(
            getResourceAsString("res/set-with-booleans-and-strings.xml"),
            ImmutableSetValueImpl.class);

        // check the created object
        final Set expectedSet = new HashSet();
        MutableStringValue stringValue = new MutableStringValueImpl();
        stringValue.setValue("First Value");
        expectedSet.add(stringValue.createImmutable());
        MutableBooleanValue booleanValue = new MutableBooleanValueImpl();
        booleanValue.setValue(Boolean.TRUE);
        expectedSet.add(booleanValue.createImmutable());
        booleanValue.setValue(Boolean.FALSE);
        expectedSet.add(booleanValue.createImmutable());
        stringValue.setValue("Fourth Value");
        expectedSet.add(stringValue.createImmutable());
        assertEquals(expectedSet, set.getContentsAsSet());

        final Object otherList = doRoundTrip(set);
        assertEquals(set, otherList);
    }
View Full Code Here

TOP

Related Classes of com.volantis.shared.metadata.value.immutable.ImmutableSetValue

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.