Package org.apache.crunch.test

Examples of org.apache.crunch.test.Person


    assertEquals(record, detachedRecord);
    assertNotSame(record, detachedRecord);
  }
 
  private Person createPerson(){
    Person person = new Person();
    person.name = "name value";
    person.age = 42;
    person.siblingnames = Lists.<CharSequence> newArrayList();
    return person;
  }
View Full Code Here


  }

  @Test
  public void testGetDetachedValue_SpecificAvroType() {
    AvroType<Person> specificType = Avros.specifics(Person.class);
    Person person = createPerson();
    Person detachedPerson = specificType.getDetachedValue(person);
    assertEquals(person, detachedPerson);
    assertNotSame(person, detachedPerson);
  }
View Full Code Here

    assertNotSame(rp, detached);
  }

  @Test
  public void testGetDetachedValue_Pair() {
    Person person = createPerson();
    AvroType<Pair<Integer, Person>> pairType = Avros.pairs(Avros.ints(),
        Avros.records(Person.class));

    Pair<Integer, Person> inputPair = Pair.of(1, person);
    Pair<Integer, Person> detachedPair = pairType.getDetachedValue(inputPair);
View Full Code Here

    assertNotSame(inputPair.second(), detachedPair.second());
  }
 
  @Test
  public void testGetDetachedValue_Collection(){
    Person person = createPerson();
    List<Person> personList = Lists.newArrayList(person);
   
    AvroType<Collection<Person>> collectionType = Avros.collections(Avros.records(Person.class));
   
    Collection<Person> detachedCollection = collectionType.getDetachedValue(personList);
   
    assertEquals(personList, detachedCollection);
    Person detachedPerson = detachedCollection.iterator().next();
   
    assertNotSame(person, detachedPerson);
  }
View Full Code Here

  }
 
  @Test
  public void testGetDetachedValue_Map(){
    String key = "key";
    Person value = createPerson();
   
    Map<String,Person> stringPersonMap = Maps.newHashMap();
    stringPersonMap.put(key, value);
   
    AvroType<Map<String, Person>> mapType = Avros.maps(Avros.records(Person.class));
View Full Code Here

    assertNotSame(value, detachedMap.get(key));
  }
 
  @Test
  public void testGetDetachedValue_TupleN(){
    Person person = createPerson();
    AvroType<TupleN> ptype = Avros.tuples(Avros.records(Person.class));
    TupleN tuple = new TupleN(person);
    TupleN detachedTuple = ptype.getDetachedValue(tuple);
   
    assertEquals(tuple, detachedTuple);
View Full Code Here

public class AvroTableTypeTest {

  @Test
  public void testGetDetachedValue() {
    Integer integerValue = 42;
    Person person = new Person();
    person.name = "John Doe";
    person.age = 42;
    person.siblingnames = Lists.<CharSequence> newArrayList();

    Pair<Integer, Person> pair = Pair.of(integerValue, person);
View Full Code Here

public class CollectionDeepCopierTest {

  @Test
  public void testDeepCopy() {
    Person person = new Person();
    person.age = 42;
    person.name = "John Smith";
    person.siblingnames = Lists.<CharSequence> newArrayList();

    Collection<Person> personCollection = Lists.newArrayList(person);
View Full Code Here

public class TupleDeepCopierTest {

  @Test
  public void testDeepCopy_Pair() {
    Person person = new Person();
    person.name = "John Doe";
    person.age = 42;
    person.siblingnames = Lists.<CharSequence> newArrayList();

    Pair<Integer, Person> inputPair = Pair.of(1, person);
View Full Code Here

TOP

Related Classes of org.apache.crunch.test.Person

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.