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

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


    public void testListRetrieval() throws Exception {
        ImmutableMetaDataValue value =
                createService().getCharacteristic("key2");

        ImmutableListValue list = assertImmutableList(value, 2);

        // check that this items at index 0 is a boolean of value true
        assertImmutableBooleanValue(
                (ImmutableMetaDataValue)list.getContentsAsList().get(0), true);

        // check that this items at index 1 is a boolean of value false
        assertImmutableBooleanValue(
                (ImmutableMetaDataValue)list.getContentsAsList().get(1), false);
    }
View Full Code Here


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

        ImmutableListValue list = (ImmutableListValue) value;
        assertEquals("structure should have size of " + expectedSize,
                     expectedSize,
                     list.getContentsAsList().size());
        return list;
    }
View Full Code Here

     * Test which ensures that when {@link ListValueImpl#getContentsAsList} is
     * called on an {@link ImmutableListValue} then the returned {@link java.util.List} is
     * immutable.
     */
    public void testGetContentsAsListReturnsImmutableListOnImmutable() {
        ImmutableListValue immutableList = (ImmutableListValue)
                getImmutableInhibitor();
        List list = immutableList.getContentsAsList();
        MetaDataTestCaseHelper.ensureListIsImmutable(list);
    }
View Full Code Here

        final Object otherStructure = doRoundTrip(structure);
        assertEquals(structure, otherStructure);
    }

    public void testListWithStrings() throws Exception {
        final ImmutableListValue list = (ImmutableListValue) unmarshall(
            getResourceAsString("res/list-with-strings.xml"),
            ImmutableListValueImpl.class);

        // check the created object
        final List expectedList = new LinkedList();
        MutableStringValue value = new MutableStringValueImpl();
        value.setValue("First Value");
        expectedList.add(value.createImmutable());
        value.setValue("Second Value");
        expectedList.add(value.createImmutable());
        assertEquals(expectedList, list.getContentsAsList());

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

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

    public void testListWithBooleansAndStrings() throws Exception {
        final ImmutableListValue list = (ImmutableListValue) unmarshall(
            getResourceAsString("res/list-with-booleans-and-strings.xml"),
            ImmutableListValueImpl.class);

        // check the created object
        final List expectedList = new LinkedList();
        MutableStringValue stringValue = new MutableStringValueImpl();
        stringValue.setValue("First Value");
        expectedList.add(stringValue.createImmutable());
        MutableBooleanValue booleanValue = new MutableBooleanValueImpl();
        booleanValue.setValue(Boolean.TRUE);
        expectedList.add(booleanValue.createImmutable());
        booleanValue.setValue(Boolean.FALSE);
        expectedList.add(booleanValue.createImmutable());
        stringValue.setValue("Fourth Value");
        expectedList.add(stringValue.createImmutable());
        assertEquals(expectedList, list.getContentsAsList());

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

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

    public void testListWithNumbers() throws Exception {
        final ImmutableListValue list = (ImmutableListValue) unmarshall(
            getResourceAsString("res/list-with-numbers.xml"),
            ImmutableListValueImpl.class);

        // check the created object
        final List expectedList = new LinkedList();
        MutableNumberValue value = new MutableNumberValueImpl();
        value.setValue(new Byte((byte) 42));
        expectedList.add(value.createImmutable());
        value.setValue(new Short((short) 1));
        expectedList.add(value.createImmutable());
        value.setValue(new Integer(2));
        expectedList.add(value.createImmutable());
        value.setValue(new Long(3));
        expectedList.add(value.createImmutable());
        value.setValue(new BigInteger("4"));
        expectedList.add(value.createImmutable());
        value.setValue(new BigDecimal("4.2"));
        expectedList.add(value.createImmutable());
        value.setValue(new Float(0.1f));
        expectedList.add(value.createImmutable());
        value.setValue(new Double(0.2d));
        expectedList.add(value.createImmutable());
        assertEquals(expectedList, list.getContentsAsList());

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

TOP

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

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.