Search in sources :

Example 1 with TEverythingExtendedStruct

use of joynr.types.TestTypes.TEverythingExtendedStruct in project joynr by bmwcarit.

the class SerializationTest method serializeDeserializeMapWithEnumKeyTest.

@Test
public void serializeDeserializeMapWithEnumKeyTest() throws Exception {
    TEverythingMap tmap = new TEverythingMap();
    Byte tInt8 = 1;
    Byte tUInt8 = 2;
    Short tInt16 = 3;
    Short tUInt16 = 4;
    Integer tInt32 = 5;
    Integer tUInt32 = 6;
    Long tInt64 = 7L;
    Long tUInt64 = 8L;
    Double tDouble = 9.0;
    Float tFloat = 10.0f;
    Boolean tBoolean = false;
    String tString = "tString";
    Byte[] tByteBuffer = { 1, 2, 3 };
    Byte[] tUInt8Array = { 4, 5, 6 };
    TEnum tEnum = TEnum.TLITERALA;
    TEnum[] tEnumArray = { TEnum.TLITERALA, TEnum.TLITERALB };
    String[] tStringArray = { "tStringArray1", "tStringArray2" };
    Word word = new Word(new Vowel[] { Vowel.A, Vowel.E });
    Word[] wordArray = { word, word };
    Boolean tBooleanExtended = true;
    String tStringExtended = "tStringExtended";
    TStringKeyMap tStringMap = new TStringKeyMap();
    tStringMap.put("key1", "value1");
    tStringMap.put("key2", "value2");
    TStruct typeDefForTStruct = new TStruct();
    TEverythingExtendedStruct value = new TEverythingExtendedStruct(tInt8, tUInt8, tInt16, tUInt16, tInt32, tUInt32, tInt64, tUInt64, tDouble, tFloat, tString, tBoolean, tByteBuffer, tUInt8Array, tEnum, tEnumArray, tStringArray, word, wordArray, tStringMap, typeDefForTStruct, tBooleanExtended, tStringExtended);
    tmap.put(TEnum.TLITERALA, value);
    tmap.put(TEnum.TLITERALB, value);
    String valueAsString = objectMapper.writeValueAsString(tmap);
    TEverythingMap readValue = objectMapper.readValue(valueAsString, TEverythingMap.class);
    assertEquals(tmap, readValue);
}
Also used : TStringKeyMap(joynr.types.TestTypes.TStringKeyMap) Word(joynr.types.TestTypes.Word) TStruct(joynr.types.TestTypes.TStruct) TEverythingMap(joynr.types.TestTypes.TEverythingMap) TEnum(joynr.types.TestTypes.TEnum) TEverythingExtendedStruct(joynr.types.TestTypes.TEverythingExtendedStruct) Test(org.junit.Test)

Aggregations

TEnum (joynr.types.TestTypes.TEnum)1 TEverythingExtendedStruct (joynr.types.TestTypes.TEverythingExtendedStruct)1 TEverythingMap (joynr.types.TestTypes.TEverythingMap)1 TStringKeyMap (joynr.types.TestTypes.TStringKeyMap)1 TStruct (joynr.types.TestTypes.TStruct)1 Word (joynr.types.TestTypes.Word)1 Test (org.junit.Test)1