Package com.twitter.elephantbird.thrift.test

Examples of com.twitter.elephantbird.thrift.test.MapStruct


  private MapStruct genMapStruct() {
    Map<Integer, String> map = Maps.newHashMap();
    map.put(1, "one");
    map.put(2, "two");
    map.put(3, "three");
    return new MapStruct(map);
  }
View Full Code Here


  @Test
  public void testMapConversionWhenNestedStructsEnabled() throws DescriptorValidationException {
    ThriftToDynamicProto<MapStruct> thriftToProto =
      new ThriftToDynamicProto<MapStruct>(MapStruct.class, true, false);
    MapStruct mapStruct = genMapStruct();
    Message msg = thriftToProto.convert(mapStruct);

    Map<Integer, String> expected = mapStruct.entries;
    List<?> entries = (List)Protobufs.getFieldByName(msg, "entries");
    Set<?> expectedKeys = Sets.newHashSet(expected.keySet());
View Full Code Here

  @Test
  public void testMapConversionWhenNestedStructsDisabled() throws DescriptorValidationException {
    ThriftToDynamicProto<MapStruct> thriftToProto =
      new ThriftToDynamicProto<MapStruct>(MapStruct.class);
    MapStruct mapStruct = genMapStruct();
    Message msg = thriftToProto.convert(mapStruct);
    assertTrue(!Protobufs.hasFieldByName(msg, "entries"));
  }
View Full Code Here

TOP

Related Classes of com.twitter.elephantbird.thrift.test.MapStruct

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.