Search in sources :

Example 1 with WithCustomTypesArray

use of com.linkedin.pegasus.generator.test.idl.arrays.WithCustomTypesArray in project rest.li by linkedin.

the class ArrayGeneratorTest method testWithCustomTypesArray.

@Test
public void testWithCustomTypesArray() throws Throwable {
    String json = load("WithCustomTypesArray.json");
    SimpleMap map = new SimpleMap();
    map.put("a", new Simple().setMessage("m1"));
    WithCustomTypesArray original = new WithCustomTypesArray().setInts(new CustomIntArray(new CustomInt(1), new CustomInt(2), new CustomInt(3))).setArrays(new SimpleArrayArray(new SimpleArray(new Simple().setMessage("a1")))).setMaps(new SimpleMapArray(map)).setUnions(new WithCustomTypesArrayUnionArray(WithCustomTypesArrayUnion.create(1), WithCustomTypesArrayUnion.create("str"), WithCustomTypesArrayUnion.create(new Simple().setMessage("u1")))).setFixed(new Fixed8Array(new Fixed8(SchemaFixtures.bytesFixed8)));
    assertJson(original, json);
    WithCustomTypesArray roundTripped = new WithCustomTypesArray(roundTrip(original.data()));
    assertJson(roundTripped, json);
}
Also used : Fixed8(com.linkedin.pegasus.generator.test.idl.fixed.Fixed8) SimpleArray(com.linkedin.pegasus.generator.test.idl.records.SimpleArray) SimpleMap(com.linkedin.pegasus.generator.test.idl.records.SimpleMap) WithCustomTypesArrayUnionArray(com.linkedin.pegasus.generator.test.idl.arrays.WithCustomTypesArrayUnionArray) WithCustomTypesArray(com.linkedin.pegasus.generator.test.idl.arrays.WithCustomTypesArray) CustomIntArray(com.linkedin.pegasus.generator.test.idl.customtypes.CustomIntArray) SimpleMapArray(com.linkedin.pegasus.generator.test.idl.records.SimpleMapArray) CustomInt(com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt) SimpleArrayArray(com.linkedin.pegasus.generator.test.idl.records.SimpleArrayArray) Fixed8Array(com.linkedin.pegasus.generator.test.idl.fixed.Fixed8Array) Simple(com.linkedin.pegasus.generator.test.idl.records.Simple) Test(org.testng.annotations.Test)

Aggregations

WithCustomTypesArray (com.linkedin.pegasus.generator.test.idl.arrays.WithCustomTypesArray)1 WithCustomTypesArrayUnionArray (com.linkedin.pegasus.generator.test.idl.arrays.WithCustomTypesArrayUnionArray)1 CustomIntArray (com.linkedin.pegasus.generator.test.idl.customtypes.CustomIntArray)1 Fixed8 (com.linkedin.pegasus.generator.test.idl.fixed.Fixed8)1 Fixed8Array (com.linkedin.pegasus.generator.test.idl.fixed.Fixed8Array)1 Simple (com.linkedin.pegasus.generator.test.idl.records.Simple)1 SimpleArray (com.linkedin.pegasus.generator.test.idl.records.SimpleArray)1 SimpleArrayArray (com.linkedin.pegasus.generator.test.idl.records.SimpleArrayArray)1 SimpleMap (com.linkedin.pegasus.generator.test.idl.records.SimpleMap)1 SimpleMapArray (com.linkedin.pegasus.generator.test.idl.records.SimpleMapArray)1 CustomInt (com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt)1 Test (org.testng.annotations.Test)1