use of com.twitter.data.proto.tutorial.AddressBookProtos.Person.PhoneNumber in project elephant-bird by twitter.
the class ProtobufDeserializerTest method setUp.
@Before
public void setUp() throws SerDeException {
PhoneNumber pn1 = PhoneNumber.newBuilder().setNumber("pn0001").setType(PhoneType.HOME).build();
PhoneNumber pn2 = PhoneNumber.newBuilder().setNumber("pn0002").setType(PhoneType.WORK).build();
PhoneNumber pn3 = PhoneNumber.newBuilder().setNumber("pn0003").build();
test_pn = PhoneNumber.newBuilder().setNumber("pn0004").setType(PhoneType.MOBILE).build();
Person p1 = Person.newBuilder().setName("p1").setId(1).setEmail("p1@twitter").addPhone(pn1).addPhone(pn2).addPhone(pn3).build();
Person p2 = Person.newBuilder().setName("p2").setId(2).addPhone(test_pn).build();
Person p3 = Person.newBuilder().setName("p3").setId(3).build();
test_ab = AddressBook.newBuilder().addPerson(p1).addPerson(p2).addPerson(p3).setByteData(ByteString.copyFrom(new byte[] { 16, 32, 64, (byte) 128 })).build();
deserializer = new ProtobufDeserializer();
Properties properties = new Properties();
properties.setProperty(org.apache.hadoop.hive.serde.Constants.SERIALIZATION_CLASS, AddressBook.class.getName());
deserializer.initialize(new Configuration(), properties);
protobufOI = (ProtobufStructObjectInspector) deserializer.getObjectInspector();
}
Aggregations