use of com.linkedin.pegasus.generator.test.idl.fixed.Fixed8 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);
}
use of com.linkedin.pegasus.generator.test.idl.fixed.Fixed8 in project rest.li by linkedin.
the class FixedGeneratorTest method testFixed.
@Test
public void testFixed() throws Throwable {
WithFixed8 original = new WithFixed8();
Fixed8 fixed8 = new Fixed8(SchemaFixtures.bytesFixed8);
original.setFixed(fixed8);
WithFixed8 roundTripped = new WithFixed8(roundTrip(original.data()));
assertEquals(roundTripped.getFixed().bytes(), SchemaFixtures.bytesFixed8);
}
use of com.linkedin.pegasus.generator.test.idl.fixed.Fixed8 in project rest.li by linkedin.
the class MapGeneratorTest method testWithComplexTypesMap.
@Test
public void testWithComplexTypesMap() throws Throwable {
String json = load("WithComplexTypesMap.json");
WithComplexTypesMap original = new WithComplexTypesMap();
EmptyMap empties = new EmptyMap();
empties.put("a", new Empty());
empties.put("b", new Empty());
empties.put("c", new Empty());
original.setEmpties(empties);
FruitsMap fruits = new FruitsMap();
fruits.put("a", Fruits.APPLE);
fruits.put("b", Fruits.BANANA);
fruits.put("c", Fruits.ORANGE);
original.setFruits(fruits);
SimpleArrayMap simpleArrays = new SimpleArrayMap();
Simple simplev1 = new Simple();
simplev1.setMessage("v1");
Simple simplev2 = new Simple();
simplev2.setMessage("v2");
SimpleArray simpleArray = new SimpleArray();
simpleArray.add(simplev1);
simpleArray.add(simplev2);
simpleArrays.put("a", simpleArray);
original.setArrays(simpleArrays);
SimpleMap simpleMapi1 = new SimpleMap();
Simple simpleo1i1 = new Simple();
simpleo1i1.setMessage("o1i1");
simpleMapi1.put("i1", simpleo1i1);
Simple simpleo1i2 = new Simple();
simpleo1i2.setMessage("o1i2");
simpleMapi1.put("i2", simpleo1i2);
SimpleMapMap maps = new SimpleMapMap();
maps.put("o1", simpleMapi1);
original.setMaps(maps);
WithComplexTypesMapUnionMap unions = new WithComplexTypesMapUnionMap();
unions.put("a", WithComplexTypesMapUnion.create(1));
unions.put("b", WithComplexTypesMapUnion.create("u1"));
original.setUnions(unions);
Fixed8Map fixed = new Fixed8Map();
fixed.put("a", new Fixed8(SchemaFixtures.bytesFixed8));
original.setFixed(fixed);
assertJson(original, json);
WithComplexTypesMap roundTripped = new WithComplexTypesMap(roundTrip(original.data()));
assertJson(roundTripped, json);
}
Aggregations