Search in sources :

Example 11 with Person

use of com.twitter.data.proto.tutorial.AddressBookProtos.Person in project elephant-bird by twitter.

the class TestTypedProtobufWritable method setUp.

@BeforeClass
public static void setUp() {
    Person p1 = Person.newBuilder().setEmail("email1@example.com").setId(74).setName("Example Person").addPhone(PhoneNumber.newBuilder().setType(PhoneType.MOBILE).setNumber("2930423").build()).addPhone(PhoneNumber.newBuilder().setType(PhoneType.HOME).setNumber("214121").build()).build();
    Person p2 = Person.newBuilder().setEmail("email2@example.com").setId(7334).setName("Another person").addPhone(PhoneNumber.newBuilder().setType(PhoneType.MOBILE).setNumber("030303").build()).build();
    referenceAb = AddressBook.newBuilder().addPerson(p1).addPerson(p2).build();
    referenceAbWritable = new TypedProtobufWritable<AddressBook>(referenceAb);
}
Also used : AddressBook(com.twitter.data.proto.tutorial.AddressBookProtos.AddressBook) Person(com.twitter.data.proto.tutorial.AddressBookProtos.Person) BeforeClass(org.junit.BeforeClass)

Example 12 with Person

use of com.twitter.data.proto.tutorial.AddressBookProtos.Person in project elephant-bird by twitter.

the class TestProtobufWritable method setUp.

@BeforeClass
public static void setUp() {
    Person p1 = Person.newBuilder().setEmail("email1@example.com").setId(74).setName("Example Person").addPhone(PhoneNumber.newBuilder().setType(PhoneType.MOBILE).setNumber("2930423").build()).addPhone(PhoneNumber.newBuilder().setType(PhoneType.HOME).setNumber("214121").build()).build();
    Person p2 = Person.newBuilder().setEmail("email2@example.com").setId(7334).setName("Another person").addPhone(PhoneNumber.newBuilder().setType(PhoneType.MOBILE).setNumber("030303").build()).build();
    referenceAb = AddressBook.newBuilder().addPerson(p1).addPerson(p2).build();
    referenceAbWritable = new ProtobufWritable<AddressBook>(referenceAb, new TypeRef<AddressBook>() {
    });
}
Also used : AddressBook(com.twitter.data.proto.tutorial.AddressBookProtos.AddressBook) TypeRef(com.twitter.elephantbird.util.TypeRef) Person(com.twitter.data.proto.tutorial.AddressBookProtos.Person) BeforeClass(org.junit.BeforeClass)

Aggregations

Person (com.twitter.data.proto.tutorial.AddressBookProtos.Person)12 Test (org.junit.Test)5 AddressBook (com.twitter.data.proto.tutorial.AddressBookProtos.AddressBook)4 Tuple (org.apache.pig.data.Tuple)4 Before (org.junit.Before)3 ProtobufWritable (com.twitter.elephantbird.mapreduce.io.ProtobufWritable)2 ProtobufTuple (com.twitter.elephantbird.pig.util.ProtobufTuple)2 File (java.io.File)2 Configuration (org.apache.hadoop.conf.Configuration)2 BeforeClass (org.junit.BeforeClass)2 ByteString (com.google.protobuf.ByteString)1 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)1 PhoneNumber (com.twitter.data.proto.tutorial.AddressBookProtos.Person.PhoneNumber)1 PersonWithoutEmail (com.twitter.data.proto.tutorial.AddressBookProtos.PersonWithoutEmail)1 ProtobufBlockWriter (com.twitter.elephantbird.mapreduce.io.ProtobufBlockWriter)1 ProtobufBytesToTuple (com.twitter.elephantbird.pig.piggybank.ProtobufBytesToTuple)1 ProtobufToPig (com.twitter.elephantbird.pig.util.ProtobufToPig)1 TypeRef (com.twitter.elephantbird.util.TypeRef)1 FileOutputStream (java.io.FileOutputStream)1 List (java.util.List)1